Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TamTamEdit.activity/Edit/EditToolbars.py1484
-rw-r--r--TamTamEdit.activity/Edit/HitInterface.py195
-rw-r--r--TamTamEdit.activity/Edit/KeyboardInput.py97
-rw-r--r--TamTamEdit.activity/Edit/MainWindow.py2091
-rw-r--r--TamTamEdit.activity/Edit/NoteInterface.py345
-rw-r--r--TamTamEdit.activity/Edit/Properties.py808
-rw-r--r--TamTamEdit.activity/Edit/TrackInterface.py1364
-rw-r--r--TamTamEdit.activity/Edit/TuneInterface.py645
-rw-r--r--TamTamEdit.activity/Edit/__init__.py0
-rw-r--r--TamTamEdit.activity/Edit/rm/BackgroundView.py501
-rw-r--r--TamTamEdit.activity/Edit/rm/NoteView.py253
-rw-r--r--TamTamEdit.activity/Edit/rm/PageBankView.py85
-rw-r--r--TamTamEdit.activity/Edit/rm/PageView.py65
-rw-r--r--TamTamEdit.activity/Edit/rm/PositionIndicator.py47
-rw-r--r--TamTamEdit.activity/Edit/rm/TrackView.py263
-rw-r--r--TamTamEdit.activity/Edit/rm/TunePageView.py17
-rw-r--r--TamTamEdit.activity/Edit/rm/TuneView.py123
-rw-r--r--TamTamEdit.activity/NEWS71
-rw-r--r--TamTamEdit.activity/TamTam.py1229
-rw-r--r--TamTamEdit.activity/activity/activity-tamtamedit.svg22
-rw-r--r--TamTamEdit.activity/activity/activity.info6
l---------TamTamEdit.activity/common1
-rw-r--r--TamTamEdit.activity/icons/XYBut.svg14
-rw-r--r--TamTamEdit.activity/icons/XYButDown.svg14
-rw-r--r--TamTamEdit.activity/icons/XYButDownClick.svg12
-rwxr-xr-xTamTamEdit.activity/icons/accept.svg18
-rw-r--r--TamTamEdit.activity/icons/add.svg11
-rw-r--r--TamTamEdit.activity/icons/arrow-down.svg7
-rw-r--r--TamTamEdit.activity/icons/arrow-up.svg7
-rwxr-xr-xTamTamEdit.activity/icons/cancel.svg11
-rw-r--r--TamTamEdit.activity/icons/dice.svg36
-rw-r--r--TamTamEdit.activity/icons/diceB.svg27
-rw-r--r--TamTamEdit.activity/icons/duplicate.svg14
-rw-r--r--TamTamEdit.activity/icons/edit-brush.svg16
-rw-r--r--TamTamEdit.activity/icons/edit-pencil.svg21
-rw-r--r--TamTamEdit.activity/icons/edit-pointer.svg9
-rw-r--r--TamTamEdit.activity/icons/grid.svg26
-rw-r--r--TamTamEdit.activity/icons/notedur.svg22
-rw-r--r--TamTamEdit.activity/icons/props.svg25
-rw-r--r--TamTamEdit.activity/icons/recordK.svg16
-rw-r--r--TamTamEdit.activity/icons/recordO.svg18
-rw-r--r--TamTamEdit.activity/icons/sideR.svg19
-rw-r--r--TamTamEdit.activity/icons/sideW.svg19
-rw-r--r--TamTamEdit.activity/icons/tam-help.svg18
-rw-r--r--TamTamEdit.activity/icons/tempo1.svg8
-rw-r--r--TamTamEdit.activity/icons/tempo2.svg9
-rw-r--r--TamTamEdit.activity/icons/tempo3.svg8
-rw-r--r--TamTamEdit.activity/icons/tempo4.svg9
-rw-r--r--TamTamEdit.activity/icons/tempo5.svg9
-rw-r--r--TamTamEdit.activity/icons/tempo6.svg11
-rw-r--r--TamTamEdit.activity/icons/tempo7.svg9
-rw-r--r--TamTamEdit.activity/icons/tempo8.svg10
-rw-r--r--TamTamEdit.activity/icons/updownR.svg19
-rw-r--r--TamTamEdit.activity/icons/updownW.svg19
-rw-r--r--TamTamEdit.activity/icons/voltemp.svg16
-rw-r--r--TamTamEdit.activity/icons/volume0.svg10
-rw-r--r--TamTamEdit.activity/icons/volume1.svg12
-rw-r--r--TamTamEdit.activity/icons/volume2.svg14
-rw-r--r--TamTamEdit.activity/icons/volume3.svg16
-rw-r--r--TamTamEdit.activity/setup.py21
-rw-r--r--TamTamJam.activity/Jam/Block.py895
-rw-r--r--TamTamJam.activity/Jam/Desktop.py466
-rw-r--r--TamTamJam.activity/Jam/Fillin.py116
-rw-r--r--TamTamJam.activity/Jam/GenRythm.py80
-rw-r--r--TamTamJam.activity/Jam/JamMain.py1112
-rw-r--r--TamTamJam.activity/Jam/Parasite.py349
-rw-r--r--TamTamJam.activity/Jam/Picker.py422
-rw-r--r--TamTamJam.activity/Jam/Popup.py1397
-rw-r--r--TamTamJam.activity/Jam/RythmGenerator.py77
-rw-r--r--TamTamJam.activity/Jam/Toolbars.py129
-rw-r--r--TamTamJam.activity/Jam/__init__.py0
-rw-r--r--TamTamJam.activity/NEWS71
-rw-r--r--TamTamJam.activity/TamTam.py1229
-rw-r--r--TamTamJam.activity/actvity/activity-tamtamjam.svg24
-rw-r--r--TamTamJam.activity/actvity/activity.info6
l---------TamTamJam.activity/common1
-rw-r--r--TamTamJam.activity/icons/XYBut.svg14
-rw-r--r--TamTamJam.activity/icons/XYButDown.svg14
-rw-r--r--TamTamJam.activity/icons/XYButDownClick.svg12
-rwxr-xr-xTamTamJam.activity/icons/accept.svg18
-rwxr-xr-xTamTamJam.activity/icons/cancel.svg11
-rw-r--r--TamTamJam.activity/icons/preset1.svg12
-rw-r--r--TamTamJam.activity/icons/preset10.svg15
-rw-r--r--TamTamJam.activity/icons/preset2.svg14
-rw-r--r--TamTamJam.activity/icons/preset3.svg16
-rw-r--r--TamTamJam.activity/icons/preset4.svg14
-rw-r--r--TamTamJam.activity/icons/preset5.svg13
-rw-r--r--TamTamJam.activity/icons/preset6.svg17
-rw-r--r--TamTamJam.activity/icons/preset7.svg13
-rw-r--r--TamTamJam.activity/icons/preset8.svg17
-rw-r--r--TamTamJam.activity/icons/preset9.svg17
-rw-r--r--TamTamJam.activity/icons/tam-help.svg18
-rw-r--r--TamTamJam.activity/icons/tempo1.svg8
-rw-r--r--TamTamJam.activity/icons/tempo2.svg9
-rw-r--r--TamTamJam.activity/icons/tempo3.svg8
-rw-r--r--TamTamJam.activity/icons/tempo4.svg9
-rw-r--r--TamTamJam.activity/icons/tempo5.svg9
-rw-r--r--TamTamJam.activity/icons/tempo6.svg11
-rw-r--r--TamTamJam.activity/icons/tempo7.svg9
-rw-r--r--TamTamJam.activity/icons/tempo8.svg10
-rw-r--r--TamTamJam.activity/icons/volume0.svg10
-rw-r--r--TamTamJam.activity/icons/volume1.svg12
-rw-r--r--TamTamJam.activity/icons/volume2.svg14
-rw-r--r--TamTamJam.activity/icons/volume3.svg16
-rw-r--r--TamTamJam.activity/setup.py21
-rw-r--r--TamTamMini.activity/Mini/Fillin.py105
-rw-r--r--TamTamMini.activity/Mini/GenRythm.py80
-rw-r--r--TamTamMini.activity/Mini/KeyboardStandAlone.py142
-rwxr-xr-xTamTamMini.activity/Mini/Loop.py210
-rw-r--r--TamTamMini.activity/Mini/MiniSequencer.py139
-rw-r--r--TamTamMini.activity/Mini/NoteStdAlone.py103
-rw-r--r--TamTamMini.activity/Mini/RythmGenerator.py77
-rw-r--r--TamTamMini.activity/Mini/__init__.py0
-rwxr-xr-xTamTamMini.activity/Mini/lps.py242
-rw-r--r--TamTamMini.activity/Mini/miniTamTamMain.py823
-rw-r--r--TamTamMini.activity/Mini/miniToolbars.py152
-rw-r--r--TamTamMini.activity/NEWS71
-rw-r--r--TamTamMini.activity/TamTamMini.py175
-rw-r--r--TamTamMini.activity/activity/activity-tamtam.svg24
-rw-r--r--TamTamMini.activity/activity/activity.info6
l---------TamTamMini.activity/common1
-rw-r--r--TamTamMini.activity/icons/keyrec.svg13
-rw-r--r--TamTamMini.activity/icons/loop.svg13
-rw-r--r--TamTamMini.activity/icons/micrec1.svg11
-rw-r--r--TamTamMini.activity/icons/micrec2.svg13
-rw-r--r--TamTamMini.activity/icons/micrec3.svg15
-rw-r--r--TamTamMini.activity/icons/micrec4.svg13
-rw-r--r--TamTamMini.activity/icons/micrec5.svg14
-rw-r--r--TamTamMini.activity/icons/micrec6.svg15
-rw-r--r--TamTamMini.activity/icons/minusrec.svg15
-rw-r--r--TamTamMini.activity/icons/overrec.svg15
-rw-r--r--TamTamMini.activity/icons/rec1.svg11
-rw-r--r--TamTamMini.activity/icons/rec2.svg13
-rw-r--r--TamTamMini.activity/icons/rec3.svg15
-rw-r--r--TamTamMini.activity/icons/rec4.svg13
-rw-r--r--TamTamMini.activity/icons/rec5.svg14
-rw-r--r--TamTamMini.activity/icons/rec6.svg15
-rw-r--r--TamTamMini.activity/setup.py21
-rw-r--r--TamTamSynthLab.activity/NEWS71
-rwxr-xr-xTamTamSynthLab.activity/SynthLab/SynthLabConstants.py374
-rw-r--r--TamTamSynthLab.activity/SynthLab/SynthLabToolbars.py170
-rw-r--r--TamTamSynthLab.activity/SynthLab/SynthLabWindow.py1395
-rwxr-xr-xTamTamSynthLab.activity/SynthLab/SynthObjectsParameters.py42
-rwxr-xr-xTamTamSynthLab.activity/SynthLab/__init__.py0
-rw-r--r--TamTamSynthLab.activity/TamTam.py1229
-rw-r--r--TamTamSynthLab.activity/activity/activity-tamtamsynthlab.svg12
-rw-r--r--TamTamSynthLab.activity/activity/activity.info6
l---------TamTamSynthLab.activity/common1
-rw-r--r--TamTamSynthLab.activity/icons/XYBut.svg14
-rw-r--r--TamTamSynthLab.activity/icons/XYButDown.svg14
-rw-r--r--TamTamSynthLab.activity/icons/XYButDownClick.svg12
-rwxr-xr-xTamTamSynthLab.activity/icons/accept.svg18
-rwxr-xr-xTamTamSynthLab.activity/icons/cancel.svg11
-rw-r--r--TamTamSynthLab.activity/icons/preset1.svg12
-rw-r--r--TamTamSynthLab.activity/icons/preset10.svg15
-rw-r--r--TamTamSynthLab.activity/icons/preset2.svg14
-rw-r--r--TamTamSynthLab.activity/icons/preset3.svg16
-rw-r--r--TamTamSynthLab.activity/icons/preset4.svg14
-rw-r--r--TamTamSynthLab.activity/icons/preset5.svg13
-rw-r--r--TamTamSynthLab.activity/icons/preset6.svg17
-rw-r--r--TamTamSynthLab.activity/icons/preset7.svg13
-rw-r--r--TamTamSynthLab.activity/icons/preset8.svg17
-rw-r--r--TamTamSynthLab.activity/icons/preset9.svg17
-rw-r--r--TamTamSynthLab.activity/icons/rec1.svg11
-rw-r--r--TamTamSynthLab.activity/icons/rec2.svg13
-rw-r--r--TamTamSynthLab.activity/icons/rec3.svg15
-rw-r--r--TamTamSynthLab.activity/icons/rec4.svg13
-rw-r--r--TamTamSynthLab.activity/icons/rec5.svg14
-rw-r--r--TamTamSynthLab.activity/icons/rec6.svg15
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-addSynth+.svg30
-rw-r--r--TamTamSynthLab.activity/icons/sl-addSynth-menu.svg15
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-adsr+.svg21
-rw-r--r--TamTamSynthLab.activity/icons/sl-adsr-menu.svg20
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-buzz+.svg30
-rw-r--r--TamTamSynthLab.activity/icons/sl-buzz-menu.svg15
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-chorus+.svg139
-rw-r--r--TamTamSynthLab.activity/icons/sl-chorus-menu.svg101
-rw-r--r--TamTamSynthLab.activity/icons/sl-distort+.svg30
-rw-r--r--TamTamSynthLab.activity/icons/sl-distort-menu.svg21
-rw-r--r--TamTamSynthLab.activity/icons/sl-eq4band+.svg51
-rw-r--r--TamTamSynthLab.activity/icons/sl-eq4band-menu.svg38
-rw-r--r--TamTamSynthLab.activity/icons/sl-filter+.svg32
-rw-r--r--TamTamSynthLab.activity/icons/sl-filter-menu.svg21
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-fm+.svg43
-rw-r--r--TamTamSynthLab.activity/icons/sl-fm-menu.svg30
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-grain+.svg205
-rw-r--r--TamTamSynthLab.activity/icons/sl-grain-menu.svg190
-rw-r--r--TamTamSynthLab.activity/icons/sl-harmon+.svg30
-rw-r--r--TamTamSynthLab.activity/icons/sl-harmon-menu.svg21
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-lfo+.svg14
-rw-r--r--TamTamSynthLab.activity/icons/sl-lfo-menu.svg20
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-noise+.svg233
-rw-r--r--TamTamSynthLab.activity/icons/sl-noise-menu.svg222
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-pluck+.svg73
-rw-r--r--TamTamSynthLab.activity/icons/sl-pluck-menu.svg62
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-rand+.svg17
-rw-r--r--TamTamSynthLab.activity/icons/sl-rand-menu.svg20
-rw-r--r--TamTamSynthLab.activity/icons/sl-reset.svg13
-rw-r--r--TamTamSynthLab.activity/icons/sl-reverb+.svg39
-rw-r--r--TamTamSynthLab.activity/icons/sl-reverb-menu.svg28
-rw-r--r--TamTamSynthLab.activity/icons/sl-ring+.svg30
-rw-r--r--TamTamSynthLab.activity/icons/sl-ring-menu.svg21
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-sample+.svg34
-rw-r--r--TamTamSynthLab.activity/icons/sl-sample-menu.svg24
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-speaker.svg13
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-trackpadX+.svg22
-rw-r--r--TamTamSynthLab.activity/icons/sl-trackpadX-menu.svg21
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-trackpadY+.svg22
-rw-r--r--TamTamSynthLab.activity/icons/sl-trackpadY-menu.svg21
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-vco+.svg31
-rw-r--r--TamTamSynthLab.activity/icons/sl-vco-menu.svg19
-rwxr-xr-xTamTamSynthLab.activity/icons/sl-voice+.svg28
-rw-r--r--TamTamSynthLab.activity/icons/sl-voice-menu.svg21
-rw-r--r--TamTamSynthLab.activity/icons/sl-wguide+.svg32
-rw-r--r--TamTamSynthLab.activity/icons/sl-wguide-menu.svg25
-rw-r--r--TamTamSynthLab.activity/icons/tam-help.svg18
-rw-r--r--TamTamSynthLab.activity/setup.py21
-rw-r--r--common/Config.py599
-rwxr-xr-xcommon/Generation/Drunk.py162
-rwxr-xr-xcommon/Generation/GenerationConstants.py184
-rwxr-xr-xcommon/Generation/GenerationParametersWindow.py383
-rw-r--r--common/Generation/GenerationPitch.py40
-rw-r--r--common/Generation/GenerationRythm.py213
-rwxr-xr-xcommon/Generation/Generator.py167
-rwxr-xr-xcommon/Generation/Utils.py74
-rw-r--r--common/Generation/VariationPitch.py82
-rw-r--r--common/Generation/VariationRythm.py74
-rw-r--r--common/Generation/__init__.py0
-rw-r--r--common/Generation/bList.py97
-rw-r--r--common/Resources/Desktops/desktop0206
-rw-r--r--common/Resources/Desktops/desktop1206
-rw-r--r--common/Resources/Desktops/desktop2206
-rw-r--r--common/Resources/Desktops/desktop3206
-rw-r--r--common/Resources/Desktops/desktop4206
-rw-r--r--common/Resources/Desktops/desktop5206
-rw-r--r--common/Resources/Desktops/desktop6206
-rw-r--r--common/Resources/Desktops/desktop7206
-rw-r--r--common/Resources/Desktops/desktop8206
-rw-r--r--common/Resources/Desktops/desktop9206
-rw-r--r--common/Resources/Images/TamTam.pngbin0 -> 12771 bytes
-rw-r--r--common/Resources/Images/acguit.pngbin0 -> 10779 bytes
-rw-r--r--common/Resources/Images/acguitsel.pngbin0 -> 9552 bytes
-rwxr-xr-xcommon/Resources/Images/alarm.pngbin0 -> 8794 bytes
-rwxr-xr-xcommon/Resources/Images/alarmsel.pngbin0 -> 8302 bytes
-rw-r--r--common/Resources/Images/all.pngbin0 -> 13361 bytes
-rw-r--r--common/Resources/Images/allsel.pngbin0 -> 14000 bytes
-rw-r--r--common/Resources/Images/animals.pngbin0 -> 15944 bytes
-rw-r--r--common/Resources/Images/animalssel.pngbin0 -> 16536 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditDown.pngbin0 -> 3058 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditDownDown.pngbin0 -> 3037 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditDownOver.pngbin0 -> 3058 bytes
-rw-r--r--common/Resources/Images/arrowEditLeft.pngbin0 -> 456 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditLeftDown.pngbin0 -> 3003 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditLeftOver.pngbin0 -> 3058 bytes
-rw-r--r--common/Resources/Images/arrowEditRight.pngbin0 -> 454 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditRightDown.pngbin0 -> 3014 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditRightOver.pngbin0 -> 3049 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditUp.pngbin0 -> 3045 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditUpDown.pngbin0 -> 3030 bytes
-rwxr-xr-xcommon/Resources/Images/arrowEditUpOver.pngbin0 -> 3046 bytes
-rw-r--r--common/Resources/Images/basse.pngbin0 -> 9265 bytes
-rw-r--r--common/Resources/Images/bassesel.pngbin0 -> 7934 bytes
-rw-r--r--common/Resources/Images/beat1.pngbin0 -> 679 bytes
-rw-r--r--common/Resources/Images/beat10.pngbin0 -> 1003 bytes
-rw-r--r--common/Resources/Images/beat11.pngbin0 -> 722 bytes
-rw-r--r--common/Resources/Images/beat2.pngbin0 -> 672 bytes
-rw-r--r--common/Resources/Images/beat3.pngbin0 -> 620 bytes
-rw-r--r--common/Resources/Images/beat4.pngbin0 -> 984 bytes
-rw-r--r--common/Resources/Images/beat5.pngbin0 -> 651 bytes
-rw-r--r--common/Resources/Images/beat6.pngbin0 -> 947 bytes
-rw-r--r--common/Resources/Images/beat7.pngbin0 -> 663 bytes
-rw-r--r--common/Resources/Images/beat8.pngbin0 -> 721 bytes
-rw-r--r--common/Resources/Images/beat9.pngbin0 -> 1005 bytes
-rw-r--r--common/Resources/Images/bird.pngbin0 -> 9311 bytes
-rw-r--r--common/Resources/Images/birdsel.pngbin0 -> 8048 bytes
-rw-r--r--common/Resources/Images/bottle.pngbin0 -> 8387 bytes
-rw-r--r--common/Resources/Images/bottlesel.pngbin0 -> 7674 bytes
-rwxr-xr-xcommon/Resources/Images/bubbles.pngbin0 -> 9571 bytes
-rwxr-xr-xcommon/Resources/Images/bubblessel.pngbin0 -> 8695 bytes
-rwxr-xr-xcommon/Resources/Images/byke.pngbin0 -> 14257 bytes
-rwxr-xr-xcommon/Resources/Images/bykesel.pngbin0 -> 12502 bytes
-rwxr-xr-xcommon/Resources/Images/camera.pngbin0 -> 9598 bytes
-rwxr-xr-xcommon/Resources/Images/camerasel.pngbin0 -> 9467 bytes
-rwxr-xr-xcommon/Resources/Images/car.pngbin0 -> 7720 bytes
-rwxr-xr-xcommon/Resources/Images/carsel.pngbin0 -> 7354 bytes
-rw-r--r--common/Resources/Images/cat.pngbin0 -> 13255 bytes
-rw-r--r--common/Resources/Images/catsel.pngbin0 -> 12546 bytes
-rwxr-xr-xcommon/Resources/Images/cello.pngbin0 -> 12080 bytes
-rwxr-xr-xcommon/Resources/Images/cellosel.pngbin0 -> 10904 bytes
-rw-r--r--common/Resources/Images/check.pngbin0 -> 1862 bytes
-rw-r--r--common/Resources/Images/checkOff.svg7
-rw-r--r--common/Resources/Images/checkOn.svg14
-rwxr-xr-xcommon/Resources/Images/chimes.pngbin0 -> 8878 bytes
-rwxr-xr-xcommon/Resources/Images/chimessel.pngbin0 -> 8340 bytes
-rw-r--r--common/Resources/Images/clang.pngbin0 -> 10702 bytes
-rw-r--r--common/Resources/Images/clangsel.pngbin0 -> 10306 bytes
-rw-r--r--common/Resources/Images/clarinette.pngbin0 -> 5628 bytes
-rw-r--r--common/Resources/Images/clarinettesel.pngbin0 -> 4700 bytes
-rw-r--r--common/Resources/Images/cling.pngbin0 -> 14855 bytes
-rw-r--r--common/Resources/Images/clingsel.pngbin0 -> 13973 bytes
-rw-r--r--common/Resources/Images/complex1.pngbin0 -> 2084 bytes
-rw-r--r--common/Resources/Images/complex2.pngbin0 -> 1930 bytes
-rw-r--r--common/Resources/Images/complex3.pngbin0 -> 1862 bytes
-rw-r--r--common/Resources/Images/complex4.pngbin0 -> 1914 bytes
-rw-r--r--common/Resources/Images/complex5.pngbin0 -> 1890 bytes
-rw-r--r--common/Resources/Images/complex6.pngbin0 -> 1912 bytes
-rw-r--r--common/Resources/Images/complex7.pngbin0 -> 1938 bytes
-rw-r--r--common/Resources/Images/complex8.pngbin0 -> 1791 bytes
-rw-r--r--common/Resources/Images/concret.pngbin0 -> 9928 bytes
-rw-r--r--common/Resources/Images/concretsel.pngbin0 -> 10472 bytes
-rwxr-xr-xcommon/Resources/Images/crash.pngbin0 -> 8027 bytes
-rwxr-xr-xcommon/Resources/Images/crashsel.pngbin0 -> 7362 bytes
-rw-r--r--common/Resources/Images/dice.pngbin0 -> 11085 bytes
-rw-r--r--common/Resources/Images/diceProp.pngbin0 -> 2613 bytes
-rw-r--r--common/Resources/Images/dicePropSel.pngbin0 -> 2721 bytes
-rw-r--r--common/Resources/Images/diceblur.pngbin0 -> 13327 bytes
-rw-r--r--common/Resources/Images/diceinst.pngbin0 -> 8634 bytes
-rw-r--r--common/Resources/Images/diceinstsel.pngbin0 -> 8003 bytes
-rw-r--r--common/Resources/Images/didjeridu.pngbin0 -> 9087 bytes
-rw-r--r--common/Resources/Images/didjeridusel.pngbin0 -> 8296 bytes
-rw-r--r--common/Resources/Images/dog.pngbin0 -> 12824 bytes
-rw-r--r--common/Resources/Images/dogsel.pngbin0 -> 12298 bytes
-rw-r--r--common/Resources/Images/door.pngbin0 -> 10469 bytes
-rw-r--r--common/Resources/Images/doorsel.pngbin0 -> 10272 bytes
-rwxr-xr-xcommon/Resources/Images/dru0.pngbin0 -> 2313 bytes
-rwxr-xr-xcommon/Resources/Images/dru1.pngbin0 -> 2708 bytes
-rwxr-xr-xcommon/Resources/Images/dru2.pngbin0 -> 3293 bytes
-rwxr-xr-xcommon/Resources/Images/dru3.pngbin0 -> 4062 bytes
-rwxr-xr-xcommon/Resources/Images/dru4.pngbin0 -> 5015 bytes
-rw-r--r--common/Resources/Images/drum1kit.pngbin0 -> 14900 bytes
-rw-r--r--common/Resources/Images/drum1kitsel.pngbin0 -> 13729 bytes
-rw-r--r--common/Resources/Images/drum1kitselgen.pngbin0 -> 13887 bytes
-rw-r--r--common/Resources/Images/drum2kit.pngbin0 -> 14882 bytes
-rw-r--r--common/Resources/Images/drum2kitsel.pngbin0 -> 13869 bytes
-rw-r--r--common/Resources/Images/drum2kitselgen.pngbin0 -> 13964 bytes
-rw-r--r--common/Resources/Images/drum3kit.pngbin0 -> 15880 bytes
-rw-r--r--common/Resources/Images/drum3kitsel.pngbin0 -> 14679 bytes
-rw-r--r--common/Resources/Images/drum3kitselgen.pngbin0 -> 14801 bytes
-rw-r--r--common/Resources/Images/drum4kit.pngbin0 -> 12904 bytes
-rw-r--r--common/Resources/Images/drum4kitsel.pngbin0 -> 10888 bytes
-rw-r--r--common/Resources/Images/drum4kitselgen.pngbin0 -> 11047 bytes
-rw-r--r--common/Resources/Images/drum5kit.pngbin0 -> 14999 bytes
-rw-r--r--common/Resources/Images/drum5kitsel.pngbin0 -> 13580 bytes
-rw-r--r--common/Resources/Images/drum5kitselgen.pngbin0 -> 13712 bytes
-rw-r--r--common/Resources/Images/duck.pngbin0 -> 9694 bytes
-rw-r--r--common/Resources/Images/duck2.pngbin0 -> 11299 bytes
-rw-r--r--common/Resources/Images/duck2sel.pngbin0 -> 8960 bytes
-rw-r--r--common/Resources/Images/ducksel.pngbin0 -> 8652 bytes
-rw-r--r--common/Resources/Images/editTam.pngbin0 -> 10701 bytes
-rw-r--r--common/Resources/Images/editTamDown.pngbin0 -> 11789 bytes
-rw-r--r--common/Resources/Images/editTamOver.pngbin0 -> 9958 bytes
-rw-r--r--common/Resources/Images/electronic.pngbin0 -> 12476 bytes
-rw-r--r--common/Resources/Images/electronicsel.pngbin0 -> 13161 bytes
-rw-r--r--common/Resources/Images/flute.pngbin0 -> 6248 bytes
-rw-r--r--common/Resources/Images/flutesel.pngbin0 -> 5266 bytes
-rw-r--r--common/Resources/Images/gam.pngbin0 -> 12581 bytes
-rw-r--r--common/Resources/Images/gamsel.pngbin0 -> 11893 bytes
-rwxr-xr-xcommon/Resources/Images/generic.pngbin0 -> 8768 bytes
-rwxr-xr-xcommon/Resources/Images/genericsel.pngbin0 -> 8015 bytes
-rw-r--r--common/Resources/Images/guit.pngbin0 -> 9996 bytes
-rwxr-xr-xcommon/Resources/Images/guit2.pngbin0 -> 8352 bytes
-rwxr-xr-xcommon/Resources/Images/guit2sel.pngbin0 -> 7611 bytes
-rw-r--r--common/Resources/Images/guitsel.pngbin0 -> 8589 bytes
-rw-r--r--common/Resources/Images/harmonica.pngbin0 -> 9120 bytes
-rw-r--r--common/Resources/Images/harmonicasel.pngbin0 -> 8638 bytes
-rw-r--r--common/Resources/Images/harmonium.pngbin0 -> 13371 bytes
-rw-r--r--common/Resources/Images/harmoniumsel.pngbin0 -> 12936 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow1.jpgbin0 -> 32969 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow2.jpgbin0 -> 87871 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow3.jpgbin0 -> 79367 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow4.jpgbin0 -> 85694 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow5.jpgbin0 -> 75364 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow6.jpgbin0 -> 60244 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow7.jpgbin0 -> 52708 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow8.jpgbin0 -> 70312 bytes
-rwxr-xr-xcommon/Resources/Images/helpShow9.jpgbin0 -> 52295 bytes
-rw-r--r--common/Resources/Images/helpTam.pngbin0 -> 11789 bytes
-rw-r--r--common/Resources/Images/helpTamDown.pngbin0 -> 10701 bytes
-rw-r--r--common/Resources/Images/helpTamOver.pngbin0 -> 9958 bytes
-rw-r--r--common/Resources/Images/hit.pngbin0 -> 973 bytes
-rw-r--r--common/Resources/Images/hitSelected.pngbin0 -> 1171 bytes
-rw-r--r--common/Resources/Images/horse.pngbin0 -> 15048 bytes
-rw-r--r--common/Resources/Images/horsesel.pngbin0 -> 13520 bytes
-rwxr-xr-xcommon/Resources/Images/instr0.pngbin0 -> 1700 bytes
-rwxr-xr-xcommon/Resources/Images/instr1.pngbin0 -> 2032 bytes
-rwxr-xr-xcommon/Resources/Images/instr2.pngbin0 -> 2350 bytes
-rwxr-xr-xcommon/Resources/Images/instr3.pngbin0 -> 2748 bytes
-rwxr-xr-xcommon/Resources/Images/instr4.pngbin0 -> 3212 bytes
-rw-r--r--common/Resources/Images/jam-blockMask.pngbin0 -> 4242 bytes
-rw-r--r--common/Resources/Images/kalimba.pngbin0 -> 10500 bytes
-rw-r--r--common/Resources/Images/kalimbasel.pngbin0 -> 9964 bytes
-rw-r--r--common/Resources/Images/keyboard.pngbin0 -> 5602 bytes
-rw-r--r--common/Resources/Images/keyboardsel.pngbin0 -> 6201 bytes
-rw-r--r--common/Resources/Images/koto.pngbin0 -> 9666 bytes
-rw-r--r--common/Resources/Images/kotosel.pngbin0 -> 8872 bytes
-rw-r--r--common/Resources/Images/laugh.pngbin0 -> 14044 bytes
-rw-r--r--common/Resources/Images/laughsel.pngbin0 -> 13332 bytes
-rw-r--r--common/Resources/Images/mando.pngbin0 -> 8705 bytes
-rw-r--r--common/Resources/Images/mandosel.pngbin0 -> 7728 bytes
-rw-r--r--common/Resources/Images/marimba.pngbin0 -> 14598 bytes
-rw-r--r--common/Resources/Images/marimbasel.pngbin0 -> 13469 bytes
-rw-r--r--common/Resources/Images/marquis.pngbin0 -> 1341 bytes
-rw-r--r--common/Resources/Images/mic1.pngbin0 -> 4231 bytes
-rw-r--r--common/Resources/Images/mic1sel.pngbin0 -> 3988 bytes
-rw-r--r--common/Resources/Images/mic2.pngbin0 -> 4365 bytes
-rw-r--r--common/Resources/Images/mic2sel.pngbin0 -> 4122 bytes
-rw-r--r--common/Resources/Images/mic3.pngbin0 -> 4375 bytes
-rw-r--r--common/Resources/Images/mic3sel.pngbin0 -> 4145 bytes
-rw-r--r--common/Resources/Images/mic4.pngbin0 -> 4225 bytes
-rw-r--r--common/Resources/Images/mic4sel.pngbin0 -> 4062 bytes
-rw-r--r--common/Resources/Images/miniTam.pngbin0 -> 30569 bytes
-rw-r--r--common/Resources/Images/miniTamDown.pngbin0 -> 36042 bytes
-rw-r--r--common/Resources/Images/miniTamOver.pngbin0 -> 33015 bytes
-rw-r--r--common/Resources/Images/miniplay.pngbin0 -> 970 bytes
-rw-r--r--common/Resources/Images/mysounds.pngbin0 -> 7908 bytes
-rw-r--r--common/Resources/Images/mysoundssel.pngbin0 -> 8350 bytes
-rw-r--r--common/Resources/Images/note.pngbin0 -> 1034 bytes
-rw-r--r--common/Resources/Images/noteSelected.pngbin0 -> 1281 bytes
-rw-r--r--common/Resources/Images/ocarina.pngbin0 -> 6891 bytes
-rw-r--r--common/Resources/Images/ocarinasel.pngbin0 -> 6601 bytes
-rw-r--r--common/Resources/Images/ounk.pngbin0 -> 12569 bytes
-rw-r--r--common/Resources/Images/ounksel.pngbin0 -> 11792 bytes
-rw-r--r--common/Resources/Images/ow.pngbin0 -> 13340 bytes
-rw-r--r--common/Resources/Images/owsel.pngbin0 -> 12320 bytes
-rw-r--r--common/Resources/Images/pageThumbnailBG.pngbin0 -> 1154 bytes
-rw-r--r--common/Resources/Images/pageThumbnailBG0.pngbin0 -> 1068 bytes
-rw-r--r--common/Resources/Images/pageThumbnailBG1.pngbin0 -> 1073 bytes
-rw-r--r--common/Resources/Images/pageThumbnailBG2.pngbin0 -> 1037 bytes
-rw-r--r--common/Resources/Images/pageThumbnailBG3.pngbin0 -> 1094 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut0.pngbin0 -> 927 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut0Down.pngbin0 -> 945 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut1.pngbin0 -> 917 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut1Down.pngbin0 -> 937 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut2.pngbin0 -> 919 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut2Down.pngbin0 -> 944 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut3.pngbin0 -> 916 bytes
-rwxr-xr-xcommon/Resources/Images/pageThumbnailBut3Down.pngbin0 -> 934 bytes
-rw-r--r--common/Resources/Images/pageThumbnailMask.pngbin0 -> 500 bytes
-rw-r--r--common/Resources/Images/people.pngbin0 -> 17115 bytes
-rw-r--r--common/Resources/Images/peoplesel.pngbin0 -> 17596 bytes
-rw-r--r--common/Resources/Images/percussions.pngbin0 -> 15245 bytes
-rw-r--r--common/Resources/Images/percussionssel.pngbin0 -> 15815 bytes
-rw-r--r--common/Resources/Images/piano.pngbin0 -> 11422 bytes
-rw-r--r--common/Resources/Images/pianosel.pngbin0 -> 10785 bytes
-rwxr-xr-xcommon/Resources/Images/plane.pngbin0 -> 12105 bytes
-rwxr-xr-xcommon/Resources/Images/planesel.pngbin0 -> 10920 bytes
-rw-r--r--common/Resources/Images/reverb0.pngbin0 -> 890 bytes
-rw-r--r--common/Resources/Images/reverb1.pngbin0 -> 888 bytes
-rw-r--r--common/Resources/Images/reverb2.pngbin0 -> 939 bytes
-rw-r--r--common/Resources/Images/reverb3.pngbin0 -> 992 bytes
-rw-r--r--common/Resources/Images/reverb4.pngbin0 -> 1035 bytes
-rw-r--r--common/Resources/Images/reverb5.pngbin0 -> 1090 bytes
-rw-r--r--common/Resources/Images/rhodes.pngbin0 -> 10014 bytes
-rw-r--r--common/Resources/Images/rhodessel.pngbin0 -> 8396 bytes
-rw-r--r--common/Resources/Images/sampleBG.pngbin0 -> 36405 bytes
-rw-r--r--common/Resources/Images/sampleNoteMask.pngbin0 -> 2963 bytes
-rw-r--r--common/Resources/Images/saxo.pngbin0 -> 8445 bytes
-rw-r--r--common/Resources/Images/saxosel.pngbin0 -> 7424 bytes
-rw-r--r--common/Resources/Images/scrollBar.pngbin0 -> 584 bytes
-rw-r--r--common/Resources/Images/sheep.pngbin0 -> 11805 bytes
-rw-r--r--common/Resources/Images/sheepsel.pngbin0 -> 10623 bytes
-rw-r--r--common/Resources/Images/shenai.pngbin0 -> 6780 bytes
-rw-r--r--common/Resources/Images/shenaisel.pngbin0 -> 5808 bytes
-rw-r--r--common/Resources/Images/sitar.pngbin0 -> 9766 bytes
-rw-r--r--common/Resources/Images/sitarsel.pngbin0 -> 8536 bytes
-rwxr-xr-xcommon/Resources/Images/slap.pngbin0 -> 11935 bytes
-rwxr-xr-xcommon/Resources/Images/slapsel.pngbin0 -> 10959 bytes
-rw-r--r--common/Resources/Images/sliderDrum.pngbin0 -> 1294 bytes
-rw-r--r--common/Resources/Images/sliderEditTempo.pngbin0 -> 1272 bytes
-rw-r--r--common/Resources/Images/sliderEditVolume.pngbin0 -> 1242 bytes
-rw-r--r--common/Resources/Images/sliderInst1.pngbin0 -> 1284 bytes
-rw-r--r--common/Resources/Images/sliderInst2.pngbin0 -> 1252 bytes
-rw-r--r--common/Resources/Images/sliderInst3.pngbin0 -> 1263 bytes
-rw-r--r--common/Resources/Images/sliderInst4.pngbin0 -> 1272 bytes
-rw-r--r--common/Resources/Images/sliderbutbleu.pngbin0 -> 1744 bytes
-rw-r--r--common/Resources/Images/sliderbutjaune.pngbin0 -> 1770 bytes
-rw-r--r--common/Resources/Images/sliderbutred.pngbin0 -> 1562 bytes
-rw-r--r--common/Resources/Images/sliderbutvert.pngbin0 -> 1769 bytes
-rw-r--r--common/Resources/Images/sliderbutviolet.pngbin0 -> 1654 bytes
-rw-r--r--common/Resources/Images/sliderlong.pngbin0 -> 251 bytes
-rw-r--r--common/Resources/Images/slidershort.pngbin0 -> 244 bytes
-rw-r--r--common/Resources/Images/stop.pngbin0 -> 807 bytes
-rw-r--r--common/Resources/Images/strings.pngbin0 -> 11888 bytes
-rw-r--r--common/Resources/Images/stringssel.pngbin0 -> 12428 bytes
-rw-r--r--common/Resources/Images/synthTam.pngbin0 -> 7525 bytes
-rw-r--r--common/Resources/Images/synthTamDown.pngbin0 -> 8297 bytes
-rw-r--r--common/Resources/Images/synthTamOver.pngbin0 -> 7569 bytes
-rw-r--r--common/Resources/Images/synthlabMask.pngbin0 -> 4884 bytes
-rw-r--r--common/Resources/Images/tchiwo.pngbin0 -> 10240 bytes
-rw-r--r--common/Resources/Images/tchiwosel.pngbin0 -> 9545 bytes
-rw-r--r--common/Resources/Images/tempo1.pngbin0 -> 1546 bytes
-rw-r--r--common/Resources/Images/tempo2.pngbin0 -> 1847 bytes
-rw-r--r--common/Resources/Images/tempo3.pngbin0 -> 2354 bytes
-rw-r--r--common/Resources/Images/tempo4.pngbin0 -> 2130 bytes
-rw-r--r--common/Resources/Images/tempo5.pngbin0 -> 2733 bytes
-rw-r--r--common/Resources/Images/tempo6.pngbin0 -> 2322 bytes
-rw-r--r--common/Resources/Images/tempo7.pngbin0 -> 3351 bytes
-rw-r--r--common/Resources/Images/tempo8.pngbin0 -> 2960 bytes
-rw-r--r--common/Resources/Images/trackBG.pngbin0 -> 4740 bytes
-rw-r--r--common/Resources/Images/trackBGDrum.pngbin0 -> 5216 bytes
-rw-r--r--common/Resources/Images/trackBGDrumSelected.pngbin0 -> 4922 bytes
-rw-r--r--common/Resources/Images/trackBGSelected.pngbin0 -> 4491 bytes
-rw-r--r--common/Resources/Images/triangle.pngbin0 -> 8220 bytes
-rw-r--r--common/Resources/Images/trianglesel.pngbin0 -> 6643 bytes
-rw-r--r--common/Resources/Images/trumpet.pngbin0 -> 8326 bytes
-rw-r--r--common/Resources/Images/trumpetsel.pngbin0 -> 7294 bytes
-rw-r--r--common/Resources/Images/tuba.pngbin0 -> 10558 bytes
-rw-r--r--common/Resources/Images/tubasel.pngbin0 -> 9921 bytes
-rw-r--r--common/Resources/Images/violin.pngbin0 -> 10071 bytes
-rw-r--r--common/Resources/Images/violinsel.pngbin0 -> 8386 bytes
-rw-r--r--common/Resources/Images/voix.pngbin0 -> 11567 bytes
-rw-r--r--common/Resources/Images/voixsel.pngbin0 -> 10996 bytes
-rw-r--r--common/Resources/Images/volume0.pngbin0 -> 725 bytes
-rw-r--r--common/Resources/Images/volume1.pngbin0 -> 1034 bytes
-rw-r--r--common/Resources/Images/volume2.pngbin0 -> 1478 bytes
-rw-r--r--common/Resources/Images/volume3.pngbin0 -> 1987 bytes
-rw-r--r--common/Resources/Images/water.pngbin0 -> 14819 bytes
-rw-r--r--common/Resources/Images/watersel.pngbin0 -> 12868 bytes
-rw-r--r--common/Resources/Images/winds.pngbin0 -> 14332 bytes
-rw-r--r--common/Resources/Images/windssel.pngbin0 -> 14955 bytes
-rw-r--r--common/Resources/Images/zap.pngbin0 -> 11170 bytes
-rw-r--r--common/Resources/Images/zapsel.pngbin0 -> 12286 bytes
-rw-r--r--common/Resources/Loops/loop1.ttl5
-rw-r--r--common/Resources/Loops/loop2.ttl44
-rw-r--r--common/Resources/Loops/loop3.ttl9
-rwxr-xr-xcommon/Resources/Sounds/acguitbin0 -> 32360 bytes
-rwxr-xr-xcommon/Resources/Sounds/alarmbin0 -> 55744 bytes
-rwxr-xr-xcommon/Resources/Sounds/banjobin0 -> 32360 bytes
-rwxr-xr-xcommon/Resources/Sounds/bassebin0 -> 32516 bytes
-rwxr-xr-xcommon/Resources/Sounds/birdbin0 -> 32804 bytes
-rwxr-xr-xcommon/Resources/Sounds/bottlebin0 -> 19206 bytes
-rwxr-xr-xcommon/Resources/Sounds/bubblesbin0 -> 40364 bytes
-rwxr-xr-xcommon/Resources/Sounds/bykebin0 -> 32726 bytes
-rwxr-xr-xcommon/Resources/Sounds/camerabin0 -> 22564 bytes
-rwxr-xr-xcommon/Resources/Sounds/carbin0 -> 63940 bytes
-rwxr-xr-xcommon/Resources/Sounds/catbin0 -> 18160 bytes
-rwxr-xr-xcommon/Resources/Sounds/cellobin0 -> 24340 bytes
-rwxr-xr-xcommon/Resources/Sounds/chimesbin0 -> 107098 bytes
-rwxr-xr-xcommon/Resources/Sounds/clangbin0 -> 41150 bytes
-rwxr-xr-xcommon/Resources/Sounds/clarinettebin0 -> 31830 bytes
-rwxr-xr-xcommon/Resources/Sounds/clingbin0 -> 31758 bytes
-rwxr-xr-xcommon/Resources/Sounds/crashbin0 -> 20352 bytes
-rwxr-xr-xcommon/Resources/Sounds/diceinstbin0 -> 12658 bytes
-rwxr-xr-xcommon/Resources/Sounds/didjeridubin0 -> 60788 bytes
-rwxr-xr-xcommon/Resources/Sounds/dogbin0 -> 22332 bytes
-rwxr-xr-xcommon/Resources/Sounds/doorbin0 -> 33640 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1chinebin0 -> 20480 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1crashbin0 -> 64044 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1floortombin0 -> 38498 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1hardridebin0 -> 80044 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1hatpedalbin0 -> 23022 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1hatshoulderbin0 -> 28508 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1kickbin0 -> 32044 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1ridebellbin0 -> 80044 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1snarebin0 -> 32044 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1snaresidestickbin0 -> 5726 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1splashbin0 -> 48044 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum1tombin0 -> 37152 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukadoombin0 -> 38652 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukafingerbin0 -> 22470 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukapiedbin0 -> 32106 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukapiedsoftbin0 -> 24454 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukarollbin0 -> 27176 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukaslapbin0 -> 25672 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2darbukatakbin0 -> 12882 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2hatflangerbin0 -> 64246 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2hatpiedbin0 -> 14638 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2hatpied2bin0 -> 14460 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2tambourinepiedbin0 -> 33262 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum2tambourinepiedsoftbin0 -> 19470 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3cowbellbin0 -> 15950 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3cowbelltipbin0 -> 12872 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3cupbin0 -> 15926 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3djembelowbin0 -> 32080 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3djembemidbin0 -> 15050 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3djembesidestickbin0 -> 13602 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3djembeslapbin0 -> 24090 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3djembestickmidbin0 -> 25722 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3metalstandbin0 -> 16108 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3pedalpercbin0 -> 16160 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3rainstickbin0 -> 56454 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3tambourinehighbin0 -> 15996 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum3tambourinelowbin0 -> 15506 bytes
-rw-r--r--common/Resources/Sounds/drum4afrofeetbin0 -> 23774 bytes
-rw-r--r--common/Resources/Sounds/drum4fingersnbin0 -> 33644 bytes
-rw-r--r--common/Resources/Sounds/drum4mutecuicbin0 -> 12738 bytes
-rw-r--r--common/Resources/Sounds/drum4stompbassbin0 -> 22026 bytes
-rw-r--r--common/Resources/Sounds/drum4tambouribin0 -> 21382 bytes
-rw-r--r--common/Resources/Sounds/drum4tr707clapbin0 -> 11456 bytes
-rw-r--r--common/Resources/Sounds/drum4tr707openbin0 -> 29702 bytes
-rw-r--r--common/Resources/Sounds/drum4tr808closedbin0 -> 7530 bytes
-rw-r--r--common/Resources/Sounds/drum4tr808snbin0 -> 17474 bytes
-rw-r--r--common/Resources/Sounds/drum4tr909bassbin0 -> 61846 bytes
-rw-r--r--common/Resources/Sounds/drum4tr909kickbin0 -> 27516 bytes
-rw-r--r--common/Resources/Sounds/drum4tr909snbin0 -> 20920 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5agogoaigubin0 -> 22366 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5agogogravebin0 -> 19796 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5bongoaiguouvertbin0 -> 11418 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5bongograveouvertbin0 -> 14442 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5congaaiguouvertbin0 -> 16146 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5congagravefermebin0 -> 9674 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5congagraveouvertbin0 -> 14490 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5guiroretourbin0 -> 14462 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5quicaaigubin0 -> 10410 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5quicamediumbin0 -> 11398 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5timablesaiguslapbin0 -> 33698 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5timablesslapbin0 -> 37170 bytes
-rwxr-xr-xcommon/Resources/Sounds/drum5vibraslapbin0 -> 52238 bytes
-rwxr-xr-xcommon/Resources/Sounds/duckbin0 -> 12942 bytes
-rwxr-xr-xcommon/Resources/Sounds/duck2bin0 -> 7840 bytes
-rwxr-xr-xcommon/Resources/Sounds/flutebin0 -> 26902 bytes
-rwxr-xr-xcommon/Resources/Sounds/gambin0 -> 31848 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice1bin0 -> 10610 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice10bin0 -> 12298 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice2bin0 -> 16130 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice3bin0 -> 14980 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice4bin0 -> 14128 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice5bin0 -> 9760 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice6bin0 -> 12658 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice7bin0 -> 11148 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice8bin0 -> 11720 bytes
-rwxr-xr-xcommon/Resources/Sounds/guidice9bin0 -> 12376 bytes
-rwxr-xr-xcommon/Resources/Sounds/guitbin0 -> 32432 bytes
-rwxr-xr-xcommon/Resources/Sounds/guit2bin0 -> 57108 bytes
-rwxr-xr-xcommon/Resources/Sounds/harmonicabin0 -> 10396 bytes
-rwxr-xr-xcommon/Resources/Sounds/harmoniumbin0 -> 16948 bytes
-rwxr-xr-xcommon/Resources/Sounds/horsebin0 -> 36966 bytes
-rwxr-xr-xcommon/Resources/Sounds/kalimbabin0 -> 14496 bytes
-rwxr-xr-xcommon/Resources/Sounds/kotobin0 -> 29288 bytes
-rw-r--r--common/Resources/Sounds/lab1bin0 -> 44 bytes
-rw-r--r--common/Resources/Sounds/lab2bin0 -> 44 bytes
-rw-r--r--common/Resources/Sounds/lab3bin0 -> 44 bytes
-rw-r--r--common/Resources/Sounds/lab4bin0 -> 44 bytes
-rw-r--r--common/Resources/Sounds/lab5bin0 -> 44 bytes
-rw-r--r--common/Resources/Sounds/lab6bin0 -> 44 bytes
-rwxr-xr-xcommon/Resources/Sounds/laughbin0 -> 18112 bytes
-rwxr-xr-xcommon/Resources/Sounds/mandobin0 -> 20786 bytes
-rwxr-xr-xcommon/Resources/Sounds/marimbabin0 -> 13322 bytes
-rwxr-xr-xcommon/Resources/Sounds/mic1bin0 -> 44 bytes
-rwxr-xr-xcommon/Resources/Sounds/mic2bin0 -> 44 bytes
-rwxr-xr-xcommon/Resources/Sounds/mic3bin0 -> 44 bytes
-rwxr-xr-xcommon/Resources/Sounds/mic4bin0 -> 44 bytes
-rwxr-xr-xcommon/Resources/Sounds/ocarinabin0 -> 8650 bytes
-rwxr-xr-xcommon/Resources/Sounds/ounkbin0 -> 15232 bytes
-rwxr-xr-xcommon/Resources/Sounds/owbin0 -> 20300 bytes
-rwxr-xr-xcommon/Resources/Sounds/pianobin0 -> 96828 bytes
-rwxr-xr-xcommon/Resources/Sounds/planebin0 -> 69662 bytes
-rwxr-xr-xcommon/Resources/Sounds/rhodesbin0 -> 30080 bytes
-rwxr-xr-xcommon/Resources/Sounds/saxobin0 -> 29702 bytes
-rwxr-xr-xcommon/Resources/Sounds/sheepbin0 -> 39768 bytes
-rwxr-xr-xcommon/Resources/Sounds/shenaibin0 -> 14716 bytes
-rwxr-xr-xcommon/Resources/Sounds/sitarbin0 -> 27164 bytes
-rwxr-xr-xcommon/Resources/Sounds/slapbin0 -> 17534 bytes
-rwxr-xr-xcommon/Resources/Sounds/trianglebin0 -> 58652 bytes
-rwxr-xr-xcommon/Resources/Sounds/trumpetbin0 -> 20246 bytes
-rwxr-xr-xcommon/Resources/Sounds/tubabin0 -> 25876 bytes
-rwxr-xr-xcommon/Resources/Sounds/violinbin0 -> 21884 bytes
-rwxr-xr-xcommon/Resources/Sounds/voixbin0 -> 39052 bytes
-rwxr-xr-xcommon/Resources/Sounds/waterbin0 -> 19512 bytes
-rwxr-xr-xcommon/Resources/Sounds/zapbin0 -> 24218 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile1bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile10bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile2bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile3bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile4bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile5bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile6bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile7bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile8bin0 -> 12288 bytes
-rw-r--r--common/Resources/SynthFiles/synthFile9bin0 -> 12288 bytes
-rw-r--r--common/Resources/__init__.py0
-rw-r--r--common/Resources/crop.csd72
-rw-r--r--common/Resources/tamtamorc.csd1096
-rw-r--r--common/Resources/tooltips_en.py128
-rw-r--r--common/Resources/tooltips_fr.py153
-rw-r--r--common/Util/CSoundClient.py356
-rw-r--r--common/Util/CSoundNote.py77
-rw-r--r--common/Util/Clooper/Makefile21
-rw-r--r--common/Util/Clooper/SoundClient.i14
-rw-r--r--common/Util/Clooper/__init__.py0
-rw-r--r--common/Util/Clooper/aclient.cpp1090
-rwxr-xr-xcommon/Util/Clooper/aclient.sobin0 -> 59030 bytes
-rw-r--r--common/Util/Clooper/audio.cpp223
-rw-r--r--common/Util/Clooper/cmd_csound.cpp22
-rw-r--r--common/Util/Clooper/log.cpp52
-rw-r--r--common/Util/Clooper/ttest.c53
-rw-r--r--common/Util/Clooper/ttest.h15
-rw-r--r--common/Util/Clooper/ttest.i15
-rw-r--r--common/Util/Clooper/ttest.py54
-rw-r--r--common/Util/Clooper/ttest_wrap.c3042
-rw-r--r--common/Util/ControlStream.py225
-rw-r--r--common/Util/Credits.py39
-rw-r--r--common/Util/InstrumentDB.py143
-rw-r--r--common/Util/InstrumentPanel.py379
-rw-r--r--common/Util/Instrument_.py392
-rw-r--r--common/Util/KeyboardWindow.py181
-rw-r--r--common/Util/LoopSettings.py230
-rw-r--r--common/Util/Network.py569
-rw-r--r--common/Util/NoteDB.py811
-rw-r--r--common/Util/NoteLooper.py199
-rw-r--r--common/Util/Profiler.py93
-rw-r--r--common/Util/Sound.py289
-rw-r--r--common/Util/ThemeWidgets.py1276
-rw-r--r--common/Util/Trackpad.py93
-rw-r--r--common/Util/__init__.py0
-rw-r--r--common/__init__.py0
706 files changed, 41077 insertions, 0 deletions
diff --git a/TamTamEdit.activity/Edit/EditToolbars.py b/TamTamEdit.activity/Edit/EditToolbars.py
new file mode 100644
index 0000000..38e2e27
--- /dev/null
+++ b/TamTamEdit.activity/Edit/EditToolbars.py
@@ -0,0 +1,1484 @@
+#!/usr/bin/env python
+
+import gtk
+
+import Config
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.radiotoolbutton import RadioToolButton
+from sugar.graphics.palette import Palette
+from sugar.graphics.icon import Icon
+from Util.ThemeWidgets import *
+from gettext import gettext as _
+
+#Generation palette
+import gobject
+from Generation.Generator import GenerationParameters
+#Generation palette and Properties palette
+from Generation.GenerationConstants import GenerationConstants
+from Generation.GenerationRythm import GenerationRythm
+from Generation.GenerationPitch import GenerationPitch
+
+#Properties palette
+from Util.NoteDB import PARAMETER
+from Generation.Drunk import *
+import Generation.Utils as Utils
+from types import *
+from math import sqrt
+from random import *
+
+class mainToolbar(gtk.Toolbar):
+ def __init__(self,toolbox, edit):
+ gtk.Toolbar.__init__(self)
+
+ def _insertSeparator(x = 1):
+ for i in range(x):
+ self.separator = gtk.SeparatorToolItem()
+ self.separator.set_expand(True)
+ self.separator.set_draw(True)
+ self.insert(self.separator,-1)
+ self.separator.show()
+
+ self.toolbox = toolbox
+ self.edit = edit
+
+ self.tooltips = gtk.Tooltips()
+
+ #Play button
+ self.playButton = ToggleToolButton('media-playback-start')
+ self.playButtonHandler = self.playButton.connect('toggled', self.handlePlayPause)
+ self.insert(self.playButton, -1)
+ self.playButton.show()
+ self.playButton.set_tooltip(_('Play / Pause'))
+
+ #Stop button
+ self.stopButton = ToolButton('media-playback-stop')
+ self.stopButton.connect('clicked', self.handleStop)
+ self.insert(self.stopButton, -1)
+ self.stopButton.show()
+ self.stopButton.set_tooltip(_('Stop'))
+
+ #Play button Image
+ self.playButtonImg = gtk.Image()
+ self.playButtonImg.set_from_icon_name('media-playback-start', gtk.ICON_SIZE_LARGE_TOOLBAR)
+ self.playButtonImg.show()
+
+ #Pause button Image
+ self.pauseButtonImg = gtk.Image()
+ self.pauseButtonImg.set_from_icon_name('media-playback-pause', gtk.ICON_SIZE_LARGE_TOOLBAR)
+ self.pauseButtonImg.show()
+
+ #Record button
+ self.recordButton = ToggleToolButton('recordK')
+ self.recordButton.connect('clicked', self.edit.handleKeyboardRecordButton)
+ self.insert(self.recordButton, -1)
+ self.recordButton.show()
+ self.recordButton.set_tooltip(_('Record keyboard'))
+
+ #RecordOgg button
+ self.recordOggButton = ToggleToolButton('recordO')
+ self.recordOggButton.connect('clicked', self.edit.handleAudioRecord)
+ self.insert(self.recordOggButton, -1)
+ self.recordOggButton.show()
+ self.recordOggButton.set_tooltip(_('Record to ogg'))
+
+ _insertSeparator(1)
+
+ #Pointer button
+ self._pointerPalette = pointerPalette(_('Select Tool'), self.edit)
+ self.pointerButton = RadioToolButton('edit-pointer', group = None)
+ self.pointerButton.set_palette(self._pointerPalette)
+ self.pointerButton.connect('toggled', self.edit.handleToolClick, 'default')
+ self.pointerButton.get_child().connect('enter-notify-event', self.edit.blockFocus)
+ self.pointerButton.get_child().connect('leave-notify-event', self.edit.unblockFocus)
+ self.insert(self.pointerButton, -1)
+ self.pointerButton.show()
+
+ #Draw button
+ self._drawPalette = drawPalette(_('Draw Tool'), self.edit)
+ self.drawButton = RadioToolButton('edit-pencil', group = self.pointerButton)
+ self.drawButton.set_palette(self._drawPalette)
+ self.drawButton.connect('toggled', self.edit.handleToolClick, 'draw')
+ self.drawButton.get_child().connect('enter-notify-event', self.edit.blockFocus)
+ self.drawButton.get_child().connect('leave-notify-event', self.edit.unblockFocus)
+ self.insert(self.drawButton, -1)
+ self.drawButton.show()
+
+ #Paint button
+ self._paintPalette = paintPalette(_('Paint Tool'), self.edit)
+ self.paintButton = RadioToolButton('edit-brush', group = self.pointerButton)
+ self.paintButton.set_palette(self._paintPalette)
+ self.paintButton.connect('toggled', self.edit.handleToolClick, 'paint')
+ self.paintButton.get_child().connect('enter-notify-event', self.edit.blockFocus)
+ self.paintButton.get_child().connect('leave-notify-event', self.edit.unblockFocus)
+ self.insert(self.paintButton, -1)
+ self.paintButton.show()
+
+ _insertSeparator(1)
+
+ #Duplicate button
+ self.duplicateButton = ToggleToolButton('duplicate')
+ self.duplicateButton.connect('toggled', self.handleDuplicate)
+ self.insert(self.duplicateButton, -1)
+ self.duplicateButton.show()
+ self.duplicateButton.set_tooltip(_('Duplicate'))
+
+ #Volume / Tempo button
+ self._volumeTempoPalette = volumeTempoPalette(_('Volume / Tempo'), self.edit)
+ self.volumeTempoButton = ToggleToolButton('voltemp')
+ self.volumeTempoButton.set_palette(self._volumeTempoPalette)
+ self.volumeTempoButton.get_child().connect('enter-notify-event', self.edit.blockFocus)
+ self.volumeTempoButton.get_child().connect('leave-notify-event', self.edit.unblockFocus)
+ self.insert(self.volumeTempoButton, -1)
+ self.volumeTempoButton.show()
+
+ def handlePlayPause(self, widget, data = None):
+ if widget.get_active():
+ self.edit.handlePlay(widget)
+ self.edit._generateToolbar.handler_block(self.edit._generateToolbar.playButtonHandler)
+ self.edit._generateToolbar.playButton.set_active(True)
+ self.edit._generateToolbar.handler_unblock(self.edit._generateToolbar.playButtonHandler)
+ widget.set_icon_widget(self.pauseButtonImg)
+ self.edit._generateToolbar.playButton.set_icon_widget(self.edit._generateToolbar.pauseButtonImg)
+ else:
+ self.edit.handleStop(widget, False)
+ self.edit._generateToolbar.handler_block(self.edit._generateToolbar.playButtonHandler)
+ self.edit._generateToolbar.playButton.set_active(False)
+ self.edit._generateToolbar.handler_unblock(self.edit._generateToolbar.playButtonHandler)
+ widget.set_icon_widget(self.playButtonImg)
+ self.edit._generateToolbar.playButton.set_icon_widget(self.edit._generateToolbar.playButtonImg)
+
+ def handleStop(self, widget, data = None):
+ self.edit.handleStop(widget, True)
+ self.playButton.set_active(False)
+ if self.recordButton.get_active():
+ self.recordButton.set_active(False)
+
+ def handleDuplicate(self, widget):
+ if widget.get_active():
+ if self.edit.getContext() == 0: #Page
+ self.edit.pageDuplicate()
+ elif self.edit.getContext() == 1: #Track
+ self.edit.trackDuplicateWidget(widget)
+ elif self.edit.getContext() == 2: #Note
+ self.edit.noteDuplicateWidget(widget)
+ widget.set_active(False)
+
+class generateToolbar(gtk.Toolbar):
+ def __init__(self,toolbox, edit):
+ gtk.Toolbar.__init__(self)
+
+ def _insertSeparator(x = 1):
+ for i in range(x):
+ self.separator = gtk.SeparatorToolItem()
+ self.separator.set_expand(True)
+ self.separator.set_draw(False)
+ self.insert(self.separator,-1)
+ self.separator.show()
+
+ self.toolbox = toolbox
+ self.edit = edit
+
+ self.tooltips = gtk.Tooltips()
+
+ #Play button
+ self.playButton = ToggleToolButton('media-playback-start')
+ self.playButtonHandler = self.playButton.connect('toggled', self.handlePlayPause)
+ self.insert(self.playButton, -1)
+ self.playButton.show()
+ self.playButton.set_tooltip(_('Play / Pause'))
+
+ #Stop button
+ self.stopButton = ToolButton('media-playback-stop')
+ self.stopButton.connect('clicked', self.handleStop)
+ self.insert(self.stopButton, -1)
+ self.stopButton.show()
+ self.stopButton.set_tooltip(_('Stop'))
+
+ #Play button Image
+ self.playButtonImg = gtk.Image()
+ self.playButtonImg.set_from_icon_name('media-playback-start', gtk.ICON_SIZE_LARGE_TOOLBAR)
+ self.playButtonImg.show()
+
+ #Pause button Image
+ self.pauseButtonImg = gtk.Image()
+ self.pauseButtonImg.set_from_icon_name('media-playback-pause', gtk.ICON_SIZE_LARGE_TOOLBAR)
+ self.pauseButtonImg.show()
+
+ _insertSeparator(1)
+
+ #BigGeneration button
+ self.bigGenerationButton = ToolButton('diceB')
+ self.bigGenerationButton.connect('clicked', self.edit.createNewTune)
+ self.insert(self.bigGenerationButton, -1)
+ self.bigGenerationButton.show()
+ self.bigGenerationButton.set_tooltip(_('Generate Tune'))
+
+ #Generation button
+ self._generationPalette = generationPalette(_('Generation'), self.edit)
+ self.generationButton = ToggleToolButton('dice')
+ #self.generationButton.connect(None)
+ self.generationButton.set_palette(self._generationPalette)
+ self.generationButton.get_child().connect('enter-notify-event', self.edit.blockFocus)
+ self.generationButton.get_child().connect('leave-notify-event', self.edit.unblockFocus)
+ self.insert(self.generationButton, -1)
+ self.generationButton.show()
+
+ #Properties button
+ self._propertiesPalette = propertiesPalette(_('Properties'), self.edit)
+ self.propsButton = ToggleToolButton('props')
+ self.propsButton.set_palette(self._propertiesPalette)
+ self.propsButton.get_child().connect('enter-notify-event', self.edit.blockFocus)
+ self.propsButton.get_child().connect('leave-notify-event', self.edit.unblockFocus)
+ self.insert(self.propsButton, -1)
+ self.propsButton.show()
+
+ def handlePlayPause(self, widget, data = None):
+ if widget.get_active():
+ self.edit.handlePlay(widget)
+ self.edit._mainToolbar.handler_block(self.edit._mainToolbar.playButtonHandler)
+ self.edit._mainToolbar.playButton.set_active(True)
+ self.edit._mainToolbar.handler_unblock(self.edit._mainToolbar.playButtonHandler)
+ widget.set_icon_widget(self.pauseButtonImg)
+ self.edit._mainToolbar.playButton.set_icon_widget(self.edit._mainToolbar.pauseButtonImg)
+ else:
+ self.edit.handleStop(widget, False)
+ self.edit._mainToolbar.handler_block(self.edit._mainToolbar.playButtonHandler)
+ self.edit._mainToolbar.playButton.set_active(False)
+ self.edit._mainToolbar.handler_unblock(self.edit._mainToolbar.playButtonHandler)
+ widget.set_icon_widget(self.playButtonImg)
+ self.edit._mainToolbar.playButton.set_icon_widget(self.edit._mainToolbar.playButtonImg)
+
+ def handleStop(self, widget, data = None):
+ self.edit.handleStop(widget, True)
+ self.playButton.set_active(False)
+ if self.edit._mainToolbar.recordButton.get_active():
+ self.edit._mainToolbar.recordButton.set_active(False)
+
+class pointerPalette(Palette):
+ def __init__(self, label, edit):
+ Palette.__init__(self, label)
+
+ self.edit = edit
+
+ self.pointerBox = gtk.VBox()
+
+ self.snapGridHBox = gtk.HBox()
+ self.snapGridImage = gtk.Image()
+ self.snapGridImage.set_from_file(Config.TAM_TAM_ROOT + '/icons/grid.svg')
+ self.snapGridBox = BigComboBox()
+ self.snapGridBox.connect('changed', self.handleSnapGrid)
+ self.gridDurs = [1, 2, 3, 4, 6, 12, 24]
+ durs = [_('1/12'), _('1/6'), _('1/4'), _('1/3'), _('1/2'), _('1'), _('2') ]
+ for dur in durs:
+ self.snapGridBox.append_item(durs.index(dur),dur)
+ self.snapGridBox.set_active(0)
+ self.snapGridHBox.pack_start(self.snapGridImage, False, False, padding = 5)
+ self.snapGridHBox.pack_start(self.snapGridBox, False, False, padding = 5)
+
+ self.pointerBox.pack_start(self.snapGridHBox, False, False, padding = 5)
+ self.pointerBox.show_all()
+
+ self.set_content(self.pointerBox)
+
+ pass
+ #self.noteDur = widget.props.value
+
+ def handleSnapGrid(self, widget):
+ data = widget.props.value
+ grid = int(self.gridDurs[data])
+ self.edit.trackInterface.setPointerGrid(grid)
+
+class drawPalette(Palette):
+ def __init__(self, label, edit):
+ Palette.__init__(self, label)
+
+ self.edit = edit
+
+ self.drawBox = gtk.VBox()
+
+ self.snapGridHBox = gtk.HBox()
+ self.snapGridImage = gtk.Image()
+ self.snapGridImage.set_from_file(Config.TAM_TAM_ROOT + '/icons/grid.svg')
+ self.snapGridBox = BigComboBox()
+ self.snapGridBox.connect('changed', self.handleSnapGrid)
+ self.gridDurs = [1, 2, 3, 4, 6, 12, 24]
+ durs = [_('1/12'), _('1/6'), _('1/4'), _('1/3'), _('1/2'), _('1'), _('2') ]
+ for dur in durs:
+ self.snapGridBox.append_item(durs.index(dur),dur)
+ self.snapGridBox.set_active(0)
+ self.snapGridHBox.pack_start(self.snapGridImage, False, False, padding = 5)
+ self.snapGridHBox.pack_start(self.snapGridBox, False, False, padding = 5)
+
+ self.drawBox.pack_start(self.snapGridHBox, False, False, padding = 5)
+ self.drawBox.show_all()
+
+ self.set_content(self.drawBox)
+
+ pass
+ #self.noteDur = widget.props.value
+
+ def handleSnapGrid(self, widget):
+ data = widget.props.value
+ grid = int(self.gridDurs[data])
+ self.edit.trackInterface.setDrawGrid(grid)
+
+class paintPalette(Palette):
+ def __init__(self, label, edit):
+ Palette.__init__(self, label)
+
+ self.edit = edit
+
+ self.paintBox = gtk.VBox()
+
+ self.noteDurHBox = gtk.HBox()
+ self.noteDurImage = gtk.Image()
+ self.noteDurImage.set_from_file(Config.TAM_TAM_ROOT + '/icons/notedur.svg')
+ self.noteDurBox = BigComboBox()
+ self.noteDurBox.connect('changed', self.handleNoteDur)
+ self.noteDurs = [1, 2, 3, 4, 6, 12, 24]
+ self.durs = [_('1/12'), _('1/6'), _('1/4'), _('1/3'), _('1/2'), _('1'), _('2') ]
+ for dur in self.durs:
+ self.noteDurBox.append_item(self.durs.index(dur),dur)
+ self.noteDurBox.set_active(2)
+ self.noteDurHBox.pack_start(self.noteDurImage, False, False, padding = 5)
+ self.noteDurHBox.pack_start(self.noteDurBox, False, False, padding = 5)
+
+ self.snapGridHBox = gtk.HBox()
+ self.snapGridImage = gtk.Image()
+ self.snapGridImage.set_from_file(Config.TAM_TAM_ROOT + '/icons/grid.svg')
+ self.snapGridBox = BigComboBox()
+ self.snapGridBox.connect('changed', self.handleSnapGrid)
+ self.gridDurs = [1, 2, 3, 4, 6, 12, 24]
+ durs = [_('1/12'), _('1/6'), _('1/4'), _('1/3'), _('1/2'), _('1'), _('2')]
+ for dur in durs:
+ self.snapGridBox.append_item(durs.index(dur),dur)
+ self.snapGridBox.set_active(2)
+ self.snapGridHBox.pack_start(self.snapGridImage, False, False, padding = 5)
+ self.snapGridHBox.pack_start(self.snapGridBox, False, False, padding = 5)
+
+ self.paintBox.pack_start(self.noteDurHBox, False, False, padding = 5)
+ self.paintBox.pack_start(self.snapGridHBox, False, False, padding = 5)
+ self.paintBox.show_all()
+
+ self.set_content(self.paintBox)
+
+ def resizeNoteDur(self):
+ oldActive = self.noteDurBox.get_active()
+ len = self.snapGridBox.get_active()
+ self.noteDurBox.remove_all()
+ for dur in self.durs[0:len+1]:
+ self.noteDurBox.append_item(self.durs.index(dur), dur)
+ if oldActive <= len:
+ self.noteDurBox.set_active(oldActive)
+ else:
+ self.noteDurBox.set_active(len)
+
+ def handleNoteDur(self, widget):
+ data = widget.props.value
+ noteDur = int(self.noteDurs[data])
+ self.edit.trackInterface.setPaintNoteDur(noteDur)
+
+ def handleSnapGrid(self, widget):
+ data = widget.props.value
+ grid = int(self.gridDurs[data])
+ self.edit.trackInterface.setPaintGrid(grid)
+ self.resizeNoteDur()
+
+class volumeTempoPalette(Palette):
+ def __init__(self, label, edit):
+ Palette.__init__(self, label)
+
+ self.edit = edit
+
+ self.volumeTempoBox = gtk.VBox()
+
+ self.volumeSliderBox = gtk.HBox()
+ self.volumeSliderLabel = gtk.Label(_('Volume'))
+ self.volumeSliderAdj = gtk.Adjustment(Config.DEFAULT_VOLUME, 0, 100, 1, 1, 0)
+ self.volumeSliderAdj.connect('value-changed', self.edit.handleVolume)
+ self.volumeSlider = gtk.HScale(adjustment = self.volumeSliderAdj)
+ self.volumeSlider.set_size_request(250,-1)
+ self.volumeSlider.set_inverted(False)
+ self.volumeSlider.set_draw_value(False)
+ self.volumeSliderBox.pack_start(self.volumeSliderLabel, False, False, padding = 5)
+ self.volumeSliderBox.pack_end(self.volumeSlider, False, False, padding = 5)
+
+ self.tempoSliderBox = gtk.HBox()
+ self.tempoSliderLabel = gtk.Label(_('Tempo'))
+ self.tempoSliderAdj = gtk.Adjustment(Config.PLAYER_TEMPO, 40, 240, 1, 1, 0)
+ self.tempoSliderAdj.connect('value-changed', self.edit.handleTempo)
+ self.tempoSlider = gtk.HScale(adjustment = self.tempoSliderAdj)
+ self.tempoSlider.set_size_request(250,-1)
+ self.tempoSlider.set_inverted(False)
+ self.tempoSlider.set_draw_value(False)
+ self.tempoSliderBox.pack_start(self.tempoSliderLabel, False, False, padding = 5)
+ self.tempoSliderBox.pack_end(self.tempoSlider, False, False, padding = 5)
+
+ self.volumeTempoBox.pack_start(self.volumeSliderBox, padding = 5)
+ self.volumeTempoBox.pack_start(self.tempoSliderBox, padding = 5)
+ self.volumeTempoBox.show_all()
+
+ self.set_content(self.volumeTempoBox)
+
+class generationPalette(Palette):
+ def __init__(self, label, edit):
+ Palette.__init__(self, label)
+
+ self.edit = edit
+
+ self.rythmDensity = GenerationConstants.DEFAULT_DENSITY
+ self.rythmRegularity = GenerationConstants.DEFAULT_RYTHM_REGULARITY
+ self.pitchRegularity = GenerationConstants.DEFAULT_PITCH_REGULARITY
+ self.pitchStep = GenerationConstants.DEFAULT_STEP
+ self.duration = GenerationConstants.DEFAULT_DURATION
+ self.silence = GenerationConstants.DEFAULT_SILENCE
+ self.rythmMethod = GenerationConstants.DEFAULT_RYTHM_METHOD
+ self.pitchMethod = GenerationConstants.DEFAULT_PITCH_METHOD
+ self.pattern = GenerationConstants.DEFAULT_PATTERN
+ self.scale = GenerationConstants.DEFAULT_SCALE
+
+ self.mainBox = gtk.VBox()
+ self.slidersBox = gtk.HBox()
+ self.scaleModeBox = gtk.VBox()
+ self.decisionBox = gtk.HBox()
+
+ self.XYSlider1MainBox = gtk.VBox()
+ self.XYSlider1TopLabel = gtk.Label(_('Rythm'))
+ self.XSlider1BottomLabelBox = gtk.HBox()
+ self.XSlider1Img = gtk.Image()
+ self.XSlider1Img.set_from_file(Config.TAM_TAM_ROOT + '/icons/sideR.svg')
+ self.XSlider1BottomLabel = gtk.Label(_('Density'))
+ self.YSlider1BottomLabelBox = gtk.HBox()
+ self.YSlider1Img = gtk.Image()
+ self.YSlider1Img.set_from_file(Config.TAM_TAM_ROOT + '/icons/updownR.svg')
+ self.YSlider1BottomLabel = gtk.Label(_('Regularity'))
+ self.XYSliderBox1 = RoundFixed(fillcolor = '#CCCCCC', bordercolor = '#000000')
+ self.XYSliderBox1.set_size_request(200,200)
+ self.XYButton1 = ImageToggleButton( Config.TAM_TAM_ROOT + '/icons/XYBut.svg', Config.TAM_TAM_ROOT + '/icons/XYButDown.svg')
+ self.XAdjustment1 = gtk.Adjustment(self.rythmDensity * 100, 0, 100, 1, 1, 1)
+ self.XAdjustment1.connect("value-changed", self.handleXAdjustment1)
+ self.YAdjustment1 = gtk.Adjustment(self.rythmRegularity * 100, 0, 100, 1, 1, 1)
+ self.YAdjustment1.connect("value-changed", self.handleYAdjustment1)
+ self.XYSlider1 = XYSlider( self.XYSliderBox1, self.XYButton1, self.XAdjustment1, self.YAdjustment1, False, True )
+ self.XSlider1BottomLabelBox.pack_start(self.XSlider1Img, False, False, padding = 5)
+ self.XSlider1BottomLabelBox.pack_start(self.XSlider1BottomLabel, False, False, padding = 5)
+ self.YSlider1BottomLabelBox.pack_start(self.YSlider1Img, False, False, padding = 5)
+ self.YSlider1BottomLabelBox.pack_start(self.YSlider1BottomLabel, False, False, padding = 5)
+ self.XYSlider1MainBox.pack_start(self.XYSlider1TopLabel, False, False, padding = 5)
+ self.XYSlider1MainBox.pack_start(self.XYSlider1, False, False, padding = 2)
+ self.XYSlider1MainBox.pack_start(self.XSlider1BottomLabelBox, False, False, padding = 2)
+ self.XYSlider1MainBox.pack_start(self.YSlider1BottomLabelBox, False, False, padding = 2)
+
+ self.XYSlider2MainBox = gtk.VBox()
+ self.XYSlider2TopLabel = gtk.Label(_('Pitch'))
+ self.XSlider2BottomLabelBox = gtk.HBox()
+ self.XSlider2Img = gtk.Image()
+ self.XSlider2Img.set_from_file(Config.TAM_TAM_ROOT + '/icons/sideR.svg')
+ self.XSlider2BottomLabel = gtk.Label(_('Regularity'))
+ self.YSlider2BottomLabelBox = gtk.HBox()
+ self.YSlider2Img = gtk.Image()
+ self.YSlider2Img.set_from_file(Config.TAM_TAM_ROOT + '/icons/updownR.svg')
+ self.YSlider2BottomLabel = gtk.Label(_('Maximum step'))
+ self.XYSliderBox2 = RoundFixed(fillcolor = '#CCCCCC', bordercolor = '#000000')
+ self.XYSliderBox2.set_size_request(200,200)
+ self.XYButton2 = ImageToggleButton( Config.TAM_TAM_ROOT + '/icons/XYBut.svg', Config.TAM_TAM_ROOT + '/icons/XYButDown.svg')
+ self.XAdjustment2 = gtk.Adjustment(self.pitchRegularity * 100, 0, 100, 1, 1, 1)
+ self.XAdjustment2.connect("value-changed", self.handleXAdjustment2)
+ self.YAdjustment2 = gtk.Adjustment(self.pitchStep * 100, 0, 100, 1, 1, 1)
+ self.YAdjustment2.connect("value-changed", self.handleYAdjustment2)
+ self.XYSlider2 = XYSlider( self.XYSliderBox2, self.XYButton2, self.XAdjustment2, self.YAdjustment2, False, True )
+ self.XSlider2BottomLabelBox.pack_start(self.XSlider2Img, False, False, padding = 5)
+ self.XSlider2BottomLabelBox.pack_start(self.XSlider2BottomLabel, False, False, padding = 5)
+ self.YSlider2BottomLabelBox.pack_start(self.YSlider2Img, False, False, padding = 5)
+ self.YSlider2BottomLabelBox.pack_start(self.YSlider2BottomLabel, False, False, padding = 5)
+ self.XYSlider2MainBox.pack_start(self.XYSlider2TopLabel, False, False, padding = 5)
+ self.XYSlider2MainBox.pack_start(self.XYSlider2, False, False, padding = 2)
+ self.XYSlider2MainBox.pack_start(self.XSlider2BottomLabelBox, False, False, padding = 2)
+ self.XYSlider2MainBox.pack_start(self.YSlider2BottomLabelBox, False, False, padding = 2)
+
+ self.XYSlider3MainBox = gtk.VBox()
+ self.XYSlider3TopLabel = gtk.Label(_('Duration'))
+ self.XSlider3BottomLabelBox = gtk.HBox()
+ self.XSlider3Img = gtk.Image()
+ self.XSlider3Img.set_from_file(Config.TAM_TAM_ROOT + '/icons/sideR.svg')
+ self.XSlider3BottomLabel = gtk.Label(_('Note duration'))
+ self.YSlider3BottomLabelBox = gtk.HBox()
+ self.YSlider3Img = gtk.Image()
+ self.YSlider3Img.set_from_file(Config.TAM_TAM_ROOT + '/icons/updownR.svg')
+ self.YSlider3BottomLabel = gtk.Label(_('Silence density'))
+ self.XYSliderBox3 = RoundFixed(fillcolor = '#CCCCCC', bordercolor = '#000000')
+ self.XYSliderBox3.set_size_request(200,200)
+ self.XYButton3 = ImageToggleButton( Config.TAM_TAM_ROOT + '/icons/XYBut.svg', Config.TAM_TAM_ROOT + '/icons/XYButDown.svg')
+ self.XAdjustment3 = gtk.Adjustment(self.duration * 100, 0, 100, 1, 1, 1)
+ self.XAdjustment3.connect("value-changed", self.handleXAdjustment3)
+ self.YAdjustment3 = gtk.Adjustment(self.silence * 100, 0, 100, 1, 1, 1)
+ self.YAdjustment3.connect("value-changed", self.handleYAdjustment3)
+ self.XYSlider3 = XYSlider( self.XYSliderBox3, self.XYButton3, self.XAdjustment3, self.YAdjustment3, False, True )
+ self.XSlider3BottomLabelBox.pack_start(self.XSlider3Img, False, False, padding = 5)
+ self.XSlider3BottomLabelBox.pack_start(self.XSlider3BottomLabel, False, False, padding = 5)
+ self.YSlider3BottomLabelBox.pack_start(self.YSlider3Img, False, False, padding = 5)
+ self.YSlider3BottomLabelBox.pack_start(self.YSlider3BottomLabel, False, False, padding = 5)
+ self.XYSlider3MainBox.pack_start(self.XYSlider3TopLabel, False, False, padding = 5)
+ self.XYSlider3MainBox.pack_start(self.XYSlider3, False, False, padding = 2)
+ self.XYSlider3MainBox.pack_start(self.XSlider3BottomLabelBox, False, False, padding = 2)
+ self.XYSlider3MainBox.pack_start(self.YSlider3BottomLabelBox, False, False, padding = 2)
+
+ self.slidersBox.pack_start(self.XYSlider1MainBox, False, False, padding = 5)
+ self.slidersBox.pack_start(self.XYSlider2MainBox, False, False, padding = 5)
+ self.slidersBox.pack_start(self.XYSlider3MainBox, False, False, padding = 5)
+
+ self.previewBox = gtk.HBox()
+ self.previewDA = gtk.DrawingArea()
+ self.previewDA.set_size_request( -1, 100 )
+ self.previewDA.connect( "size-allocate", self.handlePreviewAlloc )
+ self.previewDA.connect( "expose-event", self.handlePreviewExpose )
+ self.previewBox.pack_start( self.previewDA, True, True, padding = 5 )
+
+ self.scaleBoxHBox = gtk.HBox()
+ self.scaleBoxLabel = gtk.Label(_('Scale: '))
+ self.scaleBox = BigComboBox()
+ scales = [_('Major scale'), _('Harmonic minor scale'), _('Natural minor scale'), _('Phrygian scale'), _('Dorian scale'), _('Lydian scale'), _('Myxolidian scale')]
+ for scale in scales:
+ self.scaleBox.append_item(scales.index(scale), scale)
+ self.scaleBox.connect('changed', self.handleScale)
+
+ self.modeBoxHBox = gtk.HBox()
+ self.modeBoxLabel = gtk.Label(_('Mode: '))
+ self.modeBox = BigComboBox()
+ modes = [_('Drunk'), _('Drone and Jump'), _('Repeater'), _('Loop segments')]
+ for mode in modes:
+ self.modeBox.append_item(modes.index(mode), mode)
+ self.modeBox.connect('changed', self.handleMode)
+
+ self.scaleBoxHBox.pack_start(self.scaleBoxLabel, False, False, padding = 10)
+ self.scaleBoxHBox.pack_start(self.scaleBox, False, False, padding = 10)
+ self.modeBoxHBox.pack_start(self.modeBoxLabel, False, False, padding = 10)
+ self.modeBoxHBox.pack_start(self.modeBox, False, False, padding = 10)
+ self.scaleModeBox.pack_start(self.scaleBoxHBox, False, False, padding = 5)
+ self.scaleModeBox.pack_start(self.modeBoxHBox, False, False, padding = 5)
+
+ self.acceptButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/accept.svg')
+ self.acceptButton.connect('clicked',self.generate)
+ self.cancelButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/cancel.svg')
+ self.cancelButton.connect('clicked',self.cancel)
+ self.decisionBox.pack_start(self.cancelButton, False, False, padding = 5)
+ self.decisionBox.pack_start(self.acceptButton, False, False, padding = 5)
+
+ self.mainBox.pack_start(self.slidersBox, False, False, padding = 5)
+ self.mainBox.pack_start( self.previewBox, False, False, padding = 5 )
+ self.mainBox.pack_start(self.scaleModeBox, False, False, padding = 5)
+ self.mainBox.pack_start(self.decisionBox, False, False, padding = 5)
+ self.mainBox.show_all()
+
+ self.set_content(self.mainBox)
+
+ #-- preview drawing -----------------------------------
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ self.parametersDirty = False
+ self.drawingPreview = False
+ self.predrawTarget = 0
+ self.predrawIdleAbort = False
+ self.predrawBuffer = False
+ # self.predrawBuffer is initialized in handlePreviewAlloc
+ pix = gtk.gdk.pixbuf_new_from_file( Config.IMAGE_ROOT+"sampleBG.png" )
+ self.sampleBg = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.sampleBg.draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.sampleBg.endOffset = pix.get_width()-5
+ self.sampleNoteHeight = 7
+ if True: # load clipmask
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT+'sampleNoteMask.png')
+ pixels = pix.get_pixels()
+ stride = pix.get_rowstride()
+ channels = pix.get_n_channels()
+ bitmap = ""
+ byte = 0
+ shift = 0
+ for j in range(pix.get_height()):
+ offset = stride*j
+ for i in range(pix.get_width()):
+ r = pixels[i*channels+offset]
+ if r != "\0": byte += 1 << shift
+ shift += 1
+ if shift > 7:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ if shift > 0:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ self.sampleNoteMask = gtk.gdk.bitmap_create_from_data( None, bitmap, pix.get_width(), pix.get_height() )
+ self.sampleNoteMask.endOffset = pix.get_width()-3
+
+ colormap = self.previewDA.get_colormap()
+ self.colors = { "Beat_Line": colormap.alloc_color( "#959595", True, True ),
+ "Note_Border": colormap.alloc_color( Config.BG_COLOR, True, True ),
+ "Note_Fill": colormap.alloc_color( Config.FG_COLOR, True, True ) }
+
+ self.scaleBox.set_active(0)
+ self.modeBox.set_active(0)
+
+
+ def handleXAdjustment1( self, data ):
+ self.rythmDensity = self.XAdjustment1.value * .01
+ self.parametersChanged()
+
+ def handleYAdjustment1( self, data ):
+ self.rythmRegularity = self.YAdjustment1.value * .01
+ self.parametersChanged()
+
+ def handleXAdjustment2( self, data ):
+ self.pitchRegularity = self.XAdjustment2.value * .01
+ self.parametersChanged()
+
+ def handleYAdjustment2( self, data ):
+ self.pitchStep = self.YAdjustment2.value * .01
+ self.parametersChanged()
+
+ def handleXAdjustment3( self, data ):
+ self.duration = self.XAdjustment3.value * .01
+ self.parametersChanged()
+
+ def handleYAdjustment3( self, data ):
+ self.silence = self.YAdjustment3.value * .01
+ self.parametersChanged()
+
+ def handleScale(self, widget, data = None):
+ self.scale = widget.props.value
+ self.edit.scale = self.scale
+ self.parametersChanged()
+
+ def handleMode( self, widget, data = None ):
+ self.pattern = [widget.props.value for x in range(4)]
+ self.parametersChanged()
+
+ def getGenerationParameters( self ):
+ return GenerationParameters( self.rythmDensity,
+ self.rythmRegularity,
+ self.pitchStep,
+ self.pitchRegularity,
+ self.duration,
+ self.silence,
+ self.rythmMethod,
+ self.pitchMethod,
+ self.pattern,
+ self.scale )
+
+ def cancel(self, widget, data = None):
+ self.popdown(True)
+
+ def generate(self, widget, data=None):
+ context = self.edit.getContext()
+ if context == 0: # Page
+ mode = 'page'
+ elif context == 1: # Track
+ mode = 'track'
+ elif context == 2: # Note
+ self.popdown(True)
+ return
+ self.edit.setPageGenerateMode(mode)
+ self.edit.generate(self.getGenerationParameters())
+ self.popdown(True)
+
+ ############ generate a preview melody ##############s
+ def previewGenerator(self, parameters):
+ makeRythm = GenerationRythm()
+ makePitch = GenerationPitch()
+ table_duration = Utils.scale(parameters.articule, GenerationConstants.ARTICULATION_SCALE_MIN_MAPPING, GenerationConstants.ARTICULATION_SCALE_MAX_MAPPING, GenerationConstants.ARTICULATION_SCALE_STEPS)
+ table_pitch = GenerationConstants.SCALES[parameters.scale]
+ beat = self.edit.noteDB.pages[self.edit.tuneInterface.getSelectedIds()[0]].beats
+ barLength = Config.TICKS_PER_BEAT * beat
+ trackNotes = []
+
+ rythmSequence = makeRythm.celluleRythmSequence(parameters, barLength)
+ pitchSequence = makePitch.drunkPitchSequence(len(rythmSequence),parameters, table_pitch, 0)
+ gainSequence = self.makeGainSequence(rythmSequence)
+ durationSequence = self.makeDurationSequence(rythmSequence, parameters, table_duration, barLength)
+
+ for i in range(len(rythmSequence)):
+ if random() > parameters.silence:
+ trackNotes.append([rythmSequence[i], pitchSequence[i], gainSequence[i], durationSequence[i]])
+ #print "-------------------------------------------------------",trackNotes
+ return ( trackNotes, beat )
+
+ def makeGainSequence( self, onsetList ):
+ gainSequence = []
+ max = GenerationConstants.GAIN_MAX_BOUNDARY
+ midMax = GenerationConstants.GAIN_MID_MAX_BOUNDARY
+ midMin = GenerationConstants.GAIN_MID_MIN_BOUNDARY
+ min = GenerationConstants.GAIN_MIN_BOUNDARY
+ for onset in onsetList:
+ if onset == 0:
+ gainSequence.append(uniform(midMax, max))
+ elif ( onset % Config.TICKS_PER_BEAT) == 0:
+ gainSequence.append(uniform(midMin, midMax))
+ else:
+ gainSequence.append(uniform(min, midMin))
+ return gainSequence
+
+ def makeDurationSequence( self, onsetList, parameters, table_duration, barLength ):
+ durationSequence = []
+ if len( onsetList ) > 1:
+ for i in range(len(onsetList) - 1):
+ durationSequence.append((onsetList[i+1] - onsetList[i]) * Utils.prob2( table_duration ))
+ durationSequence.append(( barLength - onsetList[-1]) * Utils.prob2( table_duration ))
+ elif len( onsetList ) == 1:
+ durationSequence.append( ( barLength - onsetList[0] ) * Utils.prob2( table_duration ))
+ return durationSequence
+
+ def parametersChanged( self ):
+ if not self.drawingPreview:
+ self.drawPreview()
+ else:
+ self.parametersDirty = True
+
+ def drawPreview( self, force = False ):
+ if not self.predrawBuffer:
+ return # not alloc'ed yet
+
+ if self.drawingPreview and not force:
+ return # should never happen
+
+ notes, beats = self.previewGenerator( self.getGenerationParameters() )
+ self.parametersDirty = False
+
+ if force:
+ if self.drawingPreview:
+ self.predrawIdleAbort = True
+ self._idleDraw( notes, beats, True, True )
+ else:
+ self.drawingPreview = True
+ gobject.idle_add( self._idleDraw, notes, beats, True, False )
+
+ def _idleDraw( self, notes, beats, fresh, force ):
+ if self.predrawIdleAbort and not force:
+ self.predrawIdleAbort = False
+ return False
+
+ pixmap = self.predrawBuffer[self.predrawTarget]
+
+ if fresh:
+ # draw bg
+ pixmap.draw_drawable( self.gc, self.sampleBg, 0, 0, 0, 0, self.previewDA.width-5, self.previewDA.height )
+ pixmap.draw_drawable( self.gc, self.sampleBg, self.sampleBg.endOffset, 0, self.previewDA.width-5, 0, 5, self.previewDA.height )
+ # draw beat lines
+ self.gc.set_line_attributes( Config.BEAT_LINE_SIZE, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.colors["Beat_Line"]
+ for i in range(1,beats):
+ x = self.beatSpacing[beats][i]
+ pixmap.draw_line( self.gc, x, 1, x, self.previewDA.height-1 )
+
+ if not force:
+ gobject.idle_add( self._idleDraw, notes, beats, False, False )
+ return False
+
+ if force: N = len(notes)
+ else: N = min( 3, len( notes ) ) # adjust this value to get a reasonable response
+
+ self.gc.set_clip_mask( self.sampleNoteMask )
+ for i in range( N ): # draw N notes
+ note = notes.pop()
+ x = self.ticksToPixels( beats, note[0] )
+ endX = self.ticksToPixels( beats, note[0] + note[3] ) - 3 # include end cap offset
+ width = endX - x
+ y = self.pitchToPixels( note[1] )
+ # draw fill
+ self.gc.foreground = self.colors["Note_Fill"]
+ self.gc.set_clip_origin( x, y-self.sampleNoteHeight )
+ pixmap.draw_rectangle( self.gc, True, x+1, y+1, width+1, self.sampleNoteHeight-2 )
+ # draw border
+ self.gc.foreground = self.colors["Note_Border"]
+ self.gc.set_clip_origin( x, y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, self.sampleNoteHeight )
+ self.gc.set_clip_origin( endX-self.sampleNoteMask.endOffset, y )
+ pixmap.draw_rectangle( self.gc, True, endX, y, 3, self.sampleNoteHeight )
+ self.gc.set_clip_rectangle( self.clearClipMask )
+
+ if not len(notes):
+ self.predrawTarget = not self.predrawTarget
+ self.previewDA.queue_draw()
+
+ self.drawingPreview = False
+
+ if self.parametersDirty:
+ self.drawPreview()
+
+ return False
+
+ return True
+
+ def handlePreviewAlloc( self, widget, allocation ):
+ win = gtk.gdk.get_default_root_window()
+ self.previewDA.width = allocation.width
+ self.previewDA.height = allocation.height
+ self.predrawBuffer = [ gtk.gdk.Pixmap( win, allocation.width, allocation.height ),
+ gtk.gdk.Pixmap( win, allocation.width, allocation.height ) ]
+ self.clearClipMask = gtk.gdk.Rectangle( 0, 0, allocation.width, allocation.height )
+
+ self.pitchPerPixel = float(Config.NUMBER_OF_POSSIBLE_PITCHES-1) / (self.previewDA.height - self.sampleNoteHeight)
+ self.pixelsPerPitch = float(self.previewDA.height - self.sampleNoteHeight)/(Config.MAXIMUM_PITCH - Config.MINIMUM_PITCH)
+ self.pixelsPerTick = [0] + [ self.previewDA.width/float(i*Config.TICKS_PER_BEAT) for i in range(1,Config.MAXIMUM_BEATS+1) ]
+ self.ticksPerPixel = [0] + [ 1.0/self.pixelsPerTick[i] for i in range(1,Config.MAXIMUM_BEATS+1) ]
+
+ self.beatSpacing = [[0]]
+ for i in range(1,Config.MAXIMUM_BEATS+1):
+ self.beatSpacing.append( [ self.ticksToPixels( i, Config.TICKS_PER_BEAT*j ) for j in range(i) ] )
+
+ self.drawPreview( True )
+
+ def handlePreviewExpose( self, widget, event ):
+ widget.window.draw_drawable( self.gc, self.predrawBuffer[not self.predrawTarget], event.area.x, event.area.y, event.area.x, event.area.y, event.area.width, event.area.height )
+
+ def ticksToPixels( self, beats, ticks ):
+ return int(round( ticks * self.pixelsPerTick[beats] ))
+ def pitchToPixels( self, pitch ):
+ return int(round( ( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch ))
+
+
+class propertiesPalette(Palette):
+ def __init__(self, label, edit):
+ Palette.__init__(self, label)
+ self.connect('popup', self.handlePopup)
+ self.connect('popdown', self.handlePopdown)
+
+ self.edit = edit
+
+ self.filterTypes = [_('None'), _('Lowpass'), _('Bandpass'), _('Highpass')]
+ self.geneTypes = [_('Line'),_('Drunk'),_('Drone and Jump'),_('Repeater'),_('Loop Segments')]
+ self.colors = [_('Purple'), _('Green'), _('Blue'), _('Yellow')]
+ self.currentFilterType = self.filterTypes[0]
+
+ self.line = Line(0, 100)
+ self.drunk = Drunk(0, 100)
+ self.droneAndJump = DroneAndJump(0, 100)
+ self.repeter = Repeter(0, 100)
+ self.loopseg = Loopseg(0, 100)
+ self.algoTypes = [self.line, self.drunk, self.droneAndJump, self.repeter, self.loopseg]
+ self.algorithm = self.algoTypes[0]
+ self.geneMinimum = 0
+ self.geneMaximum = 100
+ self.geneRandom = 20
+
+ self.setup = False
+ self.hidden = False
+ self.geneCheckButtonDic = {}
+
+ self.pageIds = []
+ self.context = "page"
+
+ self.mainBox = gtk.VBox()
+
+ self.gridDivisionBox = gtk.HBox()
+ self.gridDivisionLabel = gtk.Label(_('Grid division: '))
+ self.gridDivisionSliderAdj = gtk.Adjustment(4, 2, 12, 1, 1, 0)
+ self.gridDivisionSlider = gtk.HScale(adjustment = self.gridDivisionSliderAdj)
+ self.gridDivisionSlider.set_digits(0)
+ self.gridDivisionSlider.connect('button-release-event', self.handleBeat)
+ self.gridDivisionSlider.set_size_request(200,-1)
+ self.gridDivisionSlider.set_value_pos(gtk.POS_RIGHT)
+ self.gridDivisionBox.pack_start(self.gridDivisionLabel, False, False, padding = 5)
+ self.gridDivisionBox.pack_end(self.gridDivisionSlider, False, False, padding = 52)
+
+ self.pageColorBox = gtk.HBox()
+ self.pageColorLabel = gtk.Label(_('Page color: '))
+ self.pageColorComboBox = BigComboBox()
+ for color in (0,1,2,3):
+ self.pageColorComboBox.append_item(color, text = None, icon_name = Config.IMAGE_ROOT + 'pageThumbnailBG' + str(color) + '.png', size = (30,40))
+ self.pageColorComboBox.set_active(0)
+ self.pageColorComboBox.connect('changed', self.handleColor)
+ self.pageColorBox.pack_start(self.pageColorLabel, False, False, padding = 5)
+ self.pageColorBox.pack_end(self.pageColorComboBox, False, False, padding = 55)
+
+ self.pageSeparator = gtk.HSeparator()
+ self.pageSeparator.set_size_request(20, -1)
+
+ self.transposeBox = gtk.HBox()
+ self.transposeLabel = gtk.Label(_('Transposition: '))
+ self.transposeDownButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/arrow-down.svg')
+ self.transposeDownButton.connect('clicked', self.stepPitch, -1)
+ self.transposeUpButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/arrow-up.svg')
+ self.transposeUpButton.connect('clicked', self.stepPitch, 1)
+ self.transposeCheckButton = gtk.CheckButton()
+ self.transposeCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['transpose'] = self.transposeCheckButton
+ self.transposeBox.pack_start(self.transposeLabel, False, False, padding = 5)
+ self.transposeBox.pack_end(self.transposeCheckButton, False, False, padding = 5)
+ self.transposeBox.pack_end(self.transposeUpButton, False, False, padding = 50)
+ self.transposeBox.pack_end(self.transposeDownButton, False, False, padding = 5)
+
+ self.volumeBox = gtk.HBox()
+ self.volumeLabel = gtk.Label(_('Volume: '))
+ self.volumeDownButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/arrow-down.svg')
+ self.volumeDownButton.connect('clicked', self.stepVolume, -0.1)
+ self.volumeUpButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/arrow-up.svg')
+ self.volumeUpButton.connect('clicked', self.stepVolume, 0.1)
+ self.volumeCheckButton = gtk.CheckButton()
+ self.volumeCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['volume'] = self.volumeCheckButton
+ self.volumeBox.pack_start(self.volumeLabel, False, False, padding = 5)
+ self.volumeBox.pack_end(self.volumeCheckButton, False, False, padding = 5)
+ self.volumeBox.pack_end(self.volumeUpButton, False, False, padding = 50)
+ self.volumeBox.pack_end(self.volumeDownButton, False, False, padding = 5)
+
+ self.panBox = gtk.HBox()
+ self.panLabel = gtk.Label(_('Pan: '))
+ self.panSliderAdj = gtk.Adjustment(0.5, 0, 1, .1, .1, 0)
+ self.panSliderAdj.connect('value-changed', self.handlePan)
+ self.panSlider = gtk.HScale(adjustment = self.panSliderAdj)
+ self.panSlider.set_size_request(200,-1)
+ self.panSlider.set_value_pos(gtk.POS_RIGHT)
+ self.panSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.panCheckButton = gtk.CheckButton()
+ self.panCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['pan'] = self.panCheckButton
+ self.panBox.pack_start(self.panLabel, False, False, padding = 5)
+ self.panBox.pack_end(self.panCheckButton, False, False, padding = 5)
+ self.panBox.pack_end(self.panSlider, False, False, padding = 5)
+
+ self.reverbBox = gtk.HBox()
+ self.reverbLabel = gtk.Label(_('Reverb: '))
+ self.reverbSliderAdj = gtk.Adjustment(0.1, 0, 1, 0.1, 0.1, 0)
+ self.reverbSliderAdj.connect("value-changed", self.handleReverb)
+ self.reverbSlider = gtk.HScale(adjustment = self.reverbSliderAdj)
+ self.reverbSlider.set_size_request(200,-1)
+ self.reverbSlider.set_value_pos(gtk.POS_RIGHT)
+ self.reverbSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.reverbCheckButton = gtk.CheckButton()
+ self.reverbCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['reverb'] = self.reverbCheckButton
+ self.reverbBox.pack_start(self.reverbLabel, False, False, padding = 5)
+ self.reverbBox.pack_end(self.reverbCheckButton, False, False, padding = 5)
+ self.reverbBox.pack_end(self.reverbSlider, False, False, padding = 5)
+
+ self.attackDurBox = gtk.HBox()
+ self.attackDurLabel = gtk.Label(_('Attack duration: '))
+ self.attackDurSliderAdj = gtk.Adjustment(0.04, 0.03, 1, .01, .01, 0)
+ self.attackDurSliderAdj.connect('value-changed', self.handleAttack)
+ self.attackDurSlider = gtk.HScale(adjustment = self.attackDurSliderAdj)
+ self.attackDurSlider.set_size_request(200,-1)
+ self.attackDurSlider.set_value_pos(gtk.POS_RIGHT)
+ self.attackDurSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.attackDurCheckButton = gtk.CheckButton()
+ self.attackDurCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['attack'] = self.attackDurCheckButton
+ self.attackDurBox.pack_start(self.attackDurLabel, False, False, padding = 5)
+ self.attackDurBox.pack_end(self.attackDurCheckButton, False, False, padding = 5)
+ self.attackDurBox.pack_end(self.attackDurSlider, False, False, padding = 5)
+
+ self.decayDurBox = gtk.HBox()
+ self.decayDurLabel = gtk.Label(_('Decay duration: '))
+ self.decayDurSliderAdj = gtk.Adjustment(0.31, 0.03, 1, .01, .01, 0)
+ self.decayDurSliderAdj.connect('value-changed', self.handleDecay)
+ self.decayDurSlider = gtk.HScale(adjustment = self.decayDurSliderAdj)
+ self.decayDurSlider.set_size_request(200,-1)
+ self.decayDurSlider.set_value_pos(gtk.POS_RIGHT)
+ self.decayDurSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.decayDurCheckButton = gtk.CheckButton()
+ self.decayDurCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['decay'] = self.decayDurCheckButton
+ self.decayDurBox.pack_start(self.decayDurLabel, False, False, padding = 5)
+ self.decayDurBox.pack_end(self.decayDurCheckButton, False, False, padding = 5)
+ self.decayDurBox.pack_end(self.decayDurSlider, False, False, padding = 5)
+
+ self.filterTypeBox = gtk.HBox()
+ self.filterTypeLabel = gtk.Label(_('Filter Type: '))
+ self.filterTypeComboBox = BigComboBox()
+ for filtertype in self.filterTypes:
+ self.filterTypeComboBox.append_item(self.filterTypes.index(filtertype), filtertype, Config.TAM_TAM_ROOT + '/icons/test.svg', (30,30))
+ self.filterTypeComboBox.connect('changed', self.handleFilterTypes)
+ self.filterTypeBox.pack_start(self.filterTypeLabel, False, False, padding = 5)
+ self.filterTypeBox.pack_end(self.filterTypeComboBox, False, False, padding = 55)
+
+ self.filterCutoffBox = gtk.HBox()
+ self.filterCutoffLabel = gtk.Label(_('Filter cutoff: '))
+ self.filterCutoffSliderAdj = gtk.Adjustment(1000, 100, 7000, 100, 100, 0)
+ self.filterCutoffSliderAdj.connect('value-changed', self.handleFilter)
+ self.filterCutoffSlider = gtk.HScale(adjustment = self.filterCutoffSliderAdj)
+ self.filterCutoffSlider.set_size_request(200,-1)
+ self.filterCutoffSlider.set_value_pos(gtk.POS_RIGHT)
+ self.filterCutoffSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.filterCutoffCheckButton = gtk.CheckButton()
+ self.filterCutoffCheckButton.connect('toggled', self.handleGeneCheckButton)
+ self.geneCheckButtonDic['filter'] = self.filterCutoffCheckButton
+ self.filterCutoffBox.pack_start(self.filterCutoffLabel, False, False, padding = 5)
+ self.filterCutoffBox.pack_end(self.filterCutoffCheckButton, False, False, padding = 5)
+ self.filterCutoffBox.pack_end(self.filterCutoffSlider, False, False, padding = 5)
+
+ self.generationMainBox = gtk.VBox()
+ self.generationSeparator = gtk.HSeparator()
+ self.generationLabel = gtk.Label(_('Generation'))
+
+ self.generationTypeBox = gtk.HBox()
+ self.generationTypeLabel = gtk.Label(_('Type: '))
+ self.generationTypeComboBox = BigComboBox()
+ for genetype in self.geneTypes:
+ self.generationTypeComboBox.append_item(self.geneTypes.index(genetype), genetype, Config.TAM_TAM_ROOT + '/icons/test.svg', (30,30))
+ self.generationTypeComboBox.connect('changed', self.handleGeneTypes)
+ self.generationTypeComboBox.set_active(0)
+ self.generationTypeBox.pack_start(self.generationTypeLabel, False, False, padding = 5)
+ self.generationTypeBox.pack_end(self.generationTypeComboBox, False, False, padding = 55)
+
+ self.minimumBox = gtk.HBox()
+ self.minimumLabel = gtk.Label(_('Minimum: '))
+ self.minimumSliderAdj = gtk.Adjustment(0, 0, 100, 1, 1, 0)
+ self.minimumSliderAdj.connect('value-changed', self.handleMinimum)
+ self.minimumSlider = gtk.HScale(adjustment = self.minimumSliderAdj)
+ self.minimumSlider.set_size_request(200,-1)
+ self.minimumSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.minimumSlider.set_value_pos(gtk.POS_RIGHT)
+ self.minimumBox.pack_start(self.minimumLabel, False, False, padding = 5)
+ self.minimumBox.pack_end(self.minimumSlider, False, False, padding = 52)
+
+ self.maximumBox = gtk.HBox()
+ self.maximumLabel = gtk.Label(_('Maximum: '))
+ self.maximumSliderAdj = gtk.Adjustment(100, 0, 100, 1, 1, 0)
+ self.maximumSliderAdj.connect('value-changed', self.handleMaximum)
+ self.maximumSlider = gtk.HScale(adjustment = self.maximumSliderAdj)
+ self.maximumSlider.set_size_request(200,-1)
+ self.maximumSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.maximumSlider.set_value_pos(gtk.POS_RIGHT)
+ self.maximumBox.pack_start(self.maximumLabel, False, False, padding = 5)
+ self.maximumBox.pack_end(self.maximumSlider, False, False, padding = 52)
+
+ self.randomBox = gtk.HBox()
+ self.randomLabel = gtk.Label(_('Random: '))
+ self.randomSliderAdj = gtk.Adjustment(20, 0, 100, 1, 1, 0)
+ self.randomSliderAdj.connect('value-changed', self.handleRandom)
+ self.randomSlider = gtk.HScale(adjustment = self.randomSliderAdj)
+ self.randomSlider.set_size_request(200,-1)
+ self.randomSlider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
+ self.randomSlider.set_value_pos(gtk.POS_RIGHT)
+ self.randomBox.pack_start(self.randomLabel, False, False, padding = 5)
+ self.randomBox.pack_end(self.randomSlider, False, False, padding = 52)
+
+ self.decisionBox = gtk.HBox()
+ self.acceptButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/accept.svg')
+ self.acceptButton.connect('clicked', self.acceptGeneration)
+ self.cancelButton = ImageButton(Config.TAM_TAM_ROOT + '/icons/cancel.svg')
+ self.cancelButton.connect('clicked', self.resetGeneCheckButton)
+ self.decisionBox.pack_start(self.cancelButton, False, False, padding = 5)
+ self.decisionBox.pack_start(self.acceptButton, False, False, padding = 5)
+
+ self.mainBox.pack_start(self.gridDivisionBox, padding = 3)
+ self.mainBox.pack_start(self.pageColorBox, padding = 3)
+ self.mainBox.pack_start(self.pageSeparator, padding = 10)
+ self.mainBox.pack_start(self.transposeBox, padding = 3)
+ self.mainBox.pack_start(self.volumeBox, padding = 3)
+ self.mainBox.pack_start(self.panBox, padding = 3)
+ self.mainBox.pack_start(self.reverbBox, padding = 3)
+ self.mainBox.pack_start(self.attackDurBox, padding = 3)
+ self.mainBox.pack_start(self.decayDurBox, padding = 3)
+ self.mainBox.pack_start(self.filterTypeBox, padding = 3)
+ self.mainBox.pack_start(self.filterCutoffBox, padding = 3)
+ self.generationMainBox.pack_start(self.generationSeparator, padding = 5)
+ self.generationMainBox.pack_start(self.generationLabel, padding = 10)
+ self.generationMainBox.pack_start(self.generationTypeBox, padding = 3)
+ self.generationMainBox.pack_start(self.minimumBox, padding = 3)
+ self.generationMainBox.pack_start(self.maximumBox, padding = 3)
+ self.generationMainBox.pack_start(self.randomBox, padding = 3)
+ self.generationMainBox.pack_start(self.decisionBox, padding = 3)
+ self.mainBox.pack_start(self.generationMainBox, padding = 3)
+ self.mainBox.show_all()
+
+ self.generationMainBox.hide()
+
+ self.set_content(self.mainBox)
+
+ def handlePopup(self, widget, data = None):
+ if self.edit.getContext() == 0: #Page
+ self.setContext('page', self.edit._generateToolbar._generationPalette.scale, self.edit.tuneInterface.getSelectedIds())
+ elif self.edit.getContext() == 1: #Track
+ self.setContext('track', self.edit._generateToolbar._generationPalette.scale, self.edit.tuneInterface.getSelectedIds(), [ i for i in range(Config.NUMBER_OF_TRACKS) if self.edit.trackSelected[i] ])
+ elif self.edit.getContext() == 2: #Note
+ ids = self.edit.trackInterface.getSelectedNotes()
+ notes = { self.edit.displayedPage: {} }
+ for t in range(Config.NUMBER_OF_TRACKS):
+ if len(ids[t]):
+ notes[self.edit.displayedPage][t] = [ self.edit.noteDB.getNote( self.edit.displayedPage, t, id ) for id in ids[t] ]
+ self.setContext('note', self.edit._generateToolbar._generationPalette.scale, notes = notes)
+
+ def handlePopdown(self, widget, data = None):
+ self.resetGeneCheckButton(self.cancelButton)
+
+ def setContext( self, context, scale, pageIds = None, trackIds = None, notes = {} ):
+ self.context = context
+ self.scale = GenerationConstants.SCALES[scale]
+ self.notes = {}
+ self.pageIds = pageIds
+ self.trackIds = trackIds
+
+ if context == "page":
+ self.trackIds = [0,1,2,3,4]
+ for p in pageIds:
+ self.notes[p] = {}
+ for t in range(Config.NUMBER_OF_TRACKS):
+ self.notes[p][t] = self.edit.noteDB.getNotesByTrack( p, t )
+ page = self.edit.noteDB.getPage(pageIds[0])
+ self.gridDivisionSliderAdj.set_value(page.beats)
+ elif context == "track":
+ for p in pageIds:
+ self.notes[p] = {}
+ for t in trackIds:
+ self.notes[p][t] = self.edit.noteDB.getNotesByTrack( p, t )
+ else:
+ self.notes = notes
+ self.pageIds = self.notes.keys()
+ self.trackIds = self.notes[self.pageIds[0]].keys()
+
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ # initialize values from first note
+ self.setup = True
+ n = self.notes[p][t][0]
+ self.panSliderAdj.set_value( n.cs.pan )
+ self.reverbSliderAdj.set_value( n.cs.reverbSend )
+ self.attackDurSliderAdj.set_value( n.cs.attack )
+ self.decayDurSliderAdj.set_value( n.cs.decay )
+ self.filterTypeComboBox.set_active(n.cs.filterType)
+ self.currentFilterType = n.cs.filterType
+ self.filterCutoffSliderAdj.set_value( n.cs.filterCutoff )
+ self.setup = False
+
+ def acceptGeneration( self, widget ):
+ valList = [self.geneMinimum, self.geneMaximum, self.geneRandom]
+ if self.geneCheckButtonDic['transpose'].get_active(): self.algoPitch(valList, self.algorithm)
+ if self.geneCheckButtonDic['volume'].get_active(): self.algoVolume(valList, self.algorithm)
+ if self.geneCheckButtonDic['pan'].get_active(): self.algoPan(valList, self.algorithm)
+ if self.geneCheckButtonDic['reverb'].get_active(): self.algoReverb(valList, self.algorithm)
+ if self.geneCheckButtonDic['attack'].get_active(): self.algoAttack(valList, self.algorithm)
+ if self.geneCheckButtonDic['decay'].get_active(): self.algoDecay(valList, self.algorithm)
+ if self.geneCheckButtonDic['filter'].get_active(): self.algoCutoff(valList, self.algorithm)
+
+ def resetGeneCheckButton(self, widget):
+ if self.hidden:
+ self.generationMainBox.hide()
+
+ for key in self.geneCheckButtonDic:
+ self.geneCheckButtonDic[key].set_active(False)
+
+ def handleGeneCheckButton(self, widget, data = None):
+ self.hidden = True
+ if widget.get_active():
+ self.generationMainBox.show()
+ else:
+ for key in self.geneCheckButtonDic:
+ if self.geneCheckButtonDic[key].get_active():
+ self.hidden = False
+ if self.hidden:
+ self.generationMainBox.hide()
+
+
+ def handleBeat(self, widget, signal_id):
+ beats = int(widget.get_adjustment().value)
+ stream = []
+ for page in self.pageIds:
+ stream += [ page, beats ]
+ if len(stream):
+ self.edit.noteDB.updatePages( [ PARAMETER.PAGE_BEATS, len(stream)//2 ] + stream )
+
+ def handleColor(self, widget):
+ index = widget.props.value
+ stream = []
+ for page in self.pageIds:
+ stream += [ page, index ]
+ if len(stream):
+ self.edit.noteDB.updatePages( [ PARAMETER.PAGE_COLOR, len(stream)//2 ] + stream )
+
+ def stepPitch(self, widget, step):
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ substream = []
+ if step > 0:
+ if t != Config.NUMBER_OF_TRACKS-1: # regular note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MAXIMUM_PITCH:
+ substream += [ n.id, min( Config.MAXIMUM_PITCH, n.cs.pitch + step ) ]
+ else: # drum note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MAXIMUM_PITCH_DRUM:
+ substream += [ n.id, min( Config.MAXIMUM_PITCH_DRUM, n.cs.pitch + step*Config.PITCH_STEP_DRUM ) ]
+ else:
+ if t != Config.NUMBER_OF_TRACKS-1: # regular note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MINIMUM_PITCH:
+ substream += [ n.id, max( Config.MINIMUM_PITCH, n.cs.pitch + step ) ]
+ else: # drum note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MINIMUM_PITCH_DRUM:
+ substream += [ n.id, max( Config.MINIMUM_PITCH_DRUM, n.cs.pitch + step*Config.PITCH_STEP_DRUM ) ]
+ if len(substream):
+ stream += [ p, t, PARAMETER.PITCH, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def algoPitch( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ scaleLength = len(self.scale)-1
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ if self.trackIds[t] != Config.NUMBER_OF_TRACKS-1:
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, self.scale[int(val*0.01*scaleLength)]+36 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.PITCH, len(substream)//2 ] + substream
+ else:
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ val = int((val*0.12)*2+24)
+ if val in GenerationConstants.DRUMPITCH.keys():
+ val = GenerationConstants.DRUMPITCH[val]
+ substream += [ n.id, val ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.PITCH, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def stepVolume(self, widget, step):
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ substream = []
+ if step > 0:
+ for n in self.notes[p][t]:
+ if n.cs.amplitude != Config.MAXIMUM_AMPLITUDE:
+ substream += [ n.id, min( Config.MAXIMUM_AMPLITUDE, n.cs.amplitude + step ) ]
+ else:
+ for n in self.notes[p][t]:
+ if n.cs.amplitude != Config.MINIMUM_AMPLITUDE:
+ substream += [ n.id, max( Config.MINIMUM_AMPLITUDE, n.cs.amplitude + step ) ]
+ if len(substream):
+ stream += [ p, t, PARAMETER.AMPLITUDE, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+
+ def algoVolume( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, min( Config.MAXIMUM_AMPLITUDE, val*0.01 ) ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.AMPLITUDE, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def handlePan(self, adjust):
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.PAN, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def algoPan( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.01 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.PAN, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def handleReverb(self, adjust):
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.REVERB, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def algoReverb( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.02 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.REVERB, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def handleAttack(self, adjust):
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.ATTACK, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def algoAttack( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.01 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.ATTACK, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def handleDecay(self, adjust):
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.DECAY, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+
+ def algoDecay( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.01 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.DECAY, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def handleFilterTypes(self, widget):
+ self.currentFilterType = widget.props.value
+
+ if not self.currentFilterType:
+ self.filterCutoffSlider.set_sensitive(False)
+ else:
+ self.filterCutoffSlider.set_sensitive(True)
+
+ if not self.setup:
+ if self.currentFilterType:
+ typestream = []
+ cutoffstream = []
+ cutoff = self.filterCutoffSliderAdj.value
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ substream = []
+ typestream += [ p, t, PARAMETER.FILTERTYPE, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ typestream += [ n.id, self.currentFilterType ]
+ if n.cs.filterCutoff != cutoff:
+ substream += [ n.id, cutoff ]
+ if len(substream):
+ cutoffstream += [ p, t, PARAMETER.FILTERCUTOFF, len(substream)//2 ] + substream
+ if len(typestream):
+ self.edit.noteDB.updateNotes( typestream + [-1] )
+ if len(cutoffstream):
+ self.edit.noteDB.updateNotes( cutoffstream + [-1] )
+ else:
+ self.currentFilterType = 0
+ typestream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ typestream += [ p, t, PARAMETER.FILTERTYPE, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ typestream += [ n.id, 0 ]
+ if len(typestream):
+ self.edit.noteDB.updateNotes( typestream + [-1] )
+
+ def handleFilter(self, adjust):
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.FILTERCUTOFF, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def algoCutoff( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*70+100 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.FILTERCUTOFF, len(substream)//2 ] + substream
+ if len(stream):
+ self.edit.noteDB.updateNotes( stream + [-1] )
+
+ def handleGeneTypes(self, widget):
+ self.algorithm = self.algoTypes[widget.props.value]
+
+ def handleMinimum(self, adjust):
+ self.geneMinimum = int(adjust.value)
+
+ def handleMaximum(self, adjust):
+ self.geneMaximum = int(adjust.value)
+
+ def handleRandom(self, adjust):
+ self.geneRandom = int(adjust.value)
diff --git a/TamTamEdit.activity/Edit/HitInterface.py b/TamTamEdit.activity/Edit/HitInterface.py
new file mode 100644
index 0000000..6e77908
--- /dev/null
+++ b/TamTamEdit.activity/Edit/HitInterface.py
@@ -0,0 +1,195 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from Util.NoteDB import PARAMETER
+from Edit.NoteInterface import NoteInterface
+import Config
+
+class HitInterface( NoteInterface ):
+
+ def __init__( self, noteDB, owner, note ):
+ NoteInterface.__init__( self, noteDB, owner, note )
+
+ self.width = self.height = Config.HIT_HEIGHT
+ self.imgWidth = self.imgHeight = Config.HIT_HEIGHT + Config.HIT_IMAGE_PADDING_MUL2
+
+ self.firstTransform = True
+ self.updateTransform()
+
+ def updateTransform( self ):
+ if self.note.page in self.owner.getActivePages():
+ if not self.firstTransform:
+ oldX = self.imgX
+ oldY = self.imgY
+ oldEndX = self.imgX + self.imgWidth
+ dirty = True
+ else:
+ dirty = False
+
+ beats = self.noteDB.getPage( self.note.page ).beats
+ if self.note.cs.onset != self.oldOnset or beats != self.oldBeats:
+ self.x = self.owner.ticksToPixels( beats, self.note.cs.onset )
+ self.x += self.origin[0]
+ self.imgX = self.x - Config.NOTE_IMAGE_PADDING
+ self.oldOnset = self.note.cs.onset
+ self.oldBeats = beats
+ if self.note.cs.pitch != self.oldPitch:
+ self.y = self.owner.pitchToPixelsDrum( self.note.cs.pitch ) + self.origin[1]
+ self.imgY = self.y - Config.NOTE_IMAGE_PADDING
+ self.oldPitch = self.note.cs.pitch
+
+ if dirty:
+ if self.firstTransform:
+ self.owner.invalidate_rect( self.imgX, self.imgY, self.imgWidth, self.imgHeight, self.note.page )
+ self.firstTransform = False
+ else:
+ x = min( self.imgX, oldX )
+ y = min( self.imgY, oldY )
+ endx = max( self.imgX + self.imgWidth, oldEndX )
+ endy = max( self.imgY, oldY ) + self.imgHeight
+ self.owner.invalidate_rect( x, y, endx-x, endy-y, self.note.page )
+
+ self.firstTransform = False
+
+ def updateDragLimits( self, dragLimits, leftBound, rightBound, widthBound, maxRightBound ):
+ left = 0 - self.note.cs.onset
+ right = maxRightBound - self.note.cs.duration - self.note.cs.onset
+ up = Config.MAXIMUM_PITCH_DRUM - self.note.cs.pitch
+ down = Config.MINIMUM_PITCH_DRUM - self.note.cs.pitch
+
+ if dragLimits[0][0] < left: dragLimits[0][0] = left
+ if dragLimits[0][1] > right: dragLimits[0][1] = right
+ if dragLimits[1][0] < down: dragLimits[1][0] = down
+ if dragLimits[1][1] > up: dragLimits[1][1] = up
+
+ # store the current loc as a reference point
+ self.baseOnset = self.note.cs.onset
+ self.basePitch = self.note.cs.pitch
+
+ #=======================================================
+ # Events
+
+ # handleButtonPress returns:
+ # -1, event occurs before us so don't bother checking any later notes
+ # 0, event didn't hit
+ # 1, event was handled
+ def handleButtonPress( self, emitter, event ):
+ eX = event.x - self.x
+ if eX < 0:
+ return -1 # event occurs before us, no point in checking further
+ if eX > self.width:
+ return 0 # no X overlap
+
+ eY = event.y - self.y
+ if eY < 0 or eY > self.height:
+ return 0 # not a hit
+
+ if event.button == 3:
+ print "Show some note parameters!?!"
+ #self.noteParameters = NoteParametersWindow( self.note, self.getNoteParameters )
+ return 1 # handled
+
+ playSample = False
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: # select bar
+ self.potentialDeselect = False
+ start = 0
+ check = self.note.cs.onset - Config.TICKS_PER_BEAT
+ while start <= check: start += Config.TICKS_PER_BEAT
+ stop = start + Config.TICKS_PER_BEAT
+ check += 1
+ while stop < check: stop += Config.TICKS_PER_BEAT
+ emitter.selectNotesByBar( self.note.track, start, stop )
+ elif event.type == gtk.gdk._3BUTTON_PRESS: # select track
+ self.potentialDeselect = False
+ emitter.selectNotesByTrack( self.note.track )
+ else:
+ if self.getSelected(): # we already selected, might want to delected
+ self.potentialDeselect = True
+ else:
+ emitter.selectNotes( { self.note.track: [ self ] } )
+ playSample = True
+
+ percent = eX/self.width
+ if percent < 0.5: emitter.setCurrentAction( "note-drag-onset", self )
+ else:
+ emitter.setCurrentAction( "note-drag-pitch-drum", self )
+ if playSample: self.playSampleNote()
+
+ return 1
+
+ def noteDragPitch( self, dp, stream ):
+ self.potentialDeselect = False
+ if dp != self.lastDragP and not dp%2:
+ self.lastDragP = dp
+ stream += [ self.note.id, self.basePitch + dp ]
+
+ def noteDragDuration( self, dd, stream ):
+ return
+
+ def noteDecOnset( self, step, leftBound, stream ):
+ if self.selected:
+ if leftBound < self.note.cs.onset:
+ onset = max( self.note.cs.onset+step, leftBound )
+ stream += [ self.note.id, onset ]
+ return leftBound
+
+ def noteIncOnset( self, step, rightBound, stream ):
+ if self.selected:
+ if rightBound > self.end:
+ onset = min( self.end+step, rightBound ) - self.note.cs.duration
+ stream += [ self.note.id, onset ]
+ return rightBound
+
+ def noteDecPitch( self, step, stream ):
+ if self.note.cs.pitch > Config.MINIMUM_PITCH_DRUM:
+ stream += [ self.note.id, max( self.note.cs.pitch+2*step, Config.MINIMUM_PITCH_DRUM ) ]
+
+ def noteIncPitch( self, step, stream ):
+ if self.note.cs.pitch < Config.MAXIMUM_PITCH_DRUM:
+ stream += [ self.note.id, min( self.note.cs.pitch+2*step, Config.MAXIMUM_PITCH_DRUM ) ]
+
+ def noteDecDuration( self, step, stream ):
+ return
+
+ def noteIncDuration( self, step, rightBound, stream ):
+ return
+
+ # updateTooltip returns:
+ # -1, event occurs before us so don't bother checking any later notes
+ # 0, event didn't hit
+ # 1, event was handled
+ def updateTooltip( self, emitter, event ):
+ eX = event.x - self.x
+ if eX < 0:
+ return -1 # event occurs before us, no point in checking further
+ if eX > self.width:
+ return 0 # no X overlap
+
+ eY = event.y - self.y
+ if eY < 0 or eY > self.height:
+ return 0 # not a hit
+
+ percent = eX/self.width
+ if percent < 0.5: emitter.setCursor("drag-onset")
+ else: emitter.setCursor("drag-pitch")
+
+ return 1 # we handled it
+
+ #=======================================================
+ # Draw
+
+ def draw( self, win, gc, startX, stopX ):
+ if stopX < self.imgX: return False # we don't need to draw and no one after us will draw
+ if startX > self.imgX + self.imgWidth: return True # we don't need to draw, but maybe a later note does
+
+ gc.foreground = self.color
+ win.draw_rectangle( gc, True, self.x+2, self.y+2, self.width-4, self.height-4 )
+
+ if self.selected: img = self.imageSelected
+ else: img = self.image
+ win.draw_pixbuf( gc, img, 0, 0, self.imgX, self.imgY, self.imgWidth, self.imgHeight, gtk.gdk.RGB_DITHER_NONE )
+
+ return True # we drew something
+
diff --git a/TamTamEdit.activity/Edit/KeyboardInput.py b/TamTamEdit.activity/Edit/KeyboardInput.py
new file mode 100644
index 0000000..d1a0d83
--- /dev/null
+++ b/TamTamEdit.activity/Edit/KeyboardInput.py
@@ -0,0 +1,97 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from Framework import Note
+from Framework.CSound.CSoundConstants import CSoundConstants
+from Framework.Generation.GenerationConstants import GenerationConstants
+from GUI.Core.KeyMapping import KEY_MAP
+
+
+class KeyboardInput:
+ def __init__( self , getCurrentTick , getTrackInstruments , getTrackDictionary , getSelectedTrackIDs , mainWindowUpdateCallback , pagePlayerUpdateCallback , getCurrentPageIDCallback ):
+ self.active = False
+ self.record = False
+ self.monophonic = False
+ self.key_dict = dict()
+
+ self.getCurrentTick = getCurrentTick
+ self.getTrackInstruments = getTrackInstruments
+ self.getTrackDictionary = getTrackDictionary
+ self.getSelectedTrackIDs = getSelectedTrackIDs
+ self.mainWindowUpdateCallback = mainWindowUpdateCallback
+ self.pagePlayerUpdateCallback = pagePlayerUpdateCallback
+ self.getCurrentPageIDCallback = getCurrentPageIDCallback
+
+ def onKeyPress(self,widget,event):
+ if not self.active:
+ return
+ if self.record:
+ self.monophonic = False
+
+ key = event.hardware_keycode
+ # If the key is already in the dictionnary, exit function (to avoir key repeats)
+ if self.key_dict.has_key(key):
+ return
+ # Assign on which track the note will be created according to the number of keys pressed
+ track = len(self.key_dict)+10
+ if self.monophonic:
+ track = 10
+ # If the pressed key is in the keymap
+ if KEY_MAP.has_key(key):
+ # CsoundNote parameters
+ onset = self.getCurrentTick()
+ pitch = KEY_MAP[key]
+ duration = -1
+ instrument = self.getTrackInstruments()[0]
+ # get instrument from top selected track if a track is selected
+ if self.getSelectedTrackIDs():
+ instrument = self.getTrackInstruments()[min(self.getSelectedTrackIDs())]
+
+ if instrument == 'drum1kit':
+ if GenerationConstants.DRUMPITCH.has_key( pitch ):
+ instrument = CSoundConstants.DRUM1INSTRUMENTS[ GenerationConstants.DRUMPITCH[ pitch ] ]
+ else:
+ instrument = CSoundConstants.DRUM1INSTRUMENTS[ pitch ]
+ pitch = 36
+ duration = 100
+
+ if CSoundConstants.INSTRUMENTS[instrument].csoundInstrumentID == 102:
+ duration = 100
+
+ # Create and play the note
+ self.key_dict[key] = Note.note_new(onset = 0,
+ pitch = pitch,
+ amplitude = 1,
+ pan = 0.5,
+ duration = duration,
+ trackID = track,
+ fullDuration = False,
+ instrument = instrument,
+ instrumentFlag = instrument)
+ Note.note_play(self.key_dict[key])
+
+ def onKeyRelease(self,widget,event):
+ if not self.active:
+ return
+ key = event.hardware_keycode
+
+ if KEY_MAP.has_key(key):
+ self.key_dict[key]['duration'] = 0
+ self.key_dict[key]['amplitude'] = 0
+ self.key_dict[key]['dirty'] = True
+ Note.note_play(self.key_dict[key])
+ self.key_dict[key]['duration'] = self.getCurrentTick() - self.key_dict[key]['onset']
+ #print "onset",self.key_dict[key].onset
+ #print "dur",self.key_dict[key].duration
+ if self.record and len( self.getSelectedTrackIDs() ) != 0:
+ self.key_dict[key]['amplitude'] = 1
+ self.getTrackDictionary()[min(self.getSelectedTrackIDs())][self.getCurrentPageIDCallback()].append(self.key_dict[key])
+ self.mainWindowUpdateCallback()
+ self.pagePlayerUpdateCallback()
+ del self.key_dict[key]
+
+
+ def onButtonPress(self,widget,event):
+ pass
+
diff --git a/TamTamEdit.activity/Edit/MainWindow.py b/TamTamEdit.activity/Edit/MainWindow.py
new file mode 100644
index 0000000..58f82f1
--- /dev/null
+++ b/TamTamEdit.activity/Edit/MainWindow.py
@@ -0,0 +1,2091 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import gobject
+
+from Util.ThemeWidgets import *
+from Util.Profiler import TP
+from Util import NoteDB
+from Util.NoteDB import PARAMETER
+from Util import ControlStream
+from Util.CSoundClient import new_csound_client
+from Util.InstrumentPanel import InstrumentPanel
+from Util.InstrumentPanel import DrumPanel
+from Util.CSoundNote import CSoundNote
+from EditToolbars import mainToolbar
+from EditToolbars import generateToolbar
+from gettext import gettext as _
+from subprocess import Popen
+from sugar.graphics.palette import Palette, WidgetInvoker
+import time
+import os
+import commands
+import random
+
+class CONTEXT:
+ PAGE = 0
+ TRACK = 1
+ NOTE = 2
+
+import Config
+from SubActivity import SubActivity
+
+from Generation.GenerationConstants import GenerationConstants
+from Generation.GenerationParametersWindow import GenerationParametersWindow
+from Edit.Properties import Properties
+from Edit.TrackInterface import TrackInterface, TrackInterfaceParasite
+from Edit.TuneInterface import TuneInterface, TuneInterfaceParasite
+
+from Generation.Generator import generator1, GenerationParameters
+
+Tooltips = Config.Tooltips()
+KEY_MAP_PIANO = Config.KEY_MAP_PIANO
+
+#-----------------------------------
+# The main TamTam window
+#-----------------------------------
+class MainWindow( SubActivity ):
+
+ def __init__( self, activity, set_mode ):
+ self.csnd = new_csound_client()
+ self.tooltips = gtk.Tooltips()
+ self.activity = activity
+ for i in [6,7,8,9,10]:
+ self.csnd.setTrackVolume(100, i)
+ self.trackCount = 6
+
+ self.scale = GenerationConstants.DEFAULT_SCALE
+
+ # META ALGO: [section, variation or not, nPages] A B A C
+ # TODO: Different parameters sets for each tracks
+ self.tuneForm = [[0, False, 4], [1, False, 4], [0, True, 4], [2, False, 2]]
+
+ def init_data( ):
+ TP.ProfileBegin("init_data")
+ self._data = {}
+
+ #[ volume, ... ]
+ self._data['track_volume'] = [ Config.DEFAULT_VOLUME ] * Config.NUMBER_OF_TRACKS
+ self._data['track_mute'] = [ 1.0 ] * Config.NUMBER_OF_TRACKS
+
+ #[ instrument index, ... ]
+ self.trackInstrumentDefault = [
+ Config.INSTRUMENTS["kalimba"],
+ Config.INSTRUMENTS["kalimba"],
+ Config.INSTRUMENTS["kalimba"],
+ Config.INSTRUMENTS["kalimba"],
+ Config.INSTRUMENTS["drum2kit"] ]
+ self.trackInstrument = self.trackInstrumentDefault[:]
+ if len(self.trackInstrument) != Config.NUMBER_OF_TRACKS: raise 'error'
+ self.drumIndex = Config.NUMBER_OF_TRACKS - 1
+
+ #second instrument for melodic tracks
+ self.trackInstrument2Default = [ None, None, None, None]
+ self.trackInstrument2 = self.trackInstrument2Default[:]
+
+ self._data['volume'] = Config.DEFAULT_VOLUME
+ self._data['tempo'] = Config.PLAYER_TEMPO
+
+ self.playScope = "Selection"
+ self.displayedPage = -1
+ self.trackSelected = [ 0 for i in range(Config.NUMBER_OF_TRACKS) ]
+ self.trackActive = [ 1 for i in range(Config.NUMBER_OF_TRACKS) ]
+
+ self.pages_playing = []
+ self.journalCalled = True
+
+ self.noteDB = NoteDB.NoteDB()
+ TP.ProfileEnd("init_data")
+
+ def formatRoundBox( box, fillcolor ):
+ box.set_radius( 7 )
+ box.set_border_width( 1 )
+ box.set_fill_color( fillcolor )
+ box.set_border_color( Config.PANEL_BCK_COLOR )
+ return box
+
+ def init_GUI():
+
+ self.GUI = {}
+ self.GUI["2main"] = gtk.VBox()
+
+ def draw_inst_icons():
+ instrumentNames = [ k for k in Config.INSTRUMENTS.keys() if (k[0:4] != 'drum' and k[0:4] != 'guid') or Config.INSTRUMENTS[k].category == "kit" ]
+ self.GUI["2instrumentIcons"] = {}
+ for instrument in instrumentNames:
+ try:
+ self.GUI["2instrumentIcons"][instrument] = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT + instrument + '.png')
+ except:
+ self.GUI["2instrumentIcons"][instrument] = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT + 'generic.png')
+ TP.ProfileBegin("init_GUI::instrument icons")
+ draw_inst_icons()
+ TP.ProfileEnd("init_GUI::instrument icons")
+
+
+ #------------------------------------------------------------------------
+ # page
+ self.GUI["2page"] = gtk.HBox()
+ self.GUI["2main"].pack_start( self.GUI["2page"], False )
+ if 1: # + instrument panel
+ self.GUI["2instrumentPanel"] = gtk.VBox()
+ self.GUI["2instrumentPanel"].set_size_request( 132, -1 )
+ self.GUI["2page"].pack_start( self.GUI["2instrumentPanel"], False )
+ # + + instrument 1 box
+ self.GUI["2instrument1Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
+ self.GUI["2instrument1Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument1volBox"] = gtk.VBox()
+ self.GUI["2instrument1volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][1], 0, 100, 1, 1, 0 )
+ #self.GUI["2instrument1volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 0 )
+ self.GUI["2instrument1volumeSlider"] = gtk.VScale(self.GUI["2instrument1volumeAdjustment"])
+ self.GUI["2instrument1volumeSlider"].set_draw_value(False)
+ self.GUI["2instrument1volumeSlider"].set_inverted(True)
+ self.GUI["2instrument1volumeSlider"].set_size_request( 30, -1 )
+ self.GUI["2instrument1volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 0 )
+ self.GUI["2instrument1muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument1muteButton"].connect("toggled",self.handlemuteButton,0)
+ self.GUI["2instrument1muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,0)
+ self.GUI["2instrument1muteButton"].set_active(True)
+ #self.GUI["2instrument1volBox"].pack_start( self.GUI["2instrument1volumeSlider"], True, True, 0 )
+ #self.GUI["2instrument1volBox"].pack_start( self.GUI["2instrument1muteButton"], False, False, 5 )
+ self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1volBox"], False, False, 0 )
+ self.GUI["2instrument1Button"] = InstrumentButton( self, 0, Config.BG_COLOR )
+ self.GUI["2instrument1Palette"] = instrumentPalette(_('Track 1 Volume'), 0, self)
+ self.GUI["2instrument1Button"].set_palette(self.GUI["2instrument1Palette"])
+ self.GUI["2instrument1Button"].setPrimary( self.GUI["2instrumentIcons"][self.trackInstrument[0].name] )
+ self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1Button"], padding = 3 )
+ self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument1Box"] )
+ # + + instrument 2 box
+ self.GUI["2instrument2Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
+ self.GUI["2instrument2Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument2volBox"] = gtk.VBox()
+ self.GUI["2instrument2volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][1], 0, 100, 1, 1, 0 )
+ #self.GUI["2instrument2volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 1 )
+ self.GUI["2instrument2volumeSlider"] = gtk.VScale(self.GUI["2instrument2volumeAdjustment"])
+ self.GUI["2instrument2volumeSlider"].set_draw_value(False)
+ self.GUI["2instrument2volumeSlider"].set_inverted(True)
+ self.GUI["2instrument2volumeSlider"].set_size_request( 30, -1 )
+ self.GUI["2instrument2volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 1 )
+ self.GUI["2instrument2muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument2muteButton"].connect("toggled",self.handlemuteButton,1)
+ self.GUI["2instrument2muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,1)
+ self.GUI["2instrument2muteButton"].set_active(True)
+ #self.GUI["2instrument2volBox"].pack_start( self.GUI["2instrument2volumeSlider"], True, True, 0 )
+ #self.GUI["2instrument2volBox"].pack_start( self.GUI["2instrument2muteButton"], False, False, 5 )
+ self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2volBox"], False, False, 0 )
+ self.GUI["2instrument2Button"] = InstrumentButton( self, 1, Config.BG_COLOR )
+ self.GUI["2instrument2Palette"] = instrumentPalette(_('Track 2 Volume'), 1, self)
+ self.GUI["2instrument2Button"].set_palette(self.GUI["2instrument2Palette"])
+ self.GUI["2instrument2Button"].setPrimary( self.GUI["2instrumentIcons"][self.trackInstrument[1].name] )
+ self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2Button"], padding = 3 )
+ self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument2Box"] )
+ # + + instrument 3 box
+ self.GUI["2instrument3Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
+ self.GUI["2instrument3Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument3volBox"] = gtk.VBox()
+ self.GUI["2instrument3volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][2], 0, 100, 1, 1, 0 )
+ #self.GUI["2instrument3volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 2 )
+ self.GUI["2instrument3volumeSlider"] = gtk.VScale(self.GUI["2instrument3volumeAdjustment"])
+ self.GUI["2instrument3volumeSlider"].set_draw_value(False)
+ self.GUI["2instrument3volumeSlider"].set_inverted(True)
+ self.GUI["2instrument3volumeSlider"].set_size_request( 30, -1 )
+ self.GUI["2instrument3volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 2 )
+ self.GUI["2instrument3muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument3muteButton"].connect("toggled",self.handlemuteButton,2)
+ self.GUI["2instrument3muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,2)
+ self.GUI["2instrument3muteButton"].set_active(True)
+ #self.GUI["2instrument3volBox"].pack_start( self.GUI["2instrument3volumeSlider"], True, True, 0 )
+ #self.GUI["2instrument3volBox"].pack_start( self.GUI["2instrument3muteButton"], False, False, 5 )
+ self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3volBox"], False, False, 0 )
+ self.GUI["2instrument3Button"] = InstrumentButton( self, 2, Config.BG_COLOR )
+ self.GUI["2instrument3Palette"] = instrumentPalette(_('Track 3 Volume'), 2, self)
+ self.GUI["2instrument3Button"].set_palette(self.GUI["2instrument3Palette"])
+ self.GUI["2instrument3Button"].setPrimary( self.GUI["2instrumentIcons"][self.trackInstrument[2].name] )
+ self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3Button"], padding = 3 )
+ self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument3Box"] )
+ # + + instrument 4 box
+ self.GUI["2instrument4Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
+ self.GUI["2instrument4Box"].set_size_request( -1, 132 )
+ self.GUI["2instrument4volBox"] = gtk.VBox()
+ self.GUI["2instrument4volumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][3], 0, 100, 1, 1, 0 )
+ #self.GUI["2instrument4volumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 3 )
+ self.GUI["2instrument4volumeSlider"] = gtk.VScale(self.GUI["2instrument4volumeAdjustment"])
+ self.GUI["2instrument4volumeSlider"].set_draw_value(False)
+ self.GUI["2instrument4volumeSlider"].set_inverted(True)
+ self.GUI["2instrument4volumeSlider"].set_size_request( 30, -1 )
+ self.GUI["2instrument4volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 3 )
+ self.GUI["2instrument4muteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2instrument4muteButton"].connect("toggled",self.handlemuteButton,3)
+ self.GUI["2instrument4muteButton"].connect("button-press-event",self.handlemuteButtonRightClick,3)
+ self.GUI["2instrument4muteButton"].set_active(True)
+ #self.GUI["2instrument4volBox"].pack_start( self.GUI["2instrument4volumeSlider"], True, True, 0 )
+ #self.GUI["2instrument4volBox"].pack_start( self.GUI["2instrument4muteButton"], False, False, 5 )
+ self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4volBox"], False, False, 0 )
+ self.GUI["2instrument4Button"] = InstrumentButton( self, 3, Config.BG_COLOR )
+ self.GUI["2instrument4Palette"] = instrumentPalette(_('Track 4 Volume'), 3, self)
+ self.GUI["2instrument4Button"].set_palette(self.GUI["2instrument4Palette"])
+ self.GUI["2instrument4Button"].setPrimary( self.GUI["2instrumentIcons"][self.trackInstrument[3].name] )
+ self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4Button"], padding = 3 )
+ self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument4Box"] )
+ # + + drum box
+ self.GUI["2drumBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
+ self.GUI["2drumBox"].set_size_request( -1, 165 )
+ self.GUI["2drumVolBox"] = gtk.VBox()
+ self.GUI["2drumvolumeAdjustment"] = gtk.Adjustment( self._data["track_volume"][4], 0, 100, 1, 1, 0 )
+ #self.GUI["2drumvolumeAdjustment"].connect( "value_changed", self.onTrackVolumeChanged, 4 )
+ self.GUI["2drumvolumeSlider"] = gtk.VScale(self.GUI["2drumvolumeAdjustment"])
+ self.GUI["2drumvolumeSlider"].set_draw_value(False)
+ self.GUI["2drumvolumeSlider"].set_inverted(True)
+ self.GUI["2drumvolumeSlider"].set_size_request( 30, -1 )
+ self.GUI["2drumvolumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 4 )
+ self.GUI["2drumMuteButton"] = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ self.GUI["2drumMuteButton"].connect("toggled",self.handlemuteButton,4)
+ self.GUI["2drumMuteButton"].connect("button-press-event",self.handlemuteButtonRightClick,4)
+ self.GUI["2drumMuteButton"].set_active(True)
+ #self.GUI["2drumVolBox"].pack_start( self.GUI["2drumvolumeSlider"], True, True, 0 )
+ #self.GUI["2drumVolBox"].pack_start( self.GUI["2drumMuteButton"], False, False, 5 )
+ self.GUI["2drumBox"].pack_start( self.GUI["2drumVolBox"], False, False, 0 )
+ self.GUI["2drumButton"] = ImageToggleButton(Config.IMAGE_ROOT + self.trackInstrument[4].name + '.png', Config.IMAGE_ROOT + self.trackInstrument[4].name + '.png')
+ self.GUI["2drumPalette"] = instrumentPalette(_('Track 5 Volume'), 4, self)
+ self.GUI["2drumButton"].set_palette(self.GUI["2drumPalette"])
+ self.GUI["2drumButton"].connect("toggled", self.pickDrum)
+ self.GUI["2drumButton"].connect('enter-notify-event', self.blockFocus)
+ self.GUI["2drumButton"].connect('leave-notify-event', self.unblockFocus)
+ self.GUI["2drumBox"].pack_start( self.GUI["2drumButton"] )
+ self.GUI["2instrumentPanel"].pack_start( self.GUI["2drumBox"] )
+ self.GUI["2page"].pack_start( self.GUI["2instrumentPanel"], False )
+ # + track interface
+ self.trackInterface = TrackInterface( self.noteDB, self, self.getScale )
+ self.noteDB.addListener( self.trackInterface, TrackInterfaceParasite, True )
+ self.trackInterface.set_size_request( 1068, 693 )
+ self.GUI["2page"].pack_start( self.trackInterface, False, False )
+
+ #------------------------------------------------------------------------
+ # tune interface
+ if 1: # + tune interface
+ self.GUI["2tuneHBox"] = RoundHBox( fillcolor = Config.TOOLBAR_BCK_COLOR, bordercolor = Config.TOOLBAR_BCK_COLOR, radius = 0 )
+ self.GUI["2tuneScrollLeftButton"] = ImageButton( Config.IMAGE_ROOT+"arrowEditLeft.png", Config.IMAGE_ROOT+"arrowEditLeftDown.png", Config.IMAGE_ROOT+"arrowEditLeftOver.png", backgroundFill = Config.TOOLBAR_BCK_COLOR )
+ self.GUI["2tuneScrollLeftButton"].set_size_request( 25, -1 )
+ self.GUI["2tuneScrollLeftButton"].connect( "clicked", lambda a1:self.scrollTune( -1 ) )
+ self.GUI["2tuneHBox"].pack_start( self.GUI["2tuneScrollLeftButton"], False, False )
+ self.GUI["2tuneVBox"] = gtk.VBox()
+ self.GUI["2tuneScrolledWindow"] = gtk.ScrolledWindow()
+ self.GUI["2tuneScrolledWindow"].set_policy( gtk.POLICY_NEVER, gtk.POLICY_NEVER )
+ self.tuneInterface = TuneInterface( self.noteDB, self, self.GUI["2tuneScrolledWindow"].get_hadjustment() )
+ self.noteDB.addListener( self.tuneInterface, TuneInterfaceParasite, True )
+ self.GUI["2tuneScrolledWindow"].add_with_viewport( self.tuneInterface )
+ self.tuneInterface.get_parent().set_shadow_type( gtk.SHADOW_NONE )
+ self.GUI["2tuneVBox"].pack_start( self.GUI["2tuneScrolledWindow"] )
+ self.GUI["2tuneSlider"] = gtk.HScrollbar( self.GUI["2tuneScrolledWindow"].get_hadjustment() ) #ImageHScale( Config.IMAGE_ROOT+"sliderEditTempo.png", self.GUI["2tuneScrolledWindow"].get_hadjustment(), 6 )
+ self.GUI["2tuneVBox"].pack_start( self.GUI["2tuneSlider"], False, False )
+ self.GUI["2tuneHBox"].pack_start( self.GUI["2tuneVBox"] )
+ self.GUI["2tuneScrollRightButton"] = ImageButton( Config.IMAGE_ROOT+"arrowEditRight.png", Config.IMAGE_ROOT+"arrowEditRightDown.png", Config.IMAGE_ROOT+"arrowEditRightOver.png", backgroundFill = Config.TOOLBAR_BCK_COLOR )
+ self.GUI["2tuneScrollRightButton"].set_size_request( 25, -1 )
+ self.GUI["2tuneScrollRightButton"].connect( "clicked", lambda a1:self.scrollTune( 1 ) )
+ self.GUI["2tuneHBox"].pack_start( self.GUI["2tuneScrollRightButton"], False, False )
+ self.GUI["2main"].pack_start( self.GUI["2tuneHBox"] )
+
+ # set tooltips
+ for key in self.GUI:
+ if Tooltips.Edit.has_key(key):
+ self.tooltips.set_tip(self.GUI[key],Tooltips.Edit[key])
+
+ self.add( self.GUI["2main"] )
+
+ self.skipCleanup = "" # used when jumping between duplicate note/track
+
+
+ # Popups
+ TP.ProfileBegin("init_GUI::popups")
+ # + instrument panel
+ self.GUI["9instrumentPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9instrumentPopup"].move( 400, 100 )
+ self.GUI["9instrumentPopup"].resize( 800, 452 )
+ self.GUI["9instrumentPopup"].set_modal(True)
+ self.GUI["9instrumentPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9instrumentPopup"].connect("button-release-event", lambda w,e:self.cancelInstrumentSelection() )
+ # + drum panel
+ TP.ProfileBegin("init_GUI::drumPanel")
+ self.drumPanel = DrumPanel( self.donePickDrum )
+ TP.ProfileEnd("init_GUI::drumPanel")
+ self.GUI["9drumPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9drumPopup"].move( 400, 100 )
+ self.GUI["9drumPopup"].resize( 400, 100 )
+ self.GUI["9drumPopup"].set_modal(True)
+ self.GUI["9drumPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9drumPopup"].connect("button-release-event", lambda w,e:self.cancelDrumSelection() )
+ self.GUI["9drumPopup"].add( self.drumPanel )
+ # + generation window
+ #TP.ProfileBegin("init_GUI::generationPanel")
+ #self.generationPanel = GenerationParametersWindow( self.generate, self.doneGenerationPopup )
+ #TP.ProfileEnd("init_GUI::generationPanel")
+ #self.GUI["9generationPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ #self.GUI["9generationPopup"].set_modal(True)
+ #self.GUI["9generationPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ #self.GUI["9generationPopup"].connect("button-release-event", lambda w,e:self.doneGenerationPopup() )
+ #self.GUI["9generationPopup"].add( self.generationPanel )
+ # + properties window
+ #self.GUI["9propertiesPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ #self.GUI["9propertiesPopup"].set_modal(True)
+ #self.GUI["9propertiesPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ #self.GUI["9propertiesPopup"].connect("button-release-event", lambda w,e:self.donePropertiesPopup() )
+ #TP.ProfileBegin("init_GUI::propertiesPanel")
+ #self.propertiesPanel = Properties( self.noteDB, self.donePropertiesPopup, self.GUI["9propertiesPopup"] )
+ #TP.ProfileEnd("init_GUI::propertiesPanel")
+ #self.GUI["9propertiesPopup"].add( self.propertiesPanel )
+ # + playback scope
+ self.GUI["9loopPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9loopPopup"].move( 100, 100 )
+ self.GUI["9loopPopup"].resize( 300, 100 )
+ self.GUI["9loopPopup"].set_modal(True)
+ self.GUI["9loopPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9loopPopup"].connect("button-release-event", lambda w,e:self.GUI["2loopButton"].set_active(False) )
+ self.GUI["9loopBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
+ self.GUI["9loopAllOnce"] = gtk.Button("AO")
+ self.GUI["9loopBox"].pack_start( self.GUI["9loopAllOnce"] )
+ self.GUI["9loopAllRepeat"] = gtk.Button("AR")
+ self.GUI["9loopBox"].pack_start( self.GUI["9loopAllRepeat"] )
+ self.GUI["9loopSelectedOnce"] = gtk.Button("SO")
+ self.GUI["9loopBox"].pack_start( self.GUI["9loopSelectedOnce"] )
+ self.GUI["9loopSelectedRepeat"] = gtk.Button("SR")
+ self.GUI["9loopBox"].pack_start( self.GUI["9loopSelectedRepeat"] )
+ self.GUI["9loopPopup"].add(self.GUI["9loopBox"])
+ TP.ProfileEnd("init_GUI::popups")
+
+ #===================================================
+ # begin initialization
+ SubActivity.__init__( self, set_mode )
+
+ # keyboard variables
+ self.kb_record = False
+ self.kb_keydict = {}
+
+ # playback params
+ self.playing = False
+ self.playSource = 'Page'
+ self.currentpageId = 0
+ self.playingTuneIdx = 0
+
+ # timers
+ self.playbackTimeout = False
+
+ # FPS stuff
+ self.fpsTotalTime = 0
+ self.fpsFrameCount = 0
+ self.fpsN = 100 # how many frames to average FPS over
+ self.fpsLastTime = time.time() # fps will be borked for the first few frames but who cares?
+
+ self.context = -1 # invalidate
+ self.contextTrackActive = False
+ self.contextNoteActive = False
+
+ init_data() #above
+ init_GUI() #above
+
+ # register for notification AFTER track and tune interfaces
+ self.noteDB.addListener( self, page=True, note=True )
+
+ self.csnd.setMasterVolume( self.getVolume() )
+ self.initTrackVolume()
+
+ for tid in range(Config.NUMBER_OF_TRACKS):
+ self.handleInstrumentChanged( ( tid, self.trackInstrument[tid] ) )
+
+ instrumentsIds = []
+ for inst in self.trackInstrument:
+ instrumentsIds.append(inst.instrumentId)
+
+ first = self.noteDB.addPage( -1, NoteDB.Page(4, instruments = instrumentsIds) )
+ self.displayPage( first )
+
+ self.createNewTune( None )
+
+ # Toolbar
+ self.activity.activity_toolbar.keep.show()
+ self._mainToolbar = mainToolbar(self.activity.toolbox, self)
+ self._generateToolbar = generateToolbar(self.activity.toolbox, self)
+ self.activity.toolbox.add_toolbar(_('Compose'), self._mainToolbar)
+ self.activity.toolbox.add_toolbar(_('Generate'), self._generateToolbar)
+ self.activity.toolbox.set_current_toolbar(1)
+ self._mainToolbar.show()
+ self._generateToolbar.show()
+
+ self.show_all() #gtk command
+
+ self.setContext( CONTEXT.PAGE )
+
+ self.audioRecordState = False
+
+ def createNewTune( self, widget, data=None ):
+ self.createNewTune3()
+
+ def createNewTune3( self ):
+
+ if self.playing == True:
+ self.handleStop()
+
+ self.tuneInterface.selectPages( self.noteDB.getTune() )
+
+ beats = random.randint(3,8)
+ stream = []
+ for page in self.noteDB.getTune():
+ stream += [ page, beats ]
+ if len(stream):
+ self.noteDB.updatePages( [ PARAMETER.PAGE_BEATS, len(stream)//2 ] + stream )
+
+ orch = self.newOrchestra()
+
+ instrumentsIds = []
+ for inst in orch:
+ instrumentsIds.append(inst.instrumentId)
+
+ self.pageDelete( -1, instruments = instrumentsIds )
+
+ initTempo = random.randint(60, 132)
+ self._data['tempo'] = initTempo
+
+ formsUsed = []
+ for section in self.tuneForm:
+ if section[0] not in formsUsed:
+ param = self.chooseGenParams()
+ self.tuneInterface.selectPages( self.noteDB.getTune() )
+ if not formsUsed:
+ for i in range(section[2]-1):
+ self.pageAdd(instruments = instrumentsIds)
+ else:
+ for i in range(section[2]):
+ self.pageAdd(instruments = instrumentsIds)
+ formsUsed.append(section[0])
+
+ self.tuneInterface.selectPages( self.noteDB.getTune()[-section[2]:] )
+ self.generateMode = 'page'
+ self.generate( GenerationParameters( density = param[0], rythmRegularity = param[1], step = param[2], pitchRegularity = param[3], articule = param[4], silence = param[5], pattern = param[6], scale = param[7]), section[2] )
+ else:
+ pageOffset = 0
+ pageIds = []
+ firstPos = [i[0] for i in self.tuneForm].index(section[0])
+ if firstPos == 0:
+ pageOffset = 0
+ else:
+ for i in range(firstPos):
+ pageOffset += self.tuneForm[i][2]
+ for i in range(section[2]):
+ pageIds.append(self.noteDB.getTune()[pageOffset + i])
+ after = self.noteDB.getTune()[-1]
+ self.displayPage( self.noteDB.getTune()[pageOffset] )
+ self.tuneInterface.selectPages(self.noteDB.getTune())
+ self.pageDuplicate(-1, pageIds)
+
+ self.tuneInterface.selectPages( self.noteDB.getTune() )
+ self.displayPage( self.noteDB.getTune()[0] )
+
+
+ def newOrchestra(self):
+ stringsPickup = []
+ windsPickup = []
+ keyboardPickup = []
+ fxPickup = []
+ drumsPickup = ["drum1kit", "drum2kit", "drum3kit", "drum4kit", "drum5kit"]
+ for name in Config.INSTRUMENTS.keys():
+ if Config.INSTRUMENTS[name].category == 'strings' and Config.INSTRUMENTS[name].name != 'violin':
+ stringsPickup.append(name)
+ elif Config.INSTRUMENTS[name].category == 'winds' and Config.INSTRUMENTS[name].name != 'didjeridu':
+ windsPickup.append(name)
+ elif Config.INSTRUMENTS[name].category == 'keyboard' or Config.INSTRUMENTS[name].category == 'percussions':
+ if Config.INSTRUMENTS[name].name != 'zap' and Config.INSTRUMENTS[name].name != 'cling':
+ keyboardPickup.append(name)
+ return [
+ Config.INSTRUMENTS[random.choice(stringsPickup)],
+ Config.INSTRUMENTS[random.choice(stringsPickup)],
+ Config.INSTRUMENTS[random.choice(windsPickup)],
+ Config.INSTRUMENTS[random.choice(keyboardPickup)],
+ Config.INSTRUMENTS[random.choice(drumsPickup)] ]
+
+ def chooseGenParams(self):
+ choose = random.randint(0,4)
+ density = GenerationConstants.RYTHM_DENSITY_BANK[choose]
+ rytReg = GenerationConstants.RYTHM_REGU_BANK[choose]
+ step = GenerationConstants.PITCH_STEP_BANK[choose]
+ pitReg = GenerationConstants.PITCH_REGU_BANK[choose]
+ dur = GenerationConstants.DURATION_BANK[choose]
+ silence = GenerationConstants.SILENCE_BANK[choose]
+ pattern = [random.choice([0,1,1,2,3,3]) for x in range(4)]
+ scale = random.randint(0,6)
+ return [density, rytReg, step, pitReg, dur, silence, pattern, scale]
+
+ def onActivate( self, arg ):
+ SubActivity.onActivate( self,arg )
+ # whatever needs to be done on initialization
+ self.csnd.loopPause()
+ self.csnd.loopClear()
+ for n in self.noteDB.getNotes( ):
+ self.csnd.loopPlay(n, 0) #adds all notes to c client in inactive state
+
+
+ def onDeactivate( self ):
+ SubActivity.onDeactivate( self )
+ # clean up things like popups etc
+ self.releaseInstrumentPanel()
+ self.csnd.loopPause()
+ self.csnd.loopClear()
+
+ def setInstrumentPanel( self, instrumentPanel ):
+ instrumentPanel.configure( self.donePickInstrument, self.playInstrumentNote, enterMode = True )
+ self.instrumentPanel = instrumentPanel
+ self.GUI["9instrumentPopup"].add( self.instrumentPanel )
+
+ def releaseInstrumentPanel( self ):
+ self.GUI["9instrumentPopup"].remove( self.instrumentPanel )
+
+
+ def updateFPS( self ):
+ t = time.time()
+ dt = t - self.fpsLastTime
+ self.fpsLastTime = t
+ self.fpsTotalTime += dt
+ self.fpsFrameCount += 1
+ if self.fpsFrameCount == self.fpsN:
+ fps = self.fpsN/self.fpsTotalTime
+ avgMS = 1000/fps
+ fps = "FPS %d ms %.2f" % (fps, avgMS)
+ #self.fpsText.set_text(fps )
+ if (Config.DEBUG > 2): print fps
+ self.fpsTotalTime = 0
+ self.fpsFrameCount = 0
+
+ #=========================================================
+ # Popup Windows
+
+ def doneGenerationPopup( self ):
+ if self.GUI["2pageGenerateButton"].get_active():
+ self.GUI["2pageGenerateButton"].set_active( False )
+ if self.GUI["2trackGenerateButton"].get_active():
+ self.GUI["2trackGenerateButton"].set_active( False )
+
+ def donePropertiesPopup( self ):
+ if self.GUI["2pagePropertiesButton"].get_active():
+ self.GUI["2pagePropertiesButton"].set_active( False )
+ if self.GUI["2trackPropertiesButton"].get_active():
+ self.GUI["2trackPropertiesButton"].set_active( False )
+ if self.GUI["2notePropertiesButton"].get_active():
+ self.GUI["2notePropertiesButton"].set_active( False )
+
+ def cancelPopup( self, w, event, popup ):
+ popup.hide()
+
+
+ def handleLoopButton( self, w ):
+ if w.get_active(): self.GUI["9loopPopup"].show_all()
+ else: self.GUI["9loopPopup"].hide()
+
+ #-----------------------------------
+ # playback functions
+ #-----------------------------------
+
+ def updatePageSelection( self, selectedIds ):
+ if not self.playing:
+ return
+
+ if self.playScope == "All":
+ return
+
+ if self.displayedPage in selectedIds:
+ startPage = self.displayedPage
+ else:
+ startPage = selectedIds[0]
+
+ self._playPages( selectedIds, startPage, self.trackInterface.getPlayhead() )
+
+ def updatePagesPlaying( self ):
+ if not self.playing:
+ return
+
+ curTick = self.csnd.loopGetTick()
+
+ pageTick = self.page_onset[self.displayedPage]
+ if curTick < pageTick:
+ pageTick = 0
+ ind = 0
+ else:
+ ind = self.pages_playing.index(self.displayedPage)
+
+ localTick = curTick - pageTick
+
+ self._playPages( self.tuneInterface.getSelectedIds(), ind, localTick )
+
+ def handleAudioRecord( self, widget, data=None ):
+ if widget.get_active() == True:
+ chooser = gtk.FileChooserDialog(
+ title='Save tune as Audio file',
+ action=gtk.FILE_CHOOSER_ACTION_SAVE,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
+ filter = gtk.FileFilter()
+ filter.add_pattern('*.ogg')
+ chooser.set_filter(filter)
+ chooser.set_current_folder(Config.TUNE_DIR)
+
+ for f in chooser.list_shortcut_folder_uris():
+ chooser.remove_shortcut_folder_uri(f)
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ if self.playing:
+ self.handleStop()
+ else:
+ self.handleRewind()
+
+ self.audioRecordState = True
+ self.audioFileName = chooser.get_filename()
+ if self.audioFileName[-4:] != '.ogg':
+ self.audioFileName += '.ogg'
+
+ self.audioRecordTimeout = gobject.timeout_add( 500, self._startAudioRecord )
+ self.audioRecordTick = -1
+ chooser.destroy()
+ else:
+ self.audioRecordState = False
+
+ def _startAudioRecord( self ):
+ if not self.playing:
+ self.handlePlay()
+ return False
+
+ def handlePlay( self, widget = None ):
+
+ if widget:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+
+ if self.audioRecordState:
+ self.csnd.inputMessage( "i5400 0 -1" )
+ time.sleep( 0.01 )
+
+ if self.playScope == "All":
+ toPlay = self.noteDB.getTune()
+ else:
+ toPlay = self.tuneInterface.getSelectedIds()
+
+ self._playPages( toPlay, self.displayedPage, self.trackInterface.getPlayhead() )
+
+ self.playing = True
+
+ def _playPages( self, pages, startPage, startTick ):
+
+ self.pages_playing = pages[:]
+
+ trackset = set( [ i for i in range(Config.NUMBER_OF_TRACKS) if self.trackActive[i] ] )
+
+ numticks = 0
+ self.page_onset = {}
+ for pid in self.pages_playing:
+ self.page_onset[pid] = numticks
+ numticks += self.noteDB.getPage(pid).ticks
+
+ # check for a second instrument on melodic tracks
+ stream = []
+ for page in self.pages_playing:
+ for track in trackset:
+ if track != self.drumIndex:
+ if self.trackInstrument2[track] != None:
+ if len(self.noteDB.getNotesByTrack(page, track)):
+ stream += [ page, track, NoteDB.PARAMETER.INSTRUMENT2, len(self.noteDB.getNotesByTrack(page, track)) ]
+ for n in self.noteDB.getNotesByTrack(page, track):
+ stream += [ n.id, self.trackInstrument2[track].instrumentId ]
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ self.csnd.loopClear()
+ for page in self.pages_playing:
+ for track in trackset:
+ for n in self.noteDB.getNotesByTrack( page, track ):
+ self.csnd.loopPlay(n, 1)
+ self.csnd.loopUpdate(n, NoteDB.PARAMETER.ONSET, n.cs.onset + self.page_onset[n.page] , 1)
+
+ self.csnd.loopSetNumTicks( numticks )
+
+ self.csnd.loopSetTick( self.page_onset[startPage] + startTick )
+ self.csnd.setTempo(self._data['tempo'])
+ if (Config.DEBUG > 3): print "starting from tick", startTick, 'at tempo', self._data['tempo']
+ self.csnd.loopStart()
+
+ if not self.playbackTimeout:
+ self.playbackTimeout = gobject.timeout_add( 50, self.onTimeout )
+
+
+
+ def handleStop( self, widget = None, rewind = True ):
+
+ if widget:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+
+ if self.audioRecordState:
+ self.csnd.inputMessage( "i5401 4 1" )
+ time.sleep( 0.01 )
+
+ if self.playbackTimeout:
+ gobject.source_remove( self.playbackTimeout )
+ self.playbackTimeout = False
+
+ self.csnd.loopPause()
+ self.csnd.loopDeactivate()
+
+ if self.audioRecordState:
+ time.sleep(4)
+ self.csnd.__del__()
+ time.sleep(0.5)
+ self.audioRecordState = False
+ command = "gst-launch-0.10 filesrc location=" + Config.PREF_DIR + "/perf.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=" + self.audioFileName
+ command2 = "rm /home/olpc/.sugar/default/tamtam/perf.wav"
+ (status, output) = commands.getstatusoutput(command)
+ (status2, output2) = commands.getstatusoutput(command2)
+ self.csnd.__init__()
+ time.sleep(0.1)
+ self.csnd.connect(True)
+ time.sleep(0.1)
+ self.waitToSet()
+ self.csnd.load_instruments()
+ self.GUI["2recordButton"].set_active(False)
+ self.playing = False
+
+ if rewind: self.handleRewind()
+
+ def handleRewind( self, widget = None ):
+ if self.playScope == "All": id = self.noteDB.getPageByIndex(0)
+ else: id = self.tuneInterface.getFirstSelected()
+ self.trackInterface.setPlayhead( 0 )
+ self.displayPage( id )
+
+ def handleClose(self,widget):
+ self.activity.close()
+
+ def onTimeout(self):
+ self.updateFPS()
+
+ curTick = self.csnd.loopGetTick()
+
+ pageTick = self.page_onset[self.displayedPage]
+ if curTick < pageTick:
+ pageTick = 0
+ ind = 0
+ else:
+ ind = self.pages_playing.index(self.displayedPage)
+
+ localTick = curTick - pageTick
+ pageLength = self.noteDB.getPage(self.pages_playing[ind]).ticks
+ max = len(self.pages_playing)
+ while localTick > pageLength:
+ ind += 1
+ if ind == max: ind = 0
+ localTick -= pageLength
+ pageLength = self.noteDB.getPage(self.pages_playing[ind]).ticks
+
+ self.trackInterface.setPlayhead( localTick )
+
+ if self.pages_playing[ind] != self.displayedPage:
+ if ind + 1 < max: predraw = self.pages_playing[ind+1]
+ else: predraw = self.pages_playing[0]
+ self._displayPage( self.pages_playing[ind], predraw )
+ else:
+ self.trackInterface.predrawPage()
+
+ if self.audioRecordState:
+ if self.audioRecordTick > curTick: # we've looped around
+ self.handleStop()
+ else:
+ self.audioRecordTick = curTick
+
+
+ return True
+
+ def onMuteTrack( self, widget, trackId ):
+ self._data['track_mute'][trackId] = not self._data['track_mute'][trackId]
+ #if self._data['track_mute'][trackId]:
+ #self.noteLooper.setMute( trackId, 0.0 )
+ #else:
+ #self.noteLooper.setMute( trackId, 1.0 )
+
+ def onTrackVolumeChanged( self, widget, trackId ):
+ v = widget.get_value() / 100.0
+ self._data['track_volume'][trackId] = v
+ #self.noteLooper.setVolume( trackId, v )
+
+ def clearInstrument( self, id, primary = True ):
+ btn = self.GUI["2instrument%dButton" % (id+1)]
+ if primary:
+ if self.trackInstrument2[id] == None:
+ return
+ self.handleInstrumentChanged( ( id, self.trackInstrument2[id] ), True )
+ self.handleInstrumentChanged( ( id, None ), False )
+ btn.setPrimary( self.GUI["2instrumentIcons"][self.trackInstrument[id].name] )
+ btn.setSecondary( None )
+ else:
+ self.handleInstrumentChanged( ( id, None ), False )
+ btn.setSecondary( None )
+ pages = self.tuneInterface.getSelectedIds()
+ self.noteDB.setInstrument2( pages, id, -1 )
+
+ # data is tuple ( trackId, instrumentName )
+ def handleInstrumentChanged( self, data, primary = True ):
+ (id, instrument) = data
+ if primary:
+ self.trackInstrument[id] = instrument
+ else:
+ self.trackInstrument2[id] = instrument
+
+
+ if primary: # TODO handle secondary instruments properly
+ if (Config.DEBUG > 3): print "handleInstrumentChanged", id, instrument.name, primary
+
+ pages = self.tuneInterface.getSelectedIds()
+ self.noteDB.setInstrument( pages, id, instrument.instrumentId )
+
+ def getScale(self):
+ return self.scale
+
+ def handleVolume( self, widget ):
+ self._data["volume"] = round( widget.get_value() )
+ self.csnd.setMasterVolume(self._data["volume"])
+ img = min(3,int(4*self._data["volume"]/100)) # volume 0-3
+ #self.GUI["2volumeImage"].set_from_file( Config.IMAGE_ROOT+"volume"+str(img)+".png" )
+
+ def initTrackVolume( self ):
+ for i in range(Config.NUMBER_OF_TRACKS):
+ self.csnd.setTrackVolume(self._data["track_volume"][i], i)
+
+ def handleTrackVolume( self, widget, track ):
+ self._data["track_volume"][track] = round( widget.get_value() )
+ self.csnd.setTrackVolume(self._data["track_volume"][track], track)
+
+ def getTrackInstrument( self, track ):
+ return self.trackInstrument[track]
+
+ def getTrackVolume( self, track ):
+ return self._data["track_volume"][track]
+
+ def handleTempo( self, widget ):
+ self._data['tempo'] = round( widget.get_value() )
+ img = min(7,int(8*(self._data["tempo"]-widget.lower)/(widget.upper-widget.lower)))+1# tempo 1-8
+ #self.GUI["2tempoImage"].set_from_file( Config.IMAGE_ROOT+"tempo"+str(img)+".png" )
+ if self.playing:
+ self.csnd.setTempo(self._data['tempo'])
+
+ def handleToolClick( self, widget, mode ):
+ if widget.get_active(): self.trackInterface.setInterfaceMode( mode )
+
+ def getTool( self ):
+ if self.GUI["2toolPointerButton"].get_active(): return "default"
+ else: return "draw"
+
+ def handleKeyboardRecordButton( self, widget, data=None ):
+ self.kb_record = widget.get_active()
+
+ def pickInstrument( self, widget, num, primary = True ):
+ self.last_clicked_instTrackID = num
+ self.last_clicked_instPrimary = primary
+ self.instrumentPanel.selectFirstCat()
+ if primary or self.trackInstrument2[num] == None:
+ self.instrumentPanel.set_activeInstrument( self.trackInstrument[num].name, True )
+ else:
+ self.instrumentPanel.set_activeInstrument( self.trackInstrument2[num].name, True )
+ winLoc = self.parent.window.get_position()
+ alloc = widget.parent.get_allocation()
+ x = alloc.x + alloc.width + winLoc[0]
+ y = alloc.y + winLoc[1]
+ self.GUI["9instrumentPopup"].move( x, y )
+ self.GUI["9instrumentPopup"].show()
+
+ def cancelInstrumentSelection( self ):
+ self.GUI["9instrumentPopup"].hide()
+
+ def donePickInstrument( self, instrumentName ):
+ self.handleInstrumentChanged( (self.last_clicked_instTrackID, Config.INSTRUMENTS[instrumentName]), self.last_clicked_instPrimary )
+ btn = self.GUI["2instrument%dButton" % (self.last_clicked_instTrackID+1)]
+ if self.last_clicked_instPrimary:
+ btn.setPrimary( self.GUI["2instrumentIcons"][instrumentName] )
+ else:
+ btn.setSecondary( self.GUI["2instrumentIcons"][instrumentName] )
+ self.GUI["9instrumentPopup"].hide()
+
+
+ def pickDrum( self, widget , data = None ):
+ if widget.get_active(): # show the panel
+ winLoc = self.parent.window.get_position()
+ alloc = widget.get_allocation()
+ x = alloc.x + alloc.width + winLoc[0]
+ y = alloc.y + winLoc[1]
+ self.drumPanel.set_activeInstrument( self.trackInstrument[Config.NUMBER_OF_TRACKS-1].name, True )
+ self.GUI["9drumPopup"].move( x, y )
+ self.GUI["9drumPopup"].show()
+ else: # hide the panel
+ self.GUI["9drumPopup"].hide()
+
+ def cancelDrumSelection( self ):
+ self.GUI["2drumButton"].set_active( False )
+
+ def donePickDrum( self, drumName ):
+ self.handleInstrumentChanged( ( self.drumIndex, Config.INSTRUMENTS[drumName] ) )
+ self.GUI["2drumButton"].setImage( "main", self.GUI["2instrumentIcons"][drumName] )
+ self.GUI["2drumButton"].setImage( "alt", self.GUI["2instrumentIcons"][drumName] )
+ self.GUI["2drumButton"].set_active( False )
+
+ def playInstrumentNote( self, instrumentName, secs_per_tick = 0.025):
+ self.csnd.play(
+ CSoundNote( onset = 0,
+ pitch = 36,
+ amplitude = 1,
+ pan = 0.5,
+ duration = 20,
+ trackId = 1,
+ instrumentId = Config.INSTRUMENTS[instrumentName].instrumentId,
+ reverbSend = 0),
+ secs_per_tick)
+
+ def handlemuteButton(self,widget,track):
+ if widget.get_active():
+ self.trackActive[track] = True
+ else:
+ self.trackActive[track] = False
+ self.updatePagesPlaying()
+
+ def handlemuteButtonRightClick(self,widget,event,track):
+ if event.button == 3:
+ widget.set_active(True)
+ #if the other tracks are inactive
+ if self.trackActive.count(False) == Config.NUMBER_OF_TRACKS - 1:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i == 4:
+ #self.GUI["2drumMuteButton"].set_active(True)
+ self.GUI["2drumPalette"].muteButton.set_active(True)
+ else:
+ #self.GUI["2instrument" + str(i+1) + "muteButton"].set_active(True)
+ self.GUI["2instrument" + str(i+1) + "Palette"].muteButton.set_active(True)
+ else:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i != track:
+ if i == 4:
+ #self.GUI["2drumMuteButton"].set_active(False)
+ self.GUI["2drumPalette"].muteButton.set_active(False)
+ else:
+ #self.GUI["2instrument" + str(i+1) + "muteButton"].set_active(False)
+ self.GUI["2instrument" + str(i+1) + "Palette"].muteButton.set_active(False)
+ self.updatePagesPlaying()
+
+ def blockFocus(self, widget = None, data = None):
+ self.activity.handler_block(self.activity.focusOutHandler)
+ self.activity.handler_block(self.activity.focusInHandler)
+
+ def unblockFocus(self, widget = None, data = None):
+ self.activity.handler_unblock(self.activity.focusOutHandler)
+ self.activity.handler_unblock(self.activity.focusInHandler)
+
+ #-----------------------------------
+ # generation functions
+ #-----------------------------------
+
+ def recompose( self, algo, params, nPagesCycle = 4):
+ if self.generateMode == "track":
+ if self.trackSelected == [ 0 for i in range(Config.NUMBER_OF_TRACKS) ]:
+ newtracks = set(range(Config.NUMBER_OF_TRACKS))
+ else:
+ newtracks = set( [ i for i in range(Config.NUMBER_OF_TRACKS) if self.trackSelected[i] ] )
+ newpages = self.tuneInterface.getSelectedIds()
+ else: # page mode
+ newtracks = set(range(Config.NUMBER_OF_TRACKS))
+ newpages = self.tuneInterface.getSelectedIds()
+
+ dict = {}
+ for t in newtracks:
+ dict[t] = {}
+ for p in newpages:
+ dict[t][p] = self.noteDB.getCSNotesByTrack( p, t )
+
+ beatsOfPages = {}
+ for pageId in newpages:
+ beatsOfPages[pageId] = self.noteDB.pages[pageId].beats
+
+ instruments = self.noteDB.getInstruments(newpages)
+
+ #[ i.name for i in self.trackInstrument ],
+ algo(
+ params,
+ self._data['track_volume'][:],
+ instruments,
+ self._data['tempo'],
+ beatsOfPages,
+ newtracks,
+ newpages,
+ dict, nPagesCycle)
+
+ # filter & fix input ...WTF!?
+ for track in dict:
+ for page in dict[track]:
+ for note in dict[track][page]:
+ intdur = int(note.duration)
+ note.duration = intdur
+ note.pageId = page
+ note.trackId = track
+
+ # prepare the new notes
+ newnotes = []
+ for tid in dict:
+ for pid in dict[tid]:
+ newnotes += dict[tid][pid]
+
+ # delete the notes and add the new
+ self.noteDB.deleteNotesByTrack( newpages, newtracks )
+
+ stream = []
+ for page in newpages:
+ for track in newtracks:
+ stream += [ page, track, len(dict[track][page]) ]
+ stream += dict[track][page]
+ stream += [-1]
+ self.noteDB.addNotes( stream )
+
+ def generate( self, params, nPagesCycle = 4 ):
+ self.recompose( generator1, params, nPagesCycle)
+
+ #=======================================================
+ # Clipboard Functions
+
+ def getClipboardArea( self, page = -1 ):
+ if page == -1: page = self.displayedPage
+ ids = self.tuneInterface.getSelectedIds()
+ return self.noteDB.getClipboardArea( ids.index(page) )
+
+ def pasteClipboard( self, offset, trackMap ):
+ pages = self.tuneInterface.getSelectedIds()
+ instrumentMap = {}
+ for t in trackMap:
+ if t != trackMap[t]: instrumentMap[t] = self.trackInstrument[t].instrumentId
+ return self.noteDB.pasteClipboard( pages, offset, trackMap, instrumentMap )
+
+ def cleanupClipboard( self ):
+ self.trackInterface.donePaste()
+
+
+ #=======================================================
+ # Note Functions
+
+ def noteProperties( self, widget ):
+ if widget.get_active():
+ ids = self.trackInterface.getSelectedNotes()
+ notes = { self.displayedPage: {} }
+ for t in range(Config.NUMBER_OF_TRACKS):
+ if len(ids[t]):
+ notes[self.displayedPage][t] = [ self.noteDB.getNote( self.displayedPage, t, id ) for id in ids[t] ]
+
+ self.propertiesPanel.setContext("note", self.generationPanel.scale, notes = notes )
+ winLoc = self.parent.window.get_position()
+ balloc = self.GUI["2contextBox"].get_allocation()
+ walloc = self.GUI["9propertiesPopup"].get_allocation()
+ if walloc.height != 1: # hack to deal with showing the window before first allocation T_T
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9propertiesPopup"].move(0, 2048) # off the screen
+ self.GUI["9propertiesPopup"].show()
+ if walloc.height == 1:
+ walloc = self.GUI["9propertiesPopup"].get_allocation()
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9propertiesPopup"].hide()
+
+ def noteDelete( self ):
+ ids = self.trackInterface.getSelectedNotes()
+ stream = []
+ for t in range(Config.NUMBER_OF_TRACKS):
+ N = len(ids[t])
+ if not N: continue
+ stream += [ self.displayedPage, t, N ] + ids[t]
+ if len(stream):
+ self.noteDB.deleteNotes( stream + [-1] )
+
+ def noteDuplicate( self ):
+ ids = self.trackInterface.getSelectedNotes()
+ stream = []
+ for t in range(Config.NUMBER_OF_TRACKS):
+ N = len(ids[t])
+ if not N: continue
+ stream += [ self.displayedPage, t, N ] + ids[t]
+ if len(stream):
+ self.skipCleanup = "note"
+ self.skipCleanup = ""
+ self.noteDB.notesToClipboard( stream + [-1] )
+ self.trackInterface.setInterfaceMode("paste_notes")
+ return True
+ return False
+
+ def noteDuplicateWidget( self, widget ):
+ if widget.get_active():
+ if self.noteDuplicate(): # duplicate succeeded
+ return
+ # cancel duplicate
+ widget.set_active(False)
+ self.trackInterface.setInterfaceMode("tool")
+ else:
+ self.trackInterface.setInterfaceMode("tool")
+
+ def noteOnset( self, step ):
+ self.trackInterface.noteStepOnset( step )
+
+ def notePitch( self, step ):
+ # TODO
+ return
+
+ def noteDuration( self, step ):
+ # TODO
+ return
+
+ def noteVolume( self, step ):
+ # TODO
+ return
+
+ #=======================================================
+ # Track Functions
+
+ def toggleTrack( self, trackN, exclusive ):
+ if exclusive:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackSelected[i]:
+ self.trackSelected[i] = False
+ self.trackInterface.trackToggled( i )
+ self.tuneInterface.trackToggled( i )
+ self.trackSelected[trackN] = True
+ self.trackInterface.trackToggled( trackN )
+ self.tuneInterface.trackToggled( trackN )
+ self.setContextState( CONTEXT.TRACK, True )
+ self.setContext( CONTEXT.TRACK )
+ else:
+ self.trackSelected[trackN] = not self.trackSelected[trackN]
+ self.trackInterface.trackToggled( trackN )
+ self.tuneInterface.trackToggled( trackN )
+ trackSelected = False
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackSelected[i]:
+ self.setContextState( CONTEXT.TRACK, True )
+ self.setContext( CONTEXT.TRACK )
+ trackSelected = True
+ break
+ if not trackSelected:
+ self.setContextState( CONTEXT.TRACK, False )
+
+ def setTrack( self, trackN, state ):
+ if self.trackSelected[trackN] != state:
+ self.trackSelected[trackN] = state
+ self.trackInterface.trackToggled( trackN )
+
+ def clearTracks( self ):
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackSelected[i]:
+ self.trackSelected[i]= False
+ self.trackInterface.trackToggled( i )
+ self.tuneInterface.trackToggled( i )
+
+ self.setContextState( CONTEXT.TRACK, False )
+
+ def getTrackSelected( self, trackN ):
+ return self.trackSelected[trackN]
+
+ def trackGenerate( self, widget ):
+ if widget.get_active():
+ self.generateMode = "track"
+ winLoc = self.parent.window.get_position()
+ balloc = self.GUI["2contextBox"].get_allocation()
+ walloc = self.GUI["9generationPopup"].get_allocation()
+ if walloc.height != 1: # hack to make deal with showing the window before first allocation T_T
+ self.GUI["9generationPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9generationPopup"].move(0, 2048) # off the screen
+ self.GUI["9generationPopup"].show()
+ if walloc.height == 1:
+ walloc = self.GUI["9generationPopup"].get_allocation()
+ self.GUI["9generationPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9generationPopup"].hide()
+
+
+ def trackProperties( self, widget ):
+ if widget.get_active():
+ self.propertiesPanel.setContext( "track", self.generationPanel.scale, self.tuneInterface.getSelectedIds(), [ i for i in range(Config.NUMBER_OF_TRACKS) if self.trackSelected[i] ] )
+ winLoc = self.parent.window.get_position()
+ balloc = self.GUI["2contextBox"].get_allocation()
+ walloc = self.GUI["9propertiesPopup"].get_allocation()
+ if walloc.height != 1: # hack to make deal with showing the window before first allocation T_T
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9propertiesPopup"].move(0, 2048) # off the screen
+ self.GUI["9propertiesPopup"].show()
+ if walloc.height == 1:
+ walloc = self.GUI["9propertiesPopup"].get_allocation()
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 30, balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9propertiesPopup"].hide()
+
+ def trackDelete( self, pageIds = -1, trackIds = -1 ):
+
+ if pageIds == -1: pageIds = self.tuneInterface.getSelectedIds()
+ if trackIds == -1: trackIds = [ i for i in range(Config.NUMBER_OF_TRACKS) if self.trackSelected[i] ]
+
+ self.noteDB.deleteNotesByTrack( pageIds, trackIds )
+
+ def trackDuplicate( self, pageIds = -1, trackIds = -1 ):
+
+ if pageIds == -1: pageIds = self.tuneInterface.getSelectedIds()
+ if trackIds == -1: trackIds = [ i for i in range(Config.NUMBER_OF_TRACKS) if self.trackSelected[i] ]
+
+ if len(trackIds):
+ self.skipCleanup = "track"
+ self.skipCleanup = ""
+ self.noteDB.tracksToClipboard( pageIds, trackIds )
+ self.trackInterface.setInterfaceMode("paste_tracks")
+ return True
+ return False
+
+ def trackDuplicateWidget( self, widget ):
+ if widget.get_active():
+ if self.trackDuplicate(): # duplicate succeeded
+ return
+ # cancel duplicate
+ widget.set_active(False)
+ self.trackInterface.setInterfaceMode("tool")
+ else:
+ self.trackInterface.setInterfaceMode("tool")
+
+ #-----------------------------------
+ # tune/page functions
+ #-----------------------------------
+
+ def scrollTune( self, direction ):
+ adj = self.GUI["2tuneScrolledWindow"].get_hadjustment()
+ if direction > 0:
+ adj.set_value( min( adj.value + Config.PAGE_THUMBNAIL_WIDTH, adj.upper - adj.page_size ) )
+ else:
+ adj.set_value( max( adj.value - Config.PAGE_THUMBNAIL_WIDTH, 0) )
+
+ def displayPage( self, pageId, nextId = -1 ):
+ if self.playing:
+ if self.displayedPage != pageId and pageId in self.pages_playing:
+ self.csnd.loopSetTick( self.page_onset[pageId] )
+
+ self._displayPage( pageId, nextId )
+
+
+ # only called locally!
+ def _displayPage( self, pageId, nextId = -1 ):
+
+ self.displayedPage = pageId
+
+ page = self.noteDB.getPage(pageId)
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackInstrument[i].instrumentId != page.instruments[i]:
+ self.trackInstrument[i] = Config.INSTRUMENTSID[page.instruments[i]]
+ if i == Config.NUMBER_OF_TRACKS-1:
+ btn = self.GUI["2drumButton"]
+ btn.setImage( "main", self.GUI["2instrumentIcons"][self.trackInstrument[i].name] )
+ btn.setImage( "alt", self.GUI["2instrumentIcons"][self.trackInstrument[i].name] )
+ else:
+ btn = self.GUI["2instrument%dButton"%(i+1)]
+ btn.setPrimary( self.GUI["2instrumentIcons"][self.trackInstrument[i].name] )
+ if self.trackInstrument2[i] != None:
+ btn.setSecondary( self.GUI["2instrumentIcons"][self.trackInstrument2[i].name] )
+ else:
+ btn.setSecondary( None )
+ self.tuneInterface.displayPage( pageId )
+ self.trackInterface.displayPage( pageId, nextId )
+
+ def predrawPage( self, pageId ):
+ if self.playbackTimeout: return # we're playing, predrawing is already handled
+ if self.trackInterface.setPredrawPage( pageId ): # page needs to be drawn
+ self.trackInterface.predrawPage()
+
+ def abortPredrawPage( self ):
+ self.trackInterface.abortPredrawPage()
+
+ def pageGenerate( self, widget ):
+ if widget.get_active():
+ self.generateMode = "page"
+ winLoc = self.parent.window.get_position()
+ balloc = self.GUI["2contextBox"].get_allocation()
+ walloc = self.GUI["9generationPopup"].get_allocation()
+ if walloc.height != 1: # hack to make deal with showing the window before first allocation T_T
+ self.GUI["9generationPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9generationPopup"].move(0, 2048) # off the screen
+ self.GUI["9generationPopup"].show()
+ if walloc.height == 1:
+ walloc = self.GUI["9generationPopup"].get_allocation()
+ self.GUI["9generationPopup"].move( balloc.x + winLoc[0], balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9generationPopup"].hide()
+
+ def setPageGenerateMode(self, mode):
+ self.generateMode = mode
+
+ def pageProperties( self, widget ):
+ if widget.get_active():
+ self.propertiesPanel.setContext( "page", self.generationPanel.scale, self.tuneInterface.getSelectedIds() )
+ winLoc = self.parent.window.get_position()
+ balloc = self.GUI["2contextBox"].get_allocation()
+ walloc = self.GUI["9propertiesPopup"].get_allocation()
+ if walloc.height != 1: # hack to make deal with showing the window before first allocation T_T
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 100, balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9propertiesPopup"].move(0, 2048) # off the screen
+ self.GUI["9propertiesPopup"].show()
+ if walloc.height == 1:
+ walloc = self.GUI["9propertiesPopup"].get_allocation()
+ self.GUI["9propertiesPopup"].move( balloc.x + winLoc[0] - 100, balloc.y - walloc.height + winLoc[1] )
+ else:
+ self.GUI["9propertiesPopup"].hide()
+
+ def pageDelete( self, pageIds = -1, instruments = False ):
+
+ if pageIds == -1:
+ pageIds = self.tuneInterface.getSelectedIds()
+
+ if instruments == False:
+ instruments = []
+ for inst in self.trackInstrument:
+ instruments.append(inst.instrumentId)
+
+ self.noteDB.deletePages( pageIds[:], instruments )
+
+ def pageDuplicate( self, after = -1, pageIds = False ):
+
+ if after == -1: after = self.tuneInterface.getLastSelected()
+ if not pageIds: pageIds = self.tuneInterface.getSelectedIds()
+
+ new = self.noteDB.duplicatePages( pageIds[:], after )
+ self.displayPage( new[self.displayedPage] )
+ self.tuneInterface.selectPages( new.values() )
+
+ def pageAdd( self, after = -1, beats = False, color = False, instruments = False ):
+
+ if after == -1: after = self.tuneInterface.getLastSelected()
+ page = self.noteDB.getPage( self.displayedPage )
+ if not beats: beats = page.beats
+ if not color: color = page.color
+ if not instruments: instruments = page.instruments
+
+ # TODO think about network mode here...
+ self.displayPage( self.noteDB.addPage( -1, NoteDB.Page(beats,color,instruments), after ) )
+
+ def pageBeats( self, pageIds = -1 ):
+
+ if pageIds == -1: pageIds = self.tuneInterface.getSelectedIds()
+
+ # TODO change the beats
+
+ #=======================================================
+ # NoteDB notifications
+
+ def notifyPageAdd( self, id, at ):
+ return
+
+ def notifyPageDelete( self, which, safe ):
+ if self.displayedPage in which:
+ self.displayPage( safe )
+
+ def notifyPageDuplicate( self, new, at ):
+ return
+
+ def notifyPageMove( self, which, low, high ):
+ return
+
+ def notifyPageUpdate( self, page, parameter, value ):
+ pass
+
+ def notifyNoteAdd( self, page, track, id ):
+ if (Config.DEBUG > 3) : print 'INFO: adding note to loop', page, track, id
+ n = self.noteDB.getNote(page, track, id)
+ self.csnd.loopPlay(n,0)
+ if self.playing and (n.page in self.page_onset ):
+ onset = n.cs.onset + self.page_onset[n.page]
+ self.csnd.loopUpdate(n, NoteDB.PARAMETER.ONSET, onset, 1) #set onset + activate
+
+ def notifyNoteDelete( self, page, track, id ):
+ if (Config.DEBUG > 3) : print 'INFO: deleting note from loop', page, track, id
+ self.csnd.loopDelete1(page,id)
+ def notifyNoteUpdate( self, page, track, id, parameter, value ):
+ if (Config.DEBUG > 3) : print 'INFO: updating note ', page, id, parameter, value
+ note = self.noteDB.getNote(page, track, id)
+ self.csnd.loopUpdate(note, parameter, value, -1)
+
+ #-----------------------------------
+ # load and save functions
+ #-----------------------------------
+
+ def waitToSet(self):
+ self.csnd.setMasterVolume(self._data['volume'])
+ self.csnd.setTempo(self._data['tempo'])
+ self.initTrackVolume()
+
+ def handleSave(self, widget):
+
+ chooser = gtk.FileChooserDialog(
+ title='Save Tune',
+ action=gtk.FILE_CHOOSER_ACTION_SAVE,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
+ filter = gtk.FileFilter()
+ filter.add_pattern('*.tam')
+ chooser.set_filter(filter)
+ chooser.set_current_folder(Config.TUNE_DIR)
+
+ for f in chooser.list_shortcut_folder_uris():
+ chooser.remove_shortcut_folder_uri(f)
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ ofilename = chooser.get_filename()
+ if ofilename[-4:] != '.tam':
+ ofilename += '.tam'
+ try:
+ ofile = open(ofilename, 'w')
+ ofilestream = ControlStream.TamTamOStream (ofile)
+ self.noteDB.dumpToStream(ofilestream)
+ ofilestream.track_vol(self._data['track_volume'])
+ ofilestream.master_vol(self._data['volume'])
+ ofilestream.tempo(self._data['tempo'])
+ ofile.close()
+ except OSError,e:
+ print 'ERROR: failed to open file %s for writing\n' % ofilename
+ chooser.destroy()
+
+ def handleJournalSave(self, file_path):
+ ofile = open(file_path, 'w')
+ ofilestream = ControlStream.TamTamOStream (ofile)
+ self.noteDB.dumpToStream(ofilestream)
+ ofilestream.track_vol(self._data['track_volume'])
+ ofilestream.master_vol(self._data['volume'])
+ ofilestream.tempo(self._data['tempo'])
+ ofile.close()
+
+ def _loadFile( self, path ):
+ try:
+ oldPages = self.noteDB.getTune()[:]
+
+ ifile = open(path, 'r')
+ ttt = ControlStream.TamTamTable ( self.noteDB )
+ ttt.parseFile(ifile)
+ self.trackInstrument = self.trackInstrumentDefault[:] # these will get set correctly in displayPage
+ self._data['track_volume'] = ttt.tracks_volume
+ self._data['volume'] = float(ttt.masterVolume)
+ self._data['tempo'] = float(ttt.tempo)
+ #self.GUI["2volumeAdjustment"].set_value(self._data['volume'])
+ #self.GUI["2tempoAdjustment"].set_value(self._data['tempo'])
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i == 4:
+ string = '2drumvolumeAdjustment'
+ else:
+ string = '2instrument' + str(i+1) + 'volumeAdjustment'
+ self.GUI[string].set_value(self._data['track_volume'][i])
+ ifile.close()
+
+ self.noteDB.deletePages( oldPages )
+
+ self.tuneInterface.selectPages( self.noteDB.getTune() )
+ except OSError,e:
+ print 'ERROR: failed to open file %s for reading\n' % ofilename
+
+ def handleLoad(self, widget):
+ chooser = gtk.FileChooserDialog(
+ title='Load Tune',
+ action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+
+ filter = gtk.FileFilter()
+ filter.add_pattern('*.tam')
+ chooser.set_filter(filter)
+ chooser.set_current_folder(Config.TUNE_DIR)
+
+ for f in chooser.list_shortcut_folder_uris():
+ chooser.remove_shortcut_folder_uri(f)
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ print 'DEBUG: loading file: ', chooser.get_filename()
+ self._loadFile( chooser.get_filename() )
+
+ chooser.destroy()
+ self.delay = gobject.timeout_add(1000, self.waitToSet)
+
+ def handleJournalLoad(self,file_path):
+ self.journalCalled = True
+ self._loadFile( file_path )
+
+ #-----------------------------------
+ # Record functions
+ #-----------------------------------
+ def handleMicRecord( self, widget, data ):
+ self.csnd.micRecording( data )
+ def handleCloseMicRecordWindow( self, widget = None, data = None ):
+ self.micRecordWindow.destroy()
+ self.micRecordButton.set_active( False )
+
+ #-----------------------------------
+ # callback functions
+ #-----------------------------------
+ def handleKeyboardShortcuts(self,event):
+ keyval = event.keyval
+
+ # backspace and del keys
+ if keyval == gtk.keysyms.Delete or keyval == gtk.keysyms.BackSpace:
+ if self.context == CONTEXT.PAGE: self.pageDelete()
+ if self.context == CONTEXT.TRACK: self.trackDelete()
+ if self.context == CONTEXT.NOTE: self.noteDelete()
+ # plus key
+ if keyval == gtk.keysyms.equal:
+ self.pageAdd()
+ # duplicate ctrl-c
+ if event.state == gtk.gdk.CONTROL_MASK and keyval == gtk.keysyms.c:
+ if self.context == CONTEXT.PAGE: self.pageDuplicate()
+ if self.context == CONTEXT.TRACK: self.trackDuplicate()
+ if self.context == CONTEXT.NOTE: self.noteDuplicate()
+ #Arrows
+ if event.state == gtk.gdk.SHIFT_MASK:
+ # up/down arrows volume
+ if keyval == gtk.keysyms.Up: self.trackInterface.noteStepVolume(0.1)
+ if keyval == gtk.keysyms.Down: self.trackInterface.noteStepVolume(-0.1)
+ # left/right arrows onset
+ if keyval == gtk.keysyms.Left: self.trackInterface.noteStepDuration(-1)
+ if keyval == gtk.keysyms.Right: self.trackInterface.noteStepDuration(1)
+ else:
+ # up/down arrows pitch
+ if keyval == gtk.keysyms.Up: self.trackInterface.noteStepPitch(1)
+ if keyval == gtk.keysyms.Down: self.trackInterface.noteStepPitch(-1)
+ # left/right arrows duration
+ if keyval == gtk.keysyms.Left: self.trackInterface.noteStepOnset(-1)
+ if keyval == gtk.keysyms.Right: self.trackInterface.noteStepOnset(1)
+
+
+ def onKeyPress(self,widget,event):
+ self.handleKeyboardShortcuts(event)
+ Config.ModKeys.keyPress( event.hardware_keycode )
+ key = event.hardware_keycode
+
+ # If the key is already in the dictionnary, exit function (to avoir key repeats)
+ if self.kb_keydict.has_key(key):
+ return
+
+ # Assign on which track the note will be created according to the number of keys pressed
+ if self.trackCount >= 9:
+ self.trackCount = 6
+ fakeTrack = self.trackCount
+ self.trackCount += 1
+
+ # If the pressed key is in the keymap
+ if KEY_MAP_PIANO.has_key(key):
+ pitch = KEY_MAP_PIANO[key]
+ duration = -1
+
+ # get instrument from top selected track if a track is selected
+ if True in self.trackSelected:
+ index = self.trackSelected.index(True)
+ instrument = self.getTrackInstrument(index).name
+ else:
+ return
+
+ tid = index
+
+ # pitch, inst and duration for drum recording
+ if tid == Config.NUMBER_OF_TRACKS-1:
+ if GenerationConstants.DRUMPITCH.has_key( pitch ):
+ pitch = GenerationConstants.DRUMPITCH[pitch]
+ if Config.INSTRUMENTS[instrument].kit != None:
+ instrument = Config.INSTRUMENTS[instrument].kit[pitch].name
+ duration = 100
+
+ # Create and play the note
+ self.kb_keydict[key] = CSoundNote(onset = 0,
+ pitch = pitch,
+ amplitude = 1,
+ pan = 0.5,
+ duration = duration,
+ trackId = fakeTrack,
+ instrumentId = Config.INSTRUMENTS[instrument].instrumentId,
+ tied = False,
+ mode = 'edit')
+ self.csnd.play(self.kb_keydict[key], 0.3)
+
+ # doesn't keep track of keys for drum recording
+ if tid == Config.NUMBER_OF_TRACKS-1:
+ del self.kb_keydict[key]
+
+ # remove previosly holded key from dictionary
+ if len(self.kb_keydict) > 1:
+ for k in self.kb_keydict.keys():
+ if k != key:
+ gobject.source_remove( self.durUpdate )
+ self.durUpdate = False
+ self.kb_keydict[k].duration = 0.5
+ self.kb_keydict[k].amplitude = 0
+ self.kb_keydict[k].decay = 0.7
+ self.kb_keydict[k].tied = False
+ self.csnd.play(self.kb_keydict[k], 0.3)
+ if not self.kb_record:
+ del self.kb_keydict[k]
+ return
+ self.removeRecNote(self.csId)
+
+ if not self.kb_record:
+ return
+
+ #record the note on track
+ pageList = self.tuneInterface.getSelectedIds()
+ pid = self.displayedPage
+ minOnset = self.page_onset[pid]
+ onsetQuantized = Config.DEFAULT_GRID * int((self.csnd.loopGetTick() - minOnset) / Config.DEFAULT_GRID + 0.5)
+
+ maxOnset = self.noteDB.getPage(pid).ticks
+ if onsetQuantized >= maxOnset:
+ if pid == pageList[-1]:
+ pid = pageList[0]
+ else:
+ if len(pageList) > 1:
+ pidPos = pageList.index(pid)
+ pid = pageList[pidPos+1]
+ onsetQuantized = 0
+
+ if tid < Config.NUMBER_OF_TRACKS-1:
+ for n in self.noteDB.getNotesByTrack( pid, tid ):
+ if onsetQuantized < n.cs.onset:
+ break
+ if onsetQuantized >= n.cs.onset + n.cs.duration:
+ continue
+ if onsetQuantized < n.cs.onset + n.cs.duration - 2:
+ self.noteDB.deleteNote(n.page, n.track, n.id)
+ elif onsetQuantized - n.cs.onset < 1:
+ self.noteDB.deleteNote(n.page, n.track, n.id)
+ else:
+ self.noteDB.updateNote( n.page, n.track, n.id, PARAMETER.DURATION, onsetQuantized - n.cs.onset )
+ break
+ else:
+ for n in self.noteDB.getNotesByTrack( pid, tid ):
+ if onsetQuantized < n.cs.onset:
+ break
+ if onsetQuantized == n.cs.onset:
+ if pitch < n.cs.pitch:
+ break
+ if pitch == n.cs.pitch:
+ return # don't bother with a new note
+
+ csnote = CSoundNote(onset = 0,
+ pitch = pitch,
+ amplitude = 1,
+ pan = 0.5,
+ duration = duration,
+ trackId = index,
+ instrumentId = Config.INSTRUMENTS[instrument].instrumentId,
+ tied = False,
+ mode = 'edit')
+
+ csnote.onset = onsetQuantized
+ csnote.duration = 1
+ csnote.pageId = pid
+ id = self.noteDB.addNote(-1, pid, tid, csnote)
+ # csId: PageId, TrackId, Onset, Key, DurationSetOnce
+ self.csId = [pid, tid, id, csnote.onset, key, False ]
+ if tid < Config.NUMBER_OF_TRACKS-1:
+ self.durUpdate = gobject.timeout_add( 25, self.durationUpdate )
+
+ def onKeyRelease(self,widget,event):
+ Config.ModKeys.keyRelease( event.hardware_keycode )
+ key = event.hardware_keycode
+
+ if True in self.trackSelected:
+ index = self.trackSelected.index(True)
+ if index == Config.NUMBER_OF_TRACKS-1:
+ return
+ else:
+ return
+
+ if KEY_MAP_PIANO.has_key(key) and self.kb_keydict.has_key(key):
+ if self.kb_record and self.durUpdate:
+ gobject.source_remove( self.durUpdate )
+ self.durUpdate = False
+
+ if Config.INSTRUMENTSID[ self.kb_keydict[key].instrumentId ].csoundInstrumentId == Config.INST_TIED:
+ self.kb_keydict[key].duration = 0.5
+ self.kb_keydict[key].amplitude = 0
+ self.kb_keydict[key].decay = 0.5
+ self.kb_keydict[key].tied = False
+ self.csnd.play(self.kb_keydict[key], 0.3)
+ if not self.kb_record:
+ del self.kb_keydict[key]
+ return
+
+ self.removeRecNote(self.csId)
+
+ def removeRecNote(self, csId):
+ newDuration = (int(self.csnd.loopGetTick()) - self.page_onset[csId[0]]) - csId[3]
+ maxTick = self.noteDB.getPage(csId[0]).ticks
+
+ if not csId[5]: # handle notes that were created right at the end of a page
+ if newDuration > maxTick//2:
+ newDuration = 1
+ else:
+ csId[5] = True
+
+ if newDuration < -Config.DEFAULT_GRID_DIV2: # we looped around
+ newDuration = maxTick - self.csId[3]
+ elif newDuration < 1:
+ newDuration = 1
+
+ if (csId[3] + newDuration) > maxTick:
+ newDuration = maxTick - csId[3]
+
+ for n in self.noteDB.getNotesByTrack( csId[0], csId[1] ):
+ if n.id == csId[2]:
+ continue
+ if csId[3] + newDuration <= n.cs.onset:
+ break
+ if csId[3] >= n.cs.onset + n.cs.duration:
+ continue
+ self.noteDB.deleteNote(n.page, n.track, n.id)
+ break
+
+ self.noteDB.updateNote( csId[0], csId[1], csId[2], PARAMETER.DURATION, newDuration)
+
+ del self.kb_keydict[csId[4]]
+
+ def durationUpdate(self):
+ newDuration = (int(self.csnd.loopGetTick()) - self.page_onset[self.csId[0]]) - self.csId[3]
+
+ maxTick = self.noteDB.getPage(self.csId[0]).ticks
+ stop = False
+
+ if not self.csId[5]: # handle notes that were created right at the end of a page
+ if newDuration > maxTick//2:
+ newDuration = 1
+ else:
+ self.csId[5] = True
+
+ if newDuration < -Config.DEFAULT_GRID_DIV2: # we looped around
+ newDuration = maxTick - self.csId[3]
+ stop = True
+ elif newDuration < 1:
+ newDuration = 1
+
+ if (self.csId[3] + newDuration) > maxTick:
+ stop = True
+ newDuration = maxTick - self.csId[3]
+
+ for n in self.noteDB.getNotesByTrack( self.csId[0], self.csId[1] ):
+ if n.id == self.csId[2]:
+ continue
+ if self.csId[3] + newDuration <= n.cs.onset:
+ break
+ if self.csId[3] >= n.cs.onset + n.cs.duration:
+ continue
+ self.noteDB.deleteNote(n.page, n.track, n.id)
+ break
+
+ self.noteDB.updateNote( self.csId[0], self.csId[1], self.csId[2], PARAMETER.DURATION, newDuration)
+
+ if stop:
+ key = self.csId[4]
+ if Config.INSTRUMENTSID[ self.kb_keydict[key].instrumentId ].csoundInstrumentId == Config.INST_TIED:
+ self.kb_keydict[key].duration = 0.5
+ self.kb_keydict[key].amplitude = 0
+ self.kb_keydict[key].decay = 0.5
+ self.kb_keydict[key].tied = False
+ self.csnd.play(self.kb_keydict[key], 0.3)
+
+ del self.kb_keydict[key]
+ return False
+ return True
+
+ def delete_event( self, widget, event, data = None ):
+ return False
+
+ def onDestroy( self ):
+
+ if (Config.DEBUG > 1): print TP.PrintAll()
+
+ def setContextState( self, context, state ):
+ if context == CONTEXT.TRACK:
+ self.contextTrackActive = state
+ if not state:
+ if self.context == CONTEXT.TRACK:
+ if self.contextNoteActive:
+ self.setContext( CONTEXT.NOTE )
+ else:
+ self.setContext( CONTEXT.PAGE )
+ else:
+ self.contextNoteActive = state
+ if not state:
+ if self.context == CONTEXT.NOTE:
+ self.prevContext()
+
+ def setContext( self, context, force = False ):
+
+ if self.context == context and not force: return
+
+ self.context = context
+
+ if self.context == CONTEXT.NOTE:
+ self._generateToolbar.generationButton.set_sensitive(False)
+ else:
+ self._generateToolbar.generationButton.set_sensitive(True)
+
+ def getContext(self):
+ return self.context
+
+ def prevContext( self ):
+ if self.context == CONTEXT.TRACK:
+ self.setContext( CONTEXT.PAGE )
+ elif self.contextTrackActive:
+ self.setContext( CONTEXT.TRACK )
+ else:
+ self.setContext( CONTEXT.PAGE )
+
+ def nextContext( self ):
+ if self.context == CONTEXT.TRACK:
+ self.setContext( CONTEXT.NOTE )
+ elif self.contextTrackActive:
+ self.setContext( CONTEXT.TRACK )
+ else:
+ self.setContext( CONTEXT.NOTE )
+
+ #-----------------------------------
+ # access functions (not sure if this is the best way to go about doing this)
+ #-----------------------------------
+ def getVolume( self ):
+ return self._data["volume"]
+
+ def getTempo( self ):
+ return self._data["tempo"]
+ #return round( self.tempoAdjustment.value, 0 )
+
+ def getBeatsPerPage( self ):
+ return int(round( self.beatsPerPageAdjustment.value, 0 ))
+
+ def getWindowTitle( self ):
+ return "Tam-Tam [Volume %i, Tempo %i, Beats/Page %i]" % ( self.getVolume(), self.getTempo(), self.getBeatsPerPage() )
+
+
+class InstrumentButton( gtk.DrawingArea ):
+
+ def __init__( self, owner, index, backgroundFill ):
+ gtk.DrawingArea.__init__( self )
+
+ self.index = index
+ self.owner = owner
+
+ self.win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( self.win )
+
+ colormap = self.get_colormap()
+ self.color = { "background": colormap.alloc_color( backgroundFill, True, True ),
+ "divider": colormap.alloc_color( "#000", True, True ),
+ "+/-": colormap.alloc_color( Config.FG_COLOR, True, True ),
+ "+/-Highlight": colormap.alloc_color( "#FFF", True, True ) }
+
+ self.pixmap = None
+ self.primary = None
+ self.primaryWidth = self.primaryHeight = 1
+ self.secondary = None
+ self.secondaryWidth = self.secondaryHeight = 1
+
+ self.clicked = None
+ self.hover = None
+
+ self.add_events( gtk.gdk.BUTTON_PRESS_MASK
+ | gtk.gdk.BUTTON_RELEASE_MASK
+ | gtk.gdk.POINTER_MOTION_MASK
+ | gtk.gdk.POINTER_MOTION_HINT_MASK
+ | gtk.gdk.LEAVE_NOTIFY_MASK
+ | gtk.gdk.ENTER_NOTIFY_MASK )
+ self.connect( "size-allocate", self.size_allocate )
+ self.connect( "button-press-event", self.button_press )
+ self.connect( "button-release-event", self.button_release )
+ self.connect( "motion-notify-event", self.motion_notify )
+ self.connect( "enter-notify-event", self.enter_notify )
+ self.connect( "leave-notify-event", self.leave_notify )
+ self.connect( "expose-event", self.expose )
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ self.pixmap = gtk.gdk.Pixmap( self.win, allocation.width, allocation.height )
+ self.primaryX = (self.alloc.width - self.primaryWidth) // 2
+ self.primaryY = (self.alloc.height - self.primaryHeight) // 2
+ self.secondaryX = (self.alloc.width - self.secondaryWidth) // 2
+ self.secondaryY = self.alloc.height//2
+
+ self.hotspots = [ [ self.alloc.width-24, self.alloc.height-29, self.alloc.width-8, self.alloc.height-13 ],
+ [ self.alloc.width-24, self.alloc.height//2-23, self.alloc.width-8, self.alloc.height//2-7 ] ]
+
+ self.hotspots[0] += [ (self.hotspots[0][0]+self.hotspots[0][2])//2, (self.hotspots[0][1]+self.hotspots[0][3])//2 ]
+ self.hotspots[1] += [ (self.hotspots[1][0]+self.hotspots[1][2])//2, (self.hotspots[1][1]+self.hotspots[1][3])//2 ]
+
+ self._updatePixmap()
+
+ def button_press( self, widget, event ):
+
+ self.clicked = "PRIMARY"
+ self.hover = None
+
+ if event.x >= self.hotspots[0][0] and event.x <= self.hotspots[0][2] \
+ and event.y >= self.hotspots[0][1] and event.y <= self.hotspots[0][3]:
+ self.clicked = "HOTSPOT_0"
+
+ elif self.secondary != None:
+
+ if event.x >= self.hotspots[1][0] and event.x <= self.hotspots[1][2] \
+ and event.y >= self.hotspots[1][1] and event.y <= self.hotspots[1][3]:
+ self.clicked = "HOTSPOT_1"
+
+ elif event.y > self.alloc.height//2:
+ self.clicked = "SECONDARY"
+
+ def button_release( self, widget, event ):
+ if self.clicked == "PRIMARY":
+ self.owner.pickInstrument( self, self.index, True )
+ elif self.clicked == "SECONDARY":
+ self.owner.pickInstrument( self, self.index, False )
+ elif self.clicked == "HOTSPOT_0":
+ if self.secondary != None: # remove secondary
+ self.owner.clearInstrument( self.index, False )
+ else: # add secondary
+ self.owner.pickInstrument( self, self.index, False )
+ else: # HOTSPOT_1, remove primary
+ self.owner.clearInstrument( self.index, True )
+
+ self.clicked = None
+
+ def motion_notify( self, widget, event ):
+
+ if self.clicked != None:
+ return
+
+ if event.is_hint:
+ x, y, state = widget.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+
+ if event.x >= self.hotspots[0][0] and event.x <= self.hotspots[0][2] \
+ and event.y >= self.hotspots[0][1] and event.y <= self.hotspots[0][3]:
+ if self.hover != "HOTSPOT_0":
+ self.hover = "HOTSPOT_0"
+ self.queue_draw()
+
+
+ elif self.secondary != None \
+ and event.x >= self.hotspots[1][0] and event.x <= self.hotspots[1][2] \
+ and event.y >= self.hotspots[1][1] and event.y <= self.hotspots[1][3]:
+ if self.hover != "HOTSPOT_1":
+ self.hover = "HOTSPOT_1"
+ self.queue_draw()
+ else:
+ if self.hover != None:
+ self.hover = None
+ self.queue_draw()
+
+ def leave_notify( self, widget, event ):
+ if event.mode != gtk.gdk.CROSSING_NORMAL:
+ return
+ if self.hover != None:
+ self.hover = None
+ if self.clicked == None:
+ self.queue_draw()
+
+ self.owner.activity.handler_unblock(self.owner.activity.focusOutHandler)
+ self.owner.activity.handler_unblock(self.owner.activity.focusInHandler)
+
+ def enter_notify(self, widget, event):
+ # Block the Focus Out event so that the sound does'nt stop when a Palette is invoked.
+ self.owner.activity.handler_block(self.owner.activity.focusOutHandler)
+ self.owner.activity.handler_block(self.owner.activity.focusInHandler)
+
+ def setPrimary( self, img ):
+ self.primary = img
+ self.primaryWidth = img.get_width()
+ self.primaryHeight = img.get_height()
+ if self.pixmap:
+ self.primaryX = (self.alloc.width - self.primaryWidth) // 2
+ self.primaryY = (self.alloc.height - self.primaryHeight) // 2
+ self._updatePixmap()
+
+ def setSecondary( self, img ):
+ self.secondary = img
+ if img != None:
+ self.secondaryWidth = img.get_width()
+ self.secondaryHeight = img.get_height()
+ self.secondaryOffset = self.secondaryHeight//2
+ if self.pixmap:
+ self.secondaryX = (self.alloc.width - self.secondaryWidth) // 2
+ self.secondaryY = self.alloc.height//2
+ if self.pixmap:
+ self._updatePixmap()
+
+ def _updatePixmap( self ):
+ self.gc.foreground = self.color["background"]
+ self.pixmap.draw_rectangle( self.gc, True, 0, 0, self.alloc.width, self.alloc.height )
+ if self.secondary != None:
+ self.pixmap.draw_pixbuf( self.gc, self.primary, 0, 0, self.primaryX, self.primaryY, self.primaryWidth, self.primaryHeight//2, gtk.gdk.RGB_DITHER_NONE )
+ self.pixmap.draw_pixbuf( self.gc, self.secondary, 0, self.secondaryOffset, self.secondaryX, self.secondaryY, self.secondaryWidth, self.secondaryHeight//2, gtk.gdk.RGB_DITHER_NONE )
+ self.gc.foreground = self.color["divider"]
+ self.gc.set_line_attributes( 2, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.pixmap.draw_line( self.gc, 2, self.alloc.height//2, self.alloc.width-4, self.alloc.height//2 )
+ else:
+ self.pixmap.draw_pixbuf( self.gc, self.primary, 0, 0, self.primaryX, self.primaryY, self.primaryWidth, self.primaryHeight, gtk.gdk.RGB_DITHER_NONE )
+ self.queue_draw()
+
+ def expose( self, widget, event ):
+ self.window.draw_drawable( self.gc, self.pixmap, 0, 0, 0, 0, self.alloc.width, self.alloc.height )
+ self.gc.set_line_attributes( 4, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_MITER )
+ if self.secondary != None:
+ if self.clicked == "HOTSPOT_0" or (self.clicked == None and self.hover == "HOTSPOT_0" ):
+ self.gc.foreground = self.color["+/-Highlight"]
+ else:
+ self.gc.foreground = self.color["+/-"]
+ self.window.draw_line( self.gc, self.hotspots[0][0], self.hotspots[0][5], self.hotspots[0][2], self.hotspots[0][5] )
+ if self.clicked == "HOTSPOT_1" or (self.clicked == None and self.hover == "HOTSPOT_1" ):
+ self.gc.foreground = self.color["+/-Highlight"]
+ else:
+ self.gc.foreground = self.color["+/-"]
+ self.window.draw_line( self.gc, self.hotspots[1][0], self.hotspots[1][5], self.hotspots[1][2], self.hotspots[1][5] )
+ else:
+ if self.clicked == "HOTSPOT_0" or self.hover == "HOTSPOT_0":
+ self.gc.foreground = self.color["+/-Highlight"]
+ else:
+ self.gc.foreground = self.color["+/-"]
+ self.window.draw_line( self.gc, self.hotspots[0][0], self.hotspots[0][5], self.hotspots[0][2], self.hotspots[0][5] )
+ self.window.draw_line( self.gc, self.hotspots[0][4], self.hotspots[0][1], self.hotspots[0][4], self.hotspots[0][3] )
+
+ def set_palette(self, palette):
+ self._palette = palette
+ self._palette.props.invoker = WidgetInvoker(self)
+ self._palette.props.invoker._position_hint = WidgetInvoker.AT_CURSOR #This is a hack, will change with newer Palette API
+
+
+class instrumentPalette(Palette):
+ def __init__(self, label, trackID, edit):
+ Palette.__init__(self, label)
+
+ self.trackID = trackID
+ self.edit = edit
+
+ self.tooltips = gtk.Tooltips()
+
+ self.volumeBox = gtk.HBox()
+
+ self.muteButton = gtk.CheckButton()
+ self.muteButton.connect("toggled",self.edit.handlemuteButton, self.trackID)
+ self.muteButton.connect("button-press-event",self.edit.handlemuteButtonRightClick, self.trackID)
+ self.muteButton.set_active(True)
+ self.tooltips.set_tip(self.muteButton, _('Left click to mute, right click to solo'))
+
+ if self.trackID < 4:
+ exec "self.volumeSliderAdj = self.edit.GUI['2instrument%svolumeAdjustment']" % str(self.trackID+1)
+ else:
+ self.volumeSliderAdj = self.edit.GUI["2drumvolumeAdjustment"]
+ self.volumeSliderAdj.connect( "value-changed", self.edit.handleTrackVolume, self.trackID)
+ self.volumeSlider = gtk.HScale(adjustment = self.volumeSliderAdj)
+ self.volumeSlider.set_size_request(250, -1)
+ self.volumeSlider.set_inverted(False)
+ self.volumeSlider.set_draw_value(False)
+
+ self.volumeBox.pack_start(self.muteButton, padding = 5)
+ self.volumeBox.pack_start(self.volumeSlider, padding = 5)
+ self.volumeBox.show_all()
+
+ self.set_content(self.volumeBox)
+ \ No newline at end of file
diff --git a/TamTamEdit.activity/Edit/NoteInterface.py b/TamTamEdit.activity/Edit/NoteInterface.py
new file mode 100644
index 0000000..a5035dd
--- /dev/null
+++ b/TamTamEdit.activity/Edit/NoteInterface.py
@@ -0,0 +1,345 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import Config
+
+from Util.NoteDB import PARAMETER
+from Util.CSoundClient import new_csound_client
+
+class NoteInterface:
+
+ def __init__( self, noteDB, owner, note ):
+ self.noteDB = noteDB
+ self.owner = owner
+ self.note = note
+
+ self.origin = self.owner.getTrackOrigin( note.track )
+ self.firstTransform = True
+ self.x = 0
+ self.y = 0
+ self.width = 1
+ self.height = Config.NOTE_HEIGHT
+ self.imgX = 0
+ self.imgY = 0
+ self.imgWidth = 1
+ self.imgHeight = self.height + Config.NOTE_IMAGE_PADDING_MUL2
+
+ self.selected = False
+ self.potentialDeselect = False
+
+ self.oldOnset = -1
+ self.oldEnd = -1
+ self.oldPitch = -1
+ self.oldAmplitude = -1
+ self.oldBeats = -1
+ self.lastDragO = 0
+ self.lastDragP = 0
+ self.lastDragD = 0
+
+ self.image, self.imageSelected, self.colormap, self.baseColors = self.owner.getDrawingPackage( note.track )
+
+ self.updateParameter( None, None )
+
+ def destroy( self ):
+ if self.selected:
+ self.owner.deselectNotes( { self.note.track: [self] } )
+ else: # if we were deselected above the rect has already been invalidated
+ self.owner.invalidate_rect( self.imgX, self.imgY, self.imgWidth, self.imgHeight, self.note.page, True )
+
+ def updateParameter( self, parameter, value ):
+ self.end = self.note.cs.onset + self.note.cs.duration
+
+ if self.oldAmplitude != self.note.cs.amplitude:
+ r = self.baseColors[0][0] + int(self.baseColors[1][0]*self.note.cs.amplitude)
+ g = self.baseColors[0][1] + int(self.baseColors[1][1]*self.note.cs.amplitude)
+ b = self.baseColors[0][2] + int(self.baseColors[1][2]*self.note.cs.amplitude)
+ self.color = self.colormap.alloc_color( r, g, b, True, True ) # TODO potential memory leak?
+ self.oldAmplitude = self.note.cs.amplitude
+
+ self.updateTransform()
+
+ def getId( self ):
+ return self.note.id
+
+ def getStartTick( self ):
+ return self.note.cs.onset
+
+ def getEndTick( self ):
+ return self.end
+
+ def testOnset( self, start, stop ):
+ return self.note.cs.onset >= start and self.note.cs.onset < stop
+
+ def getPitch( self ):
+ return self.note.cs.pitch
+
+ def updateTransform( self ):
+ if self.note.page in self.owner.getActivePages():
+ if not self.firstTransform:
+ oldX = self.imgX
+ oldY = self.imgY
+ oldEndX = self.imgX + self.imgWidth
+ dirty = True
+ else:
+ dirty = False
+
+ beats = self.noteDB.getPage( self.note.page ).beats
+ if self.note.cs.onset != self.oldOnset or beats != self.oldBeats:
+ self.x = self.owner.ticksToPixels( beats, self.note.cs.onset )
+ self.x += self.origin[0]
+ self.imgX = self.x - Config.NOTE_IMAGE_PADDING
+ self.oldOnset = self.note.cs.onset
+ if self.end != self.oldEnd or self.note.cs.onset != self.oldOnset or beats != self.oldBeats:
+ self.width = self.owner.ticksToPixels( beats, self.end ) - self.x + self.origin[0]
+ self.imgWidth = self.width + Config.NOTE_IMAGE_PADDING_MUL2
+ self.oldEnd = self.end
+ if self.note.cs.pitch != self.oldPitch:
+ self.y = self.owner.pitchToPixels( self.note.cs.pitch ) + self.origin[1]
+ self.imgY = self.y - Config.NOTE_IMAGE_PADDING
+ self.oldPitch = self.note.cs.pitch
+ self.oldBeats = beats
+
+ if dirty:
+ if self.firstTransform:
+ self.owner.invalidate_rect( self.imgX, self.imgY, self.imgWidth, self.imgHeight, self.note.page, True )
+ else:
+ x = min( self.imgX, oldX )
+ y = min( self.imgY, oldY )
+ endx = max( self.imgX + self.imgWidth, oldEndX )
+ endy = max( self.imgY, oldY ) + self.imgHeight
+ self.owner.invalidate_rect( x, y, endx-x, endy-y, self.note.page, True )
+
+ self.firstTransform = False
+
+ def updateDragLimits( self, dragLimits, leftBound, rightBound, widthBound, maxRightBound ):
+ left = leftBound - self.note.cs.onset
+ right = rightBound - self.note.cs.duration - self.note.cs.onset
+ up = Config.MAXIMUM_PITCH - self.note.cs.pitch
+ down = Config.MINIMUM_PITCH - self.note.cs.pitch
+ short = Config.MINIMUM_NOTE_DURATION - self.note.cs.duration
+ long = widthBound - self.note.cs.duration - self.note.cs.onset
+
+ if dragLimits[0][0] < left: dragLimits[0][0] = left
+ if dragLimits[0][1] > right: dragLimits[0][1] = right
+ if dragLimits[1][0] < down: dragLimits[1][0] = down
+ if dragLimits[1][1] > up: dragLimits[1][1] = up
+ if dragLimits[2][0] < short: dragLimits[2][0] = short
+ if dragLimits[2][1] > long: dragLimits[2][1] = long
+
+ # store the current loc as a reference point
+ self.baseOnset = self.note.cs.onset
+ self.basePitch = self.note.cs.pitch
+ self.baseDuration = self.note.cs.duration
+
+ def playSampleNote( self, full=True ):
+ secs_per_tick = 0.025
+ csnd = new_csound_client()
+
+ if full:
+ onset = self.note.cs.onset
+ self.note.cs.onset = 0
+ csnd.play( self.note.cs, 0.024)
+ self.note.cs.onset = onset
+ else:
+ (onset,duration) = ( self.note.cs.onset, self.note.cs.duration)
+ ( self.note.cs.onset, self.note.cs.duration) = (0, 10)
+ csnd.play( self.note.cs, 0.024)
+ ( self.note.cs.onset, self.note.cs.duration) = (onset,duration)
+
+ #=======================================================
+ # Events
+
+ # handleButtonPress returns:
+ # -2, not a hit but there was X overlap
+ # -1, event occurs before us so don't bother checking any later notes
+ # 0, event didn't hit
+ # 1, event was handled
+ def handleButtonPress( self, emitter, event ):
+ eX = event.x - self.x
+ if eX < 0:
+ return -1 # event occurs before us, no point in checking further
+ if eX > self.width:
+ return 0 # no X overlap
+
+ eY = event.y - self.y
+ if eY < 0 or eY > self.height:
+ return -2 # not a hit, but it was in our X range
+
+ if event.button == 3:
+ print "Show some note parameters!?!"
+ #self.noteParameters = NoteParametersWindow( self.note, self.getNoteParameters )
+ return 1 # handled
+
+ playSample = False
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: # select bar
+ self.potentialDeselect = False
+ start = 0
+ check = self.note.cs.onset - Config.TICKS_PER_BEAT
+ while start <= check: start += Config.TICKS_PER_BEAT
+ stop = start + Config.TICKS_PER_BEAT
+ check += self.note.cs.duration
+ while stop < check: stop += Config.TICKS_PER_BEAT
+ emitter.selectNotesByBar( self.note.track, start, stop )
+ elif event.type == gtk.gdk._3BUTTON_PRESS: # select track
+ self.potentialDeselect = False
+ emitter.selectNotesByTrack( self.note.track )
+ else:
+ if self.selected: # we already selected, might want to delected
+ self.potentialDeselect = True
+ else:
+ emitter.selectNotes( { self.note.track: [ self ] } )
+ playSample = True
+
+ percent = eX/self.width
+ if percent < 0.3: emitter.setCurrentAction( "note-drag-onset", self )
+ elif percent > 0.7: emitter.setCurrentAction( "note-drag-duration", self )
+ else:
+ emitter.setCurrentAction( "note-drag-pitch", self )
+ if playSample: self.playSampleNote()
+
+ return 1
+
+ def handleButtonRelease( self, emitter, event, buttonPressCount ):
+
+ if self.potentialDeselect:
+ self.potentialDeselect = False
+ emitter.deselectNotes( { self.note.track: [ self ] } )
+
+ emitter.doneCurrentAction()
+
+ return True
+
+ def noteDragOnset( self, do, stream ):
+ self.potentialDeselect = False
+ if do != self.lastDragO:
+ self.lastDragO = do
+ stream += [ self.note.id, self.baseOnset + do ]
+
+ def noteDragPitch( self, dp, stream ):
+ self.potentialDeselect = False
+ if dp != self.lastDragP:
+ self.lastDragP = dp
+ stream += [ self.note.id, self.basePitch + dp ]
+
+ def noteDragDuration( self, dd, stream ):
+ self.potentialDeselect = False
+ if dd != self.lastDragD:
+ self.lastDragD = dd
+ stream += [ self.note.id, self.baseDuration + dd ]
+
+ def doneNoteDrag( self, emitter ):
+ self.baseOnset = self.note.cs.onset
+ self.basePitch = self.note.cs.pitch
+ self.baseDuration = self.note.cs.duration
+
+ self.lastDragO = 0
+ self.lastDragP = 0
+ self.lastDragD = 0
+
+ def noteDecOnset( self, step, leftBound, stream ):
+ if self.selected:
+ if leftBound < self.note.cs.onset:
+ onset = max( self.note.cs.onset+step, leftBound )
+ stream += [ self.note.id, onset ]
+ return onset + self.note.cs.duration
+ return self.end
+
+ def noteIncOnset( self, step, rightBound, stream ):
+ if self.selected:
+ if rightBound > self.end:
+ onset = min( self.end+step, rightBound ) - self.note.cs.duration
+ stream += [ self.note.id, onset ]
+ return onset
+ return self.note.cs.onset
+
+ def noteDecPitch( self, step, stream ):
+ if self.note.cs.pitch > Config.MINIMUM_PITCH:
+ stream += [ self.note.id, max( self.note.cs.pitch+step, Config.MINIMUM_PITCH ) ]
+
+ def noteIncPitch( self, step, stream ):
+ if self.note.cs.pitch < Config.MAXIMUM_PITCH:
+ stream += [ self.note.id, min( self.note.cs.pitch+step, Config.MAXIMUM_PITCH ) ]
+
+ def noteDecDuration( self, step, stream ):
+ if self.note.cs.duration > Config.MINIMUM_NOTE_DURATION:
+ stream += [ self.note.id, max( self.note.cs.duration+step, Config.MINIMUM_NOTE_DURATION ) ]
+
+ def noteIncDuration( self, step, rightBound, stream ):
+ if self.selected:
+ if self.end < rightBound:
+ stream += [ self.note.id, min( self.end+step, rightBound ) - self.note.cs.onset ]
+
+ def noteDecVolume( self, step, stream ):
+ if self.note.cs.amplitude > 0:
+ stream += [ self.note.id, max( self.note.cs.amplitude+step, 0 ) ]
+
+ def noteIncVolume( self, step, stream ):
+ if self.note.cs.amplitude < 1:
+ stream += [ self.note.id, min( self.note.cs.amplitude+step, 1 ) ]
+
+ def handleMarqueeSelect( self, emitter, start, stop ):
+ intersectionY = [ max(start[1],self.y), min(stop[1],self.y+self.height) ]
+ if intersectionY[0] > intersectionY[1]:
+ return False
+
+ intersectionX = [ max(start[0],self.x), min(stop[0],self.x+self.width) ]
+ if intersectionX[0] > intersectionX[1]:
+ return False
+
+ return True
+
+ # updateTooltip returns:
+ # -2, not a hit but there was X overlap
+ # -1, event occurs before us so don't bother checking any later notes
+ # 0, event didn't hit
+ # 1, event was handled
+ def updateTooltip( self, emitter, event ):
+ eX = event.x - self.x
+ if eX < 0:
+ return -1 # event occurs before us, no point in checking further
+ if eX > self.width:
+ return 0 # no X overlap
+
+ eY = event.y - self.y
+ if eY < 0 or eY > self.height:
+ return -2 # not a hit, but it was in our X range
+
+ percent = eX/self.width
+ if percent < 0.3: emitter.setCursor("drag-onset")
+ elif percent > 0.7: emitter.setCursor("drag-duration")
+ else: emitter.setCursor("drag-pitch")
+
+ return 1 # we handled it
+
+ #=======================================================
+ # Selection
+
+ def setSelected( self, state ):
+ if self.selected != state:
+ self.selected = state
+ self.owner.invalidate_rect( self.imgX, self.imgY, self.imgWidth, self.imgHeight, self.note.page )
+ return True # state changed
+ return False # state is the same
+
+ def getSelected( self ):
+ return self.selected
+
+ #=======================================================
+ # Draw
+
+ def draw( self, win, gc, startX, stopX ):
+ if stopX < self.imgX: return False # we don't need to draw and no one after us will draw
+ if startX > self.imgX + self.imgWidth: return True # we don't need to draw, but maybe a later note does
+
+ gc.foreground = self.color
+ win.draw_rectangle( gc, True, self.x+1, self.y+1, self.width-2, self.height-2 )
+
+ if self.selected: img = self.imageSelected
+ else: img = self.image
+ win.draw_pixbuf( gc, img, 0, 0, self.imgX, self.imgY, self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgHeight, gtk.gdk.RGB_DITHER_NONE )
+ win.draw_pixbuf( gc, img, Config.NOTE_IMAGE_TAIL, 0, self.imgX+self.imgWidth-Config.NOTE_IMAGE_ENDLENGTH, self.imgY, Config.NOTE_IMAGE_ENDLENGTH, self.imgHeight, gtk.gdk.RGB_DITHER_NONE )
+
+ return True # we drew something
+
diff --git a/TamTamEdit.activity/Edit/Properties.py b/TamTamEdit.activity/Edit/Properties.py
new file mode 100644
index 0000000..b0caae0
--- /dev/null
+++ b/TamTamEdit.activity/Edit/Properties.py
@@ -0,0 +1,808 @@
+import pygtk
+pygtk.require('2.0')
+import gtk
+from types import *
+from math import sqrt
+from random import *
+from Generation.Drunk import *
+from Generation.GenerationConstants import GenerationConstants
+from Util.ThemeWidgets import *
+from Util.NoteDB import PARAMETER
+import Config
+Tooltips = Config.Tooltips()
+
+class Properties( gtk.VBox ):
+ def __init__( self, noteDB, doneHandler, popup ):
+ gtk.VBox.__init__( self )
+ self.tooltips = gtk.Tooltips()
+ self.noteDB = noteDB
+ #self.doneHandler = doneHandler
+ self.popup = popup
+ self.popup.resize( 545, 378 )
+
+ self.context = "page"
+ self.notes = {} # notes indexed by page and track
+ self.setup = False # flag to block note updates durning setup
+
+ self.line = Line(0, 100)
+ self.drunk = Drunk(0, 100)
+ self.droneAndJump = DroneAndJump(0, 100)
+ self.repeter = Repeter(0, 100)
+ self.loopseg = Loopseg(0, 100)
+ self.algoTypes = [self.line, self.drunk, self.droneAndJump, self.repeter, self.loopseg]
+ self.algorithm = self.algoTypes[0]
+
+ #self.set_size_request( 300, 200 )
+
+ self.filterType = 0
+ self.minValue = 0.
+ self.maxValue = 100.
+ self.paraValue = 20.
+
+ self.activeWidget = None
+
+ self.pageIds = []
+
+ self.GUI = {}
+ self.parametersBox = RoundHBox(fillcolor=Config.INST_BCK_COLOR, bordercolor=Config.PANEL_BCK_COLOR)
+ #self.parametersBox.set_border_width(1)
+ self.parametersBox.set_radius(10)
+ self.pack_start(self.parametersBox)
+ self.fixed = gtk.Fixed()
+ self.parametersBox.pack_start( self.fixed )
+
+ self.controlsBox = gtk.HBox()
+
+ #-- Page Properties ------------------------------------------------
+ self.pageBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ self.pageBox.set_size_request( 125, -1 )
+ self.pageBox.set_border_width(3)
+ self.pageBox.set_radius(10)
+ beatBox = gtk.VBox()
+ self.beatAdjust = gtk.Adjustment( 4, 2, 12, 1, 1, 0)
+ self.GUI['beatSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.beatAdjust, 7 )
+ self.GUI['beatSlider'].connect("button-release-event", self.handleBeat)
+ self.GUI['beatSlider'].set_snap( 1 )
+ self.GUI['beatSlider'].set_inverted(True)
+ self.GUI['beatSlider'].set_size_request(50, 200)
+ beatBox.pack_start( self.GUI['beatSlider'] )
+ self.beatLabel = gtk.Image()
+ self.beatLabel.set_from_file(Config.IMAGE_ROOT + 'volume3.png')
+ self.beatAdjust.connect("value-changed", self.updateBeatLabel)
+ self.updateBeatLabel( self.beatAdjust )
+ beatBox.pack_start( self.beatLabel )
+ self.pageBox.pack_start( beatBox )
+ colorBox = gtk.VBox()
+ self.GUI["color0Button"] = ImageRadioButton( None, Config.IMAGE_ROOT+"pageThumbnailBut0.png", Config.IMAGE_ROOT+"pageThumbnailBut0Down.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI["color0Button"].set_size_request( 80, -1 )
+ self.GUI["color0Button"].connect( "clicked", self.handleColor, 0 )
+ colorBox.pack_start( self.GUI["color0Button"] )
+ self.GUI["color1Button"] = ImageRadioButton( self.GUI["color0Button"], Config.IMAGE_ROOT+"pageThumbnailBut1.png", Config.IMAGE_ROOT+"pageThumbnailBut1Down.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI["color1Button"].connect( "clicked", self.handleColor, 1 )
+ colorBox.pack_start( self.GUI["color1Button"] )
+ self.GUI["color2Button"] = ImageRadioButton( self.GUI["color0Button"], Config.IMAGE_ROOT+"pageThumbnailBut2.png", Config.IMAGE_ROOT+"pageThumbnailBut2Down.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI["color2Button"].connect( "clicked", self.handleColor, 2 )
+ colorBox.pack_start( self.GUI["color2Button"] )
+ self.GUI["color3Button"] = ImageRadioButton( self.GUI["color0Button"], Config.IMAGE_ROOT+"pageThumbnailBut3.png", Config.IMAGE_ROOT+"pageThumbnailBut3Down.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI["color3Button"].connect( "clicked", self.handleColor, 3 )
+ colorBox.pack_start( self.GUI["color3Button"] )
+ self.pageBox.pack_start( colorBox )
+ self.pageBox.show_all()
+ #self.controlsBox.pack_start(self.pageBox)
+
+ #-- Note Properties ------------------------------------------------
+ pitchBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ pitchBox.set_border_width(3)
+ pitchBox.set_radius(10)
+ self.GUI['pitchUp'] = ImageButton( Config.IMAGE_ROOT+"arrowEditUp.png", Config.IMAGE_ROOT+"arrowEditUpDown.png", Config.IMAGE_ROOT+"arrowEditUpOver.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['pitchUp'].connect( "clicked", lambda w:self.stepPitch( 1 ) )
+ self.GUI['pitchGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['pitchGen'].connect( "clicked", self.openAlgoBox, 'pitch' )
+ pitchBox.pack_start( self.GUI['pitchGen'], False, False, 5 )
+ pitchBox.pack_start( self.GUI['pitchUp'] )
+ self.pitchIcon = gtk.Image()
+ self.pitchIcon.set_from_file(Config.IMAGE_ROOT + 'propPitch2.png')
+ pitchBox.pack_start(self.pitchIcon)
+ self.GUI['pitchDown'] = ImageButton( Config.IMAGE_ROOT+"arrowEditDown.png", Config.IMAGE_ROOT+"arrowEditDownDown.png", Config.IMAGE_ROOT+"arrowEditDownOver.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['pitchDown'].connect( "clicked", lambda w:self.stepPitch( -1 ) )
+ pitchBox.pack_start( self.GUI['pitchDown'] )
+ self.controlsBox.pack_start(pitchBox)
+
+ volumeBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ volumeBox.set_border_width(3)
+ volumeBox.set_radius(10)
+ self.GUI['volumeUp'] = ImageButton( Config.IMAGE_ROOT+"arrowEditUp.png", Config.IMAGE_ROOT+"arrowEditUpDown.png", Config.IMAGE_ROOT+"arrowEditUpOver.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['volumeUp'].connect( "clicked", lambda w:self.stepVolume( 0.1 ) )
+ self.GUI['volumeGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['volumeGen'].connect( "clicked", self.openAlgoBox, 'volume' )
+ volumeBox.pack_start( self.GUI['volumeGen'], False, False, 5 )
+ volumeBox.pack_start( self.GUI['volumeUp'] )
+ self.volumeIcon = gtk.Image()
+ self.volumeIcon.set_from_file(Config.IMAGE_ROOT + 'volume3.png')
+ volumeBox.pack_start(self.volumeIcon)
+ self.GUI['volumeDown'] = ImageButton( Config.IMAGE_ROOT+"arrowEditDown.png", Config.IMAGE_ROOT+"arrowEditDownDown.png", Config.IMAGE_ROOT+"arrowEditDownOver.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['volumeDown'].connect( "clicked", lambda w:self.stepVolume( -0.1 ) )
+ volumeBox.pack_start( self.GUI['volumeDown'] )
+ self.controlsBox.pack_start(volumeBox)
+
+ panBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ panBox.set_border_width(3)
+ panBox.set_radius(10)
+ self.panAdjust = gtk.Adjustment( 0.5, 0, 1, .1, .1, 0)
+ self.GUI['panSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.panAdjust, 7 )
+ self.panAdjust.connect("value-changed", self.handlePan)
+ self.GUI['panSlider'].set_snap( 0.1 )
+ self.GUI['panSlider'].set_inverted(True)
+ self.GUI['panSlider'].set_size_request(50, 200)
+ self.panLabel = gtk.Image()
+ self.handlePan( self.panAdjust )
+ self.GUI['panGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['panGen'].connect( "clicked", self.openAlgoBox, 'pan' )
+ panBox.pack_start(self.GUI['panGen'], True, True, 5)
+ panBox.pack_start(self.GUI['panSlider'], True, True, 5)
+ panBox.pack_start(self.panLabel, False, padding=10)
+ self.controlsBox.pack_start(panBox)
+
+ reverbBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ reverbBox.set_border_width(3)
+ reverbBox.set_radius(10)
+ self.reverbAdjust = gtk.Adjustment(0.1, 0, 1, 0.1, 0.1, 0)
+ self.GUI['reverbSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.reverbAdjust, 7 )
+ self.reverbAdjust.connect("value-changed", self.handleReverb)
+ self.GUI['reverbSlider'].set_snap( 0.1 )
+ self.GUI['reverbSlider'].set_inverted(True)
+ self.GUI['reverbSlider'].set_size_request(50, 200)
+ self.reverbLabel = gtk.Image()
+ self.handleReverb( self.reverbAdjust )
+ self.GUI['reverbGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['reverbGen'].connect( "clicked", self.openAlgoBox, 'reverb' )
+ reverbBox.pack_start(self.GUI['reverbGen'], True, True, 5)
+ reverbBox.pack_start(self.GUI['reverbSlider'], True, True, 5)
+ reverbBox.pack_start(self.reverbLabel, False, padding=10)
+ self.controlsBox.pack_start(reverbBox)
+
+ attackBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ attackBox.set_border_width(3)
+ attackBox.set_radius(10)
+ self.attackAdjust = gtk.Adjustment(0.04, 0.03, 1, .01, .01, 0)
+ self.GUI['attackSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.attackAdjust, 7 )
+ self.attackAdjust.connect("value-changed", self.handleAttack)
+ self.GUI['attackSlider'].set_snap( 0.01 )
+ self.GUI['attackSlider'].set_inverted(True)
+ self.GUI['attackSlider'].set_size_request(50, 200)
+ self.attackLabel = gtk.Image()
+ self.handleAttack( self.attackAdjust )
+ self.GUI['attackGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['attackGen'].connect( "clicked", self.openAlgoBox, 'attack' )
+ attackBox.pack_start(self.GUI['attackGen'], True, True, 5)
+ attackBox.pack_start(self.GUI['attackSlider'], True, True, 5)
+ attackBox.pack_start(self.attackLabel, False, padding=10)
+ self.controlsBox.pack_start(attackBox)
+
+ decayBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ decayBox.set_border_width(3)
+ decayBox.set_radius(10)
+ self.decayAdjust = gtk.Adjustment(0.31, 0.03, 1, .01, .01, 0)
+ self.GUI['decaySlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.decayAdjust, 7 )
+ self.decayAdjust.connect("value-changed", self.handleDecay)
+ self.GUI['decaySlider'].set_snap( 0.01 )
+ self.GUI['decaySlider'].set_inverted(True)
+ self.GUI['decaySlider'].set_size_request(50, 200)
+ self.decayLabel = gtk.Image()
+ self.handleDecay( self.decayAdjust )
+ self.GUI['decayGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['decayGen'].connect( "clicked", self.openAlgoBox, 'decay' )
+ decayBox.pack_start(self.GUI['decayGen'], True, True, 5)
+ decayBox.pack_start(self.GUI['decaySlider'], True, True, 5)
+ decayBox.pack_start(self.decayLabel, False, padding=10)
+ self.controlsBox.pack_start(decayBox)
+
+ filterBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ filterBox.set_border_width(3)
+ filterBox.set_radius(10)
+
+ filterTypeBox = gtk.VBox()
+ self.GUI['filterTypeLowButton'] = ImageToggleButton(Config.IMAGE_ROOT + 'propLow3.png', Config.IMAGE_ROOT + 'propLow3Sel.png', Config.IMAGE_ROOT + 'propLow3Over.png')
+ self.GUI['filterTypeLowButton'].connect( "toggled", self.handleFilterType, 1 )
+ filterTypeBox.pack_start( self.GUI['filterTypeLowButton'] )
+ self.GUI['filterTypeHighButton'] = ImageToggleButton(Config.IMAGE_ROOT + 'propHi3.png', Config.IMAGE_ROOT + 'propHi3Sel.png', Config.IMAGE_ROOT + 'propHi3Over.png')
+ self.GUI['filterTypeHighButton'].connect( "toggled", self.handleFilterType, 2 )
+ filterTypeBox.pack_start( self.GUI['filterTypeHighButton'] )
+ self.GUI['filterTypeBandButton'] = gtk.ToggleButton( "B" )
+ self.GUI['filterTypeBandButton'] = ImageToggleButton(Config.IMAGE_ROOT + 'propBand3.png', Config.IMAGE_ROOT + 'propBand3Sel.png', Config.IMAGE_ROOT + 'propBand3Over.png')
+ self.GUI['filterTypeBandButton'].connect( "toggled", self.handleFilterType, 3 )
+ filterTypeBox.pack_start( self.GUI['filterTypeBandButton'] )
+ filterBox.pack_start( filterTypeBox )
+
+ self.filterSliderBox = gtk.VBox()
+ self.filterSliderBox.set_size_request(50, -1)
+ self.cutoffAdjust = gtk.Adjustment(1000, 100, 7000, 100, 100, 0)
+ self.GUI['cutoffSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.cutoffAdjust, 7 )
+ self.GUI['cutoffSlider'].set_snap(100)
+ self.cutoffAdjust.connect("value-changed", self.handleFilter)
+ self.GUI['cutoffSlider'].set_inverted(True)
+ self.GUI['cutoffSlider'].set_size_request(50, 200)
+ self.GUI['cutoffGen'] = ImageToggleButton( Config.IMAGE_ROOT+"diceProp.png", Config.IMAGE_ROOT+"dicePropSel.png", Config.IMAGE_ROOT+"dicePropSel.png", backgroundFill = Config.PANEL_COLOR )
+ self.GUI['cutoffGen'].connect( "clicked", self.openAlgoBox, 'cutoff' )
+ self.filterSliderBox.pack_start(self.GUI['cutoffGen'], True, True, 5)
+ self.filterSliderBox.pack_start(self.GUI['cutoffSlider'], True, True, 5)
+ self.filterLabel = gtk.Image()
+ self.filterLabel.set_from_file(Config.IMAGE_ROOT + 'propFilter1.png')
+ self.filterSliderBox.pack_start(self.filterLabel, False, padding=10)
+
+ filterBox.pack_start(self.filterSliderBox)
+
+ self.controlsBox.pack_start(filterBox)
+
+ self.algoBox = RoundVBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ self.algoBox.set_size_request( -1, 378 )
+ self.algoBox.set_border_width(3)
+ self.algoBox.set_radius(10)
+ #self.algoBox = gtk.VBox()
+
+ algoUpperBox = gtk.HBox()
+
+ algoRadioButtonBox = gtk.VBox()
+ algoRadioButtonBox.set_size_request(100, 150)
+ #algoRadioButtonBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ #algoRadioButtonBox.set_border_width(3)
+ #algoRadioButtonBox.set_radius(10)
+
+ self.GUI['line'] = ImageRadioButton( None, Config.IMAGE_ROOT + 'propLine.png', Config.IMAGE_ROOT + 'propLineDown.png', Config.IMAGE_ROOT + 'propLineOver.png' )
+ self.GUI['line'].connect( "toggled", self.handleAlgo, 0 )
+ algoRadioButtonBox.pack_start( self.GUI['line'], False, False, 1 )
+ self.GUI['drunk'] = ImageRadioButton( self.GUI['line'], Config.IMAGE_ROOT + 'propDrunk.png', Config.IMAGE_ROOT + 'propDrunkDown.png', Config.IMAGE_ROOT + 'propDrunkOver.png' )
+ self.GUI['drunk'].connect( "toggled", self.handleAlgo, 1 )
+ algoRadioButtonBox.pack_start( self.GUI['drunk'], False, False, 1 )
+ self.GUI['droneJump'] = ImageRadioButton( self.GUI['line'], Config.IMAGE_ROOT + 'propDroneJump.png', Config.IMAGE_ROOT + 'propDroneJumpDown.png', Config.IMAGE_ROOT + 'propDroneJumpOver.png' )
+ self.GUI['droneJump'].connect( "toggled", self.handleAlgo, 2 )
+ algoRadioButtonBox.pack_start( self.GUI['droneJump'], False, False, 1 )
+ self.GUI['repeater'] = ImageRadioButton( self.GUI['line'], Config.IMAGE_ROOT + 'propRepeater.png', Config.IMAGE_ROOT + 'propRepeaterDown.png', Config.IMAGE_ROOT + 'propRepeaterOver.png' )
+ self.GUI['repeater'].connect( "toggled", self.handleAlgo, 3 )
+ algoRadioButtonBox.pack_start( self.GUI['repeater'], False, False, 1 )
+ self.GUI['loopseg'] = ImageRadioButton( self.GUI['line'], Config.IMAGE_ROOT + 'propLoopseg.png', Config.IMAGE_ROOT + 'propLoopsegDown.png', Config.IMAGE_ROOT + 'propLoopsegOver.png' )
+ self.GUI['loopseg'].connect( "toggled", self.handleAlgo, 4 )
+ algoRadioButtonBox.pack_start( self.GUI['loopseg'], False, False, 1 )
+
+ algoUpperBox.pack_start(algoRadioButtonBox)
+
+ algoSlidersBox = gtk.HBox()
+ algoSlidersBox.set_size_request(150, 320)
+ #algoSlidersBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ #algoSlidersBox.set_border_width(3)
+ #algoSlidersBox.set_radius(10)
+ minBox = gtk.VBox()
+ self.minAdjust = gtk.Adjustment(0, 0, 100, 1, 1, 0)
+ self.GUI['minSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.minAdjust, 7 )
+ self.GUI['minSlider'].set_snap(1)
+ self.minAdjust.connect("value-changed", self.handleMin)
+ self.GUI['minSlider'].set_inverted(True)
+ self.GUI['minSlider'].set_size_request(50, 200)
+ minBox.pack_start(self.GUI['minSlider'], True, True, 5)
+ algoSlidersBox.pack_start(minBox)
+
+ maxBox = gtk.VBox()
+ self.maxAdjust = gtk.Adjustment(100, 0, 100, 1, 1, 0)
+ self.GUI['maxSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.maxAdjust, 7 )
+ self.GUI['maxSlider'].set_snap(1)
+ self.maxAdjust.connect("value-changed", self.handleMax)
+ self.GUI['maxSlider'].set_inverted(True)
+ self.GUI['maxSlider'].set_size_request(50, 200)
+ maxBox.pack_start(self.GUI['maxSlider'], True, True, 5)
+ algoSlidersBox.pack_start(maxBox)
+
+ paraBox = gtk.VBox()
+ self.paraAdjust = gtk.Adjustment(20, 0, 100, 1, 1, 0)
+ self.GUI['paraSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.paraAdjust, 7 )
+ self.GUI['paraSlider'].set_snap(1)
+ self.paraAdjust.connect("value-changed", self.handlePara)
+ self.GUI['paraSlider'].set_inverted(True)
+ self.GUI['paraSlider'].set_size_request(50, 200)
+ paraBox.pack_start(self.GUI['paraSlider'], True, True, 5)
+ algoSlidersBox.pack_start(paraBox)
+
+ algoUpperBox.pack_start(algoSlidersBox)
+
+ self.algoBox.pack_start(algoUpperBox)
+
+ #transButtonBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ #transButtonBox.set_border_width(3)
+ #transButtonBox.set_radius(10)
+ transButtonBox = gtk.HBox()
+ transButtonBox.set_size_request(150, 50)
+
+ # create cancel/check button
+ self.GUI["checkButton"] = ImageButton(Config.IMAGE_ROOT + 'check.png', backgroundFill=Config.PANEL_COLOR )
+ self.GUI["checkButton"].connect("clicked", self.apply)
+
+ self.GUI["cancelButton"] = ImageButton(Config.IMAGE_ROOT + 'closeA.png', backgroundFill=Config.PANEL_COLOR )
+ self.GUI["cancelButton"].connect("clicked", self.cancel)
+
+ transButtonBox.pack_end(self.GUI["checkButton"], False, False, 10)
+ transButtonBox.pack_end(self.GUI["cancelButton"], False, False)
+ self.algoBox.pack_start(transButtonBox)
+
+ self.fixed.put( self.controlsBox, 0, 0 )
+ self.algoBox.show_all()
+
+ # set tooltips
+ for key in self.GUI:
+ if Tooltips.PROP.has_key(key):
+ self.tooltips.set_tip(self.GUI[key],Tooltips.PROP[key])
+ self.tooltips.set_tip(self.GUI['paraSlider'], 'Random')
+
+
+ self.show_all()
+
+ def openAlgoBox( self, widget, data=None ):
+ if widget.get_active() == True:
+ self.property = data
+ if self.activeWidget:
+ self.activeWidget.set_active(False)
+ self.activeWidget = widget
+ if self.context == "page":
+ if self.algoBox.parent == None: self.fixed.put( self.algoBox, 671, 0 )
+ else: self.fixed.move( self.algoBox, 671, 0 )
+ self.popup.resize( 927, 378 )
+ else:
+ self.popup.resize( 801, 378 )
+ if self.algoBox.parent == None: self.fixed.put( self.algoBox, 545, 0 )
+ else: self.fixed.move( self.algoBox, 545, 0 )
+ else:
+ self.property = None
+ self.activeWidget = None
+ if self.algoBox.parent != None:
+ if self.context == "page": self.popup.resize( 671, 378 )
+ else: self.popup.resize( 545, 378 )
+ self.fixed.remove( self.algoBox )
+
+ def setContext( self, context, scale, pageIds = None, trackIds = None, notes = {} ):
+ self.context = context
+ self.scale = GenerationConstants.SCALES[scale]
+ self.notes = {}
+ self.pageIds = pageIds
+ self.trackIds = trackIds
+
+ try:
+ self.activeWidget.set_active(False)
+ self.activeWidget = None
+ except:
+ self.activeWidget = None
+
+ if context == "page":
+ if self.pageBox.parent == None:
+ self.controlsBox.pack_start( self.pageBox )
+ self.controlsBox.reorder_child( self.pageBox, 0 )
+ self.controlsBox.set_size_request( 671, 378 )
+ self.popup.resize( 671, 378 )
+ self.trackIds = [0,1,2,3,4]
+ for p in pageIds:
+ self.notes[p] = {}
+ for t in range(Config.NUMBER_OF_TRACKS):
+ self.notes[p][t] = self.noteDB.getNotesByTrack( p, t )
+ page = self.noteDB.getPage(pageIds[0])
+ self.beatAdjust.set_value(page.beats)
+ btn = "color%dButton" % page.color
+ self.GUI[btn].set_active(True)
+ elif context == "track":
+ if self.pageBox.parent != None:
+ self.controlsBox.remove( self.pageBox )
+ self.controlsBox.set_size_request( 545, 378 )
+ self.popup.resize( 545, 378 )
+ for p in pageIds:
+ self.notes[p] = {}
+ for t in trackIds:
+ self.notes[p][t] = self.noteDB.getNotesByTrack( p, t )
+ else:
+ if self.pageBox.parent != None:
+ self.controlsBox.remove( self.pageBox )
+ self.controlsBox.set_size_request( 545, 378 )
+ self.popup.resize( 545, 378 )
+ self.notes = notes
+ self.pageIds = self.notes.keys()
+ self.trackIds = self.notes[self.pageIds[0]].keys()
+
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ # initialize values from first note
+ self.setup = True
+ n = self.notes[p][t][0]
+ self.panAdjust.set_value( n.cs.pan )
+ self.reverbAdjust.set_value( n.cs.reverbSend )
+ self.attackAdjust.set_value( n.cs.attack )
+ self.decayAdjust.set_value( n.cs.decay )
+ if n.cs.filterType == 0:
+ self.GUI['filterTypeLowButton'].set_active(False)
+ self.GUI['filterTypeHighButton'].set_active(False)
+ self.GUI['filterTypeBandButton'].set_active(False)
+ self.filterLabel.hide()
+ self.GUI['cutoffSlider'].hide()
+ self.GUI['cutoffGen'].hide()
+ else:
+ if n.cs.filterType == 1:
+ self.GUI['filterTypeLowButton'].set_active(True)
+ if n.cs.filterType == 2:
+ self.GUI['filterTypeHighButton'].set_active(True)
+ if n.cs.filterType == 3:
+ self.GUI['filterTypeBandButton'].set_active(True)
+ self.filterLabel.show()
+ self.GUI['cutoffSlider'].show()
+ self.GUI['cutoffGen'].show()
+ self.filterType = n.cs.filterType
+ self.cutoffAdjust.set_value( n.cs.filterCutoff )
+ self.setup = False
+ return
+
+ def handleColor( self, widget, index ):
+ stream = []
+ for page in self.pageIds:
+ stream += [ page, index ]
+ if len(stream):
+ self.noteDB.updatePages( [ PARAMETER.PAGE_COLOR, len(stream)//2 ] + stream )
+
+ def updateBeatLabel( self, adjust ):
+ beats = int(adjust.value)
+ self.beatLabel.set_from_file(Config.IMAGE_ROOT + 'propBeats' + str(beats) + '.png')
+
+ def handleBeat( self, widget, signal_id ):
+ beats = int(widget.get_adjustment().value)
+ stream = []
+ for page in self.pageIds:
+ stream += [ page, beats ]
+ if len(stream):
+ self.noteDB.updatePages( [ PARAMETER.PAGE_BEATS, len(stream)//2 ] + stream )
+
+
+ def stepPitch( self, step ):
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ substream = []
+ if step > 0:
+ if t != Config.NUMBER_OF_TRACKS-1: # regular note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MAXIMUM_PITCH:
+ substream += [ n.id, min( Config.MAXIMUM_PITCH, n.cs.pitch + step ) ]
+ else: # drum note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MAXIMUM_PITCH_DRUM:
+ substream += [ n.id, min( Config.MAXIMUM_PITCH_DRUM, n.cs.pitch + step*Config.PITCH_STEP_DRUM ) ]
+ else:
+ if t != Config.NUMBER_OF_TRACKS-1: # regular note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MINIMUM_PITCH:
+ substream += [ n.id, max( Config.MINIMUM_PITCH, n.cs.pitch + step ) ]
+ else: # drum note
+ for n in self.notes[p][t]:
+ if n.cs.pitch != Config.MINIMUM_PITCH_DRUM:
+ substream += [ n.id, max( Config.MINIMUM_PITCH_DRUM, n.cs.pitch + step*Config.PITCH_STEP_DRUM ) ]
+ if len(substream):
+ stream += [ p, t, PARAMETER.PITCH, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoPitch( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ scaleLength = len(self.scale)-1
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ if self.trackIds[t] != Config.NUMBER_OF_TRACKS-1:
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, self.scale[int(val*0.01*scaleLength)]+36 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.PITCH, len(substream)//2 ] + substream
+ else:
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ val = int((val*0.12)*2+24)
+ if val in GenerationConstants.DRUMPITCH.keys():
+ val = GenerationConstants.DRUMPITCH[val]
+ substream += [ n.id, val ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.PITCH, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def stepVolume( self, step ):
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ substream = []
+ if step > 0:
+ for n in self.notes[p][t]:
+ if n.cs.amplitude != Config.MAXIMUM_AMPLITUDE:
+ substream += [ n.id, min( Config.MAXIMUM_AMPLITUDE, n.cs.amplitude + step ) ]
+ else:
+ for n in self.notes[p][t]:
+ if n.cs.amplitude != Config.MINIMUM_AMPLITUDE:
+ substream += [ n.id, max( Config.MINIMUM_AMPLITUDE, n.cs.amplitude + step ) ]
+ if len(substream):
+ stream += [ p, t, PARAMETER.AMPLITUDE, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoVolume( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, min( Config.MAXIMUM_AMPLITUDE, val*0.01 ) ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.AMPLITUDE, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def handlePan( self, adjust ):
+ img = min( 4, int(adjust.value * 5) )
+ self.panLabel.set_from_file(Config.IMAGE_ROOT + 'propPan' + str(img) + '.png')
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.PAN, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoPan( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.01 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.PAN, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def handleReverb( self, adjust ):
+ img = min( 5, int(adjust.value * 6) )
+ self.reverbLabel.set_from_file(Config.IMAGE_ROOT + 'propReverb' + str(img) + '.png')
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.REVERB, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoReverb( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.02 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.REVERB, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def handleAttack( self, adjust ):
+ val = adjust.value #*adjust.value
+ img = min( 4, int(val * 4) )
+ self.attackLabel.set_from_file(Config.IMAGE_ROOT + 'propAtt' + str(img) + '.png')
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.ATTACK, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoAttack( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.01 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.ATTACK, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def handleDecay( self, adjust ):
+ val = adjust.value #*adjust.value
+ img = min( 4, int(val * 4) )
+ self.decayLabel.set_from_file(Config.IMAGE_ROOT + 'propDec' + str(img) + '.png')
+ if not self.setup:
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.DECAY, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoDecay( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*0.01 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.DECAY, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def handleFilterType( self, widget, type ):
+
+ if widget.get_active():
+ if self.filterType == 0:
+ self.filterLabel.show()
+ self.GUI['cutoffSlider'].show()
+ self.GUI['cutoffGen'].show()
+
+ self.filterType = type
+ self.updateFilterLabel()
+
+ if widget != self.GUI['filterTypeLowButton'] and self.GUI['filterTypeLowButton'].get_active():
+ self.GUI['filterTypeLowButton'].set_active( False )
+ if widget != self.GUI['filterTypeBandButton'] and self.GUI['filterTypeBandButton'].get_active():
+ self.GUI['filterTypeBandButton'].set_active( False )
+ if widget != self.GUI['filterTypeHighButton'] and self.GUI['filterTypeHighButton'].get_active():
+ self.GUI['filterTypeHighButton'].set_active( False )
+ if not self.setup:
+ typestream = []
+ cutoffstream = []
+ cutoff = self.cutoffAdjust.value
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ substream = []
+ typestream += [ p, t, PARAMETER.FILTERTYPE, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ typestream += [ n.id, type ]
+ if n.cs.filterCutoff != cutoff:
+ substream += [ n.id, cutoff ]
+ if len(substream):
+ cutoffstream += [ p, t, PARAMETER.FILTERCUTOFF, len(substream)//2 ] + substream
+ if len(typestream):
+ self.noteDB.updateNotes( typestream + [-1] )
+ if len(cutoffstream):
+ self.noteDB.updateNotes( cutoffstream + [-1] )
+
+ elif type == self.filterType:
+ self.filterType = 0
+ self.filterLabel.hide()
+ self.GUI['cutoffSlider'].hide()
+ self.GUI['cutoffGen'].hide()
+ if not self.setup:
+ typestream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ typestream += [ p, t, PARAMETER.FILTERTYPE, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ typestream += [ n.id, 0 ]
+ if len(typestream):
+ self.noteDB.updateNotes( typestream + [-1] )
+
+ def handleFilter( self, adjust ):
+ stream = []
+ for p in self.notes:
+ for t in self.notes[p]:
+ if len(self.notes[p][t]):
+ stream += [ p, t, PARAMETER.FILTERCUTOFF, len(self.notes[p][t]) ]
+ for n in self.notes[p][t]:
+ stream += [ n.id, adjust.value ]
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def algoCutoff( self, list, algorithm ):
+ maxValue = max(list[0], list[1])
+ stream = []
+ for t in range(len(self.trackIds)):
+ trackLength = 0
+ for p in range(len(self.pageIds)):
+ trackLength += len(self.notes[self.pageIds[p]][self.trackIds[t]])
+ algorithm.__init__(list[0], list[1], trackLength)
+ for p in range(len(self.pageIds)):
+ substream = []
+ for n in self.notes[self.pageIds[p]][self.trackIds[t]]:
+ val = algorithm.getNextValue(list[2], maxValue)
+ substream += [ n.id, val*70+100 ]
+ if len(substream):
+ stream += [ self.pageIds[p], self.trackIds[t], PARAMETER.FILTERCUTOFF, len(substream)//2 ] + substream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ self.updateFilterLabel()
+
+ def handleAlgo( self, widget, data ):
+ self.algorithm = self.algoTypes[data]
+ paraTooltips = ['Random', 'Maximum step', 'Maximum step', 'Maximum step', 'Maximum step']
+ self.tooltips.set_tip(self.GUI['paraSlider'], paraTooltips[data])
+
+ def handleMin( self, adjust ):
+ self.minValue = adjust.value
+
+ def handleMax( self, adjust ):
+ self.maxValue = adjust.value
+
+ def handlePara( self, adjust ):
+ self.paraValue = adjust.value
+
+ def apply( self, widget, data=None ):
+ valList = [self.minValue, self.maxValue, self.paraValue]
+ if self.property == 'pitch':
+ self.algoPitch(valList, self.algorithm)
+ elif self.property == 'volume':
+ self.algoVolume(valList, self.algorithm)
+ elif self.property == 'pan':
+ self.algoPan(valList, self.algorithm)
+ elif self.property == 'reverb':
+ self.algoReverb(valList, self.algorithm)
+ elif self.property == 'attack':
+ self.algoAttack(valList, self.algorithm)
+ elif self.property == 'decay':
+ self.algoDecay(valList, self.algorithm)
+ elif self.property == 'cutoff':
+ self.algoCutoff(valList, self.algorithm)
+ self.cancel(self.activeWidget)
+
+ def cancel( self, widget, data=None ):
+ self.activeWidget.set_active(False)
+
+ def updateFilterLabel( self ):
+ val = (self.cutoffAdjust.value-self.cutoffAdjust.lower)/(self.cutoffAdjust.upper-self.cutoffAdjust.lower)
+ img = min( 5, int(val * 6) )
+ self.filterLabel.set_from_file(Config.IMAGE_ROOT + 'propFilter%d.%d' % (self.filterType, img) + '.png')
+
+
+
+
+
+
diff --git a/TamTamEdit.activity/Edit/TrackInterface.py b/TamTamEdit.activity/Edit/TrackInterface.py
new file mode 100644
index 0000000..b8a3a27
--- /dev/null
+++ b/TamTamEdit.activity/Edit/TrackInterface.py
@@ -0,0 +1,1364 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import gobject
+
+from math import floor
+import time
+
+import Config
+from Edit.NoteInterface import NoteInterface
+from Edit.HitInterface import HitInterface
+from Edit.MainWindow import CONTEXT
+
+from Util.NoteDB import PARAMETER
+from Util.CSoundNote import CSoundNote
+from Generation.GenerationConstants import GenerationConstants
+from Util.Profiler import TP
+
+class SELECTNOTES:
+ ALL = -1
+ NONE = 0
+ ADD = 1
+ REMOVE = 2
+ FLIP = 3
+ EXCLUSIVE = 4
+
+class INTERFACEMODE:
+ DEFAULT = 0
+ DRAW = 1
+ PASTE_NOTES = 2
+ PASTE_TRACKS = 3
+ PAINT = 4
+
+class TrackInterfaceParasite:
+ def __init__( self, noteDB, owner, note ):
+ if note.track == Config.NUMBER_OF_TRACKS-1: # drum track
+ self.parasite = HitInterface( noteDB, owner, note )
+ else:
+ self.parasite = NoteInterface( noteDB, owner, note )
+
+ def attach( self ):
+ return self.parasite
+
+class TrackInterface( gtk.EventBox ):
+
+ def __init__( self, noteDB, owner, getScaleFunction ):
+ gtk.EventBox.__init__( self )
+
+ self.noteDB = noteDB
+ self.owner = owner
+ self.getScale = getScaleFunction
+
+ self.drawingArea = gtk.DrawingArea()
+ self.drawingAreaDirty = False # are we waiting to draw?
+ self.add( self.drawingArea )
+ self.dirtyRectToAdd = gtk.gdk.Rectangle() # used by the invalidate_rect function
+
+ self.fullWidth = 1 # store the maximum allowed width
+ self.width = 1
+ self.height = 1
+
+ self.interfaceMode = INTERFACEMODE.DEFAULT
+
+ self.curPage = -1 # this isn't a real page at all!
+ self.curBeats = 4
+ self.painting = False
+ self.pointerGrid = 1
+ self.drawGrid = Config.DEFAULT_GRID
+ self.paintGrid = Config.DEFAULT_GRID
+ self.paintNoteDur = Config.DEFAULT_GRID
+
+ self.selectedNotes = [ [] for i in range(Config.NUMBER_OF_TRACKS) ]
+
+ self.curAction = False # stores the current mouse action
+ self.curActionObject = False # stores the object that in handling the action
+
+ self.lastDO = self.lastDP = self.lastDrumDP = self.lastDD = None
+
+ self.clickButton = 0 # used in release and motion events to make sure we where actually the widget originally clicked. (hack for popup windows)
+ self.buttonPressCount = 1 # used on release events to indicate double/triple releases
+ self.clickLoc = [0,0] # location of the last click
+ self.marqueeLoc = False # current drag location of the marquee
+ self.marqueeRect = [[0,0],[0,0]]
+
+ self.pasteTick = -1
+ self.pasteTrack = -1
+ self.pasteRect = False
+
+ self.playheadT = 0
+ self.playheadX = Config.TRACK_SPACING_DIV2
+
+ self.cursor = { \
+ "default": None, \
+ "drag-onset": gtk.gdk.Cursor(gtk.gdk.SB_RIGHT_ARROW), \
+ "drag-pitch": gtk.gdk.Cursor(gtk.gdk.BOTTOM_SIDE), \
+ "drag-duration": gtk.gdk.Cursor(gtk.gdk.RIGHT_SIDE), \
+ "drag-playhead": gtk.gdk.Cursor(gtk.gdk.SB_H_DOUBLE_ARROW), \
+ "pencil": gtk.gdk.Cursor(gtk.gdk.PENCIL), \
+ "paste": gtk.gdk.Cursor(gtk.gdk.CENTER_PTR), \
+ "error": None }
+
+ self.add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK)
+
+ self.connect( "size-allocate", self.size_allocate )
+
+ self.drawingArea.connect( "expose-event", self.expose )
+ self.connect( "button-press-event", self.handleButtonPress )
+ self.connect( "button-release-event", self.handleButtonRelease )
+ self.connect( "motion-notify-event", self.handleMotion )
+
+ # prepare drawing stuff
+ hexToInt = { "0":0, "1":1, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "A":10, "B":11, "C":12, "D":13, "E":14, "F":15, "a":10, "b":11, "c":12, "d":13, "e":14, "f":15 }
+ self.trackColors = []
+ for i in Config.TRACK_COLORS:
+ low = ( 256*(hexToInt[i[0][1]]*16+hexToInt[i[0][2]]), 256*(hexToInt[i[0][3]]*16+hexToInt[i[0][4]]), 256*(hexToInt[i[0][5]]*16+hexToInt[i[0][6]]) )
+ high = ( 256*(hexToInt[i[1][1]]*16+hexToInt[i[1][2]]), 256*(hexToInt[i[1][3]]*16+hexToInt[i[1][4]]), 256*(hexToInt[i[1][5]]*16+hexToInt[i[1][6]]) )
+ delta = ( high[0]-low[0], high[1]-low[1], high[2]-low[2] )
+ self.trackColors.append( (low, delta) )
+
+ colormap = self.drawingArea.get_colormap()
+ self.beatColor = colormap.alloc_color( Config.BEAT_COLOR, True, True )
+ self.playheadColor = colormap.alloc_color( Config.PLAYHEAD_COLOR, True, True )
+ self.marqueeColor = colormap.alloc_color( Config.MARQUEE_COLOR, True, True )
+
+ self.image = {}
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+
+ def prepareDrawable( name ):
+ pix = gtk.gdk.pixbuf_new_from_file( Config.IMAGE_ROOT+name+".png" )
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ def preparePixbuf( name ):
+ self.image[name] = gtk.gdk.pixbuf_new_from_file( Config.IMAGE_ROOT+name+".png" )
+
+ prepareDrawable( "trackBG" )
+ prepareDrawable( "trackBGSelected" )
+ prepareDrawable( "trackBGDrum" )
+ prepareDrawable( "trackBGDrumSelected" )
+ preparePixbuf( "note" )
+ preparePixbuf( "noteSelected" )
+ preparePixbuf( "hit" )
+ preparePixbuf( "hitSelected" )
+
+ # define dimensions
+ self.width = self.trackFullWidth = self.image["trackBG"].get_size()[0]
+ self.trackWidth = self.width - Config.TRACK_SPACING
+ self.trackFullHeight = self.image["trackBG"].get_size()[1]
+ self.trackHeight = self.trackFullHeight - Config.TRACK_SPACING
+ self.trackFullHeightDrum = self.image["trackBGDrum"].get_size()[1]
+ self.trackHeightDrum = self.trackFullHeightDrum - Config.TRACK_SPACING
+ self.height = self.trackHeight*(Config.NUMBER_OF_TRACKS-1) + self.trackHeightDrum + Config.TRACK_SPACING*Config.NUMBER_OF_TRACKS
+ self.trackLimits = []
+ self.trackRect = []
+ self.drumIndex = Config.NUMBER_OF_TRACKS-1
+ for i in range(self.drumIndex):
+ start = i*(self.trackFullHeight)
+ self.trackLimits.append( (start,start+self.trackFullHeight) )
+ self.trackRect.append( gtk.gdk.Rectangle(Config.TRACK_SPACING_DIV2,start+Config.TRACK_SPACING_DIV2, self.trackWidth, self.trackHeight ) )
+ self.trackLimits.append( ( self.height - self.trackFullHeightDrum, self.height ) )
+ self.trackRect.append( gtk.gdk.Rectangle( Config.TRACK_SPACING_DIV2, self.height - self.trackFullHeightDrum + Config.TRACK_SPACING_DIV2, self.trackWidth, self.trackHeightDrum ) )
+
+ self.pitchPerPixel = float(Config.NUMBER_OF_POSSIBLE_PITCHES-1) / (self.trackHeight - Config.NOTE_HEIGHT)
+ self.pixelsPerPitch = float(self.trackHeight-Config.NOTE_HEIGHT)/(Config.MAXIMUM_PITCH - Config.MINIMUM_PITCH)
+ self.pitchPerPixelDrum = float(Config.NUMBER_OF_POSSIBLE_PITCHES_DRUM-1)*Config.PITCH_STEP_DRUM / (self.trackHeightDrum - Config.HIT_HEIGHT)
+ self.pixelsPerPitchDrum = float(self.trackHeightDrum-Config.HIT_HEIGHT)/(Config.MAXIMUM_PITCH_DRUM - Config.MINIMUM_PITCH_DRUM )
+
+ self.pixelsPerTick = [0] + [ self.trackWidth/float(i*Config.TICKS_PER_BEAT) for i in range(1,Config.MAXIMUM_BEATS+1) ]
+
+ self.ticksPerPixel = [0] + [ 1.0/self.pixelsPerTick[i] for i in range(1,Config.MAXIMUM_BEATS+1) ]
+
+ self.beatSpacing = [[0]]
+ for i in range(1,Config.MAXIMUM_BEATS+1):
+ self.beatSpacing.append( [ self.ticksToPixels( i, Config.TICKS_PER_BEAT*j ) for j in range(i) ] )
+
+ # screen buffers
+ self.screenBuf = [ gtk.gdk.Pixmap( win, self.width, self.height ), \
+ gtk.gdk.Pixmap( win, self.width, self.height ) ]
+ self.screenBufPage = [ -1, -1 ]
+ self.screenBufBeats = [ -1, -1 ]
+ self.screenBufDirtyRect = [ gtk.gdk.Rectangle(), gtk.gdk.Rectangle() ]
+ self.screenBufDirty = [ False, False ]
+ self.screenBufResume = [ [0,0], [0,0] ] # allows for stopping and restarting in the middle of a draw
+ self.curScreen = 0
+ self.preScreen = 1
+ self.predrawTimeout = False
+
+ #-- private --------------------------------------------
+
+ def _updateClipboardArea( self ):
+ self.clipboardArea = self.owner.getClipboardArea( self.curPage )
+ self.clipboardTrackTop = 0
+ for t in range(self.drumIndex):
+ if self.clipboardArea["tracks"][t]: break
+ self.clipboardTrackTop += 1
+ self.clipboardDrumTrack = self.clipboardArea["tracks"][self.drumIndex]
+
+ #=======================================================
+ # NoteDB notifications
+
+ def notifyPageAdd( self, id, at ):
+ return
+
+ def notifyPageDelete( self, which, safe ):
+ if self.screenBufPage[self.preScreen] in which:
+ self.screenBufPage[self.preScreen] = -1
+
+ def notifyPageDuplicate( self, new, at ):
+ return
+
+ def notifyPageMove( self, which, low, high ):
+ return
+
+ def notifyPageUpdate( self, page, parameter, value ):
+ if parameter == PARAMETER.PAGE_BEATS:
+ notes = self.noteDB.getNotesByPage( page, self )
+ for note in notes:
+ note.updateTransform()
+
+ if page == self.screenBufPage[self.curScreen]:
+ self.screenBufBeats[self.curScreen] = value
+ self.curBeats = value
+ if self.playheadT >= value*Config.TICKS_PER_BEAT:
+ self.playheadT = value*Config.TICKS_PER_BEAT - 1
+ self.playheadX = self.ticksToPixels( self.curBeats, self.playheadT ) + Config.TRACK_SPACING_DIV2
+ self.invalidate_rect( 0, 0, self.width, self.height, page )
+ if page == self.screenBufPage[self.preScreen]:
+ self.screenBufBeats[self.preScreen] = value
+ self.invalidate_rect( 0, 0, self.width, self.height, page )
+ self.predrawPage()
+
+
+ #=======================================================
+ # Module Interface
+
+ def getDrawingPackage( self, track ):
+ if track == self.drumIndex:
+ return ( self.image["hit"], self.image["hitSelected"], self.drawingArea.get_colormap(), self.trackColors[track] )
+ else:
+ return ( self.image["note"], self.image["noteSelected"], self.drawingArea.get_colormap(), self.trackColors[track] )
+
+ def getActivePages( self ):
+ return self.screenBufPage
+
+ def setPredrawPage( self, page ):
+ if self.screenBufPage[self.preScreen] != page:
+ self.screenBufPage[self.preScreen] = page
+ self.screenBufBeats[self.preScreen] = self.noteDB.getPage(page).beats
+ self.invalidate_rect( 0, 0, self.width, self.height, page )
+ return True
+ return False
+
+ def predrawPage( self ):
+ if self.screenBufPage[self.preScreen] == -1: return True # no page to predraw
+ if not self.predrawTimeout:
+ self.predrawTimeout = gobject.timeout_add( 50, self._predrawTimeout )
+
+ def abortPredrawPage( self ):
+ if self.predrawTimeout:
+ gobject.source_remove( self.predrawTimeout )
+ self.predrawTimeout = False
+
+ def _predrawTimeout( self ):
+ if self.preScreen == -1: return False # no page to predraw
+ if self.draw( self.preScreen, False, time.time() + 0.020 ): # 20 ms time limit
+ self.predrawTimeout = False
+ return False
+ return True
+
+
+
+ def displayPage( self, page, predraw = -1 ):
+ if page == self.curPage:
+ if predraw >= 0 and self.screenBufPage[self.preScreen] != predraw:
+ self.screenBufPage[self.preScreen] = predraw
+ self.screenBufBeats[self.preScreen] = self.noteDB.getPage(predraw).beats
+ self.invalidate_rect( 0, 0, self.width, self.height, predraw )
+ return
+
+ if self.curPage >= 0 and self.curPage != page: clearNotes = True
+ else: clearNotes = False
+
+ oldPage = self.curPage
+ self.curPage = page
+ self.curBeats = self.noteDB.getPage(page).beats
+
+ if self.screenBufPage[self.preScreen] == self.curPage: # we predrew this page, so smart!
+ t = self.preScreen
+ self.preScreen = self.curScreen
+ self.curScreen = t
+ self.invalidate_rect( 0, 0, self.width, self.height, self.curPage, False )
+ else: # we need to draw this page from scratch
+ self.screenBufPage[self.curScreen] = self.curPage
+ self.screenBufBeats[self.curScreen] = self.curBeats
+ self.invalidate_rect( 0, 0, self.width, self.height, self.curPage )
+
+ if predraw >= 0 and self.screenBufPage[self.preScreen] != predraw:
+ self.screenBufPage[self.preScreen] = predraw
+ self.screenBufBeats[self.preScreen] = self.noteDB.getPage(predraw).beats
+ self.invalidate_rect( 0, 0, self.width, self.height, predraw )
+
+ if clearNotes: # clear the notes now that we've sorted out the screen buffers
+ self.clearSelectedNotes( oldPage )
+
+ if self.curAction == "paste":
+ self._updateClipboardArea()
+
+ def getPlayhead( self ):
+ return self.playheadT
+
+ def setPlayhead( self, ticks ):
+ if self.playheadT != ticks:
+ self.invalidate_rect( self.playheadX-Config.PLAYHEAD_SIZE/2, 0, Config.PLAYHEAD_SIZE, self.height, self.curPage, False )
+ self.playheadX = self.ticksToPixels( self.curBeats, ticks ) + Config.TRACK_SPACING_DIV2
+ self.invalidate_rect( self.playheadX-Config.PLAYHEAD_SIZE/2, 0, Config.PLAYHEAD_SIZE, self.height, self.curPage, False )
+ self.playheadT = ticks
+
+ def setInterfaceMode( self, mode ):
+ self.doneCurrentAction()
+
+ if mode == "tool":
+ mode = self.owner.getTool()
+
+ if mode == "draw":
+ self.interfaceMode = INTERFACEMODE.DRAW
+ elif mode == "paint":
+ self.interfaceMode = INTERFACEMODE.PAINT
+ elif mode == "paste_notes":
+ self.interfaceMode = INTERFACEMODE.PASTE_NOTES
+ self.setCurrentAction("paste", self)
+ elif mode == "paste_tracks":
+ self.interfaceMode = INTERFACEMODE.PASTE_TRACKS
+ self.setCurrentAction("paste", self )
+ else:
+ self.interfaceMode = INTERFACEMODE.DEFAULT
+
+ def getSelectedNotes( self ):
+ ids = []
+ for t in range(Config.NUMBER_OF_TRACKS):
+ ids.append( [ n.note.id for n in self.selectedNotes[t] ] )
+ return ids
+
+ #=======================================================
+ # Event Callbacks
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ width = allocation.width
+ height = allocation.height
+
+ self.drawingArea.set_size_request( width, height )
+
+ if self.window != None:
+ self.invalidate_rect( 0, 0, width, height, self.curPage, False )
+
+ def setPointerGrid(self, value):
+ self.pointerGrid = value
+
+ def setDrawGrid(self, value):
+ self.drawGrid = value
+
+ def setPaintGrid(self, value):
+ self.paintGrid = value
+
+ def setPaintNoteDur(self, value):
+ self.paintNoteDur = value
+
+ def handleButtonPress( self, widget, event ):
+
+ TP.ProfileBegin( "TI::handleButtonPress" )
+
+ self.clickButton = event.button
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: self.buttonPressCount = 2
+ elif event.type == gtk.gdk._3BUTTON_PRESS: self.buttonPressCount = 3
+ else: self.buttonPressCount = 1
+
+ self.clickLoc = [ int(event.x), int(event.y) ]
+
+
+ if self.curAction == "paste":
+ self.doPaste()
+ self.setCurrentAction("block-track-select")
+ TP.ProfileEnd( "TI::handleButtonPress" )
+ return
+
+
+ # check if we clicked on the playhead
+ if event.x >= self.playheadX and event.x <= self.playheadX + Config.PLAYHEAD_SIZE:
+ self.setCurrentAction( "playhead-drag", self )
+ TP.ProfileEnd( "TI::handleButtonPress" )
+ return
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackLimits[i][0] > event.y: break
+ if self.trackLimits[i][1] < event.y: continue
+
+ handled = 0
+ notes = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ last = len(notes)-1
+ for n in range(last+1):
+ if i == self.drumIndex and n < last: # check to see if the next hit overlaps this one
+ if notes[n].getStartTick() == notes[n+1].getStartTick() and notes[n].getPitch() == notes[n+1].getPitch():
+ continue
+ handled = notes[n].handleButtonPress( self, event )
+ if handled == 0:
+ continue
+ elif handled == 1:
+ if not self.curAction: self.curAction = True # it was handled but no action was declared, set curAction to True anyway
+ TP.ProfileEnd( "TI::handleButtonPress" )
+ return
+ else: # all other options mean we can stop looking
+ break
+
+ if self.interfaceMode == INTERFACEMODE.DRAW:
+ if not handled or handled == -1: # event didn't overlap any notes, so we can draw
+ if i == self.drumIndex: pitch = min( self.pixelsToPitchDrumFloor( self.clickLoc[1] - self.trackLimits[i][1] + Config.HIT_HEIGHT//2 )//Config.PITCH_STEP_DRUM, Config.NUMBER_OF_POSSIBLE_PITCHES_DRUM-1)*Config.PITCH_STEP_DRUM + Config.MINIMUM_PITCH_DRUM
+ else: pitch = min( self.pixelsToPitchFloor( self.clickLoc[1] - self.trackLimits[i][1] + Config.NOTE_HEIGHT//2 ), Config.NUMBER_OF_POSSIBLE_PITCHES-1) + Config.MINIMUM_PITCH
+ onset = self.pixelsToTicksFloor( self.curBeats, self.clickLoc[0] - self.trackRect[i].x)
+ snapOnset = self.drawGrid * int(onset / float(self.drawGrid) + 0.5)
+ cs = CSoundNote( snapOnset,
+ pitch,
+ 0.75,
+ 0.5,
+ 1,
+ i,
+ instrumentId = self.owner.getTrackInstrument(i).instrumentId )
+ cs.pageId = self.curPage
+ id = self.noteDB.addNote( -1, self.curPage, i, cs )
+ n = self.noteDB.getNote( self.curPage, i, id, self )
+ self.selectNotes( { i:[n] }, True )
+ n.playSampleNote( False )
+
+ noteS = self.noteDB.getNotesByTrack(self.curPage, i)
+ for note in noteS:
+ if note.cs.onset < snapOnset and (note.cs.onset + note.cs.duration) > snapOnset:
+ self.noteDB.updateNote(self.curPage, i, note.id, PARAMETER.DURATION, snapOnset - note.cs.onset)
+
+ if i != self.drumIndex: # switch to drag duration
+ self.updateDragLimits()
+ self.clickLoc[0] += self.ticksToPixels( self.curBeats, 1 )
+ self.setCurrentAction( "note-drag-duration", n )
+ self.setCursor("drag-duration")
+ else:
+ self.curAction = True # we handled this, but there's no real action
+
+ TP.ProfileEnd( "TI::handleButtonPress" )
+ return
+ elif self.interfaceMode == INTERFACEMODE.PAINT:
+ self.scale = self.getScale()
+ self.painting = True
+ self.paintTrack = i
+ if i == self.drumIndex:
+ pitch = min( self.pixelsToPitchDrumFloor( self.clickLoc[1] - self.trackLimits[i][1] + Config.HIT_HEIGHT//2 )//Config.PITCH_STEP_DRUM, Config.NUMBER_OF_POSSIBLE_PITCHES_DRUM-1)*Config.PITCH_STEP_DRUM + Config.MINIMUM_PITCH_DRUM
+ if pitch < 24:
+ pitch = 24
+ elif pitch > 48:
+ pitch = 48
+ else:
+ pitch = pitch
+ else:
+ pitch = min( self.pixelsToPitchFloor( self.clickLoc[1] - self.trackLimits[i][1] + Config.NOTE_HEIGHT//2 ), Config.NUMBER_OF_POSSIBLE_PITCHES-1) + Config.MINIMUM_PITCH
+ if pitch < 24:
+ pitch = 24
+ elif pitch > 48:
+ pitch = 48
+ else:
+ pitch = pitch
+
+ minDiff = 100
+ for pit in GenerationConstants.SCALES[self.scale]:
+ diff = abs(pitch-(pit+36))
+ if diff < minDiff:
+ minDiff = diff
+ nearestPit = pit
+ pitch = nearestPit+36
+
+ onset = self.pixelsToTicksFloor( self.curBeats, self.clickLoc[0] - self.trackRect[i].x )
+ onset = self.paintGrid * int(onset / self.paintGrid + 0.5)
+ self.pLastPos = onset
+ if i != self.drumIndex:
+ noteS = self.noteDB.getNotesByTrack(self.curPage, i)
+ ids = []
+ stream = []
+ for n in noteS:
+ if n.cs.onset >= onset and n.cs.onset < (onset + self.paintNoteDur):
+ ids.append(n.id)
+ if onset > n.cs.onset and onset < (n.cs.onset + n.cs.duration):
+ ids.append(n.id)
+ if len(ids):
+ stream += [self.curPage, i, len(ids)] + ids
+ self.noteDB.deleteNotes( stream + [-1] )
+
+ cs = CSoundNote( int(onset),
+ pitch,
+ 0.75,
+ 0.5,
+ 1,
+ i,
+ instrumentId = self.owner.getTrackInstrument(i).instrumentId )
+ cs.pageId = self.curPage
+ id = self.noteDB.addNote( -1, self.curPage, i, cs )
+ self.noteDB.updateNote(self.curPage, i, id, PARAMETER.DURATION, self.paintNoteDur)
+ n = self.noteDB.getNote( self.curPage, i, id, self )
+ self.selectNotes( { i:[n] }, True )
+ n.playSampleNote( False )
+ self.curAction = True
+
+ TP.ProfileEnd( "TI::handleButtonPress" )
+
+
+ def handleButtonRelease( self, widget, event ):
+ if not self.clickButton: return # we recieved this event but were never clicked! (probably a popup window was open)
+ self.clickButton = 0
+ self.painting = False
+
+ TP.ProfileBegin( "TI::handleButtonRelease" )
+
+ if event.button != 1:
+ TP.ProfileEnd( "TI::handleButtonRelease" )
+ return
+
+ if not self.curAction: #do track selection stuff here so that we can also handle marquee selection
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackLimits[i][0] > event.y: break
+ if self.trackLimits[i][1] < event.y: continue
+ if event.button == 1:
+ if self.buttonPressCount == 1: self.owner.toggleTrack( i, False )
+ elif self.buttonPressCount == 2: self.owner.toggleTrack( i, True )
+ else: self.owner.clearTracks()
+ break
+
+ TP.ProfileEnd( "TI::handleButtonRelease" )
+ return
+
+ if not self.curActionObject: # there was no real action to carry out
+ self.curAction = False
+ TP.ProfileEnd( "TI::handleButtonRelease" )
+ return
+
+ if self.curActionObject != self:
+ self.curActionObject.handleButtonRelease( self, event, self.buttonPressCount )
+ self.updateTooltip( event )
+ else:
+ # we're doing the action ourselves
+ if self.curAction == "marquee": self.doneMarquee( event )
+ elif self.curAction == "playhead-drag": self.donePlayhead( event )
+ self.updateTooltip( event )
+
+
+ TP.ProfileEnd( "TI::handleButtonRelease" )
+ return
+
+ def handleMotion( self, widget, event ):
+ TP.ProfileBegin( "TI::handleMotion::Common" )
+
+ if event.is_hint:
+ x, y, state = self.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+
+ if self.painting:
+ i = self.paintTrack
+ curPos = self.pixelsToTicksFloor(self.curBeats, event.x - self.trackRect[i].x)
+ gridPos = self.paintGrid * int(curPos / self.paintGrid + 0.5)
+ if gridPos >= self.curBeats * Config.TICKS_PER_BEAT:
+ return
+ if gridPos != self.pLastPos:
+ self.pLastPos = gridPos
+ if i == self.drumIndex:
+ pitch = min( self.pixelsToPitchDrumFloor( int(event.y) - self.trackLimits[i][1] + Config.HIT_HEIGHT//2 )//Config.PITCH_STEP_DRUM, Config.NUMBER_OF_POSSIBLE_PITCHES_DRUM-1)*Config.PITCH_STEP_DRUM + Config.MINIMUM_PITCH_DRUM
+ if pitch < 24:
+ pitch = 24
+ elif pitch > 48:
+ pitch = 48
+ else:
+ pitch = pitch
+ else:
+ pitch = min( self.pixelsToPitchFloor( int(event.y) - self.trackLimits[i][1] + Config.NOTE_HEIGHT//2 ), Config.NUMBER_OF_POSSIBLE_PITCHES-1) + Config.MINIMUM_PITCH
+ if pitch < 24:
+ pitch = 24
+ elif pitch > 48:
+ pitch = 48
+ else:
+ pitch = pitch
+ minDiff = 100
+ for pit in GenerationConstants.SCALES[self.scale]:
+ diff = abs(pitch-(pit+36))
+ if diff < minDiff:
+ minDiff = diff
+ nearestPit = pit
+ pitch = nearestPit+36
+
+ onset = gridPos
+ if i != self.drumIndex:
+ noteS = self.noteDB.getNotesByTrack(self.curPage, i)
+ ids = []
+ stream = []
+ for n in noteS:
+ if n.cs.onset >= onset and n.cs.onset < (onset + self.paintNoteDur):
+ ids.append(n.id)
+ if onset > n.cs.onset and onset < (n.cs.onset + n.cs.duration):
+ ids.append(n.id)
+ if len(ids):
+ stream += [self.curPage, i, len(ids)] + ids
+ self.noteDB.deleteNotes( stream + [-1] )
+
+ cs = CSoundNote( int(onset),
+ pitch,
+ 0.75,
+ 0.5,
+ 1,
+ i,
+ instrumentId = self.owner.getTrackInstrument(i).instrumentId )
+ cs.pageId = self.curPage
+ id = self.noteDB.addNote( -1, self.curPage, i, cs )
+ self.noteDB.updateNote(self.curPage, i, id, PARAMETER.DURATION, self.paintNoteDur)
+ n = self.noteDB.getNote( self.curPage, i, id, self )
+ self.selectNotes( { i:[n] }, True )
+ n.playSampleNote( False )
+ self.curAction = True
+
+
+ TP.ProfileEnd( "TI::handleMotion::Common" )
+
+ if not self.clickButton and self.curAction != "paste": # we recieved this event but were never clicked! (probably a popup window was open)
+ TP.ProfileBegin( "TI::handleMotion::Hover" )
+ self.updateTooltip( event )
+ TP.ProfileEnd( "TI::handleMotion::Hover" )
+ return
+
+ if self.curAction == "paste":
+ TP.ProfileBegin( "TI::handleMotion::Paste" )
+ top = Config.NUMBER_OF_TRACKS
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackLimits[i][0] > event.y: break
+ if self.trackLimits[i][1] < event.y: continue
+ top = i
+ break
+ self.updatePaste( self.pixelsToTicksFloor( self.curBeats, event.x ), top )
+ TP.ProfileEnd( "TI::handleMotion::Paste" )
+ elif event.state & gtk.gdk.BUTTON1_MASK:
+ TP.ProfileBegin( "TI::handleMotion::Drag" )
+
+ if not self.curAction: # no action is in progress yet we're dragging, start a marquee
+ self.setCurrentAction( "marquee", self )
+
+ if self.curAction == "note-drag-onset":
+ self.noteDragOnset( event )
+
+ elif self.curAction == "note-drag-duration":
+ self.noteDragDuration( event )
+
+ elif self.curAction == "note-drag-pitch":
+ self.noteDragPitch( event )
+
+ elif self.curAction == "note-drag-pitch-drum":
+ self.noteDragPitch( event, True )
+
+ elif self.curAction == "marquee":
+ self.updateMarquee( event )
+
+ elif self.curAction == "playhead-drag":
+ self.updatePlayhead( event )
+
+ TP.ProfileEnd( "TI::handleMotion::Drag" )
+ else:
+ TP.ProfileBegin( "TI::handleMotion::Hover" )
+ self.updateTooltip( event )
+ TP.ProfileEnd( "TI::handleMotion::Hover" )
+
+ return
+
+ #=======================================================
+ # Actions
+
+ def setCurrentAction( self, action, obj = None ):
+ if self.curAction:
+ self.doneCurrentAction()
+
+ self.curAction = action
+ self.curActionObject = obj
+
+ if action == "note-drag-onset": self.updateDragLimits()
+ elif action == "note-drag-duration": self.updateDragLimits()
+ elif action == "note-drag-pitch": self.updateDragLimits()
+ elif action == "note-drag-pitch-drum": self.updateDragLimits()
+ elif action == "paste":
+ self._updateClipboardArea()
+ self.setCursor("paste")
+
+ def doneCurrentAction( self ):
+ if not self.curAction: return
+ action = self.curAction
+ self.curAction = False
+
+ if action == "note-drag-onset": self.doneNoteDrag( action )
+ elif action == "note-drag-duration": self.doneNoteDrag( action )
+ elif action == "note-drag-pitch": self.doneNoteDrag( action )
+ elif action == "note-drag-pitch-drum": self.doneNoteDrag( action )
+ elif action == "paste":
+ self.owner.cleanupClipboard()
+
+ def trackToggled( self, trackN = -1 ):
+ if trackN == -1: self.invalidate_rect( 0, 0, self.width, self.height )
+ else: self.invalidate_rect( 0, self.trackLimits[trackN][0], self.width, self.trackLimits[trackN][1]-self.trackLimits[trackN][0] )
+
+ def selectionChanged( self ):
+ if self.curAction == "note-drag-onset": self.updateDragLimits()
+ elif self.curAction == "note-drag-duration": self.updateDragLimits()
+ elif self.curAction == "note-drag-pitch": self.updateDragLimits()
+ elif self.curAction == "note-drag-pitch-drum": self.updateDragLimits()
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if len(self.selectedNotes[i]):
+ self.owner.setContextState( CONTEXT.NOTE, True )
+ self.owner.setContext( CONTEXT.NOTE )
+ return
+ self.owner.setContextState( CONTEXT.NOTE, False )
+
+ def applyNoteSelection( self, mode, trackN, which, page = -1 ):
+ if page == -1: page = self.curPage
+ if mode == SELECTNOTES.ALL:
+ track = self.noteDB.getNotesByTrack( page, trackN, self )
+ map( lambda note:note.setSelected( True ), track )
+ self.selectedNotes[trackN] = []
+ map( lambda note:self.selectedNotes[trackN].append(note), track )
+ elif mode == SELECTNOTES.NONE:
+ track = self.selectedNotes[trackN] #self.noteDB.getNotesByTrack( page, trackN, self )
+ map( lambda note:note.setSelected( False ), track )
+ self.selectedNotes[trackN] = []
+ elif mode == SELECTNOTES.ADD:
+ for note in which:
+ if note.setSelected( True ):
+ self.selectedNotes[trackN].append( note )
+ elif mode == SELECTNOTES.REMOVE:
+ for note in which:
+ if note.setSelected( False ):
+ self.selectedNotes[trackN].remove( note )
+ elif mode == SELECTNOTES.FLIP:
+ for note in which:
+ if note.getSelected():
+ note.setSelected( False )
+ self.selectedNotes[trackN].remove( note )
+ else:
+ note.setSelected( True )
+ self.selectedNotes[trackN].append( note )
+ elif mode == SELECTNOTES.EXCLUSIVE:
+ notes = self.noteDB.getNotesByTrack( page, trackN, self )
+ for n in range(len(notes)):
+ if notes[n] in which:
+ if notes[n].setSelected( True ):
+ self.selectedNotes[trackN].append( notes[n] )
+ else:
+ if notes[n].setSelected( False ):
+ self.selectedNotes[trackN].remove( notes[n] )
+
+ def selectNotesByBar( self, trackN, start, stop, page = -1 ):
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i == trackN:
+ notes = []
+ track = self.noteDB.getNotesByTrack( self.curPage, trackN, self )
+ for n in range(len(track)):
+ if track[n].testOnset( start, stop ): notes.append(track[n])
+ if not Config.ModKeys.ctrlDown: self.applyNoteSelection( SELECTNOTES.EXCLUSIVE, trackN, notes, page )
+ else: self.applyNoteSelection( SELECTNOTES.ADD, trackN, notes, page )
+ else:
+ if not Config.ModKeys.ctrlDown: self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def selectNotesByTrack( self, trackN, page = -1 ):
+ if Config.ModKeys.ctrlDown:
+ self.applyNoteSelection( SELECTNOTES.ALL, trackN, [], page )
+ else:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i == trackN: self.applyNoteSelection( SELECTNOTES.ALL, trackN, [], page )
+ else: self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def selectNotes( self, noteDic, ignoreCtrl = False, page = -1 ):
+ if Config.ModKeys.ctrlDown and not ignoreCtrl:
+ for i in noteDic:
+ self.applyNoteSelection( SELECTNOTES.FLIP, i, noteDic[i], page )
+ else:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i in noteDic: self.applyNoteSelection( SELECTNOTES.EXCLUSIVE, i, noteDic[i], page )
+ else: self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def deselectNotes( self, noteDic, page = -1 ):
+ for i in noteDic:
+ self.applyNoteSelection( SELECTNOTES.REMOVE, i, noteDic[i], page )
+ self.selectionChanged()
+
+ def clearSelectedNotes( self, page = -1 ):
+ for i in range(Config.NUMBER_OF_TRACKS):
+ self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def updateDragLimits( self ):
+ self.dragLimits = [ [-9999,9999], [-9999,9999], [-9999,9999] ] # initialize to big numbers!
+ maxRightBound = self.noteDB.getPage(self.curPage).ticks
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ leftBound = 0
+ skip = True # skip the first note
+ for n in range(len(track)):
+ if skip:
+ skip = False
+ thisNote = track[n]
+ continue
+ nextNote = track[n]
+ if not thisNote.getSelected():
+ leftBound = thisNote.getEndTick()
+ else:
+ if not nextNote.getSelected():
+ rightBound = min( nextNote.getStartTick(), maxRightBound )
+ widthBound = rightBound
+ else:
+ rightBound = maxRightBound
+ widthBound = min( nextNote.getStartTick(), maxRightBound )
+ thisNote.updateDragLimits( self.dragLimits, leftBound, rightBound, widthBound, maxRightBound )
+ thisNote = nextNote
+ # do the last note
+ if thisNote.getSelected():
+ thisNote.updateDragLimits( self.dragLimits, leftBound, maxRightBound, maxRightBound, maxRightBound )
+
+ def noteDragOnset( self, event ):
+ do = self.pixelsToTicks( self.curBeats, event.x - self.clickLoc[0] )
+ do = min( self.dragLimits[0][1], max( self.dragLimits[0][0], do ) )
+ do = self.pointerGrid * int(do / self.pointerGrid)
+
+ if do != self.lastDO:
+ self.lastDO = do
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ tstream = []
+ for note in self.selectedNotes[i]:
+ note.noteDragOnset( do, tstream )
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.ONSET, len(tstream)//2 ] + tstream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteDragDuration( self, event ):
+ dd = self.pixelsToTicks( self.curBeats, event.x - self.clickLoc[0] )
+ dd = min( self.dragLimits[2][1], max( self.dragLimits[2][0], dd ) )
+
+ if dd != self.lastDD:
+ self.lastDD = dd
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ tstream = []
+ for note in self.selectedNotes[i]:
+ note.noteDragDuration( dd, tstream )
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.DURATION, len(tstream)//2 ] + tstream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteDragPitch( self, event, drum = False ):
+ if not drum: dp = self.pixelsToPitch( event.y - self.clickLoc[1] )
+ else: dp = self.pixelsToPitchDrum( event.y - self.clickLoc[1] )
+ dp = min( self.dragLimits[1][1], max( self.dragLimits[1][0], dp ) )
+
+ if dp != self.lastDP:
+ self.lastDP = dp
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ tstream = []
+ for note in self.selectedNotes[i]:
+ note.noteDragPitch( dp, tstream )
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.PITCH, len(tstream)//2 ] + tstream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ if self.curActionObject.note.track != self.drumIndex:
+ self.curActionObject.playSampleNote( True )
+ elif dp != self.lastDrumDP and not dp%2: # only play of "full" drum pitches
+ self.lastDrumDP = dp
+ self.curActionObject.playSampleNote( False )
+
+ def doneNoteDrag( self, action ):
+ # if action == "note-drag-pitch" or action == "note-drag-pitch-drum":
+ # self.curActionObject.playSampleNote()
+
+ self.lastDO = self.lastDP = self.lastDrumDP = self.lastDD = None
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ for note in self.selectedNotes[i]:
+ note.doneNoteDrag( self )
+
+ def noteStepOnset( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ if step < 0: # moving to the left, iterate forwards
+ leftBound = 0
+ for n in range(len(track)):
+ leftBound = track[n].noteDecOnset( step, leftBound, tstream )
+ else: # moving to the right, iterate backwards
+ rightBound = self.noteDB.getPage(self.curPage).ticks
+ for n in range(len(track)-1, -1, -1 ):
+ rightBound = track[n].noteIncOnset( step, rightBound, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.ONSET, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteStepPitch( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ if step < 0:
+ for n in self.selectedNotes[i]:
+ n.noteDecPitch( step, tstream )
+ else:
+ for n in self.selectedNotes[i]:
+ n.noteIncPitch( step, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.PITCH, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteStepDuration( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ if step < 0:
+ for n in self.selectedNotes[i]:
+ n.noteDecDuration( step, tstream )
+ else:
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ for j in range(len(track)-1):
+ track[j].noteIncDuration( step, track[j+1].getStartTick(), tstream )
+ track[len(track)-1].noteIncDuration( step, self.noteDB.getPage(self.curPage).ticks, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.DURATION, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteStepVolume( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ if step < 0:
+ for n in self.selectedNotes[i]:
+ n.noteDecVolume( step, tstream )
+ else:
+ for n in self.selectedNotes[i]:
+ n.noteIncVolume( step, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.AMPLITUDE, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+
+ def updateMarquee( self, event ):
+ if self.marqueeLoc:
+ oldX = self.marqueeRect[0][0]
+ oldEndX = self.marqueeRect[0][0] + self.marqueeRect[1][0]
+ oldY = self.marqueeRect[0][1]
+ oldEndY = self.marqueeRect[0][1] + self.marqueeRect[1][1]
+ else:
+ oldX = oldEndX = self.clickLoc[0]
+ oldY = oldEndY = self.clickLoc[1]
+
+ self.marqueeLoc = [ int(event.x), int(event.y) ]
+ if self.marqueeLoc[0] < 0: self.marqueeLoc[0] = 0
+ elif self.marqueeLoc[0] > self.width: self.marqueeLoc[0] = self.width
+ if self.marqueeLoc[1] < 0: self.marqueeLoc[1] = 0
+ elif self.marqueeLoc[1] > self.height: self.marqueeLoc[1] = self.height
+
+ if self.marqueeLoc[0] > self.clickLoc[0]:
+ self.marqueeRect[0][0] = self.clickLoc[0]
+ self.marqueeRect[1][0] = self.marqueeLoc[0] - self.clickLoc[0]
+ else:
+ self.marqueeRect[0][0] = self.marqueeLoc[0]
+ self.marqueeRect[1][0] = self.clickLoc[0] - self.marqueeLoc[0]
+ if self.marqueeLoc[1] > self.clickLoc[1]:
+ self.marqueeRect[0][1] = self.clickLoc[1]
+ self.marqueeRect[1][1] = self.marqueeLoc[1] - self.clickLoc[1]
+ else:
+ self.marqueeRect[0][1] = self.marqueeLoc[1]
+ self.marqueeRect[1][1] = self.clickLoc[1] - self.marqueeLoc[1]
+
+ x = min( self.marqueeRect[0][0], oldX )
+ width = max( self.marqueeRect[0][0] + self.marqueeRect[1][0], oldEndX ) - x
+ y = min( self.marqueeRect[0][1], oldY )
+ height = max( self.marqueeRect[0][1] + self.marqueeRect[1][1], oldEndY ) - y
+ self.invalidate_rect( x-1, y-1, width+2, height+2, self.curPage, False )
+
+ def doneMarquee( self, event ):
+ if self.marqueeLoc:
+ stop = [ self.marqueeRect[0][0] + self.marqueeRect[1][0], self.marqueeRect[0][1] + self.marqueeRect[1][1] ]
+
+ select = {}
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ intersectionY = [ max(self.marqueeRect[0][1],self.trackLimits[i][0]), min(stop[1],self.trackLimits[i][1]) ]
+ if intersectionY[0] > intersectionY[1]:
+ continue
+
+ notes = []
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ for n in range(len(track)):
+ hit = track[n].handleMarqueeSelect( self,
+ [ self.marqueeRect[0][0], intersectionY[0] ], \
+ [ stop[0], intersectionY[1] ] )
+ if hit: notes.append(track[n])
+
+ if len(notes): select[i] = notes
+
+ self.selectNotes( select )
+
+ self.marqueeLoc = False
+ self.doneCurrentAction()
+
+ self.invalidate_rect( self.marqueeRect[0][0]-1, self.marqueeRect[0][1]-1, self.marqueeRect[1][0]+2, self.marqueeRect[1][1]+2, self.curPage, False )
+
+ def updatePlayhead( self, event ):
+ x = min( self.trackWidth - self.pixelsPerTick[self.curBeats], max( Config.TRACK_SPACING_DIV2, event.x ) )
+ self.setPlayhead( self.pixelsToTicks( self.curBeats, x ) )
+
+ def donePlayhead( self, event ):
+ x = min( self.trackWidth - self.pixelsPerTick[self.curBeats], max( Config.TRACK_SPACING_DIV2, event.x ) )
+ ticks = self.pixelsToTicks( self.curBeats, x )
+ print "set playhead to %d ticks" % (ticks)
+ self.doneCurrentAction()
+
+ def updatePaste( self, tick, track ):
+ if self.interfaceMode == INTERFACEMODE.PASTE_TRACKS: tick = 0
+ if self.pasteTick == tick and self.pasteTrack == track: return
+ if self.noteDB.getPage(self.curPage).ticks < tick < 0 \
+ or track > self.drumIndex \
+ or ( track == self.drumIndex and not self.clipboardDrumTrack ):
+ if self.pasteRect:
+ self.invalidate_rect( self.pasteRect[0][0], self.pasteRect[0][1], self.pasteRect[1][0], self.pasteRect[1][1], self.curPage, False )
+ self.pasteTick = self.pasteTrack = -1
+ self.pasteRect = False
+ return
+ if self.pasteRect:
+ self.invalidate_rect( self.pasteRect[0][0], self.pasteRect[0][1], self.pasteRect[1][0], self.pasteRect[1][1], self.curPage, False )
+ if self.clipboardDrumTrack:
+ bottom = self.drumIndex
+ else:
+ bottom = self.drumIndex - 1
+ for t in range(self.drumIndex-1,self.clipboardTrackTop-1,-1):
+ if self.clipboardArea["tracks"][t]: break
+ bottom -= 1
+ end = -tick + min( self.noteDB.getPage(self.curPage).ticks, tick + self.clipboardArea["limit"][1]-self.clipboardArea["limit"][0] )
+ self.pasteTick = tick
+ self.pasteTrack = track
+ self.pasteRect = [ [ self.ticksToPixels( self.curBeats, tick ), \
+ self.trackLimits[track][0] ], \
+ [ self.ticksToPixels( self.curBeats, end), \
+ self.trackLimits[bottom][1] ] ]
+ self.invalidate_rect( self.pasteRect[0][0], self.pasteRect[0][1], self.pasteRect[1][0], self.pasteRect[1][1], self.curPage, False )
+
+ def doPaste( self ):
+ if self.pasteTrack == -1:
+ self.doneCurrentAction()
+ return
+
+ trackMap = {}
+ for t in range(self.pasteTrack,self.drumIndex):
+ ind = t+self.clipboardTrackTop-self.pasteTrack
+ if ind >= self.drumIndex: break
+ if not self.clipboardArea["tracks"][ind]:
+ continue
+ trackMap[t] = ind
+ if self.clipboardDrumTrack:
+ trackMap[self.drumIndex] = self.drumIndex
+ new = self.owner.pasteClipboard( self.pasteTick - self.clipboardArea["limit"][0], trackMap )
+ if self.interfaceMode == INTERFACEMODE.PASTE_NOTES and self.curPage in new:
+ noteDic = {}
+ for t in range(Config.NUMBER_OF_TRACKS):
+ if len(new[self.curPage][t]):
+ noteDic[t] = [ self.noteDB.getNote( self.curPage, t, n, self ) for n in new[self.curPage][t] ]
+ self.selectNotes(noteDic)
+ elif self.interfaceMode == INTERFACEMODE.PASTE_TRACKS:
+ for t in range(self.drumIndex):
+ ind = t + self.clipboardTrackTop - self.pasteTrack
+ if ind >= self.drumIndex or ind < 0: self.owner.setTrack( t, False )
+ else: self.owner.setTrack( t, self.clipboardArea["tracks"][ind] )
+ self.owner.setTrack( self.drumIndex, self.clipboardDrumTrack )
+
+ self.doneCurrentAction()
+
+ def donePaste( self ):
+ if self.pasteRect:
+ self.invalidate_rect( self.pasteRect[0][0], self.pasteRect[0][1], self.pasteRect[1][0], self.pasteRect[1][1], self.curPage, False )
+ self.pasteTick = self.pasteTrack = -1
+ self.pasteRect = False
+ self.setInterfaceMode("tool")
+ # make a fake event for updateTooltip
+ event = gtk.gdk.Event(gtk.gdk.MOTION_NOTIFY)
+ x, y, state = self.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+ self.updateTooltip( event )
+
+ def updateTooltip( self, event ):
+
+ # check clicked the playhead
+ if event.x >= self.playheadX and event.x <= self.playheadX + Config.PLAYHEAD_SIZE:
+ self.setCursor("drag-playhead")
+ return
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if self.trackLimits[i][0] > event.y: break
+ if self.trackLimits[i][1] < event.y: continue
+
+ notes = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ handled = 0
+ for n in range(len(notes)):
+ handled = notes[n].updateTooltip( self, event )
+ if handled == 0: continue
+ elif handled == 1: return # event was handled
+ else: break
+
+ # note wasn't handled, could potentially draw a note
+ if self.interfaceMode == INTERFACEMODE.DRAW:
+ if handled == -2: # event X overlapped with a note
+ self.setCursor("default")
+ return
+
+ self.setCursor("pencil")
+ return
+
+ break
+
+ self.setCursor("default")
+
+ def setCursor( self, cursor ):
+ self.window.set_cursor(self.cursor[cursor])
+
+ #=======================================================
+ # Drawing
+
+ def draw( self, buf, noescape = True, timeout = 0 ):
+ if not self.screenBufDirty[buf]: return True
+
+ TP.ProfileBegin( "TrackInterface::draw" )
+
+ startX = self.screenBufDirtyRect[buf].x
+ startY = self.screenBufDirtyRect[buf].y
+ stopX = self.screenBufDirtyRect[buf].x + self.screenBufDirtyRect[buf].width
+ stopY = self.screenBufDirtyRect[buf].y + self.screenBufDirtyRect[buf].height
+
+ beatStart = Config.TRACK_SPACING_DIV2
+ beats = self.screenBufBeats[buf]
+
+ pixmap = self.screenBuf[buf]
+
+ resume = self.screenBufResume[buf]
+
+ self.gc.set_clip_rectangle( self.screenBufDirtyRect[buf] )
+
+ self.gc.set_line_attributes( Config.BEAT_LINE_SIZE, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ # regular tracks
+ for i in range( resume[0], self.drumIndex ):
+ if resume[1] == 0:
+ if startY > self.trackLimits[i][1]: continue
+ if stopY < self.trackLimits[i][0]: break
+
+ # draw background
+ if self.owner.getTrackSelected( i ):
+ pixmap.draw_drawable( self.gc, self.image["trackBGSelected"], 0, 0, 0, self.trackLimits[i][0], self.trackFullWidth, self.trackFullHeight )
+ else:
+ pixmap.draw_drawable( self.gc, self.image["trackBG"], 0, 0, 0, self.trackLimits[i][0], self.trackFullWidth, self.trackFullHeight )
+
+ # draw beat lines
+ self.gc.foreground = self.beatColor
+ for j in range(1,self.screenBufBeats[buf]):
+ x = beatStart + self.beatSpacing[beats][j]
+ pixmap.draw_line( self.gc, x, self.trackRect[i].y, x, self.trackRect[i].y+self.trackRect[i].height )
+
+ resume[1] = 1 # background drawn
+
+ # draw notes
+ TP.ProfileBegin("TI::draw notes")
+ notes = self.noteDB.getNotesByTrack( self.screenBufPage[buf], i, self )
+ for n in range( resume[2], len(notes) ):
+ # check escape
+ if not noescape and time.time() > timeout:
+ resume[0] = i
+ resume[2] = n
+ TP.ProfilePause( "TrackInterface::draw" )
+ return False
+
+ if not notes[n].draw( pixmap, self.gc, startX, stopX ): break
+ TP.ProfileEnd("TI::draw notes")
+
+ # finished a track, reset the resume values for the next one
+ resume[1] = 0
+ resume[2] = 0
+
+ # drum track
+ if stopY > self.trackLimits[self.drumIndex][0]:
+
+ if resume[1] == 0:
+ # draw background
+ if self.owner.getTrackSelected( self.drumIndex ):
+ pixmap.draw_drawable( self.gc, self.image["trackBGDrumSelected"], 0, 0, 0, self.trackLimits[self.drumIndex][0], self.trackFullWidth, self.trackFullHeightDrum )
+ else:
+ pixmap.draw_drawable( self.gc, self.image["trackBGDrum"], 0, 0, 0, self.trackLimits[self.drumIndex][0], self.trackFullWidth, self.trackFullHeightDrum )
+
+ # draw beat lines
+ self.gc.foreground = self.beatColor
+ for j in range(1,self.screenBufBeats[buf]):
+ x = beatStart + self.beatSpacing[beats][j]
+ pixmap.draw_line( self.gc, x, self.trackRect[self.drumIndex].y, x, self.trackRect[self.drumIndex].y+self.trackRect[self.drumIndex].height )
+
+ resume[1] = 1 # background drawn
+
+ # draw notes
+ notes = self.noteDB.getNotesByTrack( self.screenBufPage[buf], self.drumIndex, self )
+ for n in range( resume[2], len(notes) ):
+ # check escape
+ if not noescape and time.time() > timeout:
+ resume[0] = i
+ resume[2] = n
+ TP.ProfilePause( "TrackInterface::draw" )
+ return False
+ if not notes[n].draw( pixmap, self.gc, startX, stopX ): break
+
+ self.screenBufDirty[buf] = False
+
+ TP.ProfileEnd( "TrackInterface::draw" )
+
+ return True
+
+ def expose( self, DA, event ):
+
+ if self.screenBufDirty[self.curScreen]:
+ self.draw( self.curScreen )
+
+ TP.ProfileBegin( "TrackInterface::expose" )
+
+ startX = event.area.x
+ startY = event.area.y
+ stopX = event.area.x + event.area.width
+ stopY = event.area.y + event.area.height
+
+ #print "%d %d %d %d" % (startX,startY,stopX,stopY)
+
+ self.gc.set_clip_rectangle( event.area )
+
+ # draw base
+ DA.window.draw_drawable( self.gc, self.screenBuf[self.curScreen], startX, startY, startX, startY, event.area.width, event.area.height )
+
+ # draw playhead
+ self.gc.set_line_attributes( Config.PLAYHEAD_SIZE, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.playheadColor
+ DA.window.draw_line( self.gc, self.playheadX, startY, self.playheadX, stopY )
+
+ if self.marqueeLoc: # draw the selection rect
+ self.gc.set_line_attributes( Config.MARQUEE_SIZE, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.marqueeColor
+ DA.window.draw_rectangle( self.gc, False, self.marqueeRect[0][0], self.marqueeRect[0][1], self.marqueeRect[1][0], self.marqueeRect[1][1] )
+
+ if self.pasteRect: # draw the paste highlight
+ self.gc.set_function( gtk.gdk.INVERT )
+ for t in range(self.pasteTrack,self.drumIndex):
+ ind = t+self.clipboardTrackTop-self.pasteTrack
+ if ind >= self.drumIndex: break
+ if not self.clipboardArea["tracks"][ind]:
+ continue
+ DA.window.draw_rectangle( self.gc, True, self.pasteRect[0][0], self.trackLimits[t][0] + Config.TRACK_SPACING_DIV2, self.pasteRect[1][0], self.trackHeight )
+ if self.clipboardDrumTrack:
+ DA.window.draw_rectangle( self.gc, True, self.pasteRect[0][0], self.trackLimits[self.drumIndex][0] + Config.TRACK_SPACING_DIV2, self.pasteRect[1][0], self.trackHeightDrum )
+ self.gc.set_function( gtk.gdk.COPY )
+
+ self.drawingAreaDirty = False
+
+ TP.ProfileEnd( "TrackInterface::expose" )
+
+ def invalidate_rect( self, x, y, width, height, page = -1, base = True ):
+ #print "%d %d %d %d Page %d CurPage %d" % (x,y,width,height,page,self.curPage)
+ self.dirtyRectToAdd.x = x
+ self.dirtyRectToAdd.y = y
+ self.dirtyRectToAdd.width = width
+ self.dirtyRectToAdd.height = height
+
+ #print "dirty %d %d %d %d %d %d" % (x, y, width, height, x+width, y+height)
+ if page == self.curPage or page == -1:
+ if base: # the base image has been dirtied
+ if not self.screenBufDirty[self.curScreen]:
+ self.screenBufDirtyRect[self.curScreen].x = x
+ self.screenBufDirtyRect[self.curScreen].y = y
+ self.screenBufDirtyRect[self.curScreen].width = width
+ self.screenBufDirtyRect[self.curScreen].height = height
+ else:
+ self.screenBufDirtyRect[self.curScreen] = self.screenBufDirtyRect[self.curScreen].union( self.dirtyRectToAdd )
+ self.screenBufResume[self.curScreen] = [0,0,0]
+ self.screenBufDirty[self.curScreen] = True
+ if self.drawingArea.window != None:
+ self.drawingArea.window.invalidate_rect( self.dirtyRectToAdd, True )
+ self.drawingAreaDirty = True
+
+ if page == self.screenBufPage[self.preScreen] or page == -1:
+ if not self.screenBufDirty[self.preScreen]:
+ self.screenBufDirtyRect[self.preScreen].x = x
+ self.screenBufDirtyRect[self.preScreen].y = y
+ self.screenBufDirtyRect[self.preScreen].width = width
+ self.screenBufDirtyRect[self.preScreen].height = height
+ else:
+ self.screenBufDirtyRect[self.preScreen] = self.screenBufDirtyRect[self.preScreen].union( self.dirtyRectToAdd )
+ self.screenBufResume[self.preScreen] = [0,0,0]
+ self.screenBufDirty[self.preScreen] = True
+
+ #self.queue_draw()
+
+ def getTrackOrigin( self, track ):
+ return ( self.trackRect[track].x, self.trackRect[track].y )
+
+ def ticksToPixels( self, beats, ticks ):
+ return int(round( ticks * self.pixelsPerTick[beats] ))
+ def pixelsToTicks( self, beats, pixels ):
+ return int(round( pixels * self.ticksPerPixel[beats] ))
+ def ticksToPixelsFloor( self, beats, ticks ):
+ return int( ticks * self.pixelsPerTick[beats] )
+ def pixelsToTicksFloor( self, beats, pixels ):
+ return int( pixels * self.ticksPerPixel[beats] )
+ def pitchToPixels( self, pitch ):
+ return int(round( ( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch ))
+ def pixelsToPitch( self, pixels ):
+ return int(round(-pixels*self.pitchPerPixel))
+ def pitchToPixelsFloor( self, pitch ):
+ return int(( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch )
+ def pixelsToPitchFloor( self, pixels ):
+ return int(-pixels*self.pitchPerPixel)
+ def pitchToPixelsDrum( self, pitch ):
+ return int(round( ( Config.MAXIMUM_PITCH_DRUM - pitch ) * self.pixelsPerPitchDrum ))
+ def pixelsToPitchDrum( self, pixels ):
+ return int(round(-pixels*self.pitchPerPixelDrum))
+ def pitchToPixelsDrumFloor( self, pitch ):
+ return int( ( Config.MAXIMUM_PITCH_DRUM - pitch ) * self.pixelsPerPitchDrum )
+ def pixelsToPitchDrumFloor( self, pixels ):
+ return int(-pixels*self.pitchPerPixelDrum)
diff --git a/TamTamEdit.activity/Edit/TuneInterface.py b/TamTamEdit.activity/Edit/TuneInterface.py
new file mode 100644
index 0000000..3682a57
--- /dev/null
+++ b/TamTamEdit.activity/Edit/TuneInterface.py
@@ -0,0 +1,645 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import Config
+
+from Util.Profiler import TP
+from Edit.MainWindow import CONTEXT
+
+from Util.NoteDB import PARAMETER
+
+class TuneInterfaceParasite:
+
+ def __init__( self, noteDB, owner, note ):
+ self.noteDB = noteDB
+ self.owner = owner
+ self.note = note
+
+ self.x = self.y = self.width = -1
+
+ def attach( self ):
+ self.updateParameter( None, None )
+ return self
+
+ def destroy( self ):
+ self.owner.invalidate_thumbnail( self.note.page, self.x, self.y, self.width, 1 )
+
+ def updateParameter( self, parameter, value ):
+ if parameter == PARAMETER.AMPLITUDE: return
+ x = 2 + Config.THUMBNAIL_TRACK_RECT[self.note.track][0] + self.owner.ticksToPixels( self.noteDB.getPage( self.note.page).beats, self.note.cs.onset )
+ if self.note.track == Config.NUMBER_OF_TRACKS-1: # drum track
+ y = Config.THUMBNAIL_TRACK_RECT[self.note.track][1] + self.owner.pitchToPixelsDrum( self.note.cs.pitch )
+ if x != self.x or y != self.y:
+ if parameter != None: # not the first update
+ xx = min( self.x, x )
+ yy = min( self.y, y )
+ endxx = max( self.endx, x + 1 )
+ endyy = max( self.y, y ) + 1
+ self.x = x
+ self.endx = x + 1
+ self.y = y
+ self.owner.invalidate_thumbnail( self.note.page, xx, yy, endxx-xx, endyy-yy )
+ else:
+ self.x = x
+ self.endx = x + 1
+ self.y = y
+ self.owner.invalidate_thumbnail( self.note.page, x, y, 1, 1 )
+ else:
+ y = Config.THUMBNAIL_TRACK_RECT[self.note.track][1] + self.owner.pitchToPixels( self.note.cs.pitch )
+ width = max( 1, self.owner.ticksToPixels( self.noteDB.getPage( self.note.page).beats, self.note.cs.duration ) )
+ if x != self.x or y != self.y or width != self.width:
+ if parameter != None: # not the first update
+ xx = min( self.x, x )
+ yy = min( self.y, y )
+ endxx = max( self.endx, x + width )
+ endyy = max( self.y, y ) + 1
+ self.x = x
+ self.endx = x + width
+ self.y = y
+ self.width = width
+ self.owner.invalidate_thumbnail( self.note.page, xx, yy, endxx-xx, endyy-yy )
+ else:
+ self.x = x
+ self.endx = x + width
+ self.y = y
+ self.width = width
+ self.owner.invalidate_thumbnail( self.note.page, x, y, width, 1 )
+
+ def draw( self, win, gc, startX, stopX ):
+ if stopX < self.x: return False # we don't need to draw and no one after us will draw
+ if startX > self.endx: return True # we don't need to draw, but maybe a later note does
+
+ win.draw_line( gc, self.x, self.y, self.endx, self.y )
+
+ return True # we drew something
+
+
+class TuneInterface( gtk.EventBox ):
+
+ DRAG_BLOCK = -1 # block other drag events
+ DRAG_SELECT = 1
+ DRAG_DESELECT = 2
+ DRAG_MOVE = 3
+
+ def __init__( self, noteDB, owner, adjustment ):
+ gtk.EventBox.__init__( self )
+
+ self.noteDB = noteDB
+ self.owner = owner
+ self.adjustment = adjustment
+ #adjustment.connect( "changed", self.adjustmentChanged )
+ adjustment.connect( "value-changed", self.adjustmentValue )
+
+ self.drawingArea = gtk.DrawingArea()
+ self.drawingAreaDirty = False # is the drawingArea waiting to draw?
+ self.add( self.drawingArea )
+ self.dirtyRectToAdd = gtk.gdk.Rectangle() # used by the invalidate_rect function
+
+ self.selectedIds = []
+ self.displayedPage = -1
+
+ self.drumIndex = Config.NUMBER_OF_TRACKS-1
+
+ self.trackRect = Config.THUMBNAIL_TRACK_RECT
+ self.thumbnail = {}
+ self.thumbnailDirty = {}
+ self.thumbnailDirtyRect = {}
+ self.defaultwin = gtk.gdk.get_default_root_window() # used when creating pixmaps
+ self.gc = gtk.gdk.GC( self.defaultwin )
+ colormap = self.drawingArea.get_colormap()
+ self.bgColor = colormap.alloc_color( Config.TOOLBAR_BCK_COLOR, True, True )
+ self.lineColor = colormap.alloc_color( Config.THUMBNAIL_DRAG_COLOR, True, True )
+ self.displayedColor = colormap.alloc_color( Config.THUMBNAIL_DISPLAYED_COLOR, True, True )
+ self.selectedColor = colormap.alloc_color( Config.THUMBNAIL_SELECTED_COLOR, True, True )
+
+ # prepare thumbnail
+ self.thumbnailBG = []
+ self.gc.foreground = self.bgColor
+ for i in range(4):
+ pix = gtk.gdk.pixbuf_new_from_file( Config.IMAGE_ROOT+"pageThumbnailBG%d.png"%i )
+ self.thumbnailBG.append( gtk.gdk.Pixmap( self.defaultwin, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT ) )
+ self.thumbnailBG[i].draw_rectangle( self.gc, True, 0, 0, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailBG[i].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT, gtk.gdk.RGB_DITHER_NONE )
+
+ # load clipmask
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT+'pageThumbnailMask.png')
+ pixels = pix.get_pixels()
+ stride = pix.get_rowstride()
+ channels = pix.get_n_channels()
+ bitmap = ""
+ byte = 0
+ shift = 0
+ for j in range(pix.get_height()):
+ offset = stride*j
+ for i in range(pix.get_width()):
+ if pixels[i*channels+offset] != "\0":
+ byte += 1 << shift
+ shift += 1
+ if shift > 7:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ if shift:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ self.clipMask = gtk.gdk.bitmap_create_from_data( None, bitmap, pix.get_width(), pix.get_height() )
+ self.clearMask = gtk.gdk.Rectangle( 0, 0, 1200, 800 )
+
+ self.pageOffset = 5 # offset the first page by this
+ self.dropWidth = 5 # line thickness of the drop head
+ self.dropWidthDIV2 = self.dropWidth//2
+
+ self.pixelsPerPitch = float(self.trackRect[0][3]-1)/(Config.MAXIMUM_PITCH - Config.MINIMUM_PITCH)
+ self.pixelsPerPitchDrum = float(self.trackRect[self.drumIndex][3]-1)/(Config.MAXIMUM_PITCH_DRUM - Config.MINIMUM_PITCH_DRUM )
+ self.pixelsPerTick = [0] + [ float(self.trackRect[0][2]-4)/(i*Config.TICKS_PER_BEAT) for i in range(1,Config.MAXIMUM_BEATS+1) ]
+
+ self.alloced = False
+ self.width = self.baseWidth = self.height = -1
+ self.waitingForAlloc = True
+ self.scrollTo = None
+ self.clickX = -1
+
+ self.set_size_request( self.width, self.height )
+
+ self.button1Down = False
+ self.dragMode = None
+ self.dropAt = -1
+ self.dropAtX = 0
+
+ self.visibleX = 0
+ self.visibleEndX = 0
+
+ self.add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK)
+
+ self.connect( "size-allocate", self.size_allocated )
+ self.drawingArea.connect( "expose-event", self.draw )
+ self.connect( "button-press-event", self.handleButtonPress )
+ self.connect( "button-release-event", self.handleButtonRelease )
+ self.connect( "motion-notify-event", self.handleMotion )
+
+ def size_allocated( self, widget, allocation ):
+ if not self.alloced:
+ self.baseWidth = allocation.width
+ self.visibleEndX = self.baseWidth
+ self.baseHeight = allocation.height
+ self.alloced = True
+ self.updateSize()
+ self.width = allocation.width
+ self.height = allocation.height
+ self.drawingArea.set_size_request( self.width, self.height )
+ self.clearMask.height = self.height
+ self.clearMask.width = self.width
+
+ self.pageY = 2 + (self.height-Config.PAGE_THUMBNAIL_HEIGHT)//2
+
+ if self.scrollTo != None:
+ if self.scrollTo >= 0: self.adjustment.set_value( self.scrollTo )
+ else: self.adjustment.set_value( self.width - self.baseWidth )
+ self.scrollTo = None
+
+ self.waitingForAlloc = False
+
+ def adjustmentValue( self, adj ):
+ self.visibleX = int(adj.value)
+ self.visibleEndX = self.visibleX + self.baseWidth
+
+ def updateSize( self ):
+ width = self.noteDB.getPageCount()*Config.PAGE_THUMBNAIL_WIDTH + 5 # add extra 5 for the first page
+ self.waitingForAlloc = True
+ if width < self.baseWidth:
+ self.pageOffset = ( self.baseWidth - width ) // 2 + 5
+ else:
+ self.pageOffset = 5
+
+ if self.alloced:
+ self.set_size_request( max( self.baseWidth, width), -1 )
+ self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
+
+ def handleButtonPress( self, widget, event ):
+ if event.button != 1:
+ # bring up properties or something
+ return
+
+ self.button1Down = True
+
+ self.owner.abortPredrawPage()
+
+ ind = int(event.x-self.pageOffset)//Config.PAGE_THUMBNAIL_WIDTH
+ if ind >= self.noteDB.getPageCount():
+ if self.dragMode != self.DRAG_MOVE:
+ self.dragMode = self.DRAG_BLOCK
+ return
+ if ind < 0: ind = 0
+
+ self.clickX = event.x
+
+ id = self.noteDB.getPageByIndex( ind )
+
+ if event.type == gtk.gdk._3BUTTON_PRESS: # triple click -> select all
+ self.owner.displayPage( id )
+ self.selectAll()
+ elif event.type == gtk.gdk._2BUTTON_PRESS: # double click -> exclusive select
+ self.owner.displayPage( id )
+ self.selectPage( id )
+ else:
+ if Config.ModKeys.ctrlDown:
+ if id in self.selectedIds: # ctrl click, selected page -> remove page from selection
+ if self.deselectPage( id ):
+ self.dragMode = self.DRAG_DESELECT
+ self.dragLastInd = ind
+ else:
+ self.dragMode = self.DRAG_SELECT # special case, they clicked on the last selected page and it wasn't deselected
+ self.dragLastInd = ind
+ else: # ctrl click, unselected page -> add page to selection (but don't display it)
+ self.selectPage( id, False )
+ self.dragMode = self.DRAG_SELECT
+ self.dragLastInd = ind
+ elif id in self.selectedIds: # click, selected page -> display this page but don't change the selection
+ self.owner.displayPage( id )
+ else: # click, unselected page -> exclusive select
+ self.owner.displayPage( id )
+ self.selectPage( id )
+
+
+ self.owner.setContext( CONTEXT.PAGE )
+
+ def handleButtonRelease( self, widget, event ):
+ if event.button != 1:
+ return
+
+ self.button1Down = False
+
+ if self.dragMode == self.DRAG_MOVE:
+ self.invalidate_rect( self.dropAtX - self.dropWidthDIV2, 0, self.dropWidth, self.height ) # drop head
+
+ if self.dropAt > 0: after = self.noteDB.getPageByIndex( self.dropAt-1 )
+ else: after = False
+
+ self.noteDB.movePages( self.selectedIds, after )
+
+ self.dropAt = -1
+
+ self.dragMode = None
+
+ def handleMotion( self, widget, event ):
+
+ if event.is_hint:
+ x, y, state = self.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+
+ if self.button1Down: # clicking
+ if Config.ModKeys.ctrlDown and (self.dragMode == None or self.dragMode == self.DRAG_MOVE):
+ self.dropAt = -1
+ self.dragMode = self.DRAG_SELECT
+ if event.x >= self.pageOffset: ind = int(event.x-self.pageOffset)//Config.PAGE_THUMBNAIL_WIDTH
+ else: ind = 0
+ self.dragLastInd = ind
+
+ if self.dragMode == self.DRAG_SELECT: # select on drag
+ if event.x > self.pageOffset: ind = int(event.x-self.pageOffset)//Config.PAGE_THUMBNAIL_WIDTH
+ else: ind = 0
+ pageCount = self.noteDB.getPageCount()
+ if ind >= pageCount: ind = pageCount-1
+ for i in range( min(ind,self.dragLastInd), max(ind,self.dragLastInd)+1):
+ self.selectPage( self.noteDB.getPageByIndex(i), False )
+ self.dragLastInd = ind
+ elif self.dragMode == self.DRAG_DESELECT: # deselect on drag
+ if event.x > self.pageOffset: ind = int(event.x-self.pageOffset)//Config.PAGE_THUMBNAIL_WIDTH
+ else: ind = 0
+ pageCount = self.noteDB.getPageCount()
+ if ind >= pageCount: ind = pageCount-1
+ for i in range( min(ind,self.dragLastInd), max(ind,self.dragLastInd)+1):
+ self.deselectPage( self.noteDB.getPageByIndex(i) )
+ self.dragLastInd = ind
+ elif self.dragMode == None and abs(self.clickX-event.x) > 20: # drag and drop
+ self.dragMode = self.DRAG_MOVE
+
+ if self.dragMode == self.DRAG_MOVE:
+ if self.dropAt >= 0: lastX = self.dropAtX
+ else: lastX = -1
+ if event.x > self.pageOffset: self.dropAt = int(event.x-self.pageOffset+Config.PAGE_THUMBNAIL_WIDTH_DIV2)//Config.PAGE_THUMBNAIL_WIDTH
+ else: self.dropAt = 0
+ c = self.noteDB.getPageCount()
+ if self.dropAt > c: self.dropAt = c
+ self.dropAtX = self.pageOffset + self.dropAt*Config.PAGE_THUMBNAIL_WIDTH - self.dropWidthDIV2 - 1
+ if lastX >= 0 and lastX != self.dropAtX:
+ if lastX < self.dropAtX:
+ x = lastX - self.dropWidthDIV2
+ w = self.dropAtX - lastX + self.dropWidth
+ else:
+ x = self.dropAtX - self.dropWidthDIV2
+ w = lastX - self.dropAtX + self.dropWidth
+ self.invalidate_rect( x, 0, w, self.height )
+ elif lastX == -1:
+ self.invalidate_rect( self.dropAtX-self.dropWidthDIV2, 0, self.dropWidth, self.height )
+
+ else: # hovering
+ ind = int(event.x-self.pageOffset)//Config.PAGE_THUMBNAIL_WIDTH
+ if ind != self.lastPredrawInd and 0 <= ind < self.noteDB.getPageCount():
+ id = self.noteDB.getPageByIndex(ind)
+ if id != self.displayedPage:
+ self.owner.predrawPage( id )
+ self.lastPredrawInd = ind
+
+
+ def trackToggled( self, i ):
+ self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
+
+ def displayPage( self, id ):
+ if self.displayedPage == id: return -1
+
+ self.lastPredrawInd = -1
+
+ if self.displayedPage != -1:
+ ind = self.noteDB.getPageIndex( self.displayedPage )
+ self.invalidate_rect( self.pageOffset + ind*Config.PAGE_THUMBNAIL_WIDTH, 0, Config.PAGE_THUMBNAIL_WIDTH, self.height )
+
+ if not self.thumbnail.has_key( id ):
+ # premptive add
+ self.thumbnail[id] = gtk.gdk.Pixmap( self.defaultwin, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailDirtyRect[id] = gtk.gdk.Rectangle( 0, 0, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailDirty[id] = True
+ self.selectPage( id )
+ self.updateSize()
+
+ self.displayedPage = id
+
+ if id not in self.selectedIds:
+ self.selectPage( id )
+
+ ind = self.noteDB.getPageIndex( id )
+
+ startX = self.pageOffset + ind*Config.PAGE_THUMBNAIL_WIDTH
+ stopX = startX + Config.PAGE_THUMBNAIL_WIDTH
+
+ if self.adjustment.value > startX:
+ scroll = startX + Config.PAGE_THUMBNAIL_WIDTH + Config.PAGE_THUMBNAIL_WIDTH_DIV2 - self.baseWidth
+ if scroll < 0: scroll = 0
+ self.adjustment.set_value( scroll )
+ elif self.adjustment.value + self.baseWidth < stopX:
+ scroll = startX - Config.PAGE_THUMBNAIL_WIDTH_DIV2
+ if scroll + self.baseWidth > self.width:
+ if self.waitingForAlloc:
+ self.scrollTo = -1
+ else:
+ self.adjustment.set_value( self.width - self.baseWidth )
+ else:
+ if self.waitingForAlloc:
+ self.scrollTo = scroll
+ else:
+ self.adjustment.set_value( scroll )
+
+ self.invalidate_rect( startX, 0, Config.PAGE_THUMBNAIL_WIDTH, self.height )
+
+ def selectPage( self, id, exclusive = True ):
+ if exclusive:
+ self._clearSelection()
+
+ if id in self.selectedIds: return False # no change
+
+ ind = self.noteDB.getPageIndex( id )
+ l = len(self.selectedIds)
+ i = 0 # in case len(self.selectedIds) == 0
+ while i < l:
+ if self.noteDB.getPageIndex( self.selectedIds[i] ) > ind: break
+ i += 1
+
+ self.selectedIds.insert( i, id )
+
+ self.invalidate_rect( self.pageOffset + ind*Config.PAGE_THUMBNAIL_WIDTH, 0, Config.PAGE_THUMBNAIL_WIDTH, self.height )
+
+ self.owner.updatePageSelection( self.selectedIds )
+
+ return True # page added to selection
+
+ def deselectPage( self, id, force = False, skip_redraw = False, noUpdate = False ):
+ if not id in self.selectedIds: return False # page isn't selected
+
+ if not force:
+ if len(self.selectedIds) <= 1: return False # don't deselect the last page
+
+ if self.displayedPage == id:
+ i = self.selectedIds.index(id)
+ if i == 0: self.owner.displayPage( self.selectedIds[1] )
+ else: self.owner.displayPage( self.selectedIds[i-1] )
+
+ self.selectedIds.remove( id )
+ if not skip_redraw:
+ ind = self.noteDB.getPageIndex( id )
+ self.invalidate_rect( self.pageOffset + ind*Config.PAGE_THUMBNAIL_WIDTH, 0, Config.PAGE_THUMBNAIL_WIDTH, self.height )
+
+ if not noUpdate:
+ self.owner.updatePageSelection( self.selectedIds )
+
+ return True # page removed from the selection
+
+ def selectPages( self, which ):
+ self._clearSelection()
+ self.selectedIds += which
+
+ self.owner.updatePageSelection( self.selectedIds )
+
+ def selectAll( self ):
+ self.selectedIds = self.noteDB.getTune()[:]
+ self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
+
+ self.owner.updatePageSelection( self.selectedIds )
+
+ def _clearSelection( self ):
+ self.selectedIds = []
+ self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
+
+ def getSelectedIds( self ):
+ return self.selectedIds
+
+ def getDisplayedIndex( self ):
+ return self.selectedIds.index( self.displayedPage )
+
+ def getFirstSelected( self ):
+ return self.selectedIds[0]
+
+ def getLastSelected( self ):
+ return self.selectedIds[-1]
+
+ #=======================================================
+ # NoteDB notifications
+
+ def notifyPageAdd( self, id, at ):
+ if not self.thumbnail.has_key(id):
+ self.thumbnail[id] = gtk.gdk.Pixmap( self.defaultwin, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailDirtyRect[id] = gtk.gdk.Rectangle( 0, 0, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailDirty[id] = True
+ self.selectPage( id )
+ self.updateSize()
+
+ def notifyPageDelete( self, which, safe ):
+ if self.displayedPage in which:
+ noUpdate = True
+ else:
+ noUpdate = False
+ for id in self.selectedIds:
+ if id in which:
+ self.deselectPage( id, True, True, noUpdate )
+ for id in which:
+ del self.thumbnail[id]
+ del self.thumbnailDirtyRect[id]
+ del self.thumbnailDirty[id]
+ if self.displayedPage in which:
+ self.displayedPage = -1
+ self.updateSize()
+
+ def notifyPageDuplicate( self, new, at ):
+ for id in new:
+ self.thumbnail[new[id]] = gtk.gdk.Pixmap( self.defaultwin, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailDirtyRect[new[id]] = gtk.gdk.Rectangle( 0, 0, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ self.thumbnailDirty[new[id]] = True
+ self.updateSize()
+
+ def notifyPageMove( self, which, low, high ):
+ self.invalidate_rect( self.visibleX, 0, self.baseWidth, self.height )
+
+ def notifyPageUpdate( self, page, parameter, value ):
+ if parameter == PARAMETER.PAGE_BEATS:
+ notes = self.noteDB.getNotesByPage( page, self )
+ for note in notes:
+ note.updateParameter( -1, -1 ) # force update transform
+
+ elif parameter == PARAMETER.PAGE_COLOR:
+ self.invalidate_thumbnail( page, 0, 0, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+
+ #=======================================================
+ # Drawing
+
+ def drawThumbnail( self, id, pixmap, rect ):
+ startX = rect.x
+ startY = rect.y
+ stopX = rect.x + rect.width
+ stopY = rect.y + rect.height
+
+ # draw background
+ pixmap.draw_drawable( self.gc, self.thumbnailBG[self.noteDB.getPage(id).color], startX, startY, startX, startY, rect.width, rect.height+1 )
+
+ # draw regular tracks
+ self.gc.foreground = self.lineColor
+ self.gc.set_line_attributes( 1, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ for i in range(self.drumIndex):
+ if startY >= self.trackRect[i+1][1]: continue
+ if stopY < self.trackRect[i][1]: break
+
+ # draw notes
+ notes = self.noteDB.getNotesByTrack( id, i, self )
+ for n in range( len(notes) ):
+ if not notes[n].draw( pixmap, self.gc, startX, stopX ): break
+ # drum track
+ if stopY > self.trackRect[self.drumIndex][0]:
+ # draw notes
+ notes = self.noteDB.getNotesByTrack( id, self.drumIndex, self )
+ for n in range( len(notes) ):
+ if not notes[n].draw( pixmap, self.gc, startX, stopX ): break
+
+ self.thumbnailDirty[id] = False
+
+
+ def draw( self, drawingArea, event ):
+
+ startX = event.area.x
+ startY = event.area.y
+ stopX = event.area.x + event.area.width
+ stopY = event.area.y + event.area.height
+
+ self.gc.set_clip_rectangle( self.clearMask )
+
+ # draw background
+ self.gc.foreground = self.bgColor
+ drawingArea.window.draw_rectangle( self.gc, True, startX, startY, event.area.width, event.area.height )
+
+ tracks = [ self.owner.getTrackSelected(i) for i in range(Config.NUMBER_OF_TRACKS) ]
+
+ # draw pages
+ self.gc.set_clip_mask( self.clipMask )
+
+ x = self.pageOffset
+ endx = x + Config.PAGE_THUMBNAIL_WIDTH
+ for pageId in self.noteDB.getTune():
+ if endx < startX:
+ x = endx
+ endx += Config.PAGE_THUMBNAIL_WIDTH
+ continue
+ if x > stopX: break
+
+ # draw thumbnail
+ if self.thumbnailDirty[pageId]:
+ self.gc.set_clip_origin( 0, 0 )
+ self.drawThumbnail( pageId, self.thumbnail[pageId], self.thumbnailDirtyRect[pageId] )
+ self.gc.set_clip_origin( x, self.pageY )
+ drawingArea.window.draw_drawable( self.gc, self.thumbnail[pageId], 0, 0, x, self.pageY, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+
+ # draw border if necessary
+ if pageId == self.displayedPage: # displayed page border
+ self.gc.set_function( gtk.gdk.INVERT )
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if tracks[i]:
+ drawingArea.window.draw_rectangle( self.gc, True, x + self.trackRect[i][0], self.pageY + self.trackRect[i][1], self.trackRect[i][2], self.trackRect[i][3] )
+ self.gc.set_function( gtk.gdk.COPY )
+ self.gc.foreground = self.displayedColor
+ self.gc.set_clip_origin( x - Config.PAGE_THUMBNAIL_WIDTH, self.pageY )
+ drawingArea.window.draw_rectangle( self.gc, True, x, self.pageY, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+ elif pageId in self.selectedIds: # selected page border
+ self.gc.set_function( gtk.gdk.INVERT )
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if tracks[i]:
+ drawingArea.window.draw_rectangle( self.gc, True, x + self.trackRect[i][0], self.pageY + self.trackRect[i][1], self.trackRect[i][2], self.trackRect[i][3] )
+ self.gc.set_function( gtk.gdk.COPY )
+ self.gc.foreground = self.selectedColor
+ self.gc.set_clip_origin( x - Config.PAGE_THUMBNAIL_WIDTH, self.pageY )
+ drawingArea.window.draw_rectangle( self.gc, True, x, self.pageY, Config.PAGE_THUMBNAIL_WIDTH, Config.PAGE_THUMBNAIL_HEIGHT )
+
+ x += Config.PAGE_THUMBNAIL_WIDTH
+
+ # draw drop marker
+ if self.dropAt >= 0:
+ self.gc.set_clip_rectangle( self.clearMask )
+ self.gc.set_line_attributes( self.dropWidth, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.lineColor
+ drawingArea.window.draw_line( self.gc, self.dropAtX, self.pageY+2, self.dropAtX, self.pageY+Config.PAGE_THUMBNAIL_HEIGHT-4 )
+
+ def invalidate_rect( self, x, y, width, height ):
+ if self.alloced == False: return
+ if x < self.visibleX: x = self.visibleX
+ if x + width > self.visibleEndX: width = self.visibleEndX - x
+ if width <= 0: return
+
+ self.dirtyRectToAdd.x = x
+ self.dirtyRectToAdd.y = y
+ self.dirtyRectToAdd.width = width
+ self.dirtyRectToAdd.height = height
+ self.drawingArea.window.invalidate_rect( self.dirtyRectToAdd, True )
+ self.drawingAreaDirty = True
+
+ def invalidate_thumbnail( self, id, x, y, width, height ):
+ if not self.thumbnailDirty[id]:
+ self.thumbnailDirtyRect[id].x = x
+ self.thumbnailDirtyRect[id].y = y
+ self.thumbnailDirtyRect[id].width = width
+ self.thumbnailDirtyRect[id].height = height
+ self.thumbnailDirty[id] = True
+ else:
+ self.dirtyRectToAdd.x = x
+ self.dirtyRectToAdd.y = y
+ self.dirtyRectToAdd.width = width
+ self.dirtyRectToAdd.height = height
+ self.thumbnailDirtyRect[id] = self.thumbnailDirtyRect[id].union( self.dirtyRectToAdd )
+
+ ind = self.noteDB.getPageIndex( id )
+ self.invalidate_rect( self.pageOffset + ind*Config.PAGE_THUMBNAIL_WIDTH, 0, Config.PAGE_THUMBNAIL_WIDTH, self.height )
+
+ def ticksToPixels( self, beats, ticks ):
+ return int(round( ticks * self.pixelsPerTick[beats] ))
+ def pitchToPixels( self, pitch ):
+ return int(round( ( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch ))
+ def pitchToPixelsDrum( self, pitch ):
+ return int(round( ( Config.MAXIMUM_PITCH_DRUM - pitch ) * self.pixelsPerPitchDrum ))
diff --git a/TamTamEdit.activity/Edit/__init__.py b/TamTamEdit.activity/Edit/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TamTamEdit.activity/Edit/__init__.py
diff --git a/TamTamEdit.activity/Edit/rm/BackgroundView.py b/TamTamEdit.activity/Edit/rm/BackgroundView.py
new file mode 100644
index 0000000..ff6e75f
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/BackgroundView.py
@@ -0,0 +1,501 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from math import floor
+
+from Framework.Constants import Constants
+from GUI.GUIConstants import GUIConstants
+from GUI.Core.NoteParametersWindow import NoteParametersWindow
+
+from Framework.Core.Profiler import TP
+
+class SELECTNOTES:
+ ALL = -1
+ NONE = 0
+ ADD = 1
+ REMOVE = 2
+ EXCLUSIVE = 3
+
+#-------------------------------------------------------------
+# This is a TEMPORARY implementaion of the BackgroundView,
+# it was written quickly to get track selections working
+#-------------------------------------------------------------
+
+# TODO: Do I really have to subclass gtk.EventBox to get the button-press-event?
+# (I wasn't getting it subclassing directly from DrawingArea)
+class BackgroundView( gtk.EventBox ):
+ #-----------------------------------
+ # initialization
+ #-----------------------------------
+ def __init__( self, trackIDs, selectedTrackIDs, selectionChangedCallback, mutedTrackIDs, beatsPerPageAdjustment, trackDictionary, selectedPageIDs, updatePageCallback ):
+ gtk.EventBox.__init__( self )
+
+ self.drawingArea = gtk.DrawingArea()
+ self.add( self.drawingArea )
+
+ self.sizeInitialized = False
+
+ self.trackViews = {}
+ self.trackIDs = trackIDs
+ self.selectedTrackIDs = selectedTrackIDs
+ self.selectionChangedCallback = selectionChangedCallback
+ self.mutedTrackIDs = mutedTrackIDs
+ self.beatsPerPageAdjustment = beatsPerPageAdjustment
+ self.trackDictionary = trackDictionary
+ self.selectedPageIDs = selectedPageIDs
+ self.updatePageCallback = updatePageCallback
+
+ self.curAction = False # stores the current mouse action
+ self.curActionObject = False # stores the object that in handling the action
+
+ self.buttonPressCount = 1 # used on release events to indicate double/triple releases
+ self.clickLoc = [0,0] # location of the last click
+ self.marqueeLoc = False # current drag location of the marquee
+
+ self.drawingArea.connect( "expose-event", self.draw )
+ self.connect( "button-press-event", self.handleButtonPress )
+ self.connect( "button-release-event", self.handleButtonRelease )
+ self.connect( "motion-notify-event", self.handleMotion )
+
+ #-----------------------------------
+ # access methods
+ #-----------------------------------
+ def getTrackRect( self, trackID ):
+ return gtk.gdk.Rectangle( GUIConstants.BORDER_SIZE,
+ self.getTrackYLocation( trackID ),
+ self.getTrackWidth(),
+ self.getTrackHeight() )
+
+ def getTrackWidth( self ):
+ return self.get_allocation().width - 2 * ( GUIConstants.BORDER_SIZE + 2 )
+
+ def getFullHeight( self ):
+ return int( floor( self.get_allocation().height / len( self.trackIDs ) ) )
+
+ def getTrackHeight( self ):
+ return int( self.getFullHeight() - 2 * self.getTrackSpacing() )
+
+ #TODO-> trackIDs should probably be ordered!
+ # we're just using trackID as an index here (this will only work until you can remove tracks)
+ def getTrackYLocation( self, trackID ):
+ if self.getTrackHeight() < 0:
+ return 0
+ else:
+ trackIndex = trackID
+
+ trackHeight = int( floor( self.get_allocation().height / len( self.trackIDs ) ) )
+ trackBackgroundYValue = trackHeight * trackIndex
+ return trackBackgroundYValue + GUIConstants.BORDER_SIZE
+
+ def getTrackSpacing( self ):
+ return GUIConstants.TRACK_SPACING
+
+ #-----------------------------------
+ # callback methods
+ #-----------------------------------
+ def set_size_request( self, width, height ):
+ self.sizeInitialized = True
+ self.drawingArea.set_size_request( width, height )
+ self.height = height
+ self.width = width
+
+ numTracks = len(self.trackIDs)
+ trackSpacing = self.getTrackSpacing()
+ if numTracks: self.trackHeight = int( floor( (height - trackSpacing*(numTracks-1)) / numTracks ) )
+ else: self.trackHeight = 1
+ self.trackWidth = width
+
+ trackCount = 0
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].set_size_request( self.trackWidth, self.trackHeight )
+ self.trackViews[trackID].setPositionOffset( (0, trackCount*(self.trackHeight+trackSpacing)) )
+ trackCount += 1
+
+ def setCurrentTracks( self, trackViews ):
+
+ oldLen = len(self.trackViews)
+
+ if oldLen and trackViews != self.trackViews: self.clearSelectedNotes() # clear all the currently selected notes
+
+ self.trackViews = trackViews
+
+ numTracks = len(self.trackViews)
+ if oldLen != numTracks and self.sizeInitialized:
+ trackSpacing = self.getTrackSpacing()
+ if numTracks: self.trackHeight = int( floor( (self.height - trackSpacing*(numTracks-1)) / numTracks ) )
+ else: self.trackHeight = 1
+ trackCount = 0
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].set_size_request( self.trackWidth, self.trackHeight )
+ self.trackViews[trackID].setPositionOffset( (0, trackCount*(self.trackHeight+trackSpacing)) )
+ trackCount += 1
+
+ self.dirty()
+
+
+ def getNoteParameters( self ):
+ for trackID in self.selectedTrackIDs:
+ for pageID in self.selectedPageIDs:
+ for note in self.trackDictionary[ trackID ][ pageID ]:
+ newPitch = note.pitch + self.noteParameters.pitchAdjust.value
+ newAmplitude = note.amplitude * self.noteParameters.amplitudeAdjust.value
+ newPan = self.noteParameters.panAdjust.value
+ newReverbSend = note.reverbSend * self.noteParameters.reverbSendAdjust.value
+ newAttack = self.noteParameters.attackAdjust.value
+ newDecay = self.noteParameters.decayAdjust.value
+ newFilterType = self.noteParameters.filterType
+ newFilterCutoff = self.noteParameters.filterCutoff
+ newTied = self.noteParameters.tied
+ newOverlap = self.noteParameters.overlap
+
+ note.pitch = self.noteParametersBoundaries( newPitch, note.pitch, Constants.MINIMUM_PITCH, Constants.MAXIMUM_PITCH )
+ note.amplitude = self.noteParametersBoundaries( newAmplitude, note.amplitude, Constants.MINIMUM_AMPLITUDE, Constants.MAXIMUM_AMPLITUDE )
+ note.reverbSend = self.noteParametersBoundaries( newReverbSend, note.reverbSend, Constants.MINIMUM_AMPLITUDE,
+ Constants.MAXIMUM_AMPLITUDE )
+ if newPan != note.pan:
+ note.pan = newPan
+
+ if newAttack != note.attack:
+ note.attack = newAttack
+
+ if newDecay != note.decay:
+ note.decay = newDecay
+
+ if newFilterType != note.filterType:
+ note.filterType = newFilterType
+
+ if newFilterCutoff != note.filterCutoff:
+ note.filterCutoff = newFilterCutoff
+
+ if newTied != note.tied:
+ note.tied = newTied
+
+ if newOverlap != note.overlap:
+ note.overlap = newOverlap
+
+ self.updatePageCallback()
+
+ def noteParametersBoundaries( self, newValue, noteValue, minBoundary, maxBoundary ):
+ if newValue != noteValue:
+ if newValue >= minBoundary and newValue <= maxBoundary:
+ return newValue
+ elif newValue < minBoundary:
+ return minBoundary
+ elif newValue > maxBoundary:
+ return maxBoundary
+ else:
+ return noteValue
+
+ #-----------------------------------
+ # action and event methods
+ #-----------------------------------
+ def setCurrentAction( self, action, obj ):
+ if self.curAction:
+ print "BackgroundView - Action already in progress!"
+
+ self.curAction = action
+ self.curActionObject = obj
+
+ if action == "note-drag-onset": self.updateDragLimits()
+ elif action == "note-drag-duration": self.updateDragLimits()
+ elif action == "note-drag-pitch": self.updateDragLimits()
+
+ def doneCurrentAction( self ):
+ if self.curAction == "note-drag-onset": self.doneNoteDrag()
+ elif self.curAction == "note-drag-duration": self.doneNoteDrag()
+ elif self.curAction == "note-drag-pitch": self.doneNoteDrag()
+
+ self.curAction = False
+ self.curActionObject = False
+
+ def toggleTrack( self, trackID, exclusive ):
+ if exclusive:
+ self.selectedTrackIDs.clear()
+ self.selectedTrackIDs.add( trackID )
+ else:
+ if trackID in self.selectedTrackIDs:
+ self.selectedTrackIDs.discard( trackID )
+ else:
+ self.selectedTrackIDs.add( trackID )
+
+ def selectionChanged( self ):
+ if self.curAction == "note-drag-onset": self.updateDragLimits()
+ elif self.curAction == "note-drag-duration": self.updateDragLimits()
+ elif self.curAction == "note-drag-pitch": self.updateDragLimits()
+ self.dirty()
+
+ def selectNotesByBar( self, selID, startX, stopX ):
+ beatCount = int(round( self.beatsPerPageAdjustment.value, 0 ))
+ for trackID in self.trackIDs:
+ if trackID == selID:
+ notes = self.trackViews[trackID].getNotesByBar( beatCount, startX, stopX )
+ self.trackViews[trackID].selectNotes( SELECTNOTES.EXCLUSIVE, notes )
+ else:
+ self.trackViews[trackID].selectNotes( SELECTNOTES.NONE, [] )
+ self.selectionChanged()
+
+ def selectNotesByTrack( self, selID ):
+ for trackID in self.trackIDs:
+ if trackID == selID: self.trackViews[trackID].selectNotes( SELECTNOTES.ALL, [] )
+ else: self.trackViews[trackID].selectNotes( SELECTNOTES.NONE, [] )
+ self.selectionChanged()
+
+ def selectNotes( self, noteDic ):
+ for trackID in self.trackIDs:
+ if trackID in noteDic: self.trackViews[trackID].selectNotes( SELECTNOTES.EXCLUSIVE, noteDic[trackID] )
+ else: self.trackViews[trackID].selectNotes( SELECTNOTES.NONE, [] )
+ self.selectionChanged()
+
+ def addNotesToSelection( self, noteDic ):
+ for trackID in self.trackIDs:
+ if trackID in noteDic: self.trackViews[trackID].selectNotes( SELECTNOTES.ADD, noteDic[trackID] )
+ self.selectionChanged()
+
+ def deselectNotes( self, noteDic ):
+ for trackID in self.trackIDs:
+ if trackID in noteDic: self.trackViews[trackID].selectNotes( SELECTNOTES.REMOVE, noteDic[trackID] )
+ self.selectionChanged()
+
+ def clearSelectedNotes( self ):
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].selectNotes( SELECTNOTES.NONE, [] )
+ self.selectionChanged()
+
+ def updateDragLimits( self ):
+ self.dragLimits = [ [-9999,9999], [-9999,9999], [-9999,9999] ] # initialize to big numbers!
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].updateDragLimits( self.dragLimits )
+
+ def noteDragOnset( self, event ):
+ dx = event.x - self.clickLoc[0]
+ dx = min( self.dragLimits[0][1], max( self.dragLimits[0][0], dx ) )
+ dy = 0
+ dw = 0
+
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].noteDrag( self, dx, dy, dw )
+ self.dirty()
+
+ def noteDragDuration( self, event ):
+ dx = 0
+ dy = 0
+ dw = event.x - self.clickLoc[0]
+ dw = min( self.dragLimits[2][1], max( self.dragLimits[2][0], dw ) )
+
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].noteDrag( self, dx, dy, dw )
+ self.dirty()
+
+ def noteDragPitch( self, event ):
+ dx = 0
+ dy = event.y - self.clickLoc[1]
+ dy = min( self.dragLimits[1][1], max( self.dragLimits[1][0], dy ) )
+ dw = 0
+
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].noteDrag( self, dx, dy, dw )
+ self.dirty()
+
+ def doneNoteDrag( self ):
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].doneNoteDrag( self )
+
+ def updateMarquee( self, event ):
+ self.marqueeLoc = [ event.x, event.y ]
+ parentRect = self.get_allocation()
+ if self.marqueeLoc[0] < 0: self.marqueeLoc[0] = 0
+ elif self.marqueeLoc[0] > parentRect.width: self.marqueeLoc[0] = parentRect.width
+ if self.marqueeLoc[1] < 0: self.marqueeLoc[1] = 0
+ elif self.marqueeLoc[1] > parentRect.height: self.marqueeLoc[1] = parentRect.height
+
+ self.dirty()
+
+ def doneMarquee( self, event ):
+ if self.marqueeLoc:
+ start = [ min(self.clickLoc[0],self.marqueeLoc[0]), \
+ min(self.clickLoc[1],self.marqueeLoc[1]) ]
+ stop = [ max(self.clickLoc[0],self.marqueeLoc[0]), \
+ max(self.clickLoc[1],self.marqueeLoc[1]) ]
+
+ select = {}
+
+ trackSpacing = self.getTrackSpacing()
+ trackTop = 0
+ for trackID in self.trackIDs:
+ notes = self.trackViews[trackID].handleMarqueeSelect( self, start, stop )
+ if notes: select[trackID] = notes
+ trackTop += self.trackHeight + trackSpacing
+ if trackTop > stop[1]: break
+
+ self.selectNotes( select )
+
+ self.marqueeLoc = False
+ self.doneCurrentAction()
+
+ self.dirty()
+
+ def handleButtonPress( self, drawingArea, event ):
+
+ TP.ProfileBegin( "BV::handleButtonPress" )
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: self.buttonPressCount = 2
+ elif event.type == gtk.gdk._3BUTTON_PRESS: self.buttonPressCount = 3
+ else: self.buttonPressCount = 1
+
+ self.clickLoc = [ event.x, event.y ]
+
+ trackSpacing = self.getTrackSpacing()
+ trackTop = 0
+ for trackID in self.trackIDs:
+ handled = self.trackViews[trackID].handleButtonPress( self, event )
+ trackTop += self.trackHeight + trackSpacing
+ if handled or trackTop > event.y: break
+
+ if handled:
+ if not self.curAction: self.curAction = True # it was handled maybe no action was declared, set curAction to True anyway
+ TP.ProfileEnd( "BV::handleButtonPress" )
+ return
+
+ if event.button == 3:
+ self.noteParameters = NoteParametersWindow( self.trackDictionary, self.getNoteParameters )
+ self.setCurrentAction( "noteParameters", False )
+
+ TP.ProfileEnd( "BV::handleButtonPress" )
+
+
+ def handleButtonRelease( self, drawingArea, event ):
+ TP.ProfileBegin( "BV::handleButtonRelease" )
+
+ if not self.curAction: #do track selection stuff here so that we can also handle marquee selection
+ trackSpacing = self.getTrackSpacing()
+ trackTop = 0
+ for trackID in self.trackIDs:
+ handled = self.trackViews[trackID].handleButtonRelease( self, event, self.buttonPressCount )
+ trackTop += self.trackHeight + trackSpacing
+ if handled or trackTop > event.y: break
+
+ if handled: self.dirty()
+
+ TP.ProfileEnd( "BV::handleButtonRelease" )
+ return
+
+ if not self.curActionObject: # there was no real action to carry out
+ self.curAction = False
+ TP.ProfileEnd( "BV::handleButtonRelease" )
+ return
+
+ if self.curActionObject != self:
+ if self.curActionObject.handleButtonRelease( self, event, self.buttonPressCount ):
+ self.dirty()
+ TP.ProfileEnd( "BV::handleButtonRelease" )
+ return
+
+
+ # we're doing the action ourselves
+
+ if self.curAction == "marquee": self.doneMarquee( event )
+
+ TP.ProfileEnd( "BV::handleButtonRelease" )
+ return
+
+ def handleMotion( self, drawingArea, event ):
+ TP.ProfileBegin( "BV::handleMotion" )
+
+ if not self.curAction: # no action is in progress yet we're dragging, start a marquee
+ self.setCurrentAction( "marquee", self )
+
+ if self.curAction == "note-drag-onset":
+ self.noteDragOnset( event )
+ TP.ProfileEnd( "BV::handleMotion" )
+ return
+
+ if self.curAction == "note-drag-duration":
+ self.noteDragDuration( event )
+ TP.ProfileEnd( "BV::handleMotion" )
+ return
+
+ if self.curAction == "note-drag-pitch":
+ self.noteDragPitch( event )
+ TP.ProfileEnd( "BV::handleMotion" )
+ return
+
+ # we're doing the action ourselves
+
+ if self.curAction == "marquee": self.updateMarquee( event )
+
+ TP.ProfileEnd( "BV::handleMotion" )
+ return
+
+ def TEMPOLDSTUFF(self):
+
+ #TODO change this to accomodate the space between tracks
+ trackHeight = ( drawingArea.get_allocation().height - 1 ) / len( self.trackIDs )
+ trackID = int( floor( event.y / trackHeight ) )
+
+ if event.type == gtk.gdk.BUTTON_PRESS:
+ #single click toggles track selection
+ if trackID in self.selectedTrackIDs:
+ self.selectedTrackIDs.discard( trackID )
+ else:
+ self.selectedTrackIDs.add( trackID )
+ elif event.type == gtk.gdk._2BUTTON_PRESS:
+ #double click selects a single track
+ self.selectedTrackIDs.clear()
+ self.selectedTrackIDs.add( trackID )
+
+ self.drawingArea.queue_draw()
+ self.selectionChangedCallback()
+ if event.button == 3:
+ self.noteParameters = NoteParametersWindow( self.trackDictionary, self.getNoteParameters )
+
+ #-----------------------------------
+ # drawing methods
+ #-----------------------------------
+ def draw( self, drawingArea, event ):
+ TP.ProfileBegin( "BackgroundView::draw" )
+
+ context = drawingArea.window.cairo_create()
+ context.set_antialias(0) # I don't know what to set this to to turn it off, and it doesn't seem to work anyway!?
+
+ #parentRect = self.get_allocation()
+
+ beatCount = int(round( self.beatsPerPageAdjustment.value, 0 ))
+
+ for trackID in self.trackIDs:
+ self.trackViews[trackID].draw( context,
+ beatCount,
+ trackID in self.selectedTrackIDs )
+
+ # if self.curAction == "note-drag": # draw a cross at clickLoc
+ # lineW = 1
+ # context.set_line_width( lineW )
+ # lineWDIV2 = lineW/2.0
+ # context.set_source_rgb( 1, 1, 1 )
+
+ # context.move_to( self.clickLoc[0] + lineWDIV2 - 3, self.clickLoc[1] + lineWDIV2 )
+ # context.rel_line_to( 6, 0 )
+ # context.stroke()
+ # context.move_to( self.clickLoc[0] + lineWDIV2, self.clickLoc[1] + lineWDIV2 - 3)
+ # context.rel_line_to( 0, 6 )
+ # context.stroke()
+
+ if self.marqueeLoc: # draw the selection rect
+ lineW = 1
+ context.set_line_width( lineW )
+ lineWDIV2 = lineW/2.0
+
+ context.move_to( self.clickLoc[0] + lineWDIV2, self.clickLoc[1] + lineWDIV2 )
+ context.line_to( self.marqueeLoc[0] + lineWDIV2, self.clickLoc[1] + lineWDIV2 )
+ context.line_to( self.marqueeLoc[0] + lineWDIV2, self.marqueeLoc[1] + lineWDIV2 )
+ context.line_to( self.clickLoc[0] + lineWDIV2, self.marqueeLoc[1] + lineWDIV2 )
+ context.close_path()
+ context.set_source_rgb( 1, 1, 1 )
+ context.stroke()
+
+ TP.ProfileEnd( "BackgroundView::draw" )
+
+ def dirty( self ):
+ self.queue_draw()
+
+
diff --git a/TamTamEdit.activity/Edit/rm/NoteView.py b/TamTamEdit.activity/Edit/rm/NoteView.py
new file mode 100644
index 0000000..ac139a1
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/NoteView.py
@@ -0,0 +1,253 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from Framework.Constants import Constants
+from Framework.CSound.CSoundConstants import CSoundConstants
+from GUI.GUIConstants import GUIConstants
+from GUI.Core.NoteParametersWindow import NoteParametersWindow
+
+from BackgroundView import SELECTNOTES
+
+#----------------------------------------------------------------------
+# TODO: currently we are only using CSoundNotes,
+# - this should updated to handle generic Note objects
+#----------------------------------------------------------------------
+
+#----------------------------------------------------------------------
+# A view for the (CSound)Note class
+#----------------------------------------------------------------------
+class NoteView:
+ #-----------------------------------
+ # initialization
+ # TODO: not sure if passing in beatsPerPageAdjustment is the best way to go about it
+ #-----------------------------------
+ def __init__( self, note, track, beatsPerPageAdjustment ):
+ self.note = note
+
+ self.track = track
+ self.beatsPerPageAdjustment = beatsPerPageAdjustment
+ self.posOffset = (0,0)
+
+ self.baseOnset = self.basePitch = self.baseDuration = self.lastDragX = self.lastDragY = self.lastDragW = 0 # note dragging properties
+
+ self.sampleNote = None
+
+ self.parentSize = False
+
+ self.selected = False
+ self.potentialDeselect = False
+
+
+ def getNoteParameters( self ):
+ self.note.pitch = self.noteParameters.pitchAdjust.value
+ self.note.amplitude = self.noteParameters.amplitudeAdjust.value
+ self.note.pan = self.noteParameters.panAdjust.value
+ self.note.attack = self.noteParameters.attackAdjust.value
+ self.note.decay = self.noteParameters.decayAdjust.value
+ self.note.reverbSend = self.noteParameters.reverbSendAdjust.value
+ self.note.filterType = self.noteParameters.filterType
+ self.note.filterCutoff = self.noteParameters.filterCutoff
+ self.note.tied = self.noteParameters.tied
+ self.note.overlap = self.noteParameters.overlap
+
+ def handleButtonPress( self, emitter, event ):
+ eX = event.x - self.x
+ eY = event.y - self.y
+
+ if eX < 0 or eX > self.width \
+ or eY < 0 or eY > self.height:
+ return False
+
+ if event.button == 3:
+ self.noteParameters = NoteParametersWindow( self.note, self.getNoteParameters )
+ return True
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: # select bar
+ self.potentialDeselect = False
+ emitter.selectNotesByBar( self.track.getID(), self.x, self.x+self.width )
+ elif event.type == gtk.gdk._3BUTTON_PRESS: # select track
+ self.potentialDeselect = False
+ emitter.selectNotesByTrack( self.track.getID() )
+ else:
+ if self.getSelected(): # we already selected, might want to delected
+ self.potentialDeselect = True
+ else:
+ emitter.selectNotes( { self.track.getID(): [ self ] } )
+ self.updateSampleNote( self.note.pitch )
+
+ percent = eX/self.width
+ if percent < 0.3: emitter.setCurrentAction( "note-drag-onset", self )
+ elif percent > 0.7: emitter.setCurrentAction( "note-drag-duration", self )
+ else: emitter.setCurrentAction( "note-drag-pitch", self )
+
+
+ emitter.dirty()
+
+ return True
+
+ def handleButtonRelease( self, emitter, event, buttonPressCount ):
+
+ if self.potentialDeselect:
+ self.potentialDeselect = False
+ emitter.deselectNotes( { self.track.getID(): [ self ] } )
+
+ self.clearSampleNote()
+
+ emitter.doneCurrentAction()
+
+ return True
+
+ def noteDrag( self, emitter, dx, dy, dw ):
+ self.potentialDeselect = False
+
+ ticksPerPixel = (round( self.beatsPerPageAdjustment.value, 0 ) * Constants.TICKS_PER_BEAT) / self.parentSize[0]
+ stepPerPixel = (Constants.NUMBER_OF_POSSIBLE_PITCHES-1) / (self.parentSize[1] - self.height)
+ pitchPerStep = (Constants.MAXIMUM_PITCH-Constants.MINIMUM_PITCH)/(Constants.NUMBER_OF_POSSIBLE_PITCHES-1)
+
+ if dx != self.lastDragX:
+ self.lastDragX = dx
+ self.note.onset = self.baseOnset + int(dx*ticksPerPixel)
+
+ if dy != self.lastDragY:
+ self.lastDragY = dy
+ newPitch = self.basePitch + round(-dy*stepPerPixel)*pitchPerStep
+ self.note.pitch = newPitch
+ self.updateSampleNote( newPitch )
+
+ if dw != self.lastDragW:
+ self.lastDragW = dw
+ self.note.duration = self.baseDuration + int(dw*ticksPerPixel)
+
+ self.updateTransform( False )
+
+ def doneNoteDrag( self, emitter ):
+ self.baseOnset = self.note.onset
+ self.basePitch = self.note.pitch
+ self.baseDuration = self.note.duration
+
+ self.lastDragX = 0
+ self.lastDragY = 0
+ self.lastDragW = 0
+
+ self.clearSampleNote()
+
+
+ def handleMarqueeSelect( self, emitter, start, stop ):
+ intersectionY = [ max(start[1],self.y), min(stop[1],self.y+self.height) ]
+ if intersectionY[0] > intersectionY[1]:
+ return False
+
+ intersectionX = [ max(start[0],self.x), min(stop[0],self.x+self.width) ]
+ if intersectionX[0] > intersectionX[1]:
+ return False
+
+ return True
+
+ #-----------------------------------
+ # draw
+ #-----------------------------------
+
+ def setPositionOffset( self, offset ):
+ self.posOffset = offset
+ if self.parentSize: self.updateTransform( False )
+
+ def draw( self, context ):
+ lineW = GUIConstants.NOTE_BORDER_SIZE
+ lineWDIV2 = lineW/2.0
+ context.set_line_width( lineW )
+
+ context.move_to( self.x + lineWDIV2, self.y + lineWDIV2 )
+ context.rel_line_to( self.width - lineW, 0 )
+ context.rel_line_to( 0, self.height - lineW )
+ context.rel_line_to( -self.width + lineW, 0 )
+ context.close_path()
+
+ #background
+ colour = 1 - ( ( self.note.amplitude * 0.7 ) + 0.3 )
+ context.set_source_rgb( colour, colour, colour )
+ context.fill_preserve()
+
+ #border
+ if self.selected: context.set_source_rgb( 1, 1, 1 )
+ else: context.set_source_rgb( 0, 0, 0 )
+ context.stroke()
+
+ #-----------------------------------
+ # update
+ #-----------------------------------
+
+ def updateTransform( self, parentSize ):
+ if parentSize: self.parentSize = parentSize
+ self.width = int( self.parentSize[0] * self.note.duration / (round( self.beatsPerPageAdjustment.value, 0 ) * Constants.TICKS_PER_BEAT) )
+ self.height = round( max( GUIConstants.MINIMUM_NOTE_HEIGHT, self.parentSize[1] / (Constants.NUMBER_OF_POSSIBLE_PITCHES-1) ) )
+ self.x = int( self.parentSize[0] * self.note.onset / (round( self.beatsPerPageAdjustment.value, 0 ) * Constants.TICKS_PER_BEAT) ) \
+ + self.posOffset[0]
+ self.y = round( (self.parentSize[1]-self.height) * ( Constants.MAXIMUM_PITCH - self.note.pitch ) / (Constants.NUMBER_OF_POSSIBLE_PITCHES-1) ) \
+ + self.posOffset[1]
+
+ def checkX( self, startx, stopx ):
+ if self.x >= startx and self.x < stopx: return True
+ else: return False
+
+ def getStartTick( self ):
+ return self.note.onset
+
+ def getEndTick( self ):
+ return self.note.onset + self.note.duration
+
+ def updateDragLimits( self, dragLimits, leftBound, rightBound, widthBound ):
+ pixelsPerTick = self.parentSize[0] / (round( self.beatsPerPageAdjustment.value, 0 ) * Constants.TICKS_PER_BEAT)
+ pixelsPerPitch = (self.parentSize[1] - self.height) / (Constants.MAXIMUM_PITCH - Constants.MINIMUM_PITCH)
+ left = (leftBound - self.note.onset) * pixelsPerTick
+ right = (rightBound - self.note.duration - self.note.onset) * pixelsPerTick
+ up = (self.note.pitch - Constants.MAXIMUM_PITCH) * pixelsPerPitch
+ down = (self.note.pitch - Constants.MINIMUM_PITCH) * pixelsPerPitch
+ short = (Constants.MINIMUM_NOTE_DURATION - self.note.duration) * pixelsPerTick
+ long = (widthBound - self.note.duration - self.note.onset) * pixelsPerTick
+
+ if dragLimits[0][0] < left: dragLimits[0][0] = left
+ if dragLimits[0][1] > right: dragLimits[0][1] = right
+ if dragLimits[1][0] < up: dragLimits[1][0] = up
+ if dragLimits[1][1] > down: dragLimits[1][1] = down
+ if dragLimits[2][0] < short: dragLimits[2][0] = short
+ if dragLimits[2][1] > long: dragLimits[2][1] = long
+
+ # store the current loc as a reference point
+ self.baseOnset = self.note.onset
+ self.basePitch = self.note.pitch
+ self.baseDuration = self.note.duration
+
+ def updateSampleNote( self, pitch ):
+ if self.sampleNote == None:
+ self.sampleNote = self.note.clone()
+ #TODO clean this up:
+ if CSoundConstants.INSTRUMENTS[ self.sampleNote.instrumentFlag ].csoundInstrumentID == 103:
+ self.sampleNote.duration = 100
+ else:
+ self.sampleNote.duration = -1
+ self.sampleNote.play()
+
+ elif self.sampleNote.pitch != pitch:
+ self.sampleNote.pitch = pitch
+ self.sampleNote.play()
+
+ def clearSampleNote( self ):
+ if self.sampleNote != None:
+ self.sampleNote.duration = 0
+ self.sampleNote.play()
+ del self.sampleNote
+ self.sampleNote = None
+
+ #-----------------------------------
+ # Selection
+ #-----------------------------------
+
+ def setSelected( self, state ):
+ if self.selected != state:
+ self.selected = state
+ return True # state changed
+ return False # state is the same
+
+ def getSelected( self ):
+ return self.selected
diff --git a/TamTamEdit.activity/Edit/rm/PageBankView.py b/TamTamEdit.activity/Edit/rm/PageBankView.py
new file mode 100644
index 0000000..fedadef
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/PageBankView.py
@@ -0,0 +1,85 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from GUI.GUIConstants import GUIConstants
+from GUI.Core.PageView import PageView
+
+class PageBankView( gtk.Frame ):
+
+ NO_PAGE = -1
+
+ def __init__( self, selectPageCallback, pageDropCallback ):
+ gtk.Frame.__init__( self )
+ self.table = gtk.Table( 1, GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS )
+ self.add( self.table )
+ self.drag_dest_set( gtk.DEST_DEFAULT_ALL, [ ( "tune page", gtk.TARGET_SAME_APP, 11 )], gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE )
+ self.connect( "drag_data_received", self.dragDataReceived )
+ self.selectPageCallback = selectPageCallback
+ self.pageDropCallback = pageDropCallback
+ self.selectedPageIds = set([])
+ self.pageIndexDictionary = {}
+ self.pageViews = {}
+
+ def dragDataReceived( self, widget, context, x, y, selectionData, info, time):
+ self.pageDropCallback( selectionData.data )
+
+ def addPage( self, pageId, invokeCallback = True ):
+ pageIndex = len( self.pageViews.keys() )
+ self.pageIndexDictionary[ pageIndex ] = pageId
+
+ #TODO: resize table to suit number of pages?
+ #if pageIndex > ( self.table.n-rows * self.table.n_columns ):
+ # self.table.resize( self.table.n_rows + 1, self.table.n_columns )
+
+ pageView = PageView( pageIndex, self.selectPage, True )
+ self.pageViews[ pageIndex ] = pageView
+
+ columnIndex = pageIndex % GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS
+ rowIndex = int( pageIndex / GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS )
+ self.table.attach( pageView, columnIndex, columnIndex + 1, rowIndex, rowIndex + 1, gtk.SHRINK, gtk.SHRINK )
+
+ self.updateSize( pageView )
+
+ pageView.drag_source_set( gtk.gdk.BUTTON1_MASK,
+ [ ( "bank page", gtk.TARGET_SAME_APP, 10 ) ],
+ gtk.gdk.ACTION_COPY )
+
+ self.selectPage( pageId, True, invokeCallback )
+
+ pageView.show()
+
+ def set_size_request( self, width, height ):
+ gtk.Frame.set_size_request( self, width, height )
+ self.table.set_size_request( width, height )
+ for pageId in self.pageViews.keys():
+ self.updateSize( self.pageViews[ pageId ] )
+
+ def updateSize( self, pageView ):
+ pageView.set_size_request( self.get_allocation().width / GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS,
+ GUIConstants.PAGE_HEIGHT - 1 )
+
+ def selectPage( self, selectedPageId, invokeCallback = True, deselectOthers = True ):
+ if deselectOthers:
+ for pageId in self.pageViews.keys():
+ self.pageViews[ pageId ].setSelected( pageId == selectedPageId )
+ if pageId != selectedPageId:
+ self.selectedPageIds.discard( pageId )
+ else:
+ self.selectedPageIds.add( pageId )
+ #nb: pageId might be NO_PAGE, and selectedPageIds can be empty here
+
+ else:
+ self.pageViews[ selectedPageId ].toggleSelected()
+ if self.pageViews[ selectedPageId ].selected:
+ self.selectedPageIds.add( selectedPageId )
+ else:
+ self.selectedPageIds.discard( selectedPageId )
+
+ if invokeCallback:
+ self.selectPageCallback( selectedPageId )
+
+ def getSelectedPageIds( self ):
+ rval = filter( lambda id: self.pageViews[id].selected == True, self.pageViews.keys())
+ return rval
+
diff --git a/TamTamEdit.activity/Edit/rm/PageView.py b/TamTamEdit.activity/Edit/rm/PageView.py
new file mode 100644
index 0000000..00b650b
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/PageView.py
@@ -0,0 +1,65 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import pango
+
+from GUI.GUIConstants import GUIConstants
+
+class PageView( gtk.DrawingArea ):
+ def __init__( self, pageID, selectPageCallback, selected = False ):
+ gtk.DrawingArea.__init__( self )
+
+ self.pageID = pageID
+ self.selectPageCallback = selectPageCallback
+ self.selected = selected
+
+ self.add_events( gtk.gdk.BUTTON_PRESS_MASK )
+
+ self.connect( "expose-event", self.handleExposeEvent )
+ self.connect( "button-press-event", self.handleButtonPress )
+ self.connect( "drag_data_get", self.getData )
+
+ def handleButtonPress( self, widget, event ):
+ if event.button == 1 or event.button == 3:
+ self.selectPageCallback( self.pageID, event.button == 1 )
+
+ def getData( self, widget, context, selection, targetType, eventTime ):
+ return selection.set( gtk.gdk.SELECTION_PRIMARY, 32, "p %d" % self.pageID )
+
+ def toggleSelected( self ):
+ self.selected = not self.selected
+ self.queue_draw()
+
+ def setSelected( self, selected ):
+ if self.selected != selected:
+ self.selected = selected
+ self.queue_draw()
+
+ # TODO: this is temporary: replace with a visual representation of the page
+ def handleExposeEvent( self, drawingArea, event ):
+ size = self.get_allocation()
+ context = self.window.cairo_create()
+
+ if self.selected:
+ context.set_line_width( GUIConstants.PAGE_SELECTED_BORDER_SIZE )
+ else:
+ context.set_line_width( GUIConstants.PAGE_BORDER_SIZE )
+ context.move_to( 0, 0 )
+ context.rel_line_to( size.width, 0 )
+ context.rel_line_to( 0, size.height )
+ context.rel_line_to( -size.width, 0 )
+ context.close_path()
+
+ #blue background
+ context.set_source_rgb( 0.75, 0.75, 0.75 )
+ context.fill_preserve()
+
+ #black border
+ context.set_source_rgb( 0, 0, 0 )
+ context.stroke()
+
+ #text
+ layout = self.create_pango_layout( "%d" % ( self.pageID + 1 ) )
+ layout.set_font_description( pango.FontDescription( 'Sans 10' ) )
+ self.window.draw_layout( self.window.new_gc(), 5, 5, layout )
diff --git a/TamTamEdit.activity/Edit/rm/PositionIndicator.py b/TamTamEdit.activity/Edit/rm/PositionIndicator.py
new file mode 100644
index 0000000..aadc4f4
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/PositionIndicator.py
@@ -0,0 +1,47 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+#----------------------------------------------------------------------
+# A verical bar used to show the current point in time on a page
+# TODO: modify this class to change the current point in time
+# on click and drag
+#----------------------------------------------------------------------
+class PositionIndicator( gtk.DrawingArea ):
+ #-----------------------------------
+ # initialization
+ #-----------------------------------
+ def __init__( self, trackIDs, selectedTrackIDs, mutedTrackIDs ):
+ gtk.DrawingArea.__init__( self )
+
+ self.trackIDs = trackIDs
+ self.selectedTrackIDs = selectedTrackIDs
+ self.mutedTrackIDs = mutedTrackIDs
+
+ self.connect( "expose-event", self.draw )
+
+ def draw( self, drawingArea, event ):
+ indicatorSize = self.get_allocation()
+ trackHeight = indicatorSize.height / len( self.trackIDs )
+
+ context = drawingArea.window.cairo_create()
+
+ trackIndex = 0
+ for trackID in self.trackIDs:
+ height = trackIndex * trackHeight
+
+ context.move_to( 0, height )
+ context.rel_line_to( indicatorSize.width, 0 )
+ context.rel_line_to( 0, height + trackHeight )
+ context.rel_line_to( -indicatorSize.width, 0 )
+ context.close_path()
+
+ if trackID not in self.mutedTrackIDs:
+ context.set_source_rgb( 0, 0, 0 ) #black
+ else:
+ context.set_source_rgb( 0.6, 0.6, 0.6 ) #grey
+
+ context.fill_preserve()
+ context.stroke()
+
+ trackIndex += 1 \ No newline at end of file
diff --git a/TamTamEdit.activity/Edit/rm/TrackView.py b/TamTamEdit.activity/Edit/rm/TrackView.py
new file mode 100644
index 0000000..0b66abd
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/TrackView.py
@@ -0,0 +1,263 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from Framework.Constants import Constants
+from GUI.GUIConstants import GUIConstants
+
+from BackgroundView import SELECTNOTES
+from NoteView import NoteView
+
+
+#----------------------------------------------------------------------
+# This view class is used to show the contents of a NoteTrack
+# i.e. a Collection of Note objects
+#----------------------------------------------------------------------
+class TrackView:
+ #-----------------------------------
+ # initialization functions
+ #-----------------------------------
+ def __init__( self, trackID, beatsPerPageAdjustment ):
+ self.trackID = trackID
+ self.beatsPerPageAdjustment = beatsPerPageAdjustment
+ self.noteViews = []
+ self.posOffset = (0,0)
+ self.selectedNotes = []
+
+ def getID( self ):
+ return self.trackID
+
+ #-----------------------------------
+ # modification methods
+ #-----------------------------------
+ def setNotes( self, notes ):
+ self.clearNotes()
+
+ lineW = self.getBorderWidth()
+
+ for note in notes:
+ noteView = NoteView( note, self, self.beatsPerPageAdjustment )
+ self.noteViews.append( noteView )
+ noteView.setPositionOffset( (self.posOffset[0]+lineW, self.posOffset[1]+lineW ) )
+
+ self.updateNoteTransforms()
+
+ def clearNotes( self ):
+ del self.noteViews
+ self.noteViews = []
+ self.selectedNotes = []
+
+ def selectNotes( self, mode, which ):
+ if mode == SELECTNOTES.ALL:
+ for note in self.noteViews: note.setSelected( True )
+ self.selectedNotes = self.noteViews[:]
+ elif mode == SELECTNOTES.NONE:
+ for note in self.noteViews: note.setSelected( False )
+ self.selectedNotes = []
+ elif mode == SELECTNOTES.ADD:
+ for note in which:
+ if note.setSelected( True ):
+ self.selectedNotes.insert( 0, note )
+ elif mode == SELECTNOTES.REMOVE:
+ for note in which:
+ if note.setSelected( False ):
+ self.selectedNotes.remove( note )
+ elif mode == SELECTNOTES.EXCLUSIVE:
+ for note in self.noteViews:
+ if note in which:
+ if note.setSelected( True ):
+ self.selectedNotes.insert( 0, note )
+ else:
+ if note.setSelected( False ):
+ self.selectedNotes.remove( note )
+
+ def updateDragLimits( self, dragLimits ):
+ if not len(self.selectedNotes): return # no selected notes here
+
+ leftBound = 0
+ maxRightBound = round( self.beatsPerPageAdjustment.value, 0 ) * Constants.TICKS_PER_BEAT
+ last = len(self.noteViews)-1
+ for i in range(0,last):
+ if not self.noteViews[i].getSelected():
+ leftBound = self.noteViews[i].getEndTick()
+ else:
+ if not self.noteViews[i+1].getSelected():
+ rightBound = min( self.noteViews[i+1].getStartTick(), maxRightBound )
+ widthBound = rightBound
+ else:
+ rightBound = maxRightBound
+ widthBound = min( self.noteViews[i+1].getStartTick(), maxRightBound )
+ self.noteViews[i].updateDragLimits( dragLimits, leftBound, rightBound, widthBound )
+ if self.noteViews[last].getSelected():
+ self.noteViews[last].updateDragLimits( dragLimits, leftBound, maxRightBound, maxRightBound )
+
+ def getNotesByBar( self, beatCount, startX, stopX ):
+ beatWidth = self.getBeatLineSpacing( beatCount )
+ beatStart = self.getBeatLineStart()
+ while beatStart+beatWidth <= startX:
+ beatStart += beatWidth
+ beatStop = beatStart + beatWidth
+ while beatStop+beatWidth < stopX:
+ beatStop += beatWidth
+
+ notes = []
+ for note in self.noteViews:
+ if note.checkX( beatStart, beatStop ):
+ notes.insert(0,note)
+ return notes
+
+ #-----------------------------------
+ # event methods
+ #-----------------------------------
+
+ def handleButtonPress( self, emitter, event ):
+ eX = event.x - self.posOffset[0]
+ eY = event.y - self.posOffset[1]
+ if eX < 0 or eX > self.width or eY < 0 or eY > self.height:
+ return False
+
+ for note in self.noteViews:
+ handled = note.handleButtonPress( emitter, event )
+ if handled: return handled
+
+ return False
+
+ def handleButtonRelease( self, emitter, event, buttonPressCount ):
+ eX = event.x - self.posOffset[0]
+ eY = event.y - self.posOffset[1]
+
+ if eX < 0 or eX > self.width or eY < 0 or eY > self.height:
+ return False
+
+ if event.button == 1:
+ if buttonPressCount == 1: emitter.toggleTrack( self.trackID, False )
+ else: emitter.toggleTrack( self.trackID, True )
+
+ return True
+
+ def handleMarqueeSelect( self, emitter, start, stop ):
+ intersectionY = [ max(start[1],self.posOffset[1]), min(stop[1],self.posOffset[1]+self.height) ]
+ if intersectionY[0] > intersectionY[1]:
+ return False
+
+ intersectionX = [ max(start[0],self.posOffset[0]), min(stop[0],self.posOffset[0]+self.width) ]
+ if intersectionX[0] > intersectionX[1]:
+ return False
+
+
+ hits = []
+ for note in self.noteViews:
+ hit = note.handleMarqueeSelect( emitter,
+ [ intersectionX[0], intersectionY[0] ], \
+ [ intersectionX[1], intersectionY[1] ] )
+ if hit: hits.insert(0,note)
+
+ if len(hits): return hits
+
+ return False
+
+ def noteDrag( self, emitter, dx, dy, dw ):
+ for note in self.selectedNotes:
+ note.noteDrag( emitter, dx, dy, dw )
+
+ def doneNoteDrag( self, emitter ):
+ for note in self.selectedNotes:
+ note.doneNoteDrag( emitter )
+
+ #-----------------------------------
+ # drawing methods
+ #-----------------------------------
+
+ def getBorderWidth( self ): #should return a constant value, otherwise we have to recalculate sizing and positioning everyframe!
+ return GUIConstants.BORDER_SIZE
+
+ def getBeatLineWidth( self ):
+ return GUIConstants.BEAT_LINE_SIZE #should return a constant value, otherwise we have to recalculate sizing and positioning everyframe!
+
+ def getBeatLineSpacing( self, beatCount ):
+ return (self.width - 2*self.getBorderWidth() + self.getBeatLineWidth())/beatCount
+
+ def getBeatLineStart( self ):
+ return self.posOffset[0] + self.getBorderWidth() - self.getBeatLineWidth()/2.0
+
+ def setPositionOffset( self, offset ):
+ self.posOffset = offset
+
+ lineW = self.getBorderWidth()
+ for note in self.noteViews:
+ note.setPositionOffset( ( self.posOffset[0]+lineW, self.posOffset[1]+lineW ) )
+
+ def draw( self, context, beatCount, selected ):
+ #if selected: lineW = GUIConstants.SELECTED_BORDER_SIZE
+ #else: lineW = GUIConstants.BORDER_SIZE
+ lineW = self.getBorderWidth()
+ context.set_line_width( lineW )
+ lineWDIV2 = lineW/2.0
+
+ context.move_to( self.posOffset[0] + lineWDIV2, self.posOffset[1] + lineWDIV2 )
+ context.rel_line_to( self.width - lineW, 0 )
+ context.rel_line_to( 0, self.height - lineW )
+ context.rel_line_to( -self.width + lineW, 0 )
+ context.close_path()
+
+ #draw the background
+ context.set_source_rgb( 0.75, 0.75, 0.75 )
+ context.fill_preserve()
+
+ #draw the border
+ if selected: context.set_source_rgb( 1, 1, 1 )
+ else: context.set_source_rgb( 0, 0, 0 )
+ context.stroke()
+
+ #draw the beat lines
+ beatLineWidth = self.getBeatLineWidth()
+ context.set_line_width( beatLineWidth )
+ beatWidth = self.getBeatLineSpacing( beatCount )
+ beatStart = self.getBeatLineStart()
+ context.set_source_rgb( 0, 0, 0 )
+ for i in range(1,beatCount):
+ context.move_to( beatStart + i*beatWidth, self.posOffset[1] + lineW )
+ context.rel_line_to( 0, self.height - 2*lineW )
+ context.stroke()
+
+ #draw the notes
+ for note in self.noteViews:
+ note.draw( context )
+
+ #-----------------------------------
+ # sizing methods
+ #-----------------------------------
+
+ def updateNoteTransforms( self ):
+ width = self.width - 2*self.getBorderWidth()
+ height = self.height - 2*self.getBorderWidth() # adjust for actual note drawing area
+ for noteView in self.noteViews:
+ noteView.updateTransform( (width, height) )
+
+ def set_size_request( self, width, height ):
+ self.width = width
+ self.height = height
+ self.updateNoteTransforms()
+
+
+#unused for now...
+class NoteViewPool:
+ def __init__( self, parentContainer, beatsPerPageAdjustment ):
+ self.parentContainer = parentContainer
+ self.beatsPerPageAdjustment = beatsPerPageAdjustment
+ self.pool = []
+
+ def addNoteView( self, noteView ):
+ #noteView.hide()
+ self.pool.append( noteView )
+
+ def addNoteViews( self, noteViews ):
+ for noteView in noteViews:
+ self.addNoteView( noteView )
+
+ def getNoteView( self ):
+ poolSize = len( pool )
+ if poolSize != 0:
+ return pool.pop( poolSize )
+
+ return NoteView( None, self.parentContainer, self.beatsPerPageAdjustment )
diff --git a/TamTamEdit.activity/Edit/rm/TunePageView.py b/TamTamEdit.activity/Edit/rm/TunePageView.py
new file mode 100644
index 0000000..501504f
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/TunePageView.py
@@ -0,0 +1,17 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from PageView import PageView
+
+class TunePageView( PageView ):
+ def __init__( self, pageID, tuneIndex, selectPageCallback, selected = False ):
+ PageView.__init__( self, pageID, selectPageCallback, selected )
+
+ self.pageIndex = tuneIndex
+
+ def handleButtonPress( self, widget, data ):
+ self.selectPageCallback( self.tuneIndex )
+
+ def getData( self, widget, context, selection, targetType, eventTime ):
+ return selection.set( gtk.gdk.SELECTION_PRIMARY, 32, "t %d %d" % (self.pageID,self.pageIndex) )
diff --git a/TamTamEdit.activity/Edit/rm/TuneView.py b/TamTamEdit.activity/Edit/rm/TuneView.py
new file mode 100644
index 0000000..63cf468
--- /dev/null
+++ b/TamTamEdit.activity/Edit/rm/TuneView.py
@@ -0,0 +1,123 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from GUI.GUIConstants import GUIConstants
+from GUI.Core.TunePageView import TunePageView
+
+def swap(l,i,j):
+ e = l[i]
+ l[i] = l[j]
+ l[j] = e
+
+class TuneView( gtk.ScrolledWindow ):
+
+ NO_PAGE = -1
+
+ def _page_width(self):
+ return self.pageContainer.get_allocation().width / GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS
+
+ def __init__( self, selectPageCallback ):
+ gtk.ScrolledWindow.__init__( self )
+
+ #selectPageCallback(): currently connected to pagePlayer.setPlayTune, which skips to a given page of the tune.
+ self.selectPageCallback = selectPageCallback
+ self.selectedPageIndex = self.NO_PAGE
+
+ self.set_policy( gtk.POLICY_ALWAYS, gtk.POLICY_AUTOMATIC )
+ self.set_placement( gtk.CORNER_TOP_LEFT )
+
+ #self.pageViews: list of our custom PageView widgets
+ self.pageViews = []
+ self.pageContainer = gtk.HBox( False )
+ self.add_with_viewport( self.pageContainer )
+
+ #the old part
+ self.pageContainer.drag_dest_set( gtk.DEST_DEFAULT_ALL,
+ [ ( "bank page", gtk.TARGET_SAME_APP, 10 ),
+ ( "tune page", gtk.TARGET_SAME_APP, 11 )],
+ gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE )
+
+ self.pageContainer.connect( "drag_data_received", self.dragDataReceived )
+
+ #private method: called by gtk when pages get dragged onto the tune-view
+ def dragDataReceived( self, widget, context, x, y, selectionData, info, time ):
+ print 'dragDataReceived: ', selectionData.data, info, selectionData.data
+ recv = selectionData.data.split()
+ if recv[0] == 'p':
+ pageId = int( recv[1] )
+ self.addPage( pageId, min( x / self._page_width(), len( self.pageViews )) )
+ elif recv[0] == 't':
+ self.moveSelectedPage( min( x / self._page_width(), len( self.pageViews ) -1))
+ else:
+ raise 'ERROR'
+
+ #public method: called by MainWindow on file load
+ def syncFromPagePlayer(self):
+ raise 'never call this'
+ map( lambda pv:pv.destroy(), self.pageViews )
+ self.pageViews = []
+ tunePages = self.tunePagesCallback()
+ for i in range( len(tunePages)):
+ self.addPage( tunePages[i], i, False)
+
+
+ def addPage( self, pageID, position ):
+ #create a new widget
+ pageView = TunePageView( pageID, position, self.selectPage )
+ self.pageViews.insert( position, pageView )
+ self.pageContainer.pack_start( pageView, False )
+ self.pageContainer.reorder_child( pageView, position )
+
+ pageView.set_size_request( self.pageContainer.get_allocation().width / GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS,
+ GUIConstants.PAGE_HEIGHT )
+ pageView.show()
+
+ for i in range( len(self.pageViews)) :
+ self.pageViews[i].tuneIndex = i
+ self.pageViews[i].setSelected( i == position)
+ self.selectPageCallback( pageID, position )
+ pageView.drag_source_set(
+ gtk.gdk.BUTTON1_MASK,
+ [ ( "tune page", gtk.TARGET_SAME_APP, 11 ) ],
+ gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE )
+
+ def moveSelectedPage( self, position):
+ self.pageContainer.reorder_child( self.pageViews[self.selectedPageIndex], position )
+ swap( self.pageViews, self.selectedPageIndex, position )
+ self.selectedPageIndex = position
+ for i in range( len(self.pageViews) ) :
+ self.pageViews[i].tuneIndex = i
+ self.pageViews[i].setSelected( i == position)
+
+ def removePage( self, position ):
+ pv = self.pageViews[position]
+ self.pageViews[position:position+1] = []
+ if self.selectedPageIndex >= position : self.selectedPageIndex -= 1
+ for i in range( len(self.pageViews)) :
+ self.pageViews[i].tuneIndex = i
+ self.pageViews[i].setSelected( i == position)
+ self.pageContainer.remove(pv)
+ del pv
+
+ def selectPage( self, selectedPageIndex, invokeCallback = True ):
+ if selectedPageIndex >= len( self.pageViews ): selectedPageIndex = self.NO_PAGE
+ self.selectedPageIndex = selectedPageIndex
+ if selectedPageIndex == self.NO_PAGE:
+ for pv in self.pageViews: pv.setSelected(False)
+ if invokeCallback: self.selectPageCallback( -1, -1 )
+ else:
+ if not self.pageViews[ selectedPageIndex ].selected:
+ map( lambda pv: pv.setSelected( pv.tuneIndex == selectedPageIndex), self.pageViews)
+ if invokeCallback: self.selectPageCallback( self.pageViews[selectedPageIndex].pageID, selectedPageIndex )
+
+ def set_size_request( self, width, height ):
+ gtk.ScrolledWindow.set_size_request( self, width, height )
+ map( lambda pv: pv.set_size_request( width / GUIConstants.NUMBER_OF_PAGE_BANK_COLUMNS, GUIConstants.PAGE_HEIGHT ), self.pageViews)
+
+ def getPageId( self, idx):
+ return self.pageViews[idx].pageID
+
+ def getTune( self ):
+ return [ p.pageID for p in self.pageViews ]
+
diff --git a/TamTamEdit.activity/NEWS b/TamTamEdit.activity/NEWS
new file mode 100644
index 0000000..8120a07
--- /dev/null
+++ b/TamTamEdit.activity/NEWS
@@ -0,0 +1,71 @@
+39
+
+* New activity : TamTamJam (lync)
+* Activities are now separate (TamTamJam, TamTamEdit, TamTamSynthLab)
+* No sound when set to language other than english fixed (#3165) (J5, marcopg, tomeu, Flipo)
+
+38
+
+* Adapt to new Palette API (Flipo)
+
+37
+
+* Small layout change in edit (Flipo)
+* Temporary fix for Palettes causing the audio to stop (Flipo)
+
+36
+
+* Major image cleanup, 700k saved (Flipo)
+* Tune generation back (see leftmost icon on generate tab) (Olipet)
+
+35
+
+* TamTam Edit Toolbars enhancements (Flipo, Olipet)
+* TamTam Edit layout changes (lync)
+* Dual instruments for tracks in Edit (Olipet, lync)
+
+34
+
+* Synthlab sugar integration (olipet, Flipo)
+* Toolbars in edit draft, hit alt-t to show the toolbar, alt-y to hide (Flipo)
+* Bug that prevented sound from working fixed (LeJames)
+
+33
+
+* Added Sugar Toolbar to miniTamTam and Synthlab (Flipo)
+* Network now working in miniTamTam, use the share button on the activity toolbar (lync)
+* Added help subsystem (ethrop, LeJames)
+
+32
+
+* Important microphone fix (Olipet)
+
+31
+
+* Working network (create a FORCE_SHARE file in the / dir) (lync)
+* New tune generator in Edit, click the dice in the tune view (Olipet)
+* Fine tuning of the algorythmic generator and orchestras (Olipet)
+* TamTamJam (miniTamTam) integration with the journal (Flipo)
+* Title according to subactivity displayed in the journal (Flipo)
+
+30
+
+* Clicking the close button in Edit and Synthlab goes back to Sugar. (Flipo)
+* Fix to the Journal load and save. (Flipo, lync)
+* Ogg player on the welcome page. (lync)
+* Demo tune instruments and tempo are randomly generated (Olipet)
+* lab placeholder files were reduced in size by 95% (Olipet)
+
+29
+
+* WelcomeScreen: Removed Typing Game icon. (Flipo)
+* General: Added sounds. (ethrop, Olipet)
+* General: Journal integration. (Flipo, lync)
+* TamTamJam: Microphone semi-working. (James)
+* TamTamEdit: Beats per page setting. (lync, Olipet)
+* TamTamEdit: Mute/Solo controls on tracks. (Flipo)
+* TamTamEdit: Paint tool. (Olipet)
+* TamTamEdit: Properties automation. (Olipet)
+* TamTamEdit: Pages can have different colors. (lync)
+* TamTamEdit: Realtime keyboard recording. (Olipet)
+* TamTamEdit: Export song to ogg file. (Olipet) \ No newline at end of file
diff --git a/TamTamEdit.activity/TamTam.py b/TamTamEdit.activity/TamTam.py
new file mode 100644
index 0000000..e282df9
--- /dev/null
+++ b/TamTamEdit.activity/TamTam.py
@@ -0,0 +1,1229 @@
+import locale
+locale.setlocale(locale.LC_NUMERIC, 'C')
+import signal , time , sys , os, shutil
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import gobject
+import time
+
+import Config
+from Util.CSoundClient import new_csound_client
+from Util.Profiler import TP
+
+from Util.InstrumentPanel import InstrumentPanel
+from miniTamTam.miniTamTamMain import miniTamTamMain
+from Jam.JamMain import JamMain
+from Edit.MainWindow import MainWindow
+from Welcome import Welcome
+from SynthLab.SynthLabWindow import SynthLabWindow
+from Util.Trackpad import Trackpad
+from gettext import gettext as _
+#from Util.KeyboardWindow import KeyboardWindow
+import commands
+
+if __name__ != '__main__':
+ try:
+ from sugar.activity.activity import Activity
+ from sugar.activity import activity
+ FAKE_ACTIVITY = False
+ if Config.DEBUG: print 'using sugar Activity'
+ except ImportError:
+ from FActivity import FakeActivity as Activity
+ FAKE_ACTIVITY = True
+ if Config.DEBUG: print 'using fake activity'
+else:
+ from FActivity import FakeActivity as Activity
+ if Config.DEBUG: print 'using fake activity'
+
+
+class TamTam(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ if self._shared_activity: # if we're joining a shared activity force mini
+ self.set_mode("mini")
+ else:
+ self.set_mode(mode)
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ #if len( self.preloadList ):
+ # self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ #print "-----", event.keyval, event.string, event.hardware_keycode
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ subactivity_name = self.metadata['tamtam_subactivity']
+ if subactivity_name == 'edit' \
+ or subactivity_name == 'synth' \
+ or subactivity_name == 'jam':
+ self.set_mode(subactivity_name)
+ self.modeList[subactivity_name].handleJournalLoad(file_path)
+ elif subactivity_name == 'mini':
+ self.set_mode(subactivity_name)
+ else:
+ return
+
+ def write_file(self,file_path):
+ if self.mode == 'edit':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+ elif self.mode == 'synth':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+ elif self.mode == 'mini':
+ self.metadata['tamtam_subactivity'] = self.mode
+ f = open(file_path,'w')
+ f.close()
+ elif self.mode == 'jam':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+
+class TamTamJam(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Jam')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("jam")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['jam'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['jam'].handleJournalSave(file_path)
+
+class TamTamEdit(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='edit'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Edit')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("edit")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['edit'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['edit'].handleJournalSave(file_path)
+
+class TamTamSynthLab(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='synth'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam SynthLab')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("synth")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['synth'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['synth'].handleJournalSave(file_path)
+
+class TamTamMini(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='mini'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Mini')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("mini")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.metadata['tamtam_subactivity'] = 'mini'
+
+ def write_file(self,file_path):
+ f = open(file_path,'w')
+ f.close()
+
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 :
+ mainwin = TamTam(None, sys.argv[1])
+ else:
+ mainwin = TamTam(None, 'welcome')
+
+ gtk.gdk.threads_init()
+ gtk.main()
+
+ sys.exit(0)
+
+
+
+
+
+
+
+
+ def run_edit_mode():
+ tamtam = MainWindow()
+ mainwin = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ mainwin.set_title('TamTam Player')
+ display = mainwin.get_display()
+ screen = gtk.gdk.Display.get_default_screen(display)
+ mainwin.set_geometry_hints( None, screen.get_width(), screen.get_height(), screen.get_width(), screen.get_height(), screen.get_width(), screen.get_height() )
+ #mainwin.fullscreen() # don't need to specify full screen, it seem to sit properly anyway
+ mainwin.set_resizable(False)
+ mainwin.connect('destroy' , tamtam.destroy )
+ #mainwin.connect( "configure-event", tamtam.handleConfigureEvent )
+ mainwin.connect( "key-press-event", tamtam.onKeyPress )
+ mainwin.connect( "key-release-event", tamtam.onKeyRelease )
+ mainwin.connect( "delete_event", tamtam.delete_event )
+ mainwin.add(tamtam)
+ tamtam.show()
+ mainwin.show()
+ gtk.main()
diff --git a/TamTamEdit.activity/activity/activity-tamtamedit.svg b/TamTamEdit.activity/activity/activity-tamtamedit.svg
new file mode 100644
index 0000000..44f1ba6
--- /dev/null
+++ b/TamTamEdit.activity/activity/activity-tamtamedit.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-edittam">
+ <rect display="inline" fill="&fill_color;" height="20" width="44.332" x="5.543" y="25"/>
+ <path d=" M10.958,37.7c1.353-1.464,3.64-1.547,5.112-0.189c1.467,1.358,1.557,3.646,0.201,5.111c-1.355,1.464-3.644,1.546-5.11,0.189 C9.691,41.452,9.6,39.163,10.958,37.7z" display="inline" fill="&stroke_color;" id="path25_1_" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d=" M21.881,27.854c1.354-1.464,3.641-1.548,5.111-0.19c1.468,1.359,1.558,3.646,0.202,5.113c-1.355,1.464-3.644,1.545-5.11,0.19 C20.616,31.607,20.524,29.319,21.881,27.854z" display="inline" fill="&stroke_color;" id="path25_2_" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round"/>
+ <path d=" M36.845,33.095c1.354-1.464,3.641-1.547,5.112-0.189c1.466,1.357,1.557,3.646,0.2,5.109c-1.354,1.464-3.643,1.549-5.109,0.189 C35.58,36.847,35.487,34.56,36.845,33.095z" display="inline" fill="&stroke_color;" id="path25_3_" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round"/>
+ <polygon display="inline" fill="&stroke_color;" points="16.737,19.72 27.58,15.817 27.58,11.817 16.737,15.72 " stroke="&stroke_color;" stroke-width="2.25"/>
+
+ <line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25" x1="27.58" x2="27.58" y1="11.817" y2="30.031"/>
+
+ <line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25" x1="16.737" x2="16.737" y1="15.72" y2="40.44"/>
+
+ <line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25" x1="42.532" x2="42.532" y1="34.512" y2="13.692"/>
+
+ <line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="5.543" x2="49.875" y1="25" y2="25"/>
+
+ <line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="5.543" x2="49.875" y1="35" y2="35"/>
+
+ <line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="5.543" x2="49.875" y1="45" y2="45"/>
+</g></svg> \ No newline at end of file
diff --git a/TamTamEdit.activity/activity/activity.info b/TamTamEdit.activity/activity/activity.info
new file mode 100644
index 0000000..65e5044
--- /dev/null
+++ b/TamTamEdit.activity/activity/activity.info
@@ -0,0 +1,6 @@
+[Activity]
+name = TamTamEdit
+service_name = org.laptop.TamTamEdit
+icon = activity-tamtamedit
+class = TamTam.TamTamEdit
+activity_version = 40
diff --git a/TamTamEdit.activity/common b/TamTamEdit.activity/common
new file mode 120000
index 0000000..60d3b0a
--- /dev/null
+++ b/TamTamEdit.activity/common
@@ -0,0 +1 @@
+../common \ No newline at end of file
diff --git a/TamTamEdit.activity/icons/XYBut.svg b/TamTamEdit.activity/icons/XYBut.svg
new file mode 100644
index 0000000..54d7563
--- /dev/null
+++ b/TamTamEdit.activity/icons/XYBut.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<g>
+ <circle fill="#808284" cx="15" cy="15" r="9.376"/>
+ <g>
+ <path fill="#FFFFFF" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.584-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.918-6.501-6.502S11.417,8.5,15.001,8.5C18.585,8.5,21.5,11.413,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.168,28,28,22.165,28,14.998C28,7.831,22.168,2,15.003,2z"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/XYButDown.svg b/TamTamEdit.activity/icons/XYButDown.svg
new file mode 100644
index 0000000..201df5f
--- /dev/null
+++ b/TamTamEdit.activity/icons/XYButDown.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<g>
+ <circle cx="15" cy="15" r="6.933"/>
+ <g>
+ <path fill="none" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.585-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.917-6.501-6.502c0-3.584,2.917-6.498,6.501-6.498C18.585,8.5,21.5,11.414,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.169,28,28,22.165,28,14.998C28,7.831,22.169,2,15.003,2z"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/XYButDownClick.svg b/TamTamEdit.activity/icons/XYButDownClick.svg
new file mode 100644
index 0000000..9e0d222
--- /dev/null
+++ b/TamTamEdit.activity/icons/XYButDownClick.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<circle fill="none" cx="15" cy="15" r="6.933"/>
+<g>
+ <path fill="none" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.585-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.917-6.501-6.502c0-3.584,2.917-6.498,6.501-6.498C18.585,8.5,21.5,11.414,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.169,28,28,22.165,28,14.998C28,7.831,22.169,2,15.003,2z"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/accept.svg b/TamTamEdit.activity/icons/accept.svg
new file mode 100755
index 0000000..a2f9e28
--- /dev/null
+++ b/TamTamEdit.activity/icons/accept.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45px" height="45px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.78,28.079c0-12.43,10.071-22.499,22.499-22.499c12.431,0,22.501,10.069,22.501,22.499c0,12.431-10.07,22.501-22.501,22.501
+ C15.851,50.58,5.78,40.51,5.78,28.079z"/>
+</g>
+<g>
+
+ <line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="16.788" y1="26.691" x2="25.781" y2="38.706"/>
+
+ <line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="25.781" y1="38.706" x2="39.773" y2="18.704"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/add.svg b/TamTamEdit.activity/icons/add.svg
new file mode 100644
index 0000000..b605b49
--- /dev/null
+++ b/TamTamEdit.activity/icons/add.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="56.688px" height="55.5px" viewBox="0 0 56.688 55.5" enable-background="new 0 0 56.688 55.5" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M16.226,14.143
+ l24.013-0.002c4.408-0.002,7.998,2.578,7.993,5.754v17.283c0.005,3.18-3.58,5.762-7.991,5.758H16.229
+ c-4.414,0.002-8.002-2.578-7.996-5.754L8.233,19.897C8.23,16.72,11.815,14.136,16.226,14.143z"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="bevel" x1="28.011" y1="22.5" x2="28.177" y2="34.501"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="bevel" x1="22.177" y1="28.251" x2="34.177" y2="28.251"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/arrow-down.svg b/TamTamEdit.activity/icons/arrow-down.svg
new file mode 100644
index 0000000..66c6ac9
--- /dev/null
+++ b/TamTamEdit.activity/icons/arrow-down.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="35px" height="30px" viewBox="0 0 35 30" enable-background="new 0 0 35 30" xml:space="preserve">
+<polygon fill="#FFFFFF" points="0,0.006 35,0 17.5,30 "/>
+</svg>
diff --git a/TamTamEdit.activity/icons/arrow-up.svg b/TamTamEdit.activity/icons/arrow-up.svg
new file mode 100644
index 0000000..a5ac702
--- /dev/null
+++ b/TamTamEdit.activity/icons/arrow-up.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="35px" height="30px" viewBox="0 0 35 30" enable-background="new 0 0 35 30" xml:space="preserve">
+<polygon fill="#FFFFFF" points="35,29.994 0,30 17.5,0 "/>
+</svg>
diff --git a/TamTamEdit.activity/icons/cancel.svg b/TamTamEdit.activity/icons/cancel.svg
new file mode 100755
index 0000000..59512eb
--- /dev/null
+++ b/TamTamEdit.activity/icons/cancel.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45px" height="45px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.78,28.08c0-12.431,10.071-22.5,22.5-22.5c12.432,0,22.5,10.069,22.5,22.5c0,12.432-10.068,22.5-22.5,22.5
+ C15.851,50.58,5.78,40.512,5.78,28.08z"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="20.155" y1="19.956" x2="37.029" y2="36.83"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="37.029" y1="19.956" x2="20.155" y2="36.83"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/dice.svg b/TamTamEdit.activity/icons/dice.svg
new file mode 100644
index 0000000..cc8d38f
--- /dev/null
+++ b/TamTamEdit.activity/icons/dice.svg
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="56.688px" height="55.5px" viewBox="0 0 56.688 55.5" enable-background="new 0 0 56.688 55.5" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M24.16,18.908
+ c-0.114-3.243-0.215-6.109-0.215-6.109c-0.092-2.796,2.098-5.14,4.893-5.24l15.199-0.534c2.796-0.094,5.139,2.096,5.239,4.89
+ l0.535,15.2c0.092,2.797-2.099,5.14-4.891,5.241c0,0-4.982,0.175-9.242,0.324"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M43.166,23.722
+ c1.198-0.038,2.206,0.891,2.249,2.098c0.038,1.2-0.895,2.2-2.098,2.249c-1.198,0.039-2.204-0.902-2.242-2.101
+ C41.03,24.771,41.967,23.761,43.166,23.722z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M37.176,18.138
+ c1.195-0.046,2.207,0.891,2.245,2.09c0.039,1.199-0.892,2.207-2.097,2.248c-1.199,0.038-2.199-0.894-2.242-2.101
+ C35.037,19.181,35.978,18.176,37.176,18.138z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M31.183,12.547
+ c1.199-0.038,2.21,0.898,2.249,2.098c0.038,1.199-0.895,2.2-2.098,2.249c-1.197,0.038-2.202-0.902-2.239-2.101
+ C29.047,13.596,29.985,12.585,31.183,12.547z"/>
+<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M34.215,22.64l3.301,16.967
+ c0.608,3.117-1.432,6.146-4.551,6.746l-16.967,3.299c-3.119,0.609-6.146-1.432-6.748-4.549L5.951,28.136
+ c-0.609-3.118,1.432-6.146,4.551-6.747l16.966-3.3C30.587,17.48,33.615,19.521,34.215,22.64z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M26.95,24.054
+ c1.341-0.263,2.633,0.617,2.896,1.95c0.255,1.341-0.617,2.633-1.951,2.896c-1.341,0.264-2.641-0.617-2.896-1.95
+ C24.737,25.609,25.61,24.318,26.95,24.054z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M29.461,36.98
+ c1.341-0.264,2.632,0.608,2.896,1.949c0.265,1.342-0.616,2.635-1.949,2.896c-1.342,0.255-2.634-0.617-2.896-1.958
+ C27.247,38.536,28.128,37.236,29.461,36.98z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M16.542,39.491
+ c1.333-0.265,2.633,0.616,2.888,1.95c0.264,1.342-0.609,2.634-1.95,2.896c-1.333,0.264-2.633-0.617-2.896-1.951
+ C14.328,41.046,15.201,39.753,16.542,39.491z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M21.741,31.773
+ c1.342-0.265,2.633,0.617,2.896,1.949c0.264,1.342-0.609,2.633-1.95,2.896c-1.341,0.263-2.633-0.617-2.896-1.95
+ C19.537,33.327,20.41,32.036,21.741,31.773z"/>
+<path fill="#CCCCCC" stroke="#CCCCCC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M14.023,26.564
+ c1.342-0.255,2.642,0.617,2.897,1.958c0.263,1.334-0.609,2.633-1.95,2.889c-1.341,0.264-2.633-0.609-2.896-1.949
+ C11.819,28.119,12.69,26.827,14.023,26.564z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/diceB.svg b/TamTamEdit.activity/icons/diceB.svg
new file mode 100644
index 0000000..9336ad9
--- /dev/null
+++ b/TamTamEdit.activity/icons/diceB.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<path fill="none" stroke="#C8C8C8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M19.406,5.889l23.942,5.085
+ c4.4,0.933,7.219,5.267,6.274,9.665l-5.085,23.941c-0.934,4.401-5.268,7.219-9.663,6.278l-23.943-5.09
+ c-4.4-0.929-7.218-5.265-6.275-9.663l5.084-23.94C10.673,7.762,15.009,4.943,19.406,5.889z"/>
+<path fill="#CCCCCC" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M17.646,14.184
+ c0.398-1.894,2.26-3.091,4.143-2.696c1.891,0.409,3.091,2.261,2.697,4.146c-0.398,1.894-2.266,3.101-4.145,2.696
+ C18.448,17.929,17.247,16.077,17.646,14.184z"/>
+<path fill="#CCCCCC" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M35.884,18.062
+ c0.397-1.893,2.248-3.093,4.143-2.694c1.896,0.396,3.096,2.26,2.697,4.141c-0.409,1.892-2.265,3.093-4.155,2.693
+ C36.688,21.809,35.479,19.942,35.884,18.062z"/>
+<path fill="#CCCCCC" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M30.97,41.183
+ c0.393-1.885,2.26-3.092,4.14-2.687c1.894,0.399,3.097,2.252,2.694,4.146c-0.393,1.885-2.259,3.09-4.144,2.694
+ C31.772,44.928,30.568,43.074,30.97,41.183z"/>
+<path fill="#CCCCCC" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M12.725,37.314
+ c0.412-1.893,2.266-3.104,4.156-2.694c1.884,0.396,3.094,2.251,2.686,4.141c-0.396,1.894-2.25,3.095-4.142,2.695
+ C13.533,41.047,12.33,39.195,12.725,37.314z"/>
+<path fill="#CCCCCC" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M15.151,25.922
+ c0.399-1.894,2.26-3.091,4.143-2.696c1.89,0.409,3.09,2.261,2.697,4.145c-0.399,1.894-2.266,3.101-4.145,2.697
+ C15.953,29.667,14.752,27.815,15.151,25.922z"/>
+<path fill="#CCCCCC" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M33.39,29.8
+ c0.396-1.893,2.247-3.093,4.142-2.694c1.896,0.396,3.096,2.26,2.697,4.141c-0.409,1.891-2.264,3.093-4.154,2.692
+ C34.193,33.547,32.984,31.681,33.39,29.8z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/duplicate.svg b/TamTamEdit.activity/icons/duplicate.svg
new file mode 100644
index 0000000..0438f13
--- /dev/null
+++ b/TamTamEdit.activity/icons/duplicate.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="56.688px" height="55.5px" viewBox="0 0 56.688 55.5" enable-background="new 0 0 56.688 55.5" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M12.181,34.714
+ c-3.849-0.018-6.96-2.285-6.963-5.07L5.212,14.435c0.007-2.798,3.142-5.063,7.002-5.066l20.997-0.004
+ c3.863,0.004,6.99,2.275,6.995,5.071c0,0,0,0.778,0.001,1.982"/>
+<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M19.893,17.309
+ l24.013-0.002c4.408-0.002,7.998,2.578,7.993,5.754v17.284c0.005,3.18-3.58,5.762-7.991,5.758H19.896
+ c-4.414,0.002-8.002-2.578-7.996-5.754L11.9,23.064C11.897,19.886,15.482,17.303,19.893,17.309z"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="bevel" x1="31.678" y1="25.667" x2="31.844" y2="37.667"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="bevel" x1="25.844" y1="31.417" x2="37.844" y2="31.417"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/edit-brush.svg b/TamTamEdit.activity/icons/edit-brush.svg
new file mode 100644
index 0000000..e888321
--- /dev/null
+++ b/TamTamEdit.activity/icons/edit-brush.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Brush" >
+ <g display="inline">
+ <path fill="#FFFFFF" d="M26.939,32.777c0,0,9.546-10.04,12.062-13.721c3.697-5.406,5.988-10.829,3.994-11.775
+ c-1.468-0.697-6.469,3.434-9.471,7.896C31.491,18.205,24,30.635,24,30.635L26.939,32.777z"/>
+ <path fill="#FFFFFF" d="M25.613,34.668l-2.971-2.166c0,0-3.054,1.592-4.602,3.862c-1.546,2.284-2.31,6.661-4.752,9.01
+ c-1.465,1.409-0.186,1.085-0.186,1.085s7.907-2.985,9.786-5.477C24.75,38.512,25.613,34.668,25.613,34.668z"/>
+ </g>
+</g>
+
+</svg>
diff --git a/TamTamEdit.activity/icons/edit-pencil.svg b/TamTamEdit.activity/icons/edit-pencil.svg
new file mode 100644
index 0000000..c7a1ef9
--- /dev/null
+++ b/TamTamEdit.activity/icons/edit-pencil.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55px"
+ height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+
+<g id="Pencil" >
+ <g display="inline">
+ <path fill="#FFFFFF" d="M12.727,45.969c-0.053,0.132-0.02,0.281,0.09,0.373s0.264,0.103,0.385,0.025l4.635-2.984l-3.009-2.407
+ L12.727,45.969z M42.967,14.071c0-0.073-0.004-0.15-0.014-0.227c-0.112-0.949-0.903-2.109-2.062-3.025
+ c-1.16-0.915-2.474-1.413-3.424-1.304c-0.414,0.052-0.747,0.228-0.973,0.491l-0.021-0.015L19.716,32.17l-0.073,0.073l-0.011,0.015
+ c-0.026,0.029-0.029,0.069-0.05,0.103l-2.177,2.677c0,0,0.128,0.099,0.256,0.201l-0.002,0.004l-0.009,0.011
+ c-0.128-0.103-0.252-0.197-0.252-0.197l-0.042,0.051c-0.097,0.121-0.155,0.271-0.203,0.429c-0.015,0.019-0.046,0.025-0.057,0.048
+ l-1.361,3.236l4.097,3.278l3.202-2.062c0.019-0.011,0.015-0.037,0.031-0.052c0.083-0.065,0.178-0.121,0.243-0.201
+ c0.008-0.011,0.043-0.059,0.048-0.062l2.237-2.79l0.033-0.033l-0.004-0.004l0.023-0.029l0.006,0.004L42.59,15.02
+ c0.029-0.029,0.071-0.044,0.1-0.077c0.032-0.044,0.049-0.103,0.076-0.15l0.015-0.019l-0.003-0.003
+ C42.895,14.566,42.967,14.339,42.967,14.071z"/>
+ </g>
+</g>
+
+</svg>
diff --git a/TamTamEdit.activity/icons/edit-pointer.svg b/TamTamEdit.activity/icons/edit-pointer.svg
new file mode 100644
index 0000000..2397df3
--- /dev/null
+++ b/TamTamEdit.activity/icons/edit-pointer.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<rect x="5.285" y="9.417" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3" width="31.466" height="25.083"/>
+<polygon fill="#423F3D" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" points="
+ 33.225,30.118 39.89,46.332 42.087,40.904 48.34,46.951 50.126,45.508 43.874,39.05 49.576,36.714 "/>
+</svg>
diff --git a/TamTamEdit.activity/icons/grid.svg b/TamTamEdit.activity/icons/grid.svg
new file mode 100644
index 0000000..5286401
--- /dev/null
+++ b/TamTamEdit.activity/icons/grid.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="75px" height="30px" viewBox="0 0 75 30" enable-background="new 0 0 75 30" xml:space="preserve">
+<rect x="15.833" y="0.667" fill="#7D7D7D" stroke="#7D7D7D" stroke-width="0.25" stroke-linecap="round" stroke-linejoin="round" width="44.333" height="25.833"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="60" y1="0.97" x2="60" y2="25.97"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="15.51" y1="25.97" x2="15.51" y2="-0.03"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="42.204" y1="1.303" x2="42.204" y2="26.304"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="24.408" y1="26.637" x2="24.408" y2="0.636"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="51.102" y1="1.303" x2="51.102" y2="26.304"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="33.306" y1="26.637" x2="33.306" y2="0.636"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="59.66" y1="26.63" x2="15" y2="26.63"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="60.493" y1="0.463" x2="15.833" y2="0.463"/>
+<g>
+ <g>
+ <line fill="#808292" x1="43.584" y1="12.999" x2="53.001" y2="22.5"/>
+ <polygon fill="#808292" points="47.04,12.54 44.236,13.657 43.094,16.45 40.433,9.82 "/>
+ </g>
+ <g>
+
+ <line fill="none" stroke="#323232" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="43.584" y1="12.999" x2="53.001" y2="22.5"/>
+ <polygon fill="#323232" points="53.952,11.62 45.541,14.973 42.114,23.354 34.13,3.461 "/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/notedur.svg b/TamTamEdit.activity/icons/notedur.svg
new file mode 100644
index 0000000..cd11aae
--- /dev/null
+++ b/TamTamEdit.activity/icons/notedur.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="75px" height="30px" viewBox="0 0 75 30" enable-background="new 0 0 75 30" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#808284" d="M15,9.36c0-1.38,1.12-2.5,2.5-2.5h40c1.38,0,2.5,1.12,2.5,2.5c0,1.37-1.12,2.5-2.5,2.5h-40
+ C16.12,11.86,15,10.73,15,9.36z"/>
+ <path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M15,9.36
+ c0-1.38,1.12-2.5,2.5-2.5h40c1.38,0,2.5,1.12,2.5,2.5c0,1.37-1.12,2.5-2.5,2.5h-40C16.12,11.86,15,10.73,15,9.36z"/>
+ </g>
+ <g>
+
+ <line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="60" y1="17.939" x2="60" y2="25"/>
+
+ <line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="15.51" y1="25" x2="15.51" y2="17.939"/>
+
+ <line fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="59.66" y1="21.63" x2="15" y2="21.63"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/props.svg b/TamTamEdit.activity/icons/props.svg
new file mode 100644
index 0000000..18f6622
--- /dev/null
+++ b/TamTamEdit.activity/icons/props.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<path fill="#FFFFFF" d="M33.958,27.5c0,3.562-2.896,6.458-6.458,6.458c-3.562,0-6.458-2.896-6.458-6.458
+ c0-3.562,2.896-6.458,6.458-6.458C31.062,21.042,33.958,23.938,33.958,27.5z"/>
+<polygon fill="#FFFFFF" points="44.26,25.326 45.87,25.119 47.082,25.262 50,26.575 50,28.425 47.082,29.738 45.87,29.881
+ 44.26,29.674 43.525,32.927 45.064,33.449 46.1,34.113 48.169,36.584 47.382,38.256 44.189,38.157 43.031,37.744 41.668,36.846
+ 39.625,39.451 40.784,40.602 41.438,41.661 42.244,44.797 40.82,45.947 37.988,44.456 37.113,43.575 36.273,42.165 33.32,43.611
+ 33.877,45.166 34.009,46.396 33.391,49.587 31.622,50 29.711,47.395 29.295,46.227 29.145,44.582 25.855,44.582 25.705,46.227
+ 25.289,47.395 23.378,50 21.609,49.587 20.991,46.396 21.123,45.166 21.68,43.611 18.727,42.165 17.886,43.575 17.011,44.456
+ 14.18,45.947 12.756,44.797 13.562,41.661 14.216,40.602 15.375,39.451 13.332,36.846 11.969,37.744 10.811,38.157 7.618,38.256
+ 6.831,36.584 8.9,34.113 9.935,33.449 11.474,32.927 10.74,29.674 9.13,29.881 7.918,29.738 5,28.425 5,26.575 7.918,25.262
+ 9.13,25.119 10.74,25.326 11.474,22.073 9.935,21.551 8.9,20.887 6.831,18.416 7.618,16.744 10.811,16.843 11.969,17.256
+ 13.332,18.155 15.375,15.549 14.216,14.399 13.562,13.339 12.756,10.203 14.18,9.053 17.011,10.544 17.886,11.425 18.727,12.835
+ 21.68,11.389 21.123,9.834 20.991,8.604 21.609,5.413 23.378,5 25.289,7.606 25.705,8.774 25.855,10.418 29.145,10.418
+ 29.295,8.774 29.711,7.606 31.622,5 33.391,5.413 34.009,8.604 33.877,9.834 33.32,11.389 36.273,12.835 37.113,11.425
+ 37.988,10.544 40.82,9.053 42.244,10.203 41.438,13.339 40.784,14.399 39.625,15.549 41.668,18.155 43.031,17.256 44.189,16.843
+ 47.382,16.744 48.169,18.416 46.1,20.887 45.064,21.551 43.525,22.073 "/>
+<ellipse fill="#3B3C3E" cx="27.5" cy="27.5" rx="14.593" ry="14.826"/>
+<path fill="#FFFFFF" d="M16.444,27.5c0-6.2,4.953-11.232,11.056-11.232c6.104,0,11.057,5.032,11.057,11.232
+ S33.604,38.732,27.5,38.732C21.397,38.732,16.444,33.7,16.444,27.5z"/>
+<ellipse fill="#3B3C3E" cx="27.5" cy="27.5" rx="4.863" ry="4.942"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/recordK.svg b/TamTamEdit.activity/icons/recordK.svg
new file mode 100644
index 0000000..bd1e58c
--- /dev/null
+++ b/TamTamEdit.activity/icons/recordK.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<g>
+ <circle fill="#808284" cx="27" cy="27" r="22.5"/>
+ <circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="26.999" cy="27.092" r="18.677"/>
+ <path fill="#FFFFFF" d="M34.895,27c0,4.354-3.541,7.895-7.895,7.895c-4.354,0-7.895-3.541-7.895-7.895
+ c0-4.354,3.54-7.895,7.895-7.895C31.354,19.105,34.895,22.646,34.895,27z"/>
+</g>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M35.615,30.777h4.377v8.638h0.087c0.435-0.753,0.898-1.449,1.333-2.145l4.435-6.493h5.42l-6.463,8.318
+ l6.812,11.217h-5.16l-4.782-8.434l-1.681,2.058v6.376h-4.377V30.777z"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/recordO.svg b/TamTamEdit.activity/icons/recordO.svg
new file mode 100644
index 0000000..83f8cfe
--- /dev/null
+++ b/TamTamEdit.activity/icons/recordO.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<g>
+ <circle fill="#808284" cx="27" cy="27" r="22.5"/>
+ <circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="26.999" cy="27" r="18.677"/>
+ <path fill="#FFFFFF" d="M34.895,27c0,4.354-3.541,7.895-7.895,7.895S19.104,31.354,19.104,27c0-4.354,3.54-7.895,7.895-7.895
+ C31.354,19.105,34.895,22.646,34.895,27z"/>
+</g>
+<g>
+ <path fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="M31,42.936
+ c0.043,0.068,4.286-17.459,10.357,0"/>
+ <path fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="M51,41.445
+ c-0.045-0.068-4.286,17.461-10.357,0"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/sideR.svg b/TamTamEdit.activity/icons/sideR.svg
new file mode 100644
index 0000000..f5eb202
--- /dev/null
+++ b/TamTamEdit.activity/icons/sideR.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
+<g>
+ <g>
+ <line fill="#FFFFFF" x1="14.292" y1="10.229" x2="5.667" y2="10.229"/>
+ </g>
+ <g>
+
+ <line fill="none" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="14.292" y1="10.229" x2="5.667" y2="10.229"/>
+ </g>
+</g>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="17.044" y1="10.133" x2="13.153" y2="6.241"/>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="17.044" y1="10.348" x2="13.153" y2="14.24"/>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="2.728" y1="10.348" x2="6.62" y2="14.24"/>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="2.728" y1="10.133" x2="6.62" y2="6.24"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/sideW.svg b/TamTamEdit.activity/icons/sideW.svg
new file mode 100644
index 0000000..0b44384
--- /dev/null
+++ b/TamTamEdit.activity/icons/sideW.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
+<g>
+ <g>
+ <line fill="#FFFFFF" x1="14.292" y1="10.229" x2="5.667" y2="10.229"/>
+ </g>
+ <g>
+
+ <line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="14.292" y1="10.229" x2="5.667" y2="10.229"/>
+ </g>
+</g>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="17.044" y1="10.133" x2="13.153" y2="6.241"/>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="17.044" y1="10.348" x2="13.153" y2="14.24"/>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="2.728" y1="10.348" x2="6.62" y2="14.24"/>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="2.728" y1="10.133" x2="6.62" y2="6.24"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tam-help.svg b/TamTamEdit.activity/icons/tam-help.svg
new file mode 100644
index 0000000..2923bb3
--- /dev/null
+++ b/TamTamEdit.activity/icons/tam-help.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45.395px" height="45.395px" viewBox="0 0 45.395 45.395" enable-background="new 0 0 45.395 45.395" xml:space="preserve">
+<circle fill="#808284" cx="22.297" cy="23.037" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="22.295" cy="23.129" r="21.572"/>
+<circle fill="none" stroke="#4C4D4F" cx="22.628" cy="22.89" r="17.085"/>
+<g>
+ <path fill="#FFFFFF" stroke="#FFFFFF" d="M18.717,15.967c1.383-0.625,2.621-0.938,3.715-0.938c1.477,0,2.617,0.332,3.422,0.996
+ s1.207,1.645,1.207,2.941c0,1.344-0.871,2.738-2.613,4.184c-0.758,0.625-1.221,1.041-1.389,1.248s-0.303,0.459-0.404,0.756
+ s-0.152,0.668-0.152,1.113v0.645h-1.605v-0.668c0-1.359,0.434-2.418,1.301-3.176l1.547-1.359c0.5-0.422,0.867-0.85,1.102-1.283
+ s0.352-0.896,0.352-1.389c0-0.812-0.258-1.436-0.773-1.869s-1.219-0.65-2.109-0.65c-0.805,0-1.82,0.289-3.047,0.867L18.717,15.967z
+ M21.905,29.198c0.414,0,0.762,0.141,1.043,0.422s0.422,0.629,0.422,1.043c0,0.422-0.143,0.783-0.428,1.084
+ s-0.631,0.451-1.037,0.451c-0.398,0-0.738-0.15-1.02-0.451s-0.422-0.662-0.422-1.084s0.139-0.771,0.416-1.049
+ S21.498,29.198,21.905,29.198z"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo1.svg b/TamTamEdit.activity/icons/tempo1.svg
new file mode 100644
index 0000000..bb9aeec
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo1.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M23.5,6.5c3,3,7,7,9,11c-7,5-4,6-3,26c-1,1-8,1-9,0c0,0,2,1,2-1
+ c0-3-2-7-2-11c0-2,1-4,1-6c0-3-2-1-2-3c0-3,3-8,3-11c0-2-1-1-2-2v-3H23.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo2.svg b/TamTamEdit.activity/icons/tempo2.svg
new file mode 100644
index 0000000..4a98310
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo2.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M27.5,44.5v-3C28.5,42.5,28.5,43.5,27.5,44.5z M26.5,10.5
+ c2,2,2,6,2,8c0,4-3,11-3,13s4,7,7,10c-2,2-4,3-5,5h-6c1-1,2-3,2-5c0-3-2-9-3-14c0,0,0-1-1,0v-6c0-3,3-8,3-11c0-1-2-2-2-6h3
+ C23.5,5.5,26.5,9.5,26.5,10.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo3.svg b/TamTamEdit.activity/icons/tempo3.svg
new file mode 100644
index 0000000..bd893bd
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo3.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M30.5,17.5c0,3-2,2-2,4c0,3,4,14,7,21c-1,0-3,1-5,1c1-1,2,0,2-3
+ c0-2-4-7-6-10c-3,3-5,8-7,13c-1,0-3-1-4-1c3-3,7-14,7-18s-1-3-4-4c3-2,4-8,4-14h3C23.5,9.5,30.5,14.5,30.5,17.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo4.svg b/TamTamEdit.activity/icons/tempo4.svg
new file mode 100644
index 0000000..6fa5afa
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo4.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M34.5,22.5c-1-1-2-4-5-6c-1,2,0,3,0,6c0,2-3,4-3,7c0,2,4,2,4,4
+ c0,3-1,4-2,5c0-1,0-3-1-4c-1,3-2,7-3,10c-4-3,0-6,0-9s-3-11-4-17l-4,4c1-5,8.25-11.12,7.25-16.12c0.68,0.68,3.029,0,2.87,2.12
+ C26.5,10.25,33.62,17.75,34.5,22.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo5.svg b/TamTamEdit.activity/icons/tempo5.svg
new file mode 100644
index 0000000..9500e7e
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo5.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M24.5,13.5c2,1,5,3,5,6c0,2-2,3-2,5c0,9,11,4,11,13c-1,0-3-2-4-3
+ c-3-1-9,1-10-3c-2,3-5,7-7,11c-3,0-3-1-4-1c0-2,3-3,4-6s4-8,4-10c0-3-1-3-2-5c-1,0-2,1-3,2c0-1,2-3,2-4c1-2,3-5,2-8c0,0,1-1,4-2
+ C25.5,9.5,25.5,11.5,24.5,13.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo6.svg b/TamTamEdit.activity/icons/tempo6.svg
new file mode 100644
index 0000000..9844fd6
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo6.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M22.5,10.5c3,2,7,5,7,7c0,3-4,8-4,10c0,3,1,3,1,5h5l2-2l2,2v4
+ c-1,0-3-2-5-2c-3,0-5,1-8,1c-1,3-2,7-2,10h-5c1-1,3-3,3-4c1-5,1-11,1-18l-1-1c-1,1-1.75,2.88-2.75,2.88c0,0-0.25-0.63-0.25-1.63
+ c4-4,2-8.25,2-13.25c0-1,0.25-2.5,0.38-5.38L22.5,5.5C23.12,6.5,22.5,8.5,22.5,10.5z"/>
+<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#333333" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" points="
+ 25,20 25.25,16.75 26.5,17.88 "/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo7.svg b/TamTamEdit.activity/icons/tempo7.svg
new file mode 100644
index 0000000..54bed80
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo7.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M20.5,7.5c1,1,1,3,1,4c10,4,8,6,8,14c0,2,6,9,10,13c-1,2-2,4-4,5
+ c1.62-8.88-8.75-13.88-12-15c-1,1-1,0-1,2c0,3,2,5,3,7c-1,1-3,2-6,2c0-1,2-1,2-4c0-2-4-4-4-6c0-3,3-4,5-6c-3-8-8-2-11-6h6
+ c0-1,1,0,1-3c0-2-1-1-2-2l1-5H20.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/tempo8.svg b/TamTamEdit.activity/icons/tempo8.svg
new file mode 100644
index 0000000..2c0154f
--- /dev/null
+++ b/TamTamEdit.activity/icons/tempo8.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M20.5,12.5c0.67,0.4,0.4,1.9,1.75,2.25s1.05-0.38,1.5-0.37
+ c4.971,0,10.95-0.88,11.75,7.12c-1-2-3-4-5-5l-4,1c1,2,4,4,5,7c1,1,1,4,1,6c3,3,8-1,11,6c-2.88-0.82-4.25-2.62-12.75-2.75
+ c-1.561-0.02-2.34-1.561-3.75-1.87c-3.42-0.76-4.67-0.38-5.5-0.38c-3,0-8,7-11,7c-2,0-3-1-3-2c4,2,8-4,9-7c2-1,5-1,8-3c-2-4-6-5-8-3
+ l-6-6l2-2c1,1,1,2,1,4c1,0,4.12,0.38,6.12-0.62L16.5,17.5v-5H20.5z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/updownR.svg b/TamTamEdit.activity/icons/updownR.svg
new file mode 100644
index 0000000..dff1c83
--- /dev/null
+++ b/TamTamEdit.activity/icons/updownR.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
+<g>
+ <g>
+ <line fill="#FFFFFF" x1="9.875" y1="5.834" x2="9.875" y2="14.459"/>
+ </g>
+ <g>
+
+ <line fill="none" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.875" y1="5.834" x2="9.875" y2="14.459"/>
+ </g>
+</g>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.778" y1="3.082" x2="5.887" y2="6.973"/>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.993" y1="3.082" x2="13.886" y2="6.973"/>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.993" y1="17.398" x2="13.886" y2="13.506"/>
+<line fill="#FFFFFF" stroke="#ED1C24" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.778" y1="17.398" x2="5.886" y2="13.507"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/updownW.svg b/TamTamEdit.activity/icons/updownW.svg
new file mode 100644
index 0000000..bcefcb3
--- /dev/null
+++ b/TamTamEdit.activity/icons/updownW.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
+<g>
+ <g>
+ <line fill="#FFFFFF" x1="9.875" y1="5.833" x2="9.875" y2="14.459"/>
+ </g>
+ <g>
+
+ <line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.875" y1="5.833" x2="9.875" y2="14.459"/>
+ </g>
+</g>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.778" y1="3.082" x2="5.887" y2="6.973"/>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.993" y1="3.082" x2="13.886" y2="6.973"/>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.993" y1="17.398" x2="13.886" y2="13.506"/>
+<line fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" x1="9.778" y1="17.398" x2="5.886" y2="13.506"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/voltemp.svg b/TamTamEdit.activity/icons/voltemp.svg
new file mode 100644
index 0000000..e8ed7e0
--- /dev/null
+++ b/TamTamEdit.activity/icons/voltemp.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<path fill="#808284" stroke="#FFFFFF" stroke-linecap="square" d="M0.245,18.559c0-2.208,1.38-4,3.052-4h48.836
+ c1.686,0,3.052,1.792,3.052,4c0,2.19-1.366,4-3.052,4H3.296C1.625,22.559,0.245,20.75,0.245,18.559z"/>
+<path fill="#FFFFFF" d="M33.774,18.644c0,3.25-2.683,5.885-6.006,5.885c-3.31,0-5.995-2.635-5.995-5.885
+ c0-3.262,2.685-5.897,5.995-5.897C31.092,12.747,33.774,15.381,33.774,18.644z"/>
+<g>
+ <path fill="#808284" stroke="#FFFFFF" stroke-linecap="square" d="M0.185,38.365c0-2.191,1.38-4,3.052-4h48.835
+ c1.687,0,3.053,1.809,3.053,4c0,2.206-1.366,4-3.053,4H3.237C1.564,42.365,0.185,40.571,0.185,38.365z"/>
+</g>
+<path fill="#FFFFFF" d="M20.799,38.388c0,3.323-2.684,6.007-5.995,6.007c-3.322,0-6.005-2.685-6.005-6.007
+ c0-3.31,2.684-5.993,6.005-5.993C18.115,32.395,20.799,35.078,20.799,38.388z"/>
+</svg>
diff --git a/TamTamEdit.activity/icons/volume0.svg b/TamTamEdit.activity/icons/volume0.svg
new file mode 100644
index 0000000..963ebf0
--- /dev/null
+++ b/TamTamEdit.activity/icons/volume0.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/volume1.svg b/TamTamEdit.activity/icons/volume1.svg
new file mode 100644
index 0000000..a23fb00
--- /dev/null
+++ b/TamTamEdit.activity/icons/volume1.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M8.929,7.078c3.546,3.548,3.546,9.297,0,12.846"
+ />
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/volume2.svg b/TamTamEdit.activity/icons/volume2.svg
new file mode 100644
index 0000000..7b719e4
--- /dev/null
+++ b/TamTamEdit.activity/icons/volume2.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M14.574,4.015c5.242,5.236,5.242,13.73,0,18.973"
+ />
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M8.929,7.078c3.546,3.548,3.546,9.297,0,12.846"
+ />
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+</svg>
diff --git a/TamTamEdit.activity/icons/volume3.svg b/TamTamEdit.activity/icons/volume3.svg
new file mode 100644
index 0000000..db92a17
--- /dev/null
+++ b/TamTamEdit.activity/icons/volume3.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M14.574,4.015c5.242,5.236,5.242,13.73,0,18.973"
+ />
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M8.929,7.078c3.546,3.548,3.546,9.297,0,12.846"
+ />
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M20.135,0.528
+ c7.166,7.164,7.166,18.777-0.002,25.943"/>
+</svg>
diff --git a/TamTamEdit.activity/setup.py b/TamTamEdit.activity/setup.py
new file mode 100644
index 0000000..5b21f11
--- /dev/null
+++ b/TamTamEdit.activity/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+# Copyright (C) 2006, Red Hat, Inc.
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start('TamTam')
diff --git a/TamTamJam.activity/Jam/Block.py b/TamTamJam.activity/Jam/Block.py
new file mode 100644
index 0000000..f0789fd
--- /dev/null
+++ b/TamTamJam.activity/Jam/Block.py
@@ -0,0 +1,895 @@
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import random
+
+import Config
+
+from Util.NoteDB import PARAMETER
+
+#::: NOTE:
+# All the graphics resources are loaded in Desktop and referenced here as necessary
+#:::
+
+class Block():
+
+ WIDTH = 100
+ HEIGHT = 100
+
+ SNAP = 15
+
+ PAD = 4
+
+ KEYSIZE = 26
+ KEYMASK_START = 309
+
+ def __init__( self, owner, data ):
+ self.owner = owner
+ self.gc = owner.gc
+
+ self.data = {}
+ for key in data.keys():
+ self.data[key] = data[key]
+
+ self.type = Block
+
+ self.width = Block.WIDTH
+ self.height = Block.HEIGHT
+
+ self.parent = None
+ self.canChild = False
+ self.child = None
+ self.canParent = False
+
+ self.canSubstitute = False
+
+ self.parentOffest = 0
+
+ self.dragging = False # is currently dragging
+ self.placed = False # has been placed on the desktop at least once
+
+ self.firstLoc = True
+ self.x = -1
+ self.y = -1
+
+ self.active = False
+
+ def dumpToStream( self, ostream, child = False ):
+ ostream.block_add( ClassToStr[ self.type ], self.active, self.x + self.width//2, self.y + self.height//2, child, self.data )
+ if self.child:
+ self.child.dumpToStream( ostream, True )
+
+ def destroy( self ):
+ if self.child:
+ self.child.destroy()
+ self.child = None
+ self.invalidate_rect( not self.dragging )
+
+ def isPlaced( self ):
+ return self.placed
+
+ def setPlaced( self, placed ):
+ self.placed = placed
+
+ def getLoc( self ):
+ return ( self.x, self.y )
+
+ def setLoc( self, x, y ):
+ if x == self.x and y == self.y: return
+
+ if self.firstLoc:
+ self.firstLoc = False
+ else:
+ self.invalidate_rect( not self.dragging )
+
+ self.x = int(x)
+ self.y = int(y)
+ self.endX = self.x + self.width
+ self.endY = self.y + self.height
+
+ self.invalidate_rect( not self.dragging )
+
+ if self.child:
+ self.child.snapToParentLoc( self.getChildAnchor() )
+
+ def resetLoc( self ):
+ if self.oldParent != None:
+ self.oldParent.addChild( self )
+ return False
+ else:
+ self.setLoc( self.oldLoc[0], self.oldLoc[1] )
+ return True
+
+ def getParentAnchor( self ):
+ return ( self.x + self.parentOffset, self.y )
+
+ def getChildAnchor( self ):
+ return ( self.endX, self.y )
+
+ def snapToParentLoc( self, loc ):
+ self.setLoc( loc[0] - self.parentOffset, loc[1] )
+
+ def substitute( self, block ):
+ pass # override in subclasses
+
+ def testSubstitute( self, block ):
+ if self.child:
+ return self.child.testSubstitute( block )
+
+ def testChild( self, loc ):
+
+ if not self.canParent:
+ return False
+
+ if self.child:
+ return self.child.testChild( loc )
+ elif abs( self.endX - loc[0] ) < Block.SNAP and abs( self.y - loc[1] ) < Block.SNAP:
+ return self
+
+ return False
+
+ def addChild( self, child ):
+ c = self.child
+ if self.child:
+ self.removeChild()
+
+ self.child = child
+ child._addParent( self )
+ child.snapToParentLoc( self.getChildAnchor() )
+
+ if c:
+ child.addChild( c )
+
+ def removeChild( self ):
+ self.child._removeParent()
+ self.child = None
+
+ def _addParent( self, parent ):
+ self.parent = parent
+
+ def _removeParent( self ):
+ self.parent = None
+
+ def getRoot( self ):
+ if self.parent: return self.parent.getRoot()
+ return self
+
+ def isActive( self ):
+ return self.active
+
+ def setActive( self, state ):
+ self.active = state
+ self.invalidate_rect( not self.dragging )
+
+ def getData( self, key ):
+ return self.data[ key ]
+
+ def setData( self, key, value ):
+ self.data[ key ] = value
+
+ def testMouseOver( self, event ):
+ if self.child:
+ ret = self.child.testMouseOver( event )
+ if ret: return ret
+
+ x = event.x - self.x
+ y = event.y - self.y
+
+ if 0 <= x <= self.width and 0 <= y <= self.height:
+ return -1
+
+ return False
+
+ def button_press( self, event ):
+
+ if event.y < self.y or event.y > self.endY:
+ return False
+
+ return self._button_pressB( event )
+
+ def _button_pressB( self, event ):
+
+ if event.x < self.x:
+ return False
+
+ if event.x > self.endX:
+ if self.child:
+ return self.child._button_pressB( event )
+ else:
+ return False
+
+ self.oldParent = self.parent
+ self.oldLoc = ( self.x, self.y )
+ self.dragOffset = ( event.x - self.x, event.y - self.y )
+
+ self._doButtonPress( event )
+
+ return self
+
+ def _doButtonPress( self, event ):
+ pass # override in subclasses
+
+ def button_release( self, event ):
+ if self.dragging:
+ self.dragging = False
+ self.placed = True
+ self.invalidateBranch()
+
+ def motion_notify( self, event ):
+
+ removeFromBlocks = not self.dragging and not self.parent
+
+ if not self.dragging:
+ self.dragging = True
+ self.invalidate_rect()
+
+ if self.parent:
+ self.parent.removeChild()
+
+ self.setLoc( event.x - self.dragOffset[0], event.y - self.dragOffset[1] )
+
+ return removeFromBlocks
+
+ def _beginDrag( self ):
+ self.dragging = True
+ self.dragOffset = ( self.width//2, self.height//2 )
+
+ def invalidateBranch( self, base = True ):
+ self.invalidate_rect( base )
+ if self.child:
+ self.child.invalidateBranch( base )
+
+ def invalidate_rect( self, base = True ):
+ self.owner.invalidate_rect( self.x, self.y, self.width, self.height, base )
+
+ def draw( self, startX, startY, stopX, stopY, pixmap ):
+ if stopY <= self.y or startY >= self.endY:
+ return False
+
+ self._drawB( startX, startY, stopX, stopY, pixmap )
+
+ def _drawB( self, startX, startY, stopX, stopY, pixmap ):
+
+ if stopX <= self.x:
+ return False
+
+ if self.child:
+ self.child._drawB( startX, startY, stopX, stopY, pixmap )
+
+ if startX >= self.endX:
+ return False
+
+ self._doDraw( startX, startY, stopX, stopY, pixmap )
+
+ return True
+
+ def _doDraw( self, startX, startY, stopX, stopY, pixmap ):
+ pass # override in subclasses
+
+ def drawHighlight( self, startX, startY, stopX, stopY, pixmap ):
+ pass # override in subclasses
+
+class Instrument(Block):
+
+ MASK_START = 0
+
+ #::: data format:
+ # { "name": name, "id": instrumentId [, "volume": 0-1, "pan": 0-1, "reverb": 0-1 ] }
+ #:::
+ def __init__( self, owner, data ):
+ Block.__init__( self, owner, data )
+
+ self.type = Instrument
+
+ self.canParent = True
+ self.canSubstitute = True
+
+ if not "volume" in self.data.keys():
+ self.data["volume"] = 0.5
+ if not "pan" in self.data.keys():
+ self.data["pan"] = 0.5
+ if not "reverb" in self.data.keys():
+ self.data["reverb"] = 0
+
+ self.img = [ self.owner.getInstrumentImage( self.data["id"], False ),
+ self.owner.getInstrumentImage( self.data["id"], True ) ]
+
+ def setData( self, key, value ):
+ self.data[ key ] = value
+ if self.active:
+ self.owner.updateInstrument( self )
+ if self.child and self.child.active:
+ self.owner.updateLoop( self.child )
+
+ def substitute( self, block ):
+ self.data["id"] = block.data["id"]
+ self.img = [ self.owner.getInstrumentImage( self.data["id"], False ),
+ self.owner.getInstrumentImage( self.data["id"], True ) ]
+ self.invalidate_rect( True )
+
+ if self.child and self.child.active:
+ self.owner.updateLoop( self.child )
+
+ def testSubstitute( self, block ):
+ ret = Block.testSubstitute( self, block )
+ if ret:
+ return ret
+
+ if block.type == Loop:
+ return False
+
+ if abs( self.x - block.x ) < Block.SNAP and abs( self.y - block.y ) < Block.SNAP:
+ return self
+
+ return False
+
+ def _doButtonPress( self, event ): # we were hit with a button press
+ pass
+
+ def button_release( self, event ):
+ if not self.dragging:
+ self.owner.activateInstrument( self )
+ Block.button_release( self, event )
+
+ def _doDraw( self, startX, startY, stopX, stopY, pixmap ):
+ x = max( startX, self.x )
+ y = max( startY, self.y )
+ endX = min( stopX, self.endX )
+ endY = min( stopY, self.endY )
+ width = endX - x
+ height = endY - y
+
+ # draw border
+ if self.active: self.gc.foreground = self.owner.colors["Border_Active"]
+ else: self.gc.foreground = self.owner.colors["Border_Inactive"]
+ self.gc.set_clip_origin( self.x-Instrument.MASK_START, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, height )
+
+ # draw block
+ self.gc.set_clip_origin( self.x-Instrument.MASK_START, self.y-self.height )
+ pixmap.draw_drawable( self.gc, self.img[self.active], x-self.x, y-self.y, x, y, width, height )
+
+ def drawHighlight( self, startX, startY, stopX, stopY, pixmap ):
+ self.gc.foreground = self.owner.colors["Border_Highlight"]
+ self.gc.set_clip_origin( self.x-Instrument.MASK_START, self.y )
+ pixmap.draw_rectangle( self.gc, True, self.x, self.y, self.width, self.height )
+
+class Drum(Block):
+
+ MASK_START = 100
+
+ KEYRECT = [ Block.PAD - 1, Block.HEIGHT + 1 - Block.PAD - Block.KEYSIZE, Block.KEYSIZE, Block.KEYSIZE ]
+ KEYRECT += [ KEYRECT[0]+KEYRECT[2], KEYRECT[1]+KEYRECT[3] ]
+
+ #::: data format:
+ # { "name": name, "id": instrumentId [ , "page": pageId, "volume": 0-1, "reverb": 0-1, "beats": 2-12, "regularity": 0-1, "key": shortcut ] }
+ #:::
+ def __init__( self, owner, data ):
+ Block.__init__( self, owner, data )
+
+ self.type = Drum
+
+ self.canSubstitute = True
+
+ if not "page" in self.data.keys():
+ self.data["page"] = -1
+ if not "volume" in self.data.keys():
+ self.data["volume"] = 0.5
+ if not "reverb" in self.data.keys():
+ self.data["reverb"] = 0.0
+ if not "beats" in self.data.keys():
+ self.data["beats"] = random.randint(2, 12)
+ if not "regularity" in self.data.keys():
+ self.data["regularity"] = random.random()
+ if "key" not in self.data.keys():
+ self.data["key"] = None
+
+ self.owner.mapKey( self.data["key"], self )
+ self.keyImage = [ self.owner.getKeyImage( self.data["key"], False ),
+ self.owner.getKeyImage( self.data["key"], True ) ]
+
+
+ self.img = [ self.owner.getInstrumentImage( self.data["id"], False ),
+ self.owner.getInstrumentImage( self.data["id"], True ) ]
+
+ if self.data["page"] == -1:
+ self.regenerate()
+
+ def destroy( self ):
+ self.owner.mapKey( None, self, self.data["key"] )
+ self.owner.noteDB.deletePages( [ self.data["page"] ] )
+ Block.destroy( self )
+
+ def setData( self, key, value ):
+ if key == "beats":
+ self.data["beats"] = value
+ self.owner.noteDB.updatePage( self.data["page"], PARAMETER.PAGE_BEATS, value )
+
+ elif key == "key":
+ oldKey = self.data["key"]
+ self.data["key"] = value
+ self.keyImage = [ self.owner.getKeyImage( value, False ),
+ self.owner.getKeyImage( value, True ) ]
+ self.invalidate_rect()
+ self.owner.mapKey( value, self, oldKey )
+
+ else:
+ self.data[key] = value
+
+ if self.active:
+ self.owner.updateDrum( self )
+
+ def substitute( self, block ):
+ self.data["name"] = block.data["name"]
+ self.data["id"] = block.data["id"]
+
+ self.img = [ self.owner.getInstrumentImage( self.data["id"], False ),
+ self.owner.getInstrumentImage( self.data["id"], True ) ]
+
+ self.invalidate_rect( True )
+
+ if self.active:
+ self.owner.updateDrum()
+
+ def testSubstitute( self, block ):
+ ret = Block.testSubstitute( self, block )
+ if ret:
+ return ret
+
+ if block.type == Loop:
+ return False
+
+ if Config.INSTRUMENTSID[block.data["id"]].kit == None:
+ return False
+
+ if abs( self.x - block.x ) < Block.SNAP and abs( self.y - block.y ) < Block.SNAP:
+ return self
+
+ return False
+
+ def testMouseOver( self, event ):
+ ret = self.testWithinKey( event )
+ if ret: return ret
+
+ x = event.x - self.x
+ y = event.y - self.y
+
+ if 0 <= x <= self.width and 0 <= y <= self.height:
+ return -1
+
+ return False
+
+ def testWithinKey( self, event ):
+ x = event.x - self.x
+ y = event.y - self.y
+
+ if Drum.KEYRECT[0] <= x <= Drum.KEYRECT[4] and Drum.KEYRECT[1] <= y <= Drum.KEYRECT[5]:
+ return self
+
+ return False
+
+ def _doButtonPress( self, event ): # we were hit with a button press
+ pass
+
+ def button_release( self, event ):
+ if not self.dragging:
+ if self.active:
+ self.owner.deactivateDrum( self )
+ else:
+ self.owner.activateDrum( self )
+ Block.button_release( self, event )
+
+ def _doDraw( self, startX, startY, stopX, stopY, pixmap ):
+ x = max( startX, self.x )
+ y = max( startY, self.y )
+ endX = min( stopX, self.endX )
+ endY = min( stopY, self.endY )
+ width = endX - x
+ height = endY - y
+
+ # draw border
+ if self.active: self.gc.foreground = self.owner.colors["Border_Active"]
+ else: self.gc.foreground = self.owner.colors["Border_Inactive"]
+ self.gc.set_clip_origin( self.x-Drum.MASK_START, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, height )
+
+ # draw block
+ self.gc.set_clip_origin( self.x-Drum.MASK_START, self.y-self.height )
+ pixmap.draw_drawable( self.gc, self.img[self.active], x-self.x, y-self.y, x, y, width, height )
+
+ # draw key
+ self.gc.set_clip_origin( self.x+Drum.KEYRECT[0]-Block.KEYMASK_START, self.y+Drum.KEYRECT[1] )
+ pixmap.draw_drawable( self.gc, self.keyImage[ self.active ], 0, 0, self.x+Drum.KEYRECT[0], self.y+Drum.KEYRECT[1], Block.KEYSIZE, Block.KEYSIZE )
+
+
+ def drawHighlight( self, startX, startY, stopX, stopY, pixmap ):
+ self.gc.foreground = self.owner.colors["Border_Highlight"]
+ self.gc.set_clip_origin( self.x-Drum.MASK_START, self.y )
+ pixmap.draw_rectangle( self.gc, True, self.x, self.y, self.width, self.height )
+
+ def drawKeyHighlight( self, pixmap ):
+ self.gc.foreground = self.owner.colors["Border_Highlight"]
+ self.gc.set_clip_origin( self.x+Drum.KEYRECT[0]-Block.KEYMASK_START, self.y+Drum.KEYRECT[1]-Block.KEYSIZE )
+ pixmap.draw_rectangle( self.gc, True, self.x+Drum.KEYRECT[0], self.y+Drum.KEYRECT[1], Block.KEYSIZE, Block.KEYSIZE )
+
+ def regenerate( self ):
+ self.data["page"] = self.owner.owner._generateDrumLoop( self.data["id"], self.data["beats"], self.data["regularity"], self.data["reverb"], self.data["page"] )
+ if self.active:
+ self.owner.updateDrum( self )
+
+ def clear( self ):
+ self.owner.noteDB.deleteNotesByTrack( [ self.data["page"] ], [ 0 ] )
+
+class Loop(Block):
+
+ HEAD = 13
+ BEAT = 23
+ TAIL = BEAT + Block.PAD
+
+ WIDTH = [ HEAD + BEAT*(n-1) + TAIL for n in range(Config.MAXIMUM_BEATS+1) ]
+
+ BEAT_MUL3 = BEAT*3
+
+ MASK_START = 200
+ MASK_BEAT = MASK_START + HEAD
+ MASK_TAIL = MASK_START + HEAD + BEAT*3
+
+ KEYRECT = [ HEAD + Block.PAD, Block.HEIGHT - 2*Block.PAD - Block.KEYSIZE, Block.KEYSIZE, Block.KEYSIZE ]
+ KEYRECT += [ KEYRECT[0]+KEYRECT[2], KEYRECT[1]+KEYRECT[3] ]
+
+ #::: data format:
+ # { "name": name, "id": pageId [, "beats": 2-12, "regularity": 0-1, "key": shortcut ] }
+ #:::
+ def __init__( self, owner, data ):
+ Block.__init__( self, owner, data )
+
+ self.type = Loop
+
+ self.canParent = True
+ self.canChild = True
+ self.canSubstitute = True
+
+ self.parentOffset = Loop.HEAD - 4
+
+ self.data["beats"] = self.owner.noteDB.getPage(self.data["id"]).beats
+ self.width = Loop.WIDTH[ self.data["beats"] ]
+
+ if "regularity" not in self.data.keys():
+ self.data["regularity"] = random.random()
+ if "key" not in self.data.keys():
+ self.data["key"] = None
+
+ self.keyActive = False
+ self.keyImage = [ self.owner.getKeyImage( self.data["key"], False ),
+ self.owner.getKeyImage( self.data["key"], True ) ]
+
+ self.img = [ self.owner.getLoopImage( self.data["id"], False ),
+ self.owner.getLoopImage( self.data["id"], True ) ]
+
+ def destroy( self ):
+ if self.keyActive:
+ self.owner.mapKey( None, self, self.data["key"] )
+ self.owner.noteDB.deletePages( [ self.data["id"] ] )
+ Block.destroy( self )
+
+ def _updateWidth( self ):
+ self.invalidateBranch( True )
+
+ oldWidth = self.width
+
+ self.width = Loop.WIDTH[self.data["beats"]]
+ self.endX = self.x + self.width
+
+ if self.child:
+ self.child.snapToParentLoc( self.getChildAnchor() )
+
+ if oldWidth < self.width: # or block.child:
+ self.invalidateBranch( True )
+
+ def updateLoop( self ):
+ self.updateImage()
+ self.invalidate_rect()
+
+ if self.active:
+ self.owner.updateLoop( self.getRoot().child )
+
+ def updateImage( self ):
+ self.owner.updateLoopImage( self.data["id"] )
+ self.img = [ self.owner.getLoopImage( self.data["id"], False ),
+ self.owner.getLoopImage( self.data["id"], True ) ]
+
+ def setData( self, key, value ):
+
+ if key == "beats":
+ self.owner.noteDB.updatePage( self.data["id"], PARAMETER.PAGE_BEATS, value )
+ self._updateWidth()
+ self.updateLoop()
+ self.data["beats"] = value
+
+ elif key == "key":
+ oldKey = self.data["key"]
+ self.data["key"] = value
+ self.keyImage = [ self.owner.getKeyImage( value, False ),
+ self.owner.getKeyImage( value, True ) ]
+ self.invalidate_rect()
+ if self.keyActive:
+ self.owner.mapKey( value, self, oldKey )
+
+ else:
+ self.data[key] = value
+
+ def substitute( self, block ):
+ self.invalidateBranch( True )
+
+ oldWidth = self.width
+
+ newid = self.owner.noteDB.duplicatePages( [ block.data["id"] ] )[block.data["id"]]
+ self.data["id"] = newid
+ self.data["beats"] = self.owner.noteDB.getPage(self.data["id"]).beats
+
+ self.updateImage()
+ self._updateWidth()
+
+ if False: # don't substitute children
+ if block.child:
+ c = block.child
+ after = self
+ while c:
+ data = {}
+ for key in c.data.keys():
+ data[key] = c.data[key]
+
+ newid = self.owner.noteDB.duplicatePages( [ data["id"] ] )[data["id"]]
+ self.owner.updateLoopImage( newid )
+ data["id"] = newid
+
+ copy = Loop( self.owner, self.gc, data )
+ after.addChild( copy )
+ after = copy
+ c = c.child
+ elif self.child:
+ self.child.snapToParentLoc( self.getChildAnchor() )
+
+ if self.active:
+ self.owner.updateLoop( self.getRoot().child )
+
+ def testSubstitute( self, block ):
+ ret = Block.testSubstitute( self, block )
+ if ret:
+ return ret
+
+ if block.type != Loop:
+ return False
+
+ if abs( self.x - block.x ) < Block.SNAP and abs( self.y - block.y ) < Block.SNAP:
+ return self
+
+ return False
+
+ def setActive( self, state ):
+ Block.setActive( self, state )
+
+ if self.child:
+ self.child.setActive( state )
+
+ def addChild( self, child ):
+ Block.addChild( self, child )
+ if self.active:
+ child.setActive( True )
+ self.owner.updateLoop( self.getRoot().child )
+
+ def _addParent( self, parent ):
+ Block._addParent( self, parent )
+
+ if self.parent.type == Instrument:
+ self.keyActive = True
+ self.owner.mapKey( self.data["key"], self )
+ else:
+ root = self.getRoot()
+ if root.type == Instrument:
+ root = root.child
+ if root.getData("key") == None:
+ root.setData( "key", self.data["key"] )
+ self.setData( "key", None )
+
+ def _removeParent( self ):
+ if self.active:
+ loopRoot = self.getRoot().child
+ parent = self.parent
+ else:
+ loopRoot = None
+
+ self.keyActive = False
+ self.owner.mapKey( None, self, self.data["key"] )
+
+ Block._removeParent( self )
+
+ if loopRoot == self:
+ self.owner.deactivateLoop( loopRoot )
+ elif loopRoot != None:
+ self.setActive( False )
+ parent.child = None # disconnect us before updating
+ self.owner.updateLoop( loopRoot )
+
+ def testMouseOver( self, event ):
+ ret = self.testWithinKey( event )
+ if ret: return ret
+
+ x = event.x - self.x
+ y = event.y - self.y
+
+ if 0 <= x <= self.width and 0 <= y <= self.height:
+ return -1
+
+ return False
+
+ def testWithinKey( self, event ):
+ if not self.keyActive:
+ return False
+
+ x = event.x - self.x
+ y = event.y - self.y
+
+ if Loop.KEYRECT[0] <= x <= Loop.KEYRECT[4] and Loop.KEYRECT[1] <= y <= Loop.KEYRECT[5]:
+ return self
+
+ return False
+
+ def _doButtonPress( self, event ): # we were hit with a button press
+ pass
+
+ def button_release( self, event ):
+ if not self.dragging:
+ if self.active:
+ root = self.getRoot()
+ self.owner.deactivateLoop( root.child )
+ else:
+ root = self.getRoot()
+ if root.type == Instrument: # must be attached to an instrument
+ self.owner.activateLoop( root.child )
+ Block.button_release( self, event )
+
+ def _doDraw( self, startX, startY, stopX, stopY, pixmap ):
+ y = max( startY, self.y )
+ endY = min( stopY, self.endY )
+ height = endY - y
+
+ loop = self.img[ self.active ]
+ if self.active: self.gc.foreground = self.owner.colors["Border_Active"]
+ else: self.gc.foreground = self.owner.colors["Border_Inactive"]
+
+ #-- draw head -----------------------------------------
+
+ if self.x + Loop.HEAD > startX:
+ x = max( startX, self.x )
+ endX = min( stopX, self.x + Loop.HEAD )
+ width = endX - x
+
+ # draw border
+ self.gc.set_clip_origin( self.x-Loop.MASK_START, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, height )
+
+ # draw block
+ self.gc.set_clip_origin( self.x-Loop.MASK_START, self.y-self.height )
+ pixmap.draw_drawable( self.gc, loop, x-self.x, y-self.y, x, y, width, height )
+
+ #-- draw beats ----------------------------------------
+
+ beats = self.owner.noteDB.getPage(self.data["id"]).beats - 1 # last beat is drawn with the tail
+ curx = self.x + Loop.HEAD
+ while beats > 3:
+ if curx >= stopX:
+ break
+ elif curx + Loop.BEAT_MUL3 > startX:
+ x = max( startX, curx )
+ endX = min( stopX, curx + Loop.BEAT_MUL3 )
+ width = endX - x
+
+ # draw border
+ self.gc.set_clip_origin( curx-Loop.MASK_BEAT, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, height )
+
+ # draw block
+ self.gc.set_clip_origin( curx-Loop.MASK_BEAT, self.y-self.height )
+ pixmap.draw_drawable( self.gc, loop, x-self.x, y-self.y, x, y, width, height )
+
+ curx += Loop.BEAT_MUL3
+ beats -= 3
+ if beats and curx < stopX:
+ endX = curx + Loop.BEAT*beats
+ if endX > startX:
+ x = max( startX, curx )
+ endX = min( stopX, endX )
+ width = endX - x
+
+ # draw border
+ self.gc.set_clip_origin( curx-Loop.MASK_BEAT, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, height )
+
+ # draw block
+ self.gc.set_clip_origin( curx-Loop.MASK_BEAT, self.y-self.height )
+ pixmap.draw_drawable( self.gc, loop, x-self.x, y-self.y, x, y, width, height )
+
+ curx += Loop.BEAT*beats
+
+
+ #-- draw tail -----------------------------------------
+
+ if curx < stopX:
+ x = max( startX, curx )
+ endX = min( stopX, self.endX )
+ width = endX - x
+
+ # draw border
+ self.gc.set_clip_origin( curx-Loop.MASK_TAIL, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, height )
+
+ # draw block
+ self.gc.set_clip_origin( curx-Loop.MASK_TAIL, self.y-self.height )
+ pixmap.draw_drawable( self.gc, loop, x-self.x, y-self.y, x, y, width, height )
+
+ #-- draw key ------------------------------------------
+ if self.keyActive:
+ self.gc.set_clip_origin( self.x+Loop.KEYRECT[0]-Block.KEYMASK_START, self.y+Loop.KEYRECT[1] )
+ pixmap.draw_drawable( self.gc, self.keyImage[ self.active ], 0, 0, self.x+Loop.KEYRECT[0], self.y+Loop.KEYRECT[1], Block.KEYSIZE, Block.KEYSIZE )
+
+ def drawHighlight( self, startX, startY, stopX, stopY, pixmap ):
+ self.gc.foreground = self.owner.colors["Border_Highlight"]
+
+ #-- draw head -----------------------------------------
+
+ self.gc.set_clip_origin( self.x-Loop.MASK_START, self.y )
+ pixmap.draw_rectangle( self.gc, True, self.x, self.y, Loop.HEAD, self.height )
+
+ #-- draw beats ----------------------------------------
+
+ beats = self.owner.noteDB.getPage(self.data["id"]).beats - 1 # last beat is drawn with the tail
+ x = self.x + Loop.HEAD
+ while beats > 3:
+ self.gc.set_clip_origin( x-Loop.MASK_BEAT, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, self.y, Loop.BEAT_MUL3, self.height )
+
+ x += Loop.BEAT_MUL3
+ beats -= 3
+ if beats:
+ width = Loop.BEAT*beats
+
+ self.gc.set_clip_origin( x-Loop.MASK_BEAT, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, self.y, width, self.height )
+
+ x += width
+
+ #-- draw tail -----------------------------------------
+
+ self.gc.set_clip_origin( x-Loop.MASK_TAIL, self.y )
+ pixmap.draw_rectangle( self.gc, True, x, self.y, Loop.TAIL, self.height )
+
+ def drawKeyHighlight( self, pixmap ):
+ self.gc.foreground = self.owner.colors["Border_Highlight"]
+ self.gc.set_clip_origin( self.x+Loop.KEYRECT[0]-Block.KEYMASK_START, self.y+Loop.KEYRECT[1]-Block.KEYSIZE )
+ pixmap.draw_rectangle( self.gc, True, self.x+Loop.KEYRECT[0], self.y+Loop.KEYRECT[1], Block.KEYSIZE, Block.KEYSIZE )
+
+ def clear( self ):
+ self.owner.noteDB.deleteNotesByTrack( [ self.data["id"] ], [ 0 ] )
+
+ self.updateImage()
+
+ self.invalidate_rect()
+
+ if self.active:
+ self.owner.updateLoop( self.getRoot().child )
+
+
+StrToClass = {
+ "Instrument": Instrument,
+ "Drum": Drum,
+ "Loop": Loop
+ }
+
+ClassToStr = {
+ Instrument: "Instrument",
+ Drum: "Drum",
+ Loop: "Loop"
+ }
diff --git a/TamTamJam.activity/Jam/Desktop.py b/TamTamJam.activity/Jam/Desktop.py
new file mode 100644
index 0000000..7b1acba
--- /dev/null
+++ b/TamTamJam.activity/Jam/Desktop.py
@@ -0,0 +1,466 @@
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import Config
+
+from gettext import gettext as _
+
+from Jam import Block
+from Jam import Popup
+
+class Desktop( gtk.EventBox ):
+
+ def __init__( self, owner ):
+ gtk.EventBox.__init__( self )
+
+ self.owner = owner
+
+ self.drawingArea = gtk.DrawingArea()
+ self.add( self.drawingArea )
+
+ # take drawing setup from owner
+ self.gc = owner.gc
+ self.colors = owner.colors
+ self.blockMask = owner.blockMask
+
+ self.noteDB = owner.noteDB
+
+ self.dirtyRectToAdd = gtk.gdk.Rectangle() # used by the invalidate_rect function
+ self.screenBuf = None
+ self.screenBufDirty = False
+ self.screenBufDirtyRect = gtk.gdk.Rectangle()
+
+ self.blocks = [] # items on the desktop
+ self.activeInstrument = None
+ self.activeDrum = None
+
+ self.loops = {} # dict of playing loops by loop root
+ self.drums = [] # list of active drums
+
+ self.add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK)
+
+ self.connect( "size-allocate", self.on_size_allocate )
+ self.connect( "button-press-event", self.on_button_press )
+ self.connect( "button-release-event", self.on_button_release )
+ self.connect( "motion-notify-event", self.on_motion_notify )
+ self.drawingArea.connect( "expose-event", self.on_expose )
+
+ self.clickedBlock = None
+ self.possibleParent = None
+ self.possibleSubstitute = None
+ self.dragging = False
+ self.possibleDelete = False
+ self.overKey = False
+
+ #-- Popups --------------------------------------------
+ self.rightClicked = False
+
+ self.popup = {}
+ self.popup[Popup.Instrument] = Popup.Instrument( _("Instrument Properties"), self.owner )
+ self.popup[Popup.Drum] = Popup.Drum( _("Drum Kit Properties"), self.owner )
+ self.popup[Popup.Loop] = Popup.Loop( _("Loop Properties"), self.owner )
+ self.popup[Popup.Shortcut] = Popup.Shortcut( _("Assign Key"), self.owner )
+
+ def dumpToStream( self, ostream ):
+ for b in self.blocks:
+ b.dumpToStream( ostream )
+
+ def on_size_allocate( self, widget, allocation ):
+ if self.screenBuf == None or self.alloc.width != allocation.width or self.alloc.height != allocation.height:
+ win = gtk.gdk.get_default_root_window()
+ self.screenBuf = gtk.gdk.Pixmap( win, allocation.width, allocation.height )
+ self.invalidate_rect( 0, 0, allocation.width, allocation.height )
+ self.alloc = allocation
+ self.absoluteLoc = [0,0]
+ parent = self.get_parent()
+ while parent:
+ alloc = parent.get_allocation()
+ self.absoluteLoc[0] += alloc.x
+ self.absoluteLoc[1] += alloc.y
+ parent = parent.get_parent()
+ return False
+
+ def getLoopIds( self ):
+ return [ self.loops[loop] for loop in self.loops ]
+
+ #==========================================================
+ # Blocks
+
+ def addBlock( self, blockClass, blockData, loc = (-1,-1), drag = False ):
+
+ block = blockClass( self, blockData )
+
+ if loc[0] != -1: x = loc[0]
+ else: x = self.alloc.width//2
+ if loc[1] != -1: y = loc[1]
+ elif drag: y = self.alloc.height - block.height//2
+ else: y = self.alloc.height//2
+
+ if drag:
+ win = gtk.gdk.get_default_root_window()
+ display = win.get_display()
+ screen = display.get_default_screen()
+ display.warp_pointer( screen, int(self.absoluteLoc[0] + x), int(self.absoluteLoc[1] + y) )
+ self._beginDrag( block )
+ block.setLoc( x - block.width//2, y - block.height//2 )
+ else:
+ self.blocks.append( block )
+ block.setLoc( x - block.width//2, y - block.height//2 )
+
+ if blockClass == Block.Instrument:
+ pass
+ elif blockClass == Block.Drum:
+ pass
+ elif blockClass == Block.Loop:
+ pass
+
+ return block
+
+ def deleteBlock( self, block ):
+ if block.type == Block.Instrument:
+ if block == self.activeInstrument:
+ self.activeInstrument = None
+ for i in range(len(self.blocks)-1, -1, -1):
+ if self.blocks[i].type == Block.Instrument:
+ self.activateInstrument( self.blocks[i] )
+ break
+
+ elif block.type == Block.Drum:
+ if block == self.activeDrum:
+ self.deactivateDrum()
+
+ elif block.type == Block.Loop:
+ pass
+
+ if block in self.blocks:
+ block.invalidate_rect( True )
+ self.blocks.remove( block )
+
+ block.destroy()
+
+ def _clearDesktop( self ):
+ for i in range( len(self.blocks)-1, -1, -1 ):
+ self.deleteBlock( self.blocks[i] )
+
+ def mapKey( self, key, block, oldKey = None ):
+ self.owner.mapKey( key, block, oldKey )
+
+ def getInstrumentImage( self, id, active = False ):
+ return self.owner.getInstrumentImage( id, active )
+
+ def getKeyImage( self, key, active = False ):
+ return self.owner.getKeyImage( key, active )
+
+ def getLoopImage( self, id, active = False ):
+ return self.owner.getLoopImage( id, active )
+
+ def updateLoopImage( self, id ):
+ self.owner.updateLoopImage( id )
+
+ #==========================================================
+ # State
+
+ def activateInstrument( self, block ):
+ if self.activeInstrument:
+ self.activeInstrument.setActive( False )
+
+ block.setActive( True )
+ self.activeInstrument = block
+
+ self.updateInstrument( block )
+
+ def updateInstrument( self, block ):
+ data = block.data
+ self.owner._updateInstrument( data["id"], data["volume"], data["pan"], data["reverb"] )
+
+ def activateDrum( self, block ):
+ for drum in self.drums:
+ self.deactivateDrum( drum )
+
+ block.setActive( True )
+ self.drums.append( block )
+
+ self.updateDrum( block, True )
+
+ def deactivateDrum( self, block ):
+ self.owner._stopDrum( self.loops[block] )
+ del self.loops[block]
+
+ block.setActive( False )
+ self.drums.remove( block )
+
+ def updateDrum( self, block, firstTime = False ):
+ data = block.data
+
+ if firstTime:
+ loopId = None
+ else:
+ loopId = self.loops[block]
+
+ self.loops[block] = self.owner._playDrum( data["id"], data["page"], data["volume"], data["reverb"], data["beats"], data["regularity"], loopId )
+
+ def activateLoop( self, block ):
+ block.setActive( True )
+
+ self.updateLoop( block, True )
+
+ def deactivateLoop( self, block ):
+ block.setActive( False )
+
+ self.owner._stopLoop( self.loops[block] )
+ del self.loops[block]
+
+ def updateLoop( self, block, firstTime = False ):
+ inst = block.parent.data
+
+ tune = []
+ itr = block
+ while itr != None:
+ tune.append( itr.data["id"] )
+ itr = itr.child
+
+ if firstTime:
+ loopId = None
+ else:
+ loopId = self.loops[block]
+
+ self.loops[block] = self.owner._playLoop( inst["id"], inst["volume"], inst["reverb"], tune, loopId )
+
+ #==========================================================
+ # Mouse
+
+ def on_button_press( self, widget, event ):
+
+ if event.button == 3:
+ self.rightClicked = True
+
+ hit = False
+ for i in range(len(self.blocks)-1, -1, -1):
+ hit = self.blocks[i].button_press( event )
+ if hit:
+ self.clickedBlock = hit
+ break
+
+ def on_button_release( self, widget, event ):
+
+ if event.button == 3: # Right Click
+ if self.clickedBlock:
+ if self.clickedBlock.type == Block.Instrument:
+ self.popup[Popup.Instrument].setBlock( self.clickedBlock )
+ elif self.clickedBlock.type == Block.Drum:
+ self.popup[Popup.Drum].setBlock( self.clickedBlock )
+ elif self.clickedBlock.type == Block.Loop:
+ self.popup[Popup.Loop].setBlock( self.clickedBlock )
+
+ self.clickedBlock = None
+ self.rightClicked = False
+ self.overKey = False # just in case
+ return
+
+ if self.overKey:
+ self.popup[Popup.Shortcut].setBlock( self.clickedBlock )
+ self.overKey.invalidate_rect( False )
+ self.overKey = False
+ self.clickedBlock = None
+ return
+
+ if self.possibleDelete:
+ self.possibleDelete = False
+ self.deleteBlock( self.clickedBlock )
+ self.clickedBlock = None
+ self.possibleParent = None
+ self.possibleSubstitute = None
+ self.dragging = False
+
+ if self.dragging:
+ self.dragging = False
+
+ if self.possibleParent:
+ self.possibleParent.addChild( self.clickedBlock )
+ root = self.possibleParent.getRoot()
+ self.blocks.remove(root)
+ self.blocks.append(root)
+ root.invalidateBranch( True )
+ self.possibleParent = None
+ elif self.possibleSubstitute:
+ self.possibleSubstitute.substitute( self.clickedBlock )
+ if self.clickedBlock.isPlaced():
+ if self.clickedBlock.resetLoc():
+ self.blocks.append( self.clickedBlock )
+ else:
+ self.deleteBlock( self.clickedBlock )
+ self.clickedBlock = None
+ if self.possibleSubstitute.type == Block.Instrument:
+ self.activateInstrument( self.possibleSubstitute )
+ self.possibleSubstitute = None
+ else:
+ self.blocks.append( self.clickedBlock )
+
+ if self.clickedBlock:
+ self.clickedBlock.button_release( event )
+ self.clickedBlock = None
+
+
+ def on_motion_notify( self, widget, event ):
+
+ if self.rightClicked:
+ return
+
+ if self.clickedBlock and self.overKey:
+ return
+
+ if event.is_hint or widget != self:
+ x, y, state = self.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+
+ blockCount = len(self.blocks)
+
+ if not self.clickedBlock:
+ if self.popup[Popup.Shortcut].is_up():
+ return
+ for i in range(blockCount-1, -1, -1):
+ over = self.blocks[i].testMouseOver( event )
+ if over == -1:
+ break # over block but no hotspot
+ if over:
+ if self.overKey != self.blocks[i]:
+ if self.overKey:
+ self.overKey.invalidate_rect( False )
+ self.overKey = over
+ self.overKey.invalidate_rect( False )
+ return
+ if self.overKey:
+ self.overKey.invalidate_rect( False )
+ self.overKey = False
+ return
+
+ self.dragging = True
+
+ if self.clickedBlock.motion_notify( event ): # first drag of root block, remove from self.blocks
+ self.blocks.remove( self.clickedBlock )
+ blockCount = len(self.blocks)
+
+ if event.y < 0 or event.y > self.alloc.height:
+ self.possibleDelete = True
+ return
+ else:
+ self.possibleDelete = False
+
+ if self.clickedBlock.canChild and blockCount:
+ for i in range(blockCount-1, -1, -1):
+ handled = self.blocks[i].testChild( self.clickedBlock.getParentAnchor() )
+ if handled:
+ if self.possibleParent != handled:
+ if self.possibleParent:
+ self.possibleParent.invalidate_rect( False )
+ self.possibleParent = handled
+ self.possibleParent.invalidate_rect( False )
+ break
+ if not handled and self.possibleParent:
+ self.possibleParent.invalidate_rect( False )
+ self.possibleParent = None
+
+ if self.clickedBlock.canSubstitute and blockCount:
+ for i in range(blockCount-1, -1, -1):
+ handled = self.blocks[i].testSubstitute( self.clickedBlock )
+ if handled:
+ if self.possibleSubstitute != handled:
+ if self.possibleSubstitute:
+ self.possibleSubstitute.invalidate_rect( False )
+ self.possibleSubstitute = handled
+ self.possibleSubstitute.invalidate_rect( False )
+ break
+ if not handled and self.possibleSubstitute:
+ self.possibleSubstitute.invalidate_rect( False )
+ self.possibleSubstitute = None
+
+ def _beginDrag( self, block ):
+ block._beginDrag()
+ self.clickedBlock = block
+ self.dragging = True
+
+ #==========================================================
+ # Drawing
+
+ def draw( self ):
+
+ startX = self.screenBufDirtyRect.x
+ startY = self.screenBufDirtyRect.y
+ stopX = startX + self.screenBufDirtyRect.width
+ stopY = startY + self.screenBufDirtyRect.height
+
+ self.gc.set_clip_rectangle( self.screenBufDirtyRect )
+
+ # draw background
+ self.gc.foreground = self.colors["bg"]
+ self.screenBuf.draw_rectangle( self.gc, True, startX, startY, self.screenBufDirtyRect.width, self.screenBufDirtyRect.height )
+
+ # draw blocks
+ self.gc.set_clip_mask( self.blockMask )
+ for block in self.blocks:
+ block.draw( startX, startY, stopX, stopY, self.screenBuf )
+
+ self.screenBufDirty = False
+
+ def on_expose( self, DA, event ):
+
+ if self.screenBufDirty:
+ self.draw()
+
+ self.drawingAreaDirty = False
+
+ startX = event.area.x
+ startY = event.area.y
+ stopX = event.area.x + event.area.width
+ stopY = event.area.y + event.area.height
+
+ self.gc.set_clip_rectangle( event.area )
+
+ # draw base
+ DA.window.draw_drawable( self.gc, self.screenBuf, startX, startY, startX, startY, event.area.width, event.area.height )
+
+ if self.possibleDelete:
+ return
+
+ self.gc.set_clip_mask( self.blockMask )
+
+ # draw possible parent
+ if self.possibleParent:
+ self.possibleParent.drawHighlight( startX, startY, stopX, stopY, DA.window )
+
+ # draw dragged objects
+ if self.dragging:
+ self.clickedBlock.draw( startX, startY, stopX, stopY, DA.window )
+
+ # draw possible substitute
+ if self.possibleSubstitute:
+ self.possibleSubstitute.drawHighlight( startX, startY, stopX, stopY, DA.window )
+
+ # draw key highlight
+ if self.overKey:
+ self.overKey.drawKeyHighlight( DA.window )
+
+ def invalidate_rect( self, x, y, width, height, base = True ):
+ self.dirtyRectToAdd.x = x
+ self.dirtyRectToAdd.y = y
+ self.dirtyRectToAdd.width = width
+ self.dirtyRectToAdd.height = height
+
+ #print "dirty %d %d %d %d %d %d" % (x, y, width, height, x+width, y+height)
+ if base: # the base image has been dirtied
+ if not self.screenBufDirty:
+ self.screenBufDirtyRect.x = x
+ self.screenBufDirtyRect.y = y
+ self.screenBufDirtyRect.width = width
+ self.screenBufDirtyRect.height = height
+ else:
+ self.screenBufDirtyRect = self.screenBufDirtyRect.union( self.dirtyRectToAdd )
+ self.screenBufDirty = True
+ if self.drawingArea.window != None:
+ self.drawingArea.window.invalidate_rect( self.dirtyRectToAdd, True )
+ self.drawingAreaDirty = True
+
diff --git a/TamTamJam.activity/Jam/Fillin.py b/TamTamJam.activity/Jam/Fillin.py
new file mode 100644
index 0000000..72e2ae3
--- /dev/null
+++ b/TamTamJam.activity/Jam/Fillin.py
@@ -0,0 +1,116 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import gobject
+
+from RythmGenerator import *
+from Util.CSoundClient import new_csound_client
+from Util.NoteDB import Note
+import Config
+
+class Fillin:
+ def __init__( self, nbeats, tempo, instrument, reverb, volume ):
+ self.notesList = []
+ self.barCount = 0
+ self.gate = 0
+ self.nbeats = nbeats
+ self.tempo = tempo
+ self.instrument = instrument
+ self.reverb = reverb
+ self.volume = volume
+ self.onsets = []
+ self.pitchs = []
+ self.playBackTimeout = None
+ self.loopId = 0
+ self.csnd = new_csound_client()
+
+ def reset( self ):
+ self.barCount = 0
+ self.gate = 0
+
+ def setLoopId( self, id ):
+ self.loopId = id
+
+ def setProperties( self, tempo, instrument, volume, beats, reverb ):
+ self.setTempo( tempo )
+ self.setInstrument( instrument )
+ self.setVolume( volume )
+ self.setBeats( beats )
+ self.setReverb( reverb )
+
+ def setInstrument( self, instrument ):
+ self.instrument = instrument
+
+ def setBeats( self, nbeats ):
+ if self.playBackTimeout != None:
+ gobject.source_remove( self.playBackTimeout )
+
+ self.nbeats = nbeats
+ self.clear()
+ self.reset()
+
+ def setTempo( self, tempo ):
+ self.tempo = tempo
+ if self.playBackTimeout != None:
+ gobject.source_remove( self.playBackTimeout )
+ self.play()
+
+ def setReverb( self, reverb ):
+ self.reverb = reverb
+
+ def setVolume( self, volume ):
+ self.volume = volume
+
+ def play( self ):
+ if self.playBackTimeout == None:
+ self.playBackTimeout = gobject.timeout_add( int(60000/self.tempo/8), self.handleClock )
+ self.handleClock()
+
+ def stop( self ):
+ if self.playBackTimeout != None:
+ gobject.source_remove( self.playBackTimeout )
+ self.clear()
+
+ def clear( self ):
+ if self.notesList:
+ for n in self.notesList:
+ self.csnd.loopDelete(n, self.loopId)
+ self.notesList = []
+
+ def handleClock( self ):
+ tick = self.csnd.loopGetTick( self.loopId )
+ if tick < ( Config.TICKS_PER_BEAT / 2 + 1 ):
+ if self.gate == 0:
+ self.gate = 1
+ self.barCount += 1
+ self.barCount %= 4
+ if self.barCount == 1:
+ self.clear()
+
+ if tick > ( ( Config.TICKS_PER_BEAT * self.nbeats ) - ( Config.TICKS_PER_BEAT / 2 ) - 1 ):
+ if self.gate == 1:
+ self.gate = 0
+ if self.barCount == 3:
+ self.regenerate()
+ return True
+
+ def unavailable( self, onsets, pitchs ):
+ self.onsets = onsets
+ self.pitchs = pitchs
+
+ def regenerate(self):
+ def flatten(ll):
+ rval = []
+ for l in ll:
+ rval += l
+ return rval
+ i = 500
+ self.notesList= []
+ for x in flatten( generator(self.instrument, self.nbeats, 0.4, 0.1, self.reverb) ):
+ if x.onset not in self.onsets or x.pitch not in self.pitchs:
+ x.amplitude = x.amplitude*self.volume
+ n = Note(0, x.trackId, i, x)
+ self.notesList.append(n)
+ i += 1
+ self.csnd.loopPlay(n,1, loopId = self.loopId ) #add as active
+
diff --git a/TamTamJam.activity/Jam/GenRythm.py b/TamTamJam.activity/Jam/GenRythm.py
new file mode 100644
index 0000000..d0e23e3
--- /dev/null
+++ b/TamTamJam.activity/Jam/GenRythm.py
@@ -0,0 +1,80 @@
+import random
+import Config
+
+from Generation.GenerationConstants import GenerationConstants
+from Generation.Utils import *
+
+class GenRythm:
+ def drumRythmSequence(self, instrumentName, nbeats, density, regularity ):
+ rythmSequence = []
+ binSelection = []
+ downBeats = []
+ upBeats = []
+ beats = []
+ countDown = 0
+ onsetTime = None
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.PUNCH:
+ registerDensity = 0.5
+ downBeatRecurence = 4
+ downBeats = [x for x in GenerationConstants.DRUM_PUNCH_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 2 )
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.LOW:
+ registerDensity =1
+ downBeatRecurence = 4
+ downBeats = [x for x in GenerationConstants.DRUM_LOW_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 2 )
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.MID:
+ registerDensity = .75
+ downBeatRecurence = 1
+ downBeats = [x for x in GenerationConstants.DRUM_MID_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 4 )
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.HIGH:
+ registerDensity = 1.5
+ downBeatRecurence = 1
+ downBeats = [x for x in GenerationConstants.DRUM_HIGH_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 4 )
+
+ realDensity = density * registerDensity
+ if realDensity > 1.:
+ realDensity = 1.
+
+ list = range( int( realDensity * len( downBeats ) ) )
+ for i in list:
+ if random.random() < ( regularity * downBeatRecurence ) and binSelection.count( 1 ) < len( downBeats ):
+ binSelection.append( 1 )
+ else:
+ if binSelection.count( 0 ) < len( downBeats ):
+ binSelection.append( 0 )
+ else:
+ binSelection.append( 1 )
+
+ countDown = binSelection.count( 1 )
+
+ length = len(downBeats) - 1
+ for i in range( countDown ):
+ ran1 = random.randint(0, length)
+ ran2 = random.randint(0, length)
+ randMin = min(ran1, ran2)
+ onsetTime = downBeats.pop(randMin)
+ rythmSequence.append( onsetTime )
+ length -= 1
+
+ length = len(upBeats) - 1
+ for i in range( len( binSelection ) - countDown ):
+ ran1 = random.randint(0, length)
+ ran2 = random.randint(0, length)
+ randMin = min(ran1, ran2)
+ onsetTime = upBeats.pop(randMin)
+ rythmSequence.append( onsetTime )
+ length -= 1
+
+ rythmSequence.sort()
+ return rythmSequence
diff --git a/TamTamJam.activity/Jam/JamMain.py b/TamTamJam.activity/Jam/JamMain.py
new file mode 100644
index 0000000..c339ae6
--- /dev/null
+++ b/TamTamJam.activity/Jam/JamMain.py
@@ -0,0 +1,1112 @@
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import pango
+
+from SubActivity import SubActivity
+
+import os, sys, shutil
+
+import Config
+from gettext import gettext as _
+import sugar.graphics.style as style
+
+from Jam.Desktop import Desktop
+import Jam.Picker as Picker
+import Jam.Block as Block
+from Jam.Toolbars import JamToolbar, DesktopToolbar
+
+
+from Util.CSoundNote import CSoundNote
+from Util.CSoundClient import new_csound_client
+import Util.InstrumentDB as InstrumentDB
+from Util import NoteDB
+
+from Fillin import Fillin
+from RythmGenerator import generator
+from Generation.GenerationConstants import GenerationConstants
+from Util.NoteDB import Note, Page
+
+from Util import ControlStream
+
+import xdrlib
+import time
+import gobject
+import Util.Network as Net
+from sugar.presence import presenceservice
+from sugar.graphics.xocolor import XoColor
+
+from math import sqrt
+
+class JamMain(SubActivity):
+
+ def __init__(self, activity, set_mode):
+ SubActivity.__init__(self, set_mode)
+
+ self.activity = activity
+
+ self.instrumentDB = InstrumentDB.getRef()
+ self.noteDB = NoteDB.NoteDB()
+
+ #-- initial settings ----------------------------------
+ self.tempo = Config.PLAYER_TEMPO
+ self.beatDuration = 60.0/self.tempo
+ self.ticksPerSecond = Config.TICKS_PER_BEAT*self.tempo/60.0
+ self.volume = 0.5
+
+ self.csnd = new_csound_client()
+ for i in range(0,9):
+ self.csnd.setTrackVolume( 100, i )
+ self.csnd.setMasterVolume( self.volume*100 ) # csnd expects a range 0-100 for now
+ self.csnd.setTempo( self.tempo )
+
+ self.paused = False
+
+ presenceService = presenceservice.get_instance()
+ self.xoOwner = presenceService.get_owner()
+
+ #-- Drawing -------------------------------------------
+ def darken( colormap, hex ):
+ hexToDec = { "0":0, "1":1, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "A":10, "B":11, "C":12, "D":13, "E":14, "F":15, "a":10, "b":11, "c":12, "d":13, "e":14, "f":15 }
+ r = int( 0.7*(16*hexToDec[hex[1]] + hexToDec[hex[2]]) )
+ g = int( 0.7*(16*hexToDec[hex[3]] + hexToDec[hex[4]]) )
+ b = int( 0.7*(16*hexToDec[hex[5]] + hexToDec[hex[6]]) )
+ return colormap.alloc_color( r*256, g*256, b*256 )
+ def lighten( colormap, hex ):
+ hexToDec = { "0":0, "1":1, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "A":10, "B":11, "C":12, "D":13, "E":14, "F":15, "a":10, "b":11, "c":12, "d":13, "e":14, "f":15 }
+ r = 255 - int( 0.7*(255-(16*hexToDec[hex[1]] + hexToDec[hex[2]])) )
+ g = 255 - int( 0.7*(255-(16*hexToDec[hex[3]] + hexToDec[hex[4]])) )
+ b = 255 - int( 0.7*(255-(16*hexToDec[hex[5]] + hexToDec[hex[6]])) )
+ return colormap.alloc_color( r*256, g*256, b*256 )
+
+ xoColorKey = self.xoOwner.props.color
+ if not xoColorKey:
+ xoColorKey = ( "#8D8D8D,#FFDDEA" )
+ xoColor = XoColor( xoColorKey )
+
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ colormap = gtk.gdk.colormap_get_system()
+ self.colors = { "bg": colormap.alloc_color( Config.PANEL_BCK_COLOR ),
+ "black": colormap.alloc_color( style.COLOR_BLACK.get_html() ),
+ #"Picker_Bg": colormap.alloc_color( "#404040" ),
+ #"Picker_Bg_Inactive": colormap.alloc_color( "#808080" ),
+ "Picker_Bg": colormap.alloc_color( style.COLOR_TOOLBAR_GREY.get_html() ),
+ "Picker_Bg_Inactive": colormap.alloc_color( style.COLOR_BUTTON_GREY.get_html() ),
+ "Picker_Fg": colormap.alloc_color( style.COLOR_WHITE.get_html() ),
+ "Border_Active": colormap.alloc_color( xoColor.get_stroke_color() ), #colormap.alloc_color( "#590000" ),
+ "Border_Inactive": colormap.alloc_color( "#8D8D8D" ),
+ "Border_Highlight": colormap.alloc_color( "#FFFFFF" ),
+ "Bg_Active": colormap.alloc_color( xoColor.get_fill_color() ), #colormap.alloc_color( "#FFDDEA" ),
+ "Bg_Inactive": colormap.alloc_color( "#DBDBDB" ),
+ "Preview_Note_Fill": colormap.alloc_color( Config.BG_COLOR ),
+ "Preview_Note_Border": colormap.alloc_color( Config.FG_COLOR ),
+ "Preview_Note_Selected": colormap.alloc_color( style.COLOR_WHITE.get_html() ),
+ "Note_Fill_Active": lighten( colormap, "#590000" ), # base "Border_Active"
+ "Note_Fill_Inactive": lighten( colormap, "#8D8D8D" ), # base "Border_Inactive"
+ "Beat_Line": colormap.alloc_color( "#959595" ) }
+ self.colors[ "Note_Border_Active"] = self.colors["Border_Active"]
+ self.colors[ "Note_Border_Inactive"] = self.colors["Border_Inactive"]
+
+
+ if True: # load block clipmask
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT+'jam-blockMask.png')
+ pixels = pix.get_pixels()
+ stride = pix.get_rowstride()
+ channels = pix.get_n_channels()
+ bitmap = ""
+ byte = 0
+ shift = 0
+ for j in range(pix.get_height()):
+ offset = stride*j
+ for i in range(pix.get_width()):
+ r = pixels[i*channels+offset]
+ if r != "\0": byte += 1 << shift
+ shift += 1
+ if shift > 7:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ if shift > 0:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ self.blockMask = gtk.gdk.bitmap_create_from_data( None, bitmap, pix.get_width(), pix.get_height() )
+
+ pix = gtk.gdk.pixbuf_new_from_file( Config.IMAGE_ROOT+"sampleBG.png" )
+ self.sampleBg = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.sampleBg.draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.sampleBg.endOffset = pix.get_width()-5
+ self.sampleNoteHeight = 7
+ if True: # load sample note clipmask
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT+'sampleNoteMask.png')
+ pixels = pix.get_pixels()
+ stride = pix.get_rowstride()
+ channels = pix.get_n_channels()
+ bitmap = ""
+ byte = 0
+ shift = 0
+ for j in range(pix.get_height()):
+ offset = stride*j
+ for i in range(pix.get_width()):
+ r = pixels[i*channels+offset]
+ if r != "\0": byte += 1 << shift
+ shift += 1
+ if shift > 7:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ if shift > 0:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ self.sampleNoteMask = gtk.gdk.bitmap_create_from_data( None, bitmap, pix.get_width(), pix.get_height() )
+ self.sampleNoteMask.endOffset = pix.get_width()-3
+
+ self.loopPitchOffset = 4
+ self.loopTickOffset = 13
+ self.pitchPerPixel = float(Config.NUMBER_OF_POSSIBLE_PITCHES-1) / (Block.Loop.HEIGHT - 2*self.loopPitchOffset - self.sampleNoteHeight)
+ self.pixelsPerPitch = float(Block.Loop.HEIGHT - 2*self.loopPitchOffset - self.sampleNoteHeight)/(Config.MAXIMUM_PITCH - Config.MINIMUM_PITCH)
+ self.pixelsPerTick = Block.Loop.BEAT/float(Config.TICKS_PER_BEAT)
+ self.ticksPerPixel = 1.0/self.pixelsPerTick
+
+ #-- Instrument Images ---------------------------------
+ self.instrumentImage = {}
+ self.instrumentImageActive = {}
+ for inst in self.instrumentDB.getSet( "All" ):
+ self.prepareInstrumentImage( inst.id, inst.img )
+
+ #-- Loop Images ---------------------------------------
+ self.loopImage = {} # get filled in through updateLoopImage
+ self.loopImageActive = {} #
+
+ #-- Key Images ----------------------------------------
+ self.keyImage = {}
+ self.keyImageActive = {}
+ # use hardware key codes to work on any keyboard layout (hopefully)
+ self.valid_shortcuts = { 18:"9", 19:"0", 20:"-", 21:"=",
+ 32:"O", 33:"P", 34:"[", 35:"]",
+ 47:";", 48:"'", 51:"\\",
+ 60:".", 61:"/",
+ None:" " }
+ for key in self.valid_shortcuts.keys():
+ self.prepareKeyImage( key )
+
+ #-- Toolbars ------------------------------------------
+ self.activity.activity_toolbar.keep.show()
+
+ self.jamToolbar = JamToolbar( self )
+ self.activity.toolbox.add_toolbar( _("Jam"), self.jamToolbar )
+
+ self.desktopToolbar = DesktopToolbar( self )
+ self.activity.toolbox.add_toolbar( _("Desktop"), self.desktopToolbar )
+
+ #-- GUI -----------------------------------------------
+ if True: # GUI
+ self.modify_bg( gtk.STATE_NORMAL, self.colors["bg"] ) # window bg
+
+ self.GUI = {}
+ self.GUI["mainVBox"] = gtk.VBox()
+ self.add( self.GUI["mainVBox"] )
+
+ #-- Desktop -------------------------------------------
+ self.desktop = self.GUI["desktop"] = Desktop( self )
+ self.GUI["mainVBox"].pack_start( self.GUI["desktop"] )
+
+ #-- Bank ----------------------------------------------
+ separator = gtk.Label( " " )
+ separator.set_size_request( -1, style.TOOLBOX_SEPARATOR_HEIGHT )
+ self.GUI["mainVBox"].pack_start( separator, False )
+ self.GUI["notebook"] = gtk.Notebook()
+ self.GUI["notebook"].set_scrollable( True )
+ self.GUI["notebook"].modify_bg( gtk.STATE_NORMAL, self.colors["Picker_Bg"] ) # active tab
+ self.GUI["notebook"].modify_bg( gtk.STATE_ACTIVE, self.colors["Picker_Bg_Inactive"] ) # inactive tab
+ self.GUI["notebook"].props.tab_vborder = style.TOOLBOX_TAB_VBORDER
+ self.GUI["notebook"].props.tab_hborder = style.TOOLBOX_TAB_HBORDER
+ self.GUI["notebook"].set_size_request( -1, 160 )
+ self.GUI["notebook"].connect( "switch-page", self.setPicker )
+ self.GUI["mainVBox"].pack_start( self.GUI["notebook"], False, False )
+ self.pickers = {}
+ self.pickerScroll = {}
+ for type in [ Picker.Instrument, Picker.Drum, Picker.Loop ]:
+ self.pickers[type] = type( self )
+
+ def prepareLabel( name ):
+ label = gtk.Label( _(name) )
+ label.set_alignment( 0.0, 0.5 )
+ label.modify_fg( gtk.STATE_NORMAL, self.colors["Picker_Fg"] )
+ label.modify_fg( gtk.STATE_ACTIVE, self.colors["Picker_Fg"] )
+ return label
+
+ self.GUI["notebook"].append_page( self.pickers[Picker.Drum], prepareLabel("Drum Kits") )
+ self.GUI["notebook"].append_page( self.pickers[Picker.Loop], prepareLabel("Loops") )
+
+ sets = self.instrumentDB.getLabels()[:]
+ sets.sort()
+ for set in sets:
+ page = gtk.HBox()
+ page.set = set
+ self.GUI["notebook"].append_page( page, prepareLabel( set ) )
+
+ self.show_all()
+
+ self.GUI["notebook"].set_current_page( 0 )
+
+ #-- Keyboard ------------------------------------------
+ self.key_dict = {}
+ self.nextTrack = 1
+ self.keyboardListener = None
+ self.recordingNote = None
+
+ self.keyMap = {}
+
+ # default instrument
+ self._updateInstrument( Config.INSTRUMENTS["kalimba"].instrumentId, 0.5 )
+ self.instrumentStack = []
+
+ #-- Drums ---------------------------------------------
+ self.drumLoopId = None
+ # use dummy values for now
+ self.drumFillin = Fillin( 2, 100, Config.INSTRUMENTS["drum1kit"].instrumentId, 0, 1 )
+
+ #-- Desktops ------------------------------------------
+ self.curDesktop = None
+ # copy preset desktops
+ path = Config.TAM_TAM_ROOT+"/Resources/Desktops/"
+ filelist = os.listdir( path )
+ for file in filelist:
+ shutil.copyfile( path+file, Config.SCRATCH_DIR+file )
+
+ #-- Network -------------------------------------------
+ self.network = Net.Network()
+ self.network.addWatcher( self.networkStatusWatcher )
+ self.network.connectMessage( Net.HT_SYNC_REPLY, self.processHT_SYNC_REPLY )
+ self.network.connectMessage( Net.HT_TEMPO_UPDATE, self.processHT_TEMPO_UPDATE )
+ self.network.connectMessage( Net.PR_SYNC_QUERY, self.processPR_SYNC_QUERY )
+ self.network.connectMessage( Net.PR_TEMPO_QUERY, self.processPR_TEMPO_QUERY )
+ self.network.connectMessage( Net.PR_REQUEST_TEMPO_CHANGE, self.processPR_REQUEST_TEMPO_CHANGE )
+
+ # sync
+ self.syncQueryStart = {}
+ self.syncTimeout = None
+ self.heartbeatLoop = self.csnd.loopCreate()
+ self.csnd.loopSetNumTicks( Config.TICKS_PER_BEAT, self.heartbeatLoop )
+ self.heartbeatStart = time.time()
+ self.csnd.loopStart( self.heartbeatLoop )
+
+ # data packing classes
+ self.packer = xdrlib.Packer()
+ self.unpacker = xdrlib.Unpacker("")
+
+ # handle forced networking
+ if self.network.isHost():
+ self.updateSync()
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+ elif self.network.isPeer():
+ self.sendTempoQuery()
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+
+ #-- Final Set Up --------------------------------------
+ self.setVolume( self.volume )
+ self.setTempo( self.tempo )
+ self.activity.toolbox.set_current_toolbar(1) # JamToolbar
+ self.setDesktop( 0, True )
+
+
+ #==========================================================
+ # SubActivity Handlers
+
+ def onActivate( self, arg ):
+ SubActivity.onActivate( self, arg )
+
+ def onDeactivate( self ):
+ SubActivity.onDeactivate( self )
+
+ def onDestroy( self ):
+ SubActivity.onDestroy( self )
+
+ # clear up scratch folder
+ path = Config.SCRATCH_DIR
+ filelist = os.listdir( path )
+ for file in filelist:
+ os.remove( path+file )
+
+
+ #==========================================================
+ # Playback
+
+ def onKeyPress( self, widget, event ):
+ key = event.hardware_keycode
+
+ if key in self.keyMap.keys():
+ activate = True
+ for block in self.keyMap[key]:
+ if block.isActive():
+ activate = False
+ break
+ if activate:
+ for block in self.keyMap[key]:
+ if not block.isActive():
+ if block.type == Block.Drum: self.desktop.activateDrum( block )
+ elif block.type == Block.Loop: self.desktop.activateLoop( block )
+ else:
+ for block in self.keyMap[key]:
+ if block.isActive():
+ if block.type == Block.Drum: self.desktop.deactivateDrum( block )
+ elif block.type == Block.Loop: self.desktop.deactivateLoop( block )
+ return
+
+ if self.key_dict.has_key( key ): # repeated press
+ return
+
+ if Config.KEY_MAP_PIANO.has_key( key ):
+ pitch = Config.KEY_MAP_PIANO[key]
+ inst = Config.INSTRUMENTSID[self.instrument["id"]]
+
+ if inst.kit: # drum kit
+ if pitch in GenerationConstants.DRUMPITCH:
+ pitch = GenerationConstants.DRUMPITCH[pitch]
+ csnote = self._playNote( key,
+ 36,
+ self.instrument["amplitude"]*0.5, # trackVol*noteVol
+ self.instrument["pan"],
+ 100,
+ inst.kit[pitch].instrumentId,
+ self.instrument["reverb"] )
+ else:
+ if event.state == gtk.gdk.MOD1_MASK:
+ pitch += 5
+
+ if inst.csoundInstrumentId == Config.INST_PERC: #Percussions resonance
+ duration = 60
+ else:
+ duration = -1
+
+ csnote = self._playNote( key,
+ pitch,
+ self.instrument["amplitude"]*0.5, # trackVol*noteVol
+ self.instrument["pan"],
+ duration,
+ self.instrument["id"],
+ self.instrument["reverb"] )
+
+ if self.keyboardListener:
+ self.keyboardListener.recordNote( csnote.pitch )
+ self.recordingNote = True
+
+ def onKeyRelease( self, widget, event ):
+ key = event.hardware_keycode
+
+ if self.key_dict.has_key( key ):
+ self._stopNote( key )
+
+ if self.recordingNote:
+ if self.keyboardListener:
+ self.keyboardListener.finishNote()
+ self.recordingNote = False
+
+ def _playNote( self, key, pitch, amplitude, pan, duration, instrumentId, reverb ):
+ self.key_dict[key] = CSoundNote( 0, # onset
+ pitch,
+ amplitude,
+ pan,
+ duration,
+ self.nextTrack,
+ instrumentId,
+ reverbSend = reverb,
+ tied = True,
+ mode = 'mini' )
+ self.nextTrack += 1
+ if self.nextTrack > 8:
+ self.nextTrack = 1
+ self.csnd.play(self.key_dict[key], 0.3)
+
+ return self.key_dict[key]
+
+ def _stopNote( self, key ):
+ csnote = self.key_dict[key]
+ if Config.INSTRUMENTSID[ csnote.instrumentId ].csoundInstrumentId == Config.INST_TIED:
+ csnote.duration = .5
+ csnote.decay = 0.7
+ csnote.tied = False
+ self.csnd.play(csnote, 0.3)
+ del self.key_dict[key]
+
+ def _updateInstrument( self, id, volume, pan = 0, reverb = 0 ):
+ self.instrument = { "id": id,
+ "amplitude": volume,
+ "pan": pan,
+ "reverb": reverb }
+
+ def pushInstrument( self, instrument ):
+ self.instrumentStack.append( self.instrument )
+ self.instrument = instrument
+
+ def popInstrument( self ):
+ self.instrument = self.instrumentStack.pop()
+
+ def _playDrum( self, id, pageId, volume, reverb, beats, regularity, loopId = None ):
+
+ if loopId == None: # create new loop
+ startTick = 0
+ firstTime = True
+ else: # update loop
+ startTick = self.csnd.loopGetTick( loopId )
+ self.csnd.loopDestroy( loopId )
+ firstTime = False
+
+ loopId = self.csnd.loopCreate()
+
+ # TODO update track volume
+
+ noteOnsets = []
+ notePitchs = []
+ for n in self.noteDB.getNotesByTrack( pageId, 0 ):
+ n.pushState()
+ noteOnsets.append( n.cs.onset )
+ notePitchs.append( n.cs.pitch )
+ n.cs.amplitude = volume * n.cs.amplitude # TODO remove me once track volume is working
+ n.cs.reverbSend = reverb
+ self.csnd.loopPlay( n, 1, loopId = loopId ) #add as active
+ n.popState()
+
+ ticks = self.noteDB.getPage( pageId ).ticks
+
+ self.csnd.loopSetNumTicks( ticks, loopId )
+
+ self.drumFillin.setLoopId( loopId )
+ self.drumFillin.setProperties( self.tempo, Config.INSTRUMENTSID[id].name, volume, beats, reverb )
+ self.drumFillin.unavailable( noteOnsets, notePitchs )
+
+ self.drumFillin.play()
+
+ # sync to heartbeat
+ if False: # firstTime: # always force first note to play rather than snaping to nearest beat.. good idea?
+ startTick = ticks - Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ while startTick > ticks: # align with last beat
+ startTick -= Config.TICKS_PER_BEAT
+ beatTick = int(startTick) % Config.TICKS_PER_BEAT
+ heartTick = self.csnd.loopGetTick( self.heartbeatLoop )
+ if beatTick > heartTick:
+ if beatTick - heartTick < heartTick + Config.TICKS_PER_BEAT - beatTick:
+ startTick = (int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ startTick = (1 + int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ if heartTick - beatTick < beatTick + Config.TICKS_PER_BEAT - heartTick:
+ startTick = (int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ startTick = (-1 + int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+
+ if startTick >= ticks:
+ startTick -= ticks
+ elif startTick < 0:
+ startTick += ticks
+
+ self.csnd.loopSetTick( startTick, loopId )
+
+ if not self.paused:
+ self.csnd.loopStart( loopId )
+
+ return loopId
+
+ def _stopDrum( self, loopId ):
+ self.drumFillin.stop()
+ self.csnd.loopDestroy( loopId )
+
+ def _playLoop( self, id, volume, reverb, tune, loopId = None, force = False ):
+ if loopId == None: # create new loop
+ startTick = 0
+ firstTime = True
+ else: # update loop
+ startTick = self.csnd.loopGetTick( loopId )
+ self.csnd.loopDestroy( loopId )
+ firstTime = False
+
+ loopId = self.csnd.loopCreate()
+
+ # TODO update track volume
+
+ inst = Config.INSTRUMENTSID[id]
+
+ offset = 0
+ for page in tune:
+ for n in self.noteDB.getNotesByTrack( page, 0 ):
+ n.pushState()
+ n.cs.instrumentId = id
+ n.cs.amplitude = volume * n.cs.amplitude # TODO remove me once track volume is working
+ n.cs.reverbSend = reverb
+ if inst.kit: # drum kit
+ if n.cs.pitch in GenerationConstants.DRUMPITCH:
+ n.cs.pitch = GenerationConstants.DRUMPITCH[n.cs.pitch]
+ n.cs.onset += offset
+ self.csnd.loopPlay( n, 1, loopId = loopId )
+ n.popState()
+ offset += self.noteDB.getPage(page).ticks
+
+
+ self.csnd.loopSetNumTicks( offset, loopId )
+
+ # sync to heartbeat
+ if False: # firstTime: # always force first note to play rather than snaping to nearest beat.. good idea?
+ startTick = offset - Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ while startTick > offset: # align with last beat
+ startTick -= Config.TICKS_PER_BEAT
+ beatTick = int(startTick) % Config.TICKS_PER_BEAT
+ heartTick = self.csnd.loopGetTick( self.heartbeatLoop )
+ if beatTick > heartTick:
+ if beatTick - heartTick < heartTick + Config.TICKS_PER_BEAT - beatTick:
+ startTick = (int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ startTick = (1 + int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ if heartTick - beatTick < beatTick + Config.TICKS_PER_BEAT - heartTick:
+ startTick = (int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+ else:
+ startTick = (-1 + int(startTick)//Config.TICKS_PER_BEAT)*Config.TICKS_PER_BEAT + self.csnd.loopGetTick( self.heartbeatLoop )
+
+ if startTick >= offset:
+ startTick -= offset
+ elif startTick < 0:
+ startTick += offset
+
+
+ self.csnd.loopSetTick( startTick, loopId )
+
+ if not self.paused or force:
+ self.csnd.loopStart( loopId )
+
+ return loopId
+
+ def _stopLoop( self, loopId ):
+ self.csnd.loopDestroy( loopId )
+
+ def setPaused( self, paused ):
+ if self.paused == paused:
+ return
+
+ loops = self.desktop.getLoopIds()
+
+ if self.paused: # unpause
+ self.paused = False
+ for loop in loops:
+ self.csnd.loopStart( loop )
+ else: # pause
+ self.paused = True
+ for loop in loops:
+ self.csnd.loopPause( loop )
+
+ #==========================================================
+ # Generate
+
+ def _generateDrumLoop( self, instrumentId, beats, regularity, reverb, pageId = -1 ):
+ def flatten(ll):
+ rval = []
+ for l in ll:
+ rval += l
+ return rval
+
+ notes = flatten( generator( Config.INSTRUMENTSID[instrumentId].name, beats, 0.8, regularity, reverb) )
+
+ if pageId == -1:
+ page = Page( beats )
+ pageId = self.noteDB.addPage( -1, page )
+ else:
+ self.noteDB.deleteNotesByTrack( [ pageId ], [ 0 ] )
+
+ if len(notes):
+ self.noteDB.addNotes( [ pageId, 0, len(notes) ] + notes + [-1] )
+
+ return pageId
+
+ def _generateTrack( self, instrumentId, page, track, parameters, algorithm ):
+ dict = { track: { page: self.noteDB.getCSNotesByTrack( page, track ) } }
+ instruments = { page: [ Config.INSTRUMENTSID[instrumentId].name for i in range(Config.NUMBER_OF_TRACKS) ] }
+ beatsOfPages = { page: self.noteDB.getPage(page).beats }
+
+ algorithm( parameters,
+ [ 0.5 for i in range(Config.NUMBER_OF_TRACKS) ],
+ instruments,
+ self.tempo,
+ beatsOfPages,
+ [ track ],
+ [ page ],
+ dict,
+ 4)
+
+ # filter & fix input ...WTF!?
+ for track in dict:
+ for page in dict[track]:
+ for note in dict[track][page]:
+ intdur = int(note.duration)
+ note.duration = intdur
+ note.pageId = page
+ note.trackId = track
+
+ # prepare the new notes
+ newnotes = []
+ for tid in dict:
+ for pid in dict[tid]:
+ newnotes += dict[tid][pid]
+
+ # delete the notes and add the new
+ self.noteDB.deleteNotesByTrack( [ page ], [ track ] )
+
+ self.noteDB.addNotes(
+ [ page, track, len(dict[track][page]) ]
+ + dict[track][page]
+ + [ -1 ] )
+
+
+ #==========================================================
+ # Get/Set
+
+ def getVolume( self ):
+ return self.volume
+
+ def setVolume( self, volume ):
+ self.jamToolbar.volumeSlider.set_value( volume )
+
+ def _setVolume( self, volume ):
+ self.volume = volume
+ self.csnd.setMasterVolume( self.volume*100 ) # csnd expects a range 0-100 for now
+
+ def getTempo( self ):
+ return self.tempo
+
+ def setTempo( self, tempo ):
+ self.jamToolbar.tempoSlider.set_value( tempo )
+
+ def _setTempo( self, tempo ):
+ if self.network.isHost() or self.network.isOffline():
+ t = time.time()
+ percent = self.heartbeatElapsed() / self.beatDuration
+
+ self.tempo = tempo
+ self.beatDuration = 60.0/self.tempo
+ self.ticksPerSecond = Config.TICKS_PER_BEAT*self.tempo/60.0
+ self.csnd.setTempo( self.tempo )
+
+ if self.network.isHost() or self.network.isOffline():
+ self.heatbeatStart = t - percent*self.beatDuration
+ self.updateSync()
+ self.sendTempoUpdate()
+
+ def getInstrument( self ):
+ return self.instrument
+
+ def getDesktop( self ):
+ return self.desktop
+
+ def _clearDesktop( self, save = True ):
+ if self.curDesktop == None:
+ return
+
+ if save:
+ self._saveDesktop()
+
+ self.desktop._clearDesktop()
+
+ self.curDesktop = None
+
+ def setDesktop( self, desktop, force = False ):
+ radiobtn = self.desktopToolbar.getDesktopButton( desktop )
+ if force and radiobtn.get_active():
+ self._setDesktop( desktop )
+ else:
+ radiobtn.set_active( True )
+
+ def _setDesktop( self, desktop ):
+ self._clearDesktop()
+
+ self.curDesktop = desktop
+
+ TTTable = ControlStream.TamTamTable( self.noteDB, jam = self )
+
+ filename = self.getDesktopScratchFile( self.curDesktop )
+ try:
+ stream = open( filename, "r" )
+ TTTable.parseFile( stream )
+ stream.close()
+ except IOError, (errno, strerror):
+ if Config.DEBUG > 3: print "IOError:: _setDesktop:", errno, strerror
+
+ def getInstrumentImage( self, id, active = False ):
+ if active: return self.instrumentImageActive[id]
+ else: return self.instrumentImage[id]
+
+ def getKeyImage( self, key, active = False ):
+ if active: return self.keyImageActive[key]
+ else: return self.keyImage[key]
+
+ def getLoopImage( self, id, active = False ):
+ if active: return self.loopImageActive[id]
+ else: return self.loopImage[id]
+
+ def setPicker( self, widget, pagePointer, page_num ):
+ page = self.GUI["notebook"].get_nth_page( page_num )
+ if page == self.pickers[Picker.Drum]:
+ pass
+ elif page == self.pickers[Picker.Loop]:
+ pass
+ else:
+ self.pickers[Picker.Instrument].setFilter( ( page.set ) )
+ parent = self.pickers[Picker.Instrument].get_parent()
+ if parent != page:
+ if parent != None:
+ parent.remove( self.pickers[Picker.Instrument] )
+ page.add( self.pickers[Picker.Instrument] )
+
+ def setKeyboardListener( self, listener ):
+ self.keyboardListener = listener
+
+ def mapKey( self, key, block, oldKey = None ):
+ if oldKey != None and block in self.keyMap[oldKey]:
+ self.keyMap[oldKey].remove( block )
+
+ if key == None:
+ return
+
+ if key not in self.keyMap.keys():
+ self.keyMap[key] = []
+
+ if block not in self.keyMap[key]:
+ self.keyMap[key].append( block )
+
+ #==========================================================
+ # Pixmaps
+
+ def prepareInstrumentImage( self, id, img_path ):
+ try:
+ win = gtk.gdk.get_default_root_window()
+ pix = gtk.gdk.pixbuf_new_from_file( img_path )
+ x = (Block.Block.WIDTH-pix.get_width())//2
+ y = (Block.Block.HEIGHT-pix.get_height())//2
+ img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.gc.foreground = self.colors["Bg_Inactive"]
+ img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
+ img.draw_pixbuf( self.gc, pix, 0, 0, x, y, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.instrumentImage[id] = img
+ img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.gc.foreground = self.colors["Bg_Active"]
+ img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
+ img.draw_pixbuf( self.gc, pix, 0, 0, x, y, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.instrumentImageActive[id] = img
+ except:
+ if Config.DEBUG >= 5: print "JamMain:: file does not exist: " + img_path
+ img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.gc.foreground = self.colors["Bg_Inactive"]
+ img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.instrumentImage[id] = img
+ img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.gc.foreground = self.colors["Bg_Active"]
+ img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.instrumentImageActive[id] = img
+
+ def _drawNotes( self, pixmap, beats, notes, active ):
+ self.gc.set_clip_mask( self.sampleNoteMask )
+ for note in notes: # draw N notes
+ x = self.ticksToPixels( note.cs.onset )
+ endX = self.ticksToPixels( note.cs.onset + note.cs.duration ) - 3 # include end cap offset
+ width = endX - x
+ if width < 5:
+ width = 5
+ endX = x + width
+ y = self.pitchToPixels( note.cs.pitch )
+ # draw fill
+ if active: self.gc.foreground = self.colors["Note_Fill_Active"]
+ else: self.gc.foreground = self.colors["Note_Fill_Inactive"]
+ self.gc.set_clip_origin( x, y-self.sampleNoteHeight )
+ pixmap.draw_rectangle( self.gc, True, x+1, y+1, width+1, self.sampleNoteHeight-2 )
+ # draw border
+ if active: self.gc.foreground = self.colors["Note_Border_Active"]
+ else: self.gc.foreground = self.colors["Note_Border_Inactive"]
+ self.gc.set_clip_origin( x, y )
+ pixmap.draw_rectangle( self.gc, True, x, y, width, self.sampleNoteHeight )
+ self.gc.set_clip_origin( endX-self.sampleNoteMask.endOffset, y )
+ pixmap.draw_rectangle( self.gc, True, endX, y, 3, self.sampleNoteHeight )
+
+ def prepareKeyImage( self, key ):
+ win = gtk.gdk.get_default_root_window()
+ pangolayout = self.create_pango_layout( _(self.valid_shortcuts[key]) )
+ fontDesc = pango.FontDescription( "bold" )
+ pangolayout.set_font_description( fontDesc )
+ extents = pangolayout.get_pixel_extents()
+ x = ( Block.Block.KEYSIZE - extents[1][2] ) // 2
+ y = ( Block.Block.KEYSIZE - extents[1][3] ) // 2
+
+ pixmap = gtk.gdk.Pixmap( win, Block.Block.KEYSIZE, Block.Block.KEYSIZE )
+ self.gc.foreground = self.colors["Border_Inactive"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, Block.Block.KEYSIZE, Block.Block.KEYSIZE )
+ self.gc.foreground = self.colors["Bg_Inactive"]
+ pixmap.draw_layout( self.gc, x, y, pangolayout )
+ self.keyImage[key] = pixmap
+
+ pixmap = gtk.gdk.Pixmap( win, Block.Block.KEYSIZE, Block.Block.KEYSIZE )
+ self.gc.foreground = self.colors["Border_Active"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, Block.Block.KEYSIZE, Block.Block.KEYSIZE )
+ self.gc.foreground = self.colors["Bg_Active"]
+ pixmap.draw_layout( self.gc, x, y, pangolayout )
+ self.keyImageActive[key] = pixmap
+
+ def updateLoopImage( self, id ):
+ page = self.noteDB.getPage( id )
+
+ win = gtk.gdk.get_default_root_window()
+ width = Block.Loop.WIDTH[page.beats]
+ height = Block.Loop.HEIGHT
+
+ self.gc.set_clip_rectangle( gtk.gdk.Rectangle( 0, 0, width, height ) )
+
+ pixmap = gtk.gdk.Pixmap( win, width, height )
+ self.gc.foreground = self.colors["Bg_Inactive"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+ self._drawNotes( pixmap, page.beats, self.noteDB.getNotesByTrack( id, 0 ), False )
+ self.loopImage[id] = pixmap
+
+ self.gc.set_clip_rectangle( gtk.gdk.Rectangle( 0, 0, width, height ) )
+
+ pixmap = gtk.gdk.Pixmap( win, width, height )
+ self.gc.foreground = self.colors["Bg_Active"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+ self._drawNotes( pixmap, page.beats, self.noteDB.getNotesByTrack( id, 0 ), True )
+ self.loopImageActive[id] = pixmap
+
+ def ticksToPixels( self, ticks ):
+ return self.loopTickOffset + int(round( ticks * self.pixelsPerTick ))
+ def pitchToPixels( self, pitch ):
+ return self.loopPitchOffset + int(round( ( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch ))
+
+ #==========================================================
+ # Load/Save
+
+ def _saveDesktop( self ):
+ if self.curDesktop == None:
+ return
+
+ filename = self.getDesktopScratchFile( self.curDesktop )
+ if os.path.isfile( filename ):
+ os.remove( filename )
+
+ try:
+ scratch = open( filename, "w" )
+ stream = ControlStream.TamTamOStream(scratch)
+
+ self.noteDB.dumpToStream( stream, True )
+ self.desktop.dumpToStream( stream )
+
+ scratch.close()
+ except IOError, (errno, strerror):
+ if Config.DEBUG > 3: print "IOError:: _saveDesktop:", errno, strerror
+
+ def getDesktopScratchFile( self, i ):
+ return Config.SCRATCH_DIR+"desktop%d" % i
+
+ def handleJournalLoad( self, filepath ):
+
+ self._clearDesktop( False )
+
+ TTTable = ControlStream.TamTamTable( self.noteDB, jam = self )
+
+ try:
+ stream = open( filepath, "r" )
+ TTTable.parseFile( stream )
+ stream.close()
+
+ self.setVolume( TTTable.masterVolume )
+ self.setTempo( TTTable.tempo )
+
+ except IOError, (errno, strerror):
+ if Config.DEBUG > 3: print "IOError:: handleJournalLoad:", errno, strerror
+
+ def handleJournalSave( self, filepath ):
+
+ self._saveDesktop()
+
+ try:
+ streamF = open( filepath, "w" )
+ stream = ControlStream.TamTamOStream( streamF )
+
+ for i in range(10):
+ desktop_file = self.getDesktopScratchFile( i )
+ stream.desktop_store( desktop_file, i )
+
+ stream.desktop_set( self.curDesktop )
+
+ stream.master_vol( self.volume )
+ stream.tempo( self.tempo )
+
+ streamF.close()
+
+ except IOError, (errno, strerror):
+ if Config.DEBUG > 3: print "IOError:: handleJournalSave:", errno, strerror
+
+ #==========================================================
+ # Network
+
+ #-- Activity ----------------------------------------------
+
+ def shared( self, activity ):
+ if Config.DEBUG: print "miniTamTam:: successfully shared, start host mode"
+ self.activity._shared_activity.connect( "buddy-joined", self.buddy_joined )
+ self.activity._shared_activity.connect( "buddy-left", self.buddy_left )
+ self.network.setMode( Net.MD_HOST )
+ self.updateSync()
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+
+ def joined( self, activity ):
+ if Config.DEBUG:
+ print "miniTamTam:: joined activity!!"
+ for buddy in self.activity._shared_activity.get_joined_buddies():
+ print buddy.props.ip4_address
+
+ def buddy_joined( self, activity, buddy ):
+ if Config.DEBUG:
+ print "buddy joined " + str(buddy)
+ try:
+ print buddy.props.ip4_address
+ except:
+ print "bad ip4_address"
+ if self.network.isHost():
+ if buddy == self.xoOwner:
+ return
+ if buddy.props.ip4_address:
+ self.network.introducePeer( buddy.props.ip4_address )
+ else:
+ print "miniTamTam:: new buddy does not have an ip4_address!!"
+
+ def buddy_left( self, activity, buddy):
+ if Config.DEBUG: print "buddy left"
+
+ #def joined( self, activity ):
+ # if Config.DEBUG: print "miniTamTam:: successfully joined, wait for host"
+ # self.net.waitForHost()
+
+ #-- Senders -----------------------------------------------
+
+ def sendSyncQuery( self ):
+ self.packer.pack_float(random.random())
+ hash = self.packer.get_buffer()
+ self.packer.reset()
+ self.syncQueryStart[hash] = time.time()
+ self.network.send( Net.PR_SYNC_QUERY, hash)
+
+ def sendTempoUpdate( self ):
+ self.packer.pack_int(self.tempo)
+ self.network.sendAll( Net.HT_TEMPO_UPDATE, self.packer.get_buffer() )
+ self.packer.reset()
+
+ def sendTempoQuery( self ):
+ self.network.send( Net.PR_TEMPO_QUERY )
+
+ def requestTempoChange( self, val ):
+ self.packer.pack_int(val)
+ self.network.send( Net.PR_REQUEST_TEMPO_CHANGE, self.packer.get_buffer() )
+ self.packer.reset()
+
+ #-- Handlers ----------------------------------------------
+
+ def networkStatusWatcher( self, mode ):
+ if mode == Net.MD_OFFLINE:
+ if self.syncTimeout:
+ gobject.source_remove( self.syncTimeout )
+ self.syncTimeout = None
+ if mode == Net.MD_PEER:
+ self.updateSync()
+ if not self.syncTimeout:
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+ self.sendTempoQuery()
+
+ def processHT_SYNC_REPLY( self, sock, message, data ):
+ t = time.time()
+ hash = data[0:4]
+ latency = t - self.syncQueryStart[hash]
+ self.unpacker.reset(data[4:8])
+ nextBeat = self.unpacker.unpack_float()
+ #print "mini:: got sync: next beat in %f, latency %d" % (nextBeat, latency*1000)
+ self.heartbeatStart = t + nextBeat - self.beatDuration - latency/2
+ self.correctSync()
+ self.syncQueryStart.pop(hash)
+
+ def processHT_TEMPO_UPDATE( self, sock, message, data ):
+ self.unpacker.reset(data)
+ val = self.unpacker.unpack_int()
+ if self.tempoSliderActive:
+ self.delayedTempo = val
+ return
+ self.tempoAdjustment.handler_block( self.tempoAdjustmentHandler )
+ self.tempoAdjustment.set_value( val )
+ self._updateTempo( val )
+ self.tempoAdjustment.handler_unblock( self.tempoAdjustmentHandler )
+ self.sendSyncQuery()
+
+ def processPR_SYNC_QUERY( self, sock, message, data ):
+ self.packer.pack_float(self.nextHeartbeat())
+ self.network.send( Net.HT_SYNC_REPLY, data + self.packer.get_buffer(), sock )
+ self.packer.reset()
+
+ def processPR_TEMPO_QUERY( self, sock, message, data ):
+ self.packer.pack_int(self.tempo)
+ self.network.send( Net.HT_TEMPO_UPDATE, self.packer.get_buffer(), to = sock )
+ self.packer.reset()
+
+ def processPR_REQUEST_TEMPO_CHANGE( self, sock, message, data ):
+ if self.tempoSliderActive:
+ return
+ self.unpacker.reset(data)
+ val = self.unpacker.unpack_int()
+ self.tempoAdjustment.set_value( val )
+
+ #==========================================================
+ # Sync
+
+ def nextHeartbeat( self ):
+ delta = time.time() - self.heartbeatStart
+ return self.beatDuration - (delta % self.beatDuration)
+
+ def nextHeartbeatInTicks( self ):
+ delta = time.time() - self.heartbeatStart
+ next = self.beatDuration - (delta % self.beatDuration)
+ return self.ticksPerSecond*next
+
+ def heartbeatElapsed( self ):
+ delta = time.time() - self.heartbeatStart
+ return delta % self.beatDuration
+
+ def heartbeatElapsedTicks( self ):
+ delta = time.time() - self.heartbeatStart
+ return self.ticksPerSecond*(delta % self.beatDuration)
+
+ def updateSync( self ):
+ if self.network.isOffline():
+ return False
+ elif self.network.isWaiting():
+ return True
+ elif self.network.isHost():
+ self.correctSync()
+ else:
+ self.sendSyncQuery()
+ return True
+
+ def correctSync( self ):
+ curTick = self.csnd.loopGetTick( self.heartbeatLoop )
+ curTicksIn = curTick % Config.TICKS_PER_BEAT
+ ticksIn = self.heartbeatElapsedTicks()
+ err = curTicksIn - ticksIn
+ if err > Config.TICKS_PER_BEAT_DIV2:
+ err -= Config.TICKS_PER_BEAT
+ elif err < -Config.TICKS_PER_BEAT_DIV2:
+ err += Config.TICKS_PER_BEAT
+ correct = curTick - err
+ if correct > Config.TICKS_PER_BEAT:
+ correct -= Config.TICKS_PER_BEAT
+ elif correct < 0:
+ correct += Config.TICKS_PER_BEAT
+ #print "correct:: %f ticks, %f ticks in, %f expected, %f err, correct %f" % (curTick, curTicksIn, ticksIn, err, correct)
+ if abs(err) > 0.25:
+ self.csnd.adjustTick(-err)
+
+
diff --git a/TamTamJam.activity/Jam/Parasite.py b/TamTamJam.activity/Jam/Parasite.py
new file mode 100644
index 0000000..084d092
--- /dev/null
+++ b/TamTamJam.activity/Jam/Parasite.py
@@ -0,0 +1,349 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import Config
+
+from Util.NoteDB import PARAMETER
+from Util.CSoundClient import new_csound_client
+
+class LoopParasite:
+
+ def __init__( self, noteDB, owner, note ):
+ self.noteDB = noteDB
+ self.owner = owner
+ self.note = note
+
+ self.firstTransform = True
+ self.x = 0
+ self.y = 0
+ self.width = 1
+ self.height = Config.NOTE_HEIGHT
+
+ self.selected = False
+ self.potentialDeselect = False
+
+ self.oldOnset = -1
+ self.oldEnd = -1
+ self.oldPitch = -1
+ self.oldAmplitude = -1
+ self.oldBeats = -1
+ self.lastDragO = 0
+ self.lastDragP = 0
+ self.lastDragD = 0
+
+ self.gc = self.owner.gc
+ self.colors = self.owner.colors
+
+ self.updateParameter( None, None )
+
+ def attach( self ):
+ return self
+
+ def destroy( self ):
+ if self.selected:
+ self.owner.deselectNotes( { self.note.track: [self] } )
+ else: # if we were deselected above the rect has already been invalidated
+ self.owner.invalidatePreview( self.x, self.y, self.width, self.height, self.note.page, True )
+
+ def updateParameter( self, parameter, value ):
+ self.end = self.note.cs.onset + self.note.cs.duration
+
+ self.updateTransform()
+
+ def getId( self ):
+ return self.note.id
+
+ def getStartTick( self ):
+ return self.note.cs.onset
+
+ def getEndTick( self ):
+ return self.end
+
+ def testOnset( self, start, stop ):
+ return self.note.cs.onset >= start and self.note.cs.onset < stop
+
+ def getPitch( self ):
+ return self.note.cs.pitch
+
+ def updateTransform( self, force = False ):
+ if self.note.page == self.owner.getPage():
+ if not self.firstTransform:
+ oldX = self.x
+ oldY = self.y
+ oldEndX = self.x + self.width
+ dirty = True
+ else:
+ dirty = False
+
+ beats = self.noteDB.getPage( self.note.page ).beats
+ if force or self.note.cs.onset != self.oldOnset or beats != self.oldBeats:
+ self.x = self.owner.ticksToPixels( beats, self.note.cs.onset )
+ self.oldOnset = self.note.cs.onset
+ if force or self.end != self.oldEnd or self.note.cs.onset != self.oldOnset or beats != self.oldBeats:
+ self.width = self.owner.ticksToPixels( beats, self.end ) - self.x
+ self.oldEnd = self.end
+ if force or self.note.cs.pitch != self.oldPitch:
+ self.y = self.owner.pitchToPixels( self.note.cs.pitch )
+ self.oldPitch = self.note.cs.pitch
+ self.oldBeats = beats
+
+ if dirty:
+ if self.firstTransform:
+ self.owner.invalidatePreview( self.x, self.y, self.width, self.height, self.note.page, True )
+ else:
+ x = min( self.x, oldX )
+ y = min( self.y, oldY )
+ endx = max( self.x + self.width, oldEndX )
+ endy = max( self.y, oldY ) + self.height
+ self.owner.invalidatePreview( x, y, endx-x, endy-y, self.note.page, True )
+
+ self.firstTransform = False
+
+ def updateDragLimits( self, dragLimits, leftBound, rightBound, widthBound, maxRightBound ):
+ left = leftBound - self.note.cs.onset
+ right = rightBound - self.note.cs.duration - self.note.cs.onset
+ up = Config.MAXIMUM_PITCH - self.note.cs.pitch
+ down = Config.MINIMUM_PITCH - self.note.cs.pitch
+ short = Config.MINIMUM_NOTE_DURATION - self.note.cs.duration
+ long = widthBound - self.note.cs.duration - self.note.cs.onset
+
+ if dragLimits[0][0] < left: dragLimits[0][0] = left
+ if dragLimits[0][1] > right: dragLimits[0][1] = right
+ if dragLimits[1][0] < down: dragLimits[1][0] = down
+ if dragLimits[1][1] > up: dragLimits[1][1] = up
+ if dragLimits[2][0] < short: dragLimits[2][0] = short
+ if dragLimits[2][1] > long: dragLimits[2][1] = long
+
+ # store the current loc as a reference point
+ self.baseOnset = self.note.cs.onset
+ self.basePitch = self.note.cs.pitch
+ self.baseDuration = self.note.cs.duration
+
+ def playSampleNote( self, full=True ):
+ secs_per_tick = 0.025
+ csnd = new_csound_client()
+
+ if full:
+ onset = self.note.cs.onset
+ instrumentId = self.note.cs.instrumentId
+ self.note.cs.onset = 0
+ self.note.cs.instrumentId = self.owner.instrument["id"]
+ csnd.play( self.note.cs, 0.024)
+ self.note.cs.onset = onset
+ self.note.cs.instrumentId = instrumentId
+ else:
+ onset = self.note.cs.onset
+ duration = self.note.cs.duration
+ instrumentId = self.note.cs.instrumentId
+ self.note.cs.onset = 0
+ self.note.cs.duration = 10
+ self.note.cs.instrumentId = self.owner.instrument["id"]
+ csnd.play( self.note.cs, 0.024)
+ self.note.cs.onset = onset
+ self.note.cs.duration = duration
+ self.note.cs.instrumentId = instrumentId
+
+ #=======================================================
+ # Events
+
+ # handleButtonPress returns:
+ # -2, not a hit but there was X overlap
+ # -1, event occurs before us so don't bother checking any later notes
+ # 0, event didn't hit
+ # 1, event was handled
+ def handleButtonPress( self, emitter, event ):
+ eX = event.x - self.x
+ if eX < 0:
+ return -1 # event occurs before us, no point in checking further
+ if eX > self.width:
+ return 0 # no X overlap
+
+ eY = event.y - self.y
+ if eY < 0 or eY > self.height:
+ return -2 # not a hit, but it was in our X range
+
+ if event.button == 3:
+ print "Show some note parameters!?!"
+ #self.noteParameters = NoteParametersWindow( self.note, self.getNoteParameters )
+ return 1 # handled
+
+ playSample = False
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: # select bar
+ self.potentialDeselect = False
+ start = 0
+ check = self.note.cs.onset - Config.TICKS_PER_BEAT
+ while start <= check: start += Config.TICKS_PER_BEAT
+ stop = start + Config.TICKS_PER_BEAT
+ check += self.note.cs.duration
+ while stop < check: stop += Config.TICKS_PER_BEAT
+ emitter.selectNotesByBar( self.note.track, start, stop )
+ elif event.type == gtk.gdk._3BUTTON_PRESS: # select track
+ self.potentialDeselect = False
+ emitter.selectNotesByTrack( self.note.track )
+ else:
+ if self.selected: # we already selected, might want to delected
+ self.potentialDeselect = True
+ else:
+ emitter.selectNotes( { self.note.track: [ self ] } )
+ playSample = True
+
+ percent = eX/self.width
+ if percent < 0.3: emitter.setCurrentAction( "note-drag-onset", self )
+ elif percent > 0.7: emitter.setCurrentAction( "note-drag-duration", self )
+ else:
+ emitter.setCurrentAction( "note-drag-pitch", self )
+ if playSample: self.playSampleNote()
+
+ return 1
+
+ def handleButtonRelease( self, emitter, event, buttonPressCount ):
+
+ if self.potentialDeselect:
+ self.potentialDeselect = False
+ emitter.deselectNotes( { self.note.track: [ self ] } )
+
+ emitter.doneCurrentAction()
+
+ return True
+
+ def noteDragOnset( self, do, stream ):
+ self.potentialDeselect = False
+ if do != self.lastDragO:
+ self.lastDragO = do
+ stream += [ self.note.id, self.baseOnset + do ]
+
+ def noteDragPitch( self, dp, stream ):
+ self.potentialDeselect = False
+ if dp != self.lastDragP:
+ self.lastDragP = dp
+ stream += [ self.note.id, self.basePitch + dp ]
+
+ def noteDragDuration( self, dd, stream ):
+ self.potentialDeselect = False
+ if dd != self.lastDragD:
+ self.lastDragD = dd
+ stream += [ self.note.id, self.baseDuration + dd ]
+
+ def doneNoteDrag( self, emitter ):
+ self.baseOnset = self.note.cs.onset
+ self.basePitch = self.note.cs.pitch
+ self.baseDuration = self.note.cs.duration
+
+ self.lastDragO = 0
+ self.lastDragP = 0
+ self.lastDragD = 0
+
+ def noteDecOnset( self, step, leftBound, stream ):
+ if self.selected:
+ if leftBound < self.note.cs.onset:
+ onset = max( self.note.cs.onset+step, leftBound )
+ stream += [ self.note.id, onset ]
+ return onset + self.note.cs.duration
+ return self.end
+
+ def noteIncOnset( self, step, rightBound, stream ):
+ if self.selected:
+ if rightBound > self.end:
+ onset = min( self.end+step, rightBound ) - self.note.cs.duration
+ stream += [ self.note.id, onset ]
+ return onset
+ return self.note.cs.onset
+
+ def noteDecPitch( self, step, stream ):
+ if self.note.cs.pitch > Config.MINIMUM_PITCH:
+ stream += [ self.note.id, max( self.note.cs.pitch+step, Config.MINIMUM_PITCH ) ]
+
+ def noteIncPitch( self, step, stream ):
+ if self.note.cs.pitch < Config.MAXIMUM_PITCH:
+ stream += [ self.note.id, min( self.note.cs.pitch+step, Config.MAXIMUM_PITCH ) ]
+
+ def noteDecDuration( self, step, stream ):
+ if self.note.cs.duration > Config.MINIMUM_NOTE_DURATION:
+ stream += [ self.note.id, max( self.note.cs.duration+step, Config.MINIMUM_NOTE_DURATION ) ]
+
+ def noteIncDuration( self, step, rightBound, stream ):
+ if self.selected:
+ if self.end < rightBound:
+ stream += [ self.note.id, min( self.end+step, rightBound ) - self.note.cs.onset ]
+
+ def noteDecVolume( self, step, stream ):
+ if self.note.cs.amplitude > 0:
+ stream += [ self.note.id, max( self.note.cs.amplitude+step, 0 ) ]
+
+ def noteIncVolume( self, step, stream ):
+ if self.note.cs.amplitude < 1:
+ stream += [ self.note.id, min( self.note.cs.amplitude+step, 1 ) ]
+
+ def handleMarqueeSelect( self, emitter, start, stop ):
+ intersectionY = [ max(start[1],self.y), min(stop[1],self.y+self.height) ]
+ if intersectionY[0] > intersectionY[1]:
+ return False
+
+ intersectionX = [ max(start[0],self.x), min(stop[0],self.x+self.width) ]
+ if intersectionX[0] > intersectionX[1]:
+ return False
+
+ return True
+
+ # updateTooltip returns:
+ # -2, not a hit but there was X overlap
+ # -1, event occurs before us so don't bother checking any later notes
+ # 0, event didn't hit
+ # 1, event was handled
+ def updateTooltip( self, emitter, event ):
+ eX = event.x - self.x
+ if eX < 0:
+ return -1 # event occurs before us, no point in checking further
+ if eX > self.width:
+ return 0 # no X overlap
+
+ eY = event.y - self.y
+ if eY < 0 or eY > self.height:
+ return -2 # not a hit, but it was in our X range
+
+ percent = eX/self.width
+ if percent < 0.3: emitter.setCursor("drag-onset")
+ elif percent > 0.7: emitter.setCursor("drag-duration")
+ else: emitter.setCursor("drag-pitch")
+
+ return 1 # we handled it
+
+ #=======================================================
+ # Selection
+
+ def setSelected( self, state ):
+ if self.selected != state:
+ self.selected = state
+ self.owner.invalidatePreview( self.x, self.y, self.width, self.height, self.note.page )
+ return True # state changed
+ return False # state is the same
+
+ def getSelected( self ):
+ return self.selected
+
+ #=======================================================
+ # Draw
+
+ def draw( self, win, gc, startX, stopX ):
+ if stopX < self.x: return False # we don't need to draw and no one after us will draw
+ if startX > self.x + self.width: return True # we don't need to draw, but maybe a later note does
+
+ # draw fill
+ self.gc.foreground = self.colors["Preview_Note_Fill"]
+ self.gc.set_clip_origin( self.x, self.y-self.owner.sampleNoteHeight )
+ self.owner.previewBuffer.draw_rectangle( self.gc, True, self.x+1, self.y+1, self.width-2, self.owner.sampleNoteHeight-2 )
+ # draw border
+ if self.selected:
+ self.gc.foreground = self.colors["Preview_Note_Selected"]
+ else:
+ self.gc.foreground = self.colors["Preview_Note_Border"]
+ self.gc.set_clip_origin( self.x, self.y )
+ endX = self.x + self.width - 3
+ self.owner.previewBuffer.draw_rectangle( self.gc, True, self.x, self.y, self.width-3, self.owner.sampleNoteHeight )
+ self.gc.set_clip_origin( endX-self.owner.sampleNoteMask.endOffset, self.y )
+ self.owner.previewBuffer.draw_rectangle( self.gc, True, endX, self.y, 3, self.owner.sampleNoteHeight )
+
+ return True # we drew something
+
diff --git a/TamTamJam.activity/Jam/Picker.py b/TamTamJam.activity/Jam/Picker.py
new file mode 100644
index 0000000..b69a73f
--- /dev/null
+++ b/TamTamJam.activity/Jam/Picker.py
@@ -0,0 +1,422 @@
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import os
+
+import random #TEMP
+import sets
+
+import Config
+from gettext import gettext as _
+
+from sugar.graphics.palette import Palette, WidgetInvoker
+
+from Util import ControlStream
+from Util import InstrumentDB
+
+from Jam import Block
+
+class Picker( gtk.HBox ):
+
+ def __init__( self, owner, filter = None ):
+ gtk.HBox.__init__( self )
+
+ self.owner = owner
+
+ # take drawing setup from owner
+ self.gc = owner.gc
+ self.colors = owner.colors
+ self.blockMask = owner.blockMask
+
+ self.filter = filter
+
+ self.desktop = owner.getDesktop()
+
+ self.scrollLeft = gtk.Button( "<" )
+ self.scrollLeft.connect( "clicked", self.doScroll, "left" )
+ self.pack_start( self.scrollLeft, False, False )
+
+ self.scrolledWindow = gtk.ScrolledWindow()
+ self.scrolledWindow.set_policy( gtk.POLICY_ALWAYS, gtk.POLICY_NEVER )
+ self.pack_start( self.scrolledWindow )
+ self.hadjustment = self.scrolledWindow.get_hadjustment()
+ self.hadjustment.connect( "changed", self.scrollChanged )
+ self.hadjustment.connect( "value-changed", self.scrollChanged )
+
+ self.scrollRight = gtk.Button( ">" )
+ self.scrollRight.connect( "clicked", self.doScroll, "right" )
+ self.pack_start( self.scrollRight, False, False )
+
+ self.pickerBox = gtk.HBox()
+ self.scrolledWindow.add_with_viewport( self.pickerBox )
+ self.pickerBox.get_parent().modify_bg( gtk.STATE_NORMAL, self.colors["Picker_Bg"] )
+
+ # spacers
+ self.pickerBox.pack_start( gtk.Label(" "), True, True )
+ self.pickerBox.pack_end( gtk.Label(" "), True, True )
+
+ self.show_all()
+
+ self.scroll = {}
+ self.scroll[filter] = 0
+
+ self.blocks = []
+
+ def addBlock( self, data, name, block = None ):
+ if block == None:
+ block = gtk.Button( name )
+
+ # tooltip
+ block._palette = Palette( name )
+ block._palette.props.invoker = WidgetInvoker(block)
+ block._palette.props.invoker._position_hint = WidgetInvoker.AT_CURSOR
+
+ block.add_events( gtk.gdk.BUTTON_PRESS_MASK
+ | gtk.gdk.BUTTON_RELEASE_MASK
+ | gtk.gdk.ENTER_NOTIFY_MASK
+ | gtk.gdk.LEAVE_NOTIFY_MASK
+ | gtk.gdk.POINTER_MOTION_MASK
+ | gtk.gdk.POINTER_MOTION_HINT_MASK )
+ block.connect( "button-press-event", self.on_button_press )
+ block.connect( "button-release-event", self.on_button_release )
+ block.connect( "motion-notify-event", self.on_motion_notify )
+ block.data = data
+
+ self.blocks.append( block )
+
+ if self._testAgainstFilter( block ):
+ self.pickerBox.pack_start( block, False, False, 3 )
+
+ block.show_all()
+
+ return block
+
+ def getFilter( self ):
+ return filter
+
+ def setFilter( self, filter ):
+ if filter == self.filter:
+ return
+
+ self.scroll[self.filter] = self.hadjustment.get_value()
+
+ self.filter = filter
+
+ for block in self.pickerBox.get_children()[1:-1]: # outside children are spacers
+ self.pickerBox.remove( block )
+
+ for block in self.blocks:
+ if self._testAgainstFilter( block ):
+ self.pickerBox.pack_start( block, False, False, 3 )
+
+ if self.scroll.has_key( filter ):
+ self.hadjustment.set_value( self.scroll[filter] )
+ else:
+ self.hadjustment.set_value( 0 )
+ self.scroll[filter] = 0
+
+ def _testAgainstFilter( self, block ):
+ return True
+
+ def doScroll( self, widget, data ):
+ if data == "left":
+ val = max( self.hadjustment.get_property("lower"), self.hadjustment.get_value() - self.hadjustment.get_property("page_increment") )
+ else:
+ val = min( self.hadjustment.get_property("upper") - self.hadjustment.get_property("page_size"), self.hadjustment.get_value() + self.hadjustment.get_property("page_increment") )
+
+ self.hadjustment.set_value( val )
+
+ def scrollChanged( self, widget ):
+ val = self.hadjustment.get_value()
+ if val == 0:
+ self.scrollLeft.set_sensitive( False )
+ else:
+ self.scrollLeft.set_sensitive( True )
+
+ if val >= self.hadjustment.get_property( "upper" ) - self.hadjustment.get_property("page_size"):
+ self.scrollRight.set_sensitive( False )
+ else:
+ self.scrollRight.set_sensitive( True )
+
+ def on_button_press( self, widget, event ):
+ pass
+
+ def on_button_release( self, widget, event ):
+ self.desktop.on_button_release( widget, event )
+
+ def on_motion_notify( self, widget, event ):
+ self.desktop.on_motion_notify( widget, event )
+
+
+class Instrument( Picker ):
+
+ def __init__( self, owner, filter = ( "All" ) ):
+ Picker.__init__( self, owner, filter )
+
+ self.type = Instrument
+
+ self.instrumentDB = InstrumentDB.getRef()
+
+ for inst in self.instrumentDB.getSet( "All" ):
+ self.addBlock( inst.id )
+
+ def addBlock( self, id ):
+ # match data structure of Block.Instrument
+ data = { "name": _(Config.INSTRUMENTSID[id].name),
+ "id": id }
+
+ win = gtk.gdk.get_default_root_window()
+ width = Block.Instrument.WIDTH
+ height = Block.Instrument.HEIGHT
+ pixmap = gtk.gdk.Pixmap( win, width, height )
+
+ self.gc.set_clip_rectangle( gtk.gdk.Rectangle( 0, 0, width, height ) )
+
+ # draw bg
+ self.gc.foreground = self.colors["Picker_Bg"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+
+ self.gc.set_clip_mask( self.blockMask )
+
+ # draw border
+ self.gc.foreground = self.colors["Border_Inactive"]
+ self.gc.set_clip_origin( -Block.Instrument.MASK_START, 0 )
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+
+ # draw block
+ inst = self.owner.getInstrumentImage( data["id"] )
+ self.gc.set_clip_origin( -Block.Instrument.MASK_START, -height )
+ pixmap.draw_drawable( self.gc, inst, 0, 0, 0, 0, width, height )
+
+ image = gtk.Image()
+ image.set_from_pixmap( pixmap, None )
+
+ block = gtk.EventBox()
+ block.modify_bg( gtk.STATE_NORMAL, self.colors["Picker_Bg"] )
+ block.add( image )
+
+ Picker.addBlock( self, data, data["name"], block )
+
+ def _testAgainstFilter( self, block ):
+ if "All" in self.filter:
+ return True
+
+ for label in self.instrumentDB.getInstrument( block.data["id"] ).labels:
+ if label in self.filter:
+ return True
+
+ return False
+
+ def on_button_press( self, widget, event ):
+ walloc = widget.get_allocation()
+ salloc = self.scrolledWindow.get_allocation()
+ loc = ( walloc.x + salloc.x + event.x - self.hadjustment.get_value(), -1 )
+
+ block = self.desktop.addBlock( Block.Instrument, widget.data, loc, True )
+ self.desktop.activateInstrument( block )
+
+
+class Drum( Picker ):
+
+ def __init__( self, owner, filter = None ):
+ Picker.__init__( self, owner, filter )
+
+ self.type = Drum
+
+ self.instrumentDB = InstrumentDB.getRef()
+
+ for inst in self.instrumentDB.getSet( "kit" ):
+ self.addBlock( inst.id )
+
+ def addBlock( self, id ):
+ # match data structure of Block.Drum
+ data = { "name": _(Config.INSTRUMENTSID[id].name),
+ "id": id }
+
+ win = gtk.gdk.get_default_root_window()
+ width = Block.Drum.WIDTH
+ height = Block.Drum.HEIGHT
+ pixmap = gtk.gdk.Pixmap( win, width, height )
+
+ self.gc.set_clip_rectangle( gtk.gdk.Rectangle( 0, 0, width, height ) )
+
+ # draw bg
+ self.gc.foreground = self.colors["Picker_Bg"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+
+ self.gc.set_clip_mask( self.blockMask )
+
+ # draw border
+ self.gc.foreground = self.colors["Border_Inactive"]
+ self.gc.set_clip_origin( -Block.Drum.MASK_START, 0 )
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+
+ # draw block
+ inst = self.owner.getInstrumentImage( data["id"] )
+ self.gc.set_clip_origin( -Block.Drum.MASK_START, -height )
+ pixmap.draw_drawable( self.gc, inst, 0, 0, 0, 0, width, height )
+
+ image = gtk.Image()
+ image.set_from_pixmap( pixmap, None )
+
+ block = gtk.EventBox()
+ block.modify_bg( gtk.STATE_NORMAL, self.colors["Picker_Bg"] )
+ block.add( image )
+
+ Picker.addBlock( self, data, data["name"], block )
+
+ def on_button_press( self, widget, event ):
+ walloc = widget.get_allocation()
+ salloc = self.scrolledWindow.get_allocation()
+ loc = ( walloc.x + salloc.x + event.x - self.hadjustment.get_value(), -1 )
+ self.desktop.addBlock( Block.Drum, widget.data, loc, True )
+
+
+class Loop( Picker ):
+
+ def __init__( self, owner, filter = None ):
+ Picker.__init__( self, owner, filter )
+
+ self.type = Loop
+
+ self.presetLoops = self._scanDirectory( Config.FILES_DIR+"/Loops" )
+
+ def _loadFile( self, fullpath, filename ):
+ if filename[-4:] != ".ttl":
+ if Config.DEBUG >= 3: print "WARNING: incorrect extension on loop file: " + filename
+ return -1
+ try:
+ oldPages = sets.Set( self.owner.noteDB.getTune() )
+
+ ifile = open( fullpath, 'r' )
+ ttt = ControlStream.TamTamTable ( self.owner.noteDB )
+ ttt.parseFile( ifile )
+ ifile.close()
+
+ curPages = sets.Set( self.owner.noteDB.getTune() )
+ newPages = curPages.difference( oldPages )
+
+ if len(newPages) != 1:
+ print "ERROR: bad loop file, contains more than one page (or none)"
+ return -1
+
+ id = newPages.pop() # new pageId
+
+ self.owner.noteDB.getPage( id ).setLocal( False ) # flag as a global page
+
+ self.addBlock( id, filename[:-4] )
+
+ return id
+
+ except OSError,e:
+ print 'ERROR: failed to open file %s for reading\n' % ofilename
+ return -1
+
+ def _scanDirectory( self, path ):
+ dirlist = os.listdir( path )
+ ids = []
+ for fpath in dirlist:
+ id = self._loadFile( path+"/"+fpath, fpath )
+ if id != -1: ids.append(id)
+ return ids
+
+ def addBlock( self, id, name ):
+ # match data structure of Block.Loop
+ data = { "name": _(name),
+ "id": id }
+
+ self.owner.updateLoopImage( data["id"] )
+ loop = self.owner.getLoopImage( data["id"] )
+
+ page = self.owner.noteDB.getPage( id )
+
+ win = gtk.gdk.get_default_root_window()
+ width = Block.Loop.WIDTH[page.beats]
+ height = Block.Loop.HEIGHT
+ pixmap = gtk.gdk.Pixmap( win, width, height )
+
+ self.gc.set_clip_rectangle( gtk.gdk.Rectangle( 0, 0, width, height ) )
+
+ # draw bg
+ self.gc.foreground = self.colors["Picker_Bg"]
+ pixmap.draw_rectangle( self.gc, True, 0, 0, width, height )
+
+ self.gc.set_clip_mask( self.blockMask )
+ self.gc.foreground = self.owner.colors["Border_Inactive"]
+
+ #-- draw head -----------------------------------------
+
+ # draw border
+ self.gc.set_clip_origin( -Block.Loop.MASK_START, 0 )
+ pixmap.draw_rectangle( self.gc, True, 0, 0, Block.Loop.HEAD, height )
+
+ # draw block
+ self.gc.set_clip_origin( -Block.Loop.MASK_START, -height )
+ pixmap.draw_drawable( self.gc, loop, 0, 0, 0, 0, Block.Loop.HEAD, height )
+
+ #-- draw beats ----------------------------------------
+
+ beats = page.beats - 1 # last beat is drawn with the tail
+ curx = Block.Loop.HEAD
+ while beats > 3:
+ # draw border
+ self.gc.set_clip_origin( curx-Block.Loop.MASK_BEAT, 0 )
+ pixmap.draw_rectangle( self.gc, True, curx, 0, Block.Loop.BEAT_MUL3, height )
+
+ # draw block
+ self.gc.set_clip_origin( curx-Block.Loop.MASK_BEAT, -height )
+ pixmap.draw_drawable( self.gc, loop, curx, 0, curx, 0, Block.Loop.BEAT_MUL3, height )
+
+ curx += Block.Loop.BEAT_MUL3
+ beats -= 3
+
+ if beats:
+ w = Block.Loop.BEAT*beats
+
+ # draw border
+ self.gc.set_clip_origin( curx-Block.Loop.MASK_BEAT, 0 )
+ pixmap.draw_rectangle( self.gc, True, curx, 0, w, height )
+
+ # draw block
+ self.gc.set_clip_origin( curx-Block.Loop.MASK_BEAT, -height )
+ pixmap.draw_drawable( self.gc, loop, curx, 0, curx, 0, w, height )
+
+ curx += w
+
+ #-- draw tail -----------------------------------------
+
+ # draw border
+ self.gc.set_clip_origin( curx-Block.Loop.MASK_TAIL, 0 )
+ pixmap.draw_rectangle( self.gc, True, curx, 0, Block.Loop.TAIL, height )
+
+ # draw block
+ self.gc.set_clip_origin( curx-Block.Loop.MASK_TAIL, -height )
+ pixmap.draw_drawable( self.gc, loop, curx, 0, curx, 0, Block.Loop.TAIL, height )
+
+ image = gtk.Image()
+ image.set_from_pixmap( pixmap, None )
+
+ block = gtk.EventBox()
+ block.modify_bg( gtk.STATE_NORMAL, self.colors["Picker_Bg"] )
+ block.add( image )
+
+ Picker.addBlock( self, data, data["name"], block )
+
+ def on_button_press( self, widget, event ):
+ walloc = widget.get_allocation()
+ salloc = self.scrolledWindow.get_allocation()
+ loc = ( walloc.x + salloc.x + event.x - self.hadjustment.get_value(), -1 )
+
+ data = {}
+ for key in widget.data.keys():
+ data[key] = widget.data[key]
+
+ newid = self.owner.noteDB.duplicatePages( [ data["id"] ] )[data["id"]]
+ self.owner.updateLoopImage( newid )
+ data["id"] = newid
+
+ block = self.desktop.addBlock( Block.Loop, data, loc, True )
+
+
diff --git a/TamTamJam.activity/Jam/Popup.py b/TamTamJam.activity/Jam/Popup.py
new file mode 100644
index 0000000..3d21e7f
--- /dev/null
+++ b/TamTamJam.activity/Jam/Popup.py
@@ -0,0 +1,1397 @@
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import Config
+
+from gettext import gettext as _
+from sugar.graphics import style
+from sugar.graphics.palette import Palette, Invoker, _palette_observer
+import gobject
+
+import Jam.Block as Block
+from Util.NoteDB import PARAMETER
+from Util.CSoundNote import CSoundNote
+from Util.CSoundClient import new_csound_client
+from Jam.Parasite import LoopParasite
+
+from Generation.Generator import generator1, GenerationParameters
+
+class SELECTNOTES:
+ ALL = -1
+ NONE = 0
+ ADD = 1
+ REMOVE = 2
+ FLIP = 3
+ EXCLUSIVE = 4
+
+class NoneInvoker( Invoker ):
+
+ def __init__( self ):
+ Invoker.__init__( self )
+ self._position_hint = Invoker.AT_CURSOR
+
+ def get_rect( self ):
+ return gtk.gdk.Rectangle( 0, 0, 0, 0 )
+
+ def get_toplevel( self ):
+ return None
+
+class Popup( Palette ):
+
+ def __init__( self, label, owner ):
+ Palette.__init__( self, label )
+
+ self.owner = owner
+
+ self.block = None
+
+ self.props.invoker = NoneInvoker()
+ self.set_group_id( "TamTamPopup" )
+
+ self._set_state( Palette.SECONDARY ) # skip to fully exposed
+
+ self.connect( "key-press-event", self.on_key_press )
+ self.connect( "key-release-event", self.on_key_release )
+
+ self.connect( "focus_out_event", self.closePopup )
+
+ def destroy( self ):
+ pass
+
+ def _leave_notify_event_cb( self, widget, event ):
+ return # don't popdown()
+
+ def _show( self ):
+ Palette._show( self )
+
+ if self._palette_popup_sid != None:
+ _palette_observer.disconnect( self._palette_popup_sid ) # don't hide when other palettes pop
+ self._palette_popup_sid = None
+
+ def popup( self, immediate = False ):
+ self.owner.activity.handler_block(self.owner.activity.focusOutHandler)
+ self.owner.activity.handler_block(self.owner.activity.focusInHandler)
+
+ Palette.popup( self, immediate )
+
+ def popdown( self, immediate = False ):
+ self.block = None
+
+ Palette.popdown( self, immediate )
+
+ self.owner.activity.handler_unblock(self.owner.activity.focusOutHandler)
+ self.owner.activity.handler_unblock(self.owner.activity.focusInHandler)
+
+ def updatePosition( self ):
+ self.props.invoker._cursor_x = -1
+ self.props.invoker._cursor_y = -1
+ self._update_position()
+
+ def closePopup( self, widget, event ):
+ self.popdown( True )
+
+ def on_key_press( self, widget, event ):
+ self.owner.onKeyPress( widget, event )
+
+ def on_key_release( self, widget, event ):
+ self.owner.onKeyRelease( widget, event )
+
+ def setBlock( self, block ):
+ if self.is_up():
+ self.updatePosition()
+ else:
+ self.popup( True )
+
+
+class Instrument( Popup ):
+
+ def __init__( self, label, owner ):
+ Popup.__init__( self, label, owner )
+
+ self.settingBlock = False
+
+ self.GUI = {}
+
+ self.GUI["mainBox"] = gtk.VBox()
+ self.set_content( self.GUI["mainBox"] )
+
+ #-- Volume --------------------------------------------
+ self.GUI["volumeBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["volumeBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["volumeLabel"] = gtk.Label( _("Volume:") )
+ self.GUI["volumeLabel"].set_size_request( 100, -1 )
+ self.GUI["volumeLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["volumeBox"].pack_start( self.GUI["volumeLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["volumeAdjustment"] = gtk.Adjustment( 0.5, 0.0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["volumeAdjustment"].connect( 'value-changed', self.handleVolume )
+ self.GUI["volumeSlider"] = gtk.HScale( adjustment = self.GUI["volumeAdjustment"] )
+ self.GUI["volumeSlider"].set_size_request( 250, -1 )
+ self.GUI["volumeSlider"].set_draw_value( False )
+ self.GUI["volumeBox"].pack_start( self.GUI["volumeSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["volumeImage"] = gtk.Image()
+ self.GUI["volumeBox"].pack_start( self.GUI["volumeImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Pan -----------------------------------------------
+ self.GUI["panBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["panBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["panLabel"] = gtk.Label( _("Pan:") )
+ self.GUI["panLabel"].set_size_request( 100, -1 )
+ self.GUI["panLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["panBox"].pack_start( self.GUI["panLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["panAdjustment"] = gtk.Adjustment( 0.5, 0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["panAdjustment"].connect( 'value-changed', self.handlePan )
+ self.GUI["panSlider"] = gtk.HScale( adjustment = self.GUI["panAdjustment"] )
+ self.GUI["panSlider"].set_size_request( 250, -1 )
+ self.GUI["panSlider"].set_draw_value( False )
+ self.GUI["panBox"].pack_start( self.GUI["panSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["panImage"] = gtk.Image()
+ self.GUI["panBox"].pack_start( self.GUI["panImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Reverb --------------------------------------------
+ self.GUI["reverbBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["reverbBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["reverbLabel"] = gtk.Label( _("Reverb:") )
+ self.GUI["reverbLabel"].set_size_request( 100, -1 )
+ self.GUI["reverbLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["reverbBox"].pack_start( self.GUI["reverbLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["reverbAdjustment"] = gtk.Adjustment( 0.5, 0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["reverbAdjustment"].connect( 'value-changed', self.handleReverb )
+ self.GUI["reverbSlider"] = gtk.HScale( adjustment = self.GUI["reverbAdjustment"] )
+ self.GUI["reverbSlider"].set_size_request( 250, -1 )
+ self.GUI["reverbSlider"].set_draw_value( False )
+ self.GUI["reverbBox"].pack_start( self.GUI["reverbSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["reverbImage"] = gtk.Image()
+ self.GUI["reverbBox"].pack_start( self.GUI["reverbImage"], False, padding = style.DEFAULT_PADDING )
+
+ if False: # TEMP quote out
+ self.GUI["separator"] = gtk.HSeparator()
+ self.GUI["mainBox"].pack_start( self.GUI["separator"], padding = style.DEFAULT_PADDING )
+
+ #-- Export --------------------------------------------
+ self.GUI["exportBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["exportBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["exportEntry"] = gtk.Entry()
+ self.GUI["exportEntry"].modify_fg( gtk.STATE_NORMAL, self.owner.colors["black"] )
+ self.GUI["exportEntry"].modify_fg( gtk.STATE_ACTIVE, self.owner.colors["black"] )
+ self.GUI["exportBox"].pack_start( self.GUI["exportEntry"], padding = style.DEFAULT_PADDING )
+ self.GUI["exportButton"] = gtk.Button( "Export" )
+ self.GUI["exportBox"].pack_start( self.GUI["exportButton"], False, padding = style.DEFAULT_PADDING )
+
+ self.GUI["mainBox"].show_all()
+
+ def setBlock( self, block ):
+ self.settingBlock = True
+
+ self.block = block
+ self.GUI["volumeAdjustment"].set_value( block.getData( "volume" ) )
+ self.GUI["panAdjustment"].set_value( block.getData( "pan" ) )
+ self.GUI["reverbAdjustment"].set_value( block.getData( "reverb" ) )
+ #self.GUI["exportEntry"].set_text( block.getData( "name" ) )
+
+ self.settingBlock = False
+
+ Popup.setBlock( self, block )
+
+ def handleVolume( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "volume", widget.get_value() )
+
+ def handlePan( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "pan", widget.get_value() )
+
+ def handleReverb( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "reverb", widget.get_value() )
+
+
+class Drum( Popup ):
+
+ def __init__( self, label, owner ):
+ Popup.__init__( self, label, owner )
+
+ self.settingBlock = False
+
+ self.GUI = {}
+
+ self.GUI["mainBox"] = gtk.VBox()
+ self.set_content( self.GUI["mainBox"] )
+
+ #-- Volume --------------------------------------------
+ self.GUI["volumeBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["volumeBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["volumeLabel"] = gtk.Label( _("Volume:") )
+ self.GUI["volumeLabel"].set_size_request( 130, -1 )
+ self.GUI["volumeLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["volumeBox"].pack_start( self.GUI["volumeLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["volumeAdjustment"] = gtk.Adjustment( 0.5, 0.0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["volumeAdjustment"].connect( 'value-changed', self.handleVolume )
+ self.GUI["volumeSlider"] = gtk.HScale( adjustment = self.GUI["volumeAdjustment"] )
+ self.GUI["volumeSlider"].set_size_request( 250, -1 )
+ self.GUI["volumeSlider"].set_draw_value( False )
+ self.GUI["volumeBox"].pack_start( self.GUI["volumeSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["volumeImage"] = gtk.Image()
+ self.GUI["volumeBox"].pack_start( self.GUI["volumeImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Reverb --------------------------------------------
+ self.GUI["reverbBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["reverbBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["reverbLabel"] = gtk.Label( _("Reverb:") )
+ self.GUI["reverbLabel"].set_size_request( 130, -1 )
+ self.GUI["reverbLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["reverbBox"].pack_start( self.GUI["reverbLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["reverbAdjustment"] = gtk.Adjustment( 0.5, 0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["reverbAdjustment"].connect( 'value-changed', self.handleReverb )
+ self.GUI["reverbSlider"] = gtk.HScale( adjustment = self.GUI["reverbAdjustment"] )
+ self.GUI["reverbSlider"].set_size_request( 250, -1 )
+ self.GUI["reverbSlider"].set_draw_value( False )
+ self.GUI["reverbBox"].pack_start( self.GUI["reverbSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["reverbImage"] = gtk.Image()
+ self.GUI["reverbBox"].pack_start( self.GUI["reverbImage"], False, padding = style.DEFAULT_PADDING )
+
+ self.GUI["generationSeparator"] = gtk.HSeparator()
+ self.GUI["mainBox"].pack_start( self.GUI["generationSeparator"], padding = style.DEFAULT_PADDING )
+
+ #-- Beats ---------------------------------------------
+ self.GUI["beatsBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["beatsBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["beatsLabel"] = gtk.Label( _("Beats:") )
+ self.GUI["beatsLabel"].set_size_request( 130, -1 )
+ self.GUI["beatsLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["beatsBox"].pack_start( self.GUI["beatsLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["beatsAdjustment"] = gtk.Adjustment( 4, 2, Config.MAXIMUM_BEATS, 1, 1, 0 )
+ self.GUI["beatsAdjustment"].connect( 'value-changed', self.handleBeats )
+ self.GUI["beatsSlider"] = gtk.HScale( adjustment = self.GUI["beatsAdjustment"] )
+ self.GUI["beatsSlider"].set_size_request( 250, -1 )
+ self.GUI["beatsSlider"].set_draw_value( False )
+ self.GUI["beatsBox"].pack_start( self.GUI["beatsSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["beatsImage"] = gtk.Image()
+ self.GUI["beatsBox"].pack_start( self.GUI["beatsImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Regularity ----------------------------------------
+ self.GUI["regularityBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["regularityBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["regularityLabel"] = gtk.Label( _("Regularity:") )
+ self.GUI["regularityLabel"].set_size_request( 130, -1 )
+ self.GUI["regularityLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["regularityBox"].pack_start( self.GUI["regularityLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["regularityAdjustment"] = gtk.Adjustment( 0.5, 0.0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["regularityAdjustment"].connect( 'value-changed', self.handleRegularity )
+ self.GUI["regularitySlider"] = gtk.HScale( adjustment = self.GUI["regularityAdjustment"] )
+ self.GUI["regularitySlider"].set_size_request( 250, -1 )
+ self.GUI["regularitySlider"].set_draw_value( False )
+ self.GUI["regularityBox"].pack_start( self.GUI["regularitySlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["regularityImage"] = gtk.Image()
+ self.GUI["regularityBox"].pack_start( self.GUI["regularityImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Generate ------------------------------------------
+ self.GUI["generateBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["generateBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["regenerateButton"] = gtk.Button( "Regenerate" )
+ self.GUI["regenerateButton"].connect( "clicked", self.handleRegenerate )
+ self.GUI["generateBox"].pack_start( self.GUI["regenerateButton"], True, False, padding = style.DEFAULT_PADDING )
+ self.GUI["clearButton"] = gtk.Button( "Clear" )
+ self.GUI["clearButton"].connect( "clicked", self.handleClear )
+ self.GUI["generateBox"].pack_start( self.GUI["clearButton"], True, False, padding = style.DEFAULT_PADDING )
+
+ self.GUI["mainBox"].show_all()
+
+ def setBlock( self, block ):
+ self.settingBlock = True
+
+ self.block = block
+ self.GUI["volumeAdjustment"].set_value( block.getData( "volume" ) )
+ self.GUI["reverbAdjustment"].set_value( block.getData( "reverb" ) )
+ self.GUI["beatsAdjustment"].set_value( block.getData( "beats" ) )
+ self.GUI["regularityAdjustment"].set_value( block.getData( "regularity" ) )
+
+ self.settingBlock = False
+
+ Popup.setBlock( self, block )
+
+ def handleVolume( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "volume", widget.get_value() )
+
+ def handleReverb( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "reverb", widget.get_value() )
+
+ def handleBeats( self, widget ):
+ # snap to 0 decimal places
+ val = widget.get_value()
+ if round( val ) != val:
+ widget.set_value( round( val ) )
+ return
+
+ if not self.settingBlock:
+ self.block.setData( "beats", int(round( widget.get_value() )) )
+
+ def handleRegularity( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "regularity", widget.get_value() )
+
+ def handleRegenerate( self, widget ):
+ self.block.regenerate()
+
+ def handleClear( self, widget ):
+ self.block.clear()
+
+class Loop( Popup ):
+
+ def __init__( self, label, owner ):
+ Popup.__init__( self, label, owner )
+
+ self.settingBlock = False
+
+ self.gc = self.owner.gc
+ self.colors = self.owner.colors
+ self.sampleNoteMask = self.owner.sampleNoteMask
+
+ self.noteDB = self.owner.noteDB
+ self.csnd = new_csound_client()
+
+ self.GUI = {}
+
+ self.GUI["mainBox"] = gtk.VBox()
+ self.set_content( self.GUI["mainBox"] )
+
+ #-- Beats ---------------------------------------------
+ self.GUI["beatsBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["beatsBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["beatsLabel"] = gtk.Label( _("Beats:") )
+ self.GUI["beatsLabel"].set_size_request( 130, -1 )
+ self.GUI["beatsLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["beatsBox"].pack_start( self.GUI["beatsLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["beatsAdjustment"] = gtk.Adjustment( 4, 2, Config.MAXIMUM_BEATS, 1, 1, 0 )
+ self.GUI["beatsAdjustment"].connect( 'value-changed', self.handleBeats )
+ self.GUI["beatsSlider"] = gtk.HScale( adjustment = self.GUI["beatsAdjustment"] )
+ self.GUI["beatsSlider"].set_size_request( 250, -1 )
+ self.GUI["beatsSlider"].set_draw_value( False )
+ self.GUI["beatsBox"].pack_start( self.GUI["beatsSlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["beatsImage"] = gtk.Image()
+ self.GUI["beatsBox"].pack_start( self.GUI["beatsImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Regularity ----------------------------------------
+ self.GUI["regularityBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["regularityBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["regularityLabel"] = gtk.Label( _("Regularity:") )
+ self.GUI["regularityLabel"].set_size_request( 130, -1 )
+ self.GUI["regularityLabel"].set_alignment( 0.0, 0.5 )
+ self.GUI["regularityBox"].pack_start( self.GUI["regularityLabel"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["regularityAdjustment"] = gtk.Adjustment( 0.5, 0.0, 1.0, 0.1, 0.1, 0 )
+ self.GUI["regularityAdjustment"].connect( 'value-changed', self.handleRegularity )
+ self.GUI["regularitySlider"] = gtk.HScale( adjustment = self.GUI["regularityAdjustment"] )
+ self.GUI["regularitySlider"].set_size_request( 250, -1 )
+ self.GUI["regularitySlider"].set_draw_value( False )
+ self.GUI["regularityBox"].pack_start( self.GUI["regularitySlider"], False, padding = style.DEFAULT_PADDING )
+ self.GUI["regularityImage"] = gtk.Image()
+ self.GUI["regularityBox"].pack_start( self.GUI["regularityImage"], False, padding = style.DEFAULT_PADDING )
+
+ #-- Generate ------------------------------------------
+ self.GUI["generateBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["generateBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["regenerateButton"] = gtk.Button( "Regenerate" )
+ self.GUI["regenerateButton"].connect( "clicked", self.handleRegenerate )
+ self.GUI["generateBox"].pack_start( self.GUI["regenerateButton"], True, False, padding = style.DEFAULT_PADDING )
+ self.GUI["clearButton"] = gtk.Button( "Clear" )
+ self.GUI["clearButton"].connect( "clicked", self.handleClear )
+ self.GUI["generateBox"].pack_start( self.GUI["clearButton"], True, False, padding = style.DEFAULT_PADDING )
+ self.GUI["recordButton"] = gtk.ToggleButton( "Record" )
+ self.GUI["recordButton"].connect( "toggled", self.handleRecord )
+ self.GUI["generateBox"].pack_start( self.GUI["recordButton"], True, False, padding = style.DEFAULT_PADDING )
+
+ #-- Preview -------------------------------------------
+ self.GUI["previewBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["previewBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["previewEventBox"] = gtk.EventBox()
+ self.GUI["previewEventBox"].add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK)
+ self.GUI["previewEventBox"].connect( "button-press-event", self.handlePreviewPress )
+ self.GUI["previewEventBox"].connect( "button-release-event", self.handlePreviewRelease )
+ self.GUI["previewEventBox"].connect( "motion-notify-event", self.handlePreviewMotion )
+ self.GUI["previewEventBox"].connect( "leave-notify-event", self.handlePreviewLeave )
+ self.GUI["previewBox"].pack_start( self.GUI["previewEventBox"], True, padding = style.DEFAULT_PADDING )
+ self.previewDA = self.GUI["previewDA"] = gtk.DrawingArea()
+ self.GUI["previewDA"].connect( "size-allocate", self.handlePreviewAlloc )
+ self.GUI["previewDA"].connect( "expose-event", self.handlePreviewExpose )
+ self.GUI["previewEventBox"].add( self.GUI["previewDA"] )
+
+ self.GUI["mainBox"].show_all()
+
+ self.previewDA.alloced = False
+ self.previewDirty = False
+ self.previewDirtyRect = gtk.gdk.Rectangle( 0, 0, 0, 0 )
+ self.dirtyRectToAdd = gtk.gdk.Rectangle( 0, 0, 0, 0 )
+
+ self.sampleBg = self.owner.sampleBg
+ self.GUI["previewDA"].set_size_request( -1, self.sampleBg.get_size()[1] )
+ self.sampleNoteHeight = self.owner.sampleNoteHeight
+ self.sampleNoteMask = self.owner.sampleNoteMask
+
+ self.pitchPerPixel = float(Config.NUMBER_OF_POSSIBLE_PITCHES-1) / (self.sampleBg.get_size()[1] - self.sampleNoteHeight)
+ self.pixelsPerPitch = float(self.sampleBg.get_size()[1] - self.sampleNoteHeight)/(Config.MAXIMUM_PITCH - Config.MINIMUM_PITCH)
+ # Temporary Initialization
+ self.pixelsPerTick = [0] + [ 1 for i in range(1,Config.MAXIMUM_BEATS+1) ]
+ self.ticksPerPixel = [0] + [ 1 for i in range(1,Config.MAXIMUM_BEATS+1) ]
+
+ self.cursor = { \
+ "default": None, \
+ "drag-onset": gtk.gdk.Cursor(gtk.gdk.SB_RIGHT_ARROW), \
+ "drag-pitch": gtk.gdk.Cursor(gtk.gdk.BOTTOM_SIDE), \
+ "drag-duration": gtk.gdk.Cursor(gtk.gdk.RIGHT_SIDE), \
+ "drag-playhead": gtk.gdk.Cursor(gtk.gdk.SB_H_DOUBLE_ARROW), \
+ "pencil": gtk.gdk.Cursor(gtk.gdk.PENCIL), \
+ "paste": gtk.gdk.Cursor(gtk.gdk.CENTER_PTR), \
+ "error": None }
+
+ self.recording = False
+ self.recordLoop = None
+ self.recordingNote = None
+
+ self.owner.noteDB.addListener( self, LoopParasite )
+
+ def destroy( self ):
+ self.owner.noteDB.deleteListener( self )
+
+ Popup.destroy()
+
+ def setBlock( self, block ):
+ self.settingBlock = True
+
+ if self.GUI["recordButton"].get_active():
+ self.GUI["recordButton"].set_active( False )
+
+ self.block = block
+ self.GUI["beatsAdjustment"].set_value( block.getData( "beats" ) )
+ self.GUI["regularityAdjustment"].set_value( block.getData( "regularity" ) )
+
+ root = block.getRoot()
+ if root.type == Block.Instrument:
+ self.instrument = { "id": root.getData( "id" ),
+ "amplitude": root.getData( "volume" ),
+ "pan": root.getData( "pan" ),
+ "reverb": root.getData( "reverb" ) }
+ else:
+ self.instrument = self.owner.getInstrument()
+
+ self.curPage = block.getData("id")
+ self.curBeats = block.getData("beats")
+
+ self.selectedNotes = [ [] for i in range(Config.NUMBER_OF_TRACKS) ]
+
+ self.curAction = False # stores the current mouse action
+ self.curActionObject = False # stores the object that in handling the action
+
+ self.lastDO = self.lastDP = self.lastDrumDP = self.lastDD = None
+
+ self.clickButton = 0 # used in release and motion events to make sure we where actually the widget originally clicked. (hack for popup windows)
+ self.buttonPressCount = 1 # used on release events to indicate double/triple releases
+ self.clickLoc = [0,0] # location of the last click
+ self.marqueeLoc = False # current drag location of the marquee
+ self.marqueeRect = [[0,0],[0,0]]
+
+ self.playheadT = 0
+ self.playheadX = Config.TRACK_SPACING_DIV2
+
+ self.settingBlock = False
+
+ if self.previewDA.alloced:
+ self.invalidatePreview( 0, 0, self.previewDA.width, self.previewDA.height, -1, True )
+
+ Popup.setBlock( self, block )
+
+ def popdown( self, immediate = False ):
+ self.applyNoteSelection( SELECTNOTES.NONE, 0, [], self.curPage )
+
+ if self.GUI["recordButton"].get_active():
+ self.GUI["recordButton"].set_active( False )
+
+ Popup.popdown( self, immediate )
+
+ def getPage( self ):
+ if self.block != None:
+ return self.block.getData("id")
+ else:
+ return -1
+
+ #=======================================================
+ # Handelers
+
+ def handleBeats( self, widget ):
+ # snap to 0 decimal places
+ val = widget.get_value()
+ if round( val ) != val:
+ widget.set_value( round( val ) )
+ return
+
+ if not self.settingBlock:
+ self.curBeats = int(round( widget.get_value() ))
+ self.block.setData( "beats", self.curBeats )
+ for n in self.owner.noteDB.getNotesByTrack( self.getPage(), 0, self ):
+ n.updateTransform( True )
+ self.invalidatePreview( 0, 0, self.previewDA.width, self.previewDA.height )
+
+ if self.recordLoop:
+ self.recordLoop = self.owner._playLoop( self.instrument["id"], self.instrument["amplitude"], self.instrument["reverb"], [ self.curPage ], self.recordLoop, force = True )
+
+ def handleRegularity( self, widget ):
+ if not self.settingBlock:
+ self.block.setData( "regularity", widget.get_value() )
+
+ def handleRegenerate( self, widget ):
+ parameters = GenerationParameters(
+ rythmRegularity = self.block.getData( "regularity" ),
+ pitchRegularity = self.block.getData( "regularity" ) )
+
+ self.owner._generateTrack( self.instrument["id"], self.curPage, 0, parameters, generator1 )
+
+ self.block.updateLoop()
+
+ if self.recordLoop:
+ self.recordLoop = self.owner._playLoop( self.instrument["id"], self.instrument["amplitude"], self.instrument["reverb"], [ self.curPage ], self.recordLoop, force = True )
+
+ def handleClear( self, widget ):
+ self.block.clear()
+
+ if self.recordLoop:
+ self.recordLoop = self.owner._playLoop( self.instrument["id"], self.instrument["amplitude"], self.instrument["reverb"], [ self.curPage ], self.recordLoop, force = True )
+
+ def handleRecord( self, widget ):
+ if widget.get_active():
+ self.startRecording()
+ else:
+ self.stopRecording()
+
+ def handlePreviewPress( self, widget, event ):
+ if event.button != 1:
+ return
+
+ self.clickButton = event.button
+
+ if event.type == gtk.gdk._2BUTTON_PRESS: self.buttonPressCount = 2
+ elif event.type == gtk.gdk._3BUTTON_PRESS: self.buttonPressCount = 3
+ else: self.buttonPressCount = 1
+
+ self.clickLoc = [ int(event.x), int(event.y) ]
+
+ page = self.block.getData("id")
+ beats = self.block.getData("beats")
+
+ notes = self.noteDB.getNotesByTrack( page, 0, self )
+ last = len(notes)-1
+ handled = 0
+ for n in range(last+1):
+ handled = notes[n].handleButtonPress( self, event )
+ if handled == 0:
+ continue
+ elif handled == 1:
+ if not self.curAction: self.curAction = True # it was handled but no action was declared, set curAction to True anyway
+ return
+ else: # all other options mean we can stop looking
+ break
+
+ if not handled or handled == -1: # event didn't overlap any notes, so we can draw
+ pitch = min( self.pixelsToPitchFloor( self.clickLoc[1] - self.previewDA.height + self.sampleNoteHeight//2 ), Config.NUMBER_OF_POSSIBLE_PITCHES-1) + Config.MINIMUM_PITCH
+ onset = self.pixelsToTicksFloor( beats, self.clickLoc[0] )
+ cs = CSoundNote( onset,
+ pitch,
+ 0.75,
+ 0.5,
+ 1,
+ 0,
+ instrumentId = self.instrument["id"] )
+ cs.pageId = page
+ id = self.noteDB.addNote( -1, page, 0, cs )
+ n = self.noteDB.getNote( page, 0, id, self )
+ self.selectNotes( { 0:[n] }, True )
+ n.playSampleNote( False )
+
+ noteS = self.noteDB.getNotesByTrack( page, 0 )
+ for note in noteS:
+ if note.cs.onset < onset and (note.cs.onset + note.cs.duration) > onset:
+ self.noteDB.updateNote(self.curPage, 0, note.id, PARAMETER.DURATION, onset - note.cs.onset)
+
+ self.updateDragLimits()
+ self.clickLoc[0] += self.ticksToPixels( beats, 1 )
+ self.setCurrentAction( "note-drag-duration", n )
+ self.setCursor("drag-duration")
+
+ def handlePreviewRelease( self, widget, event ):
+ if not self.clickButton: return # we recieved this event but were never clicked! (probably a popup window was open)
+ self.clickButton = 0
+
+ if event.button != 1:
+ return
+
+ if not self.curAction:
+ self.applyNoteSelection( SELECTNOTES.NONE, 0, [], self.curPage )
+ return
+
+ if not self.curActionObject: # there was no real action to carry out
+ self.curAction = False
+ return
+
+ if self.curActionObject != self:
+ self.curActionObject.handleButtonRelease( self, event, self.buttonPressCount )
+ self.updateTooltip( event )
+ else:
+ # we're doing the action ourselves
+ if self.curAction == "marquee": self.doneMarquee( event )
+ self.updateTooltip( event )
+
+ def handlePreviewMotion( self, widget, event ):
+ if event.is_hint:
+ x, y, state = self.previewDA.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+
+ if not self.clickButton: # we recieved this event but were never clicked! (probably a popup window was open)
+ self.updateTooltip( event )
+ return
+
+ if event.state & gtk.gdk.BUTTON1_MASK:
+ if not self.curAction: # no action is in progress yet we're dragging, start a marquee
+ self.setCurrentAction( "marquee", self )
+
+ if self.curAction == "note-drag-onset":
+ self.noteDragOnset( event )
+
+ elif self.curAction == "note-drag-duration":
+ self.noteDragDuration( event )
+
+ elif self.curAction == "note-drag-pitch":
+ self.noteDragPitch( event )
+
+ #elif self.curAction == "note-drag-pitch-drum":
+ # self.noteDragPitch( event, True )
+
+ elif self.curAction == "marquee":
+ self.updateMarquee( event )
+ else:
+ self.updateTooltip( event )
+
+ def handlePreviewLeave( self, widget, event ):
+ self.setCursor("default")
+
+ def handlePreviewAlloc( self, widget, allocation ):
+ self.previewDA.alloced = True
+ win = gtk.gdk.get_default_root_window()
+ self.previewDA.width = allocation.width
+ self.previewDA.height = allocation.height
+ self.previewBuffer = gtk.gdk.Pixmap( win, allocation.width, allocation.height )
+ self.clearClipMask = gtk.gdk.Rectangle( 0, 0, allocation.width, allocation.height )
+
+ self.pixelsPerTick = [0] + [ self.previewDA.width/float(i*Config.TICKS_PER_BEAT) for i in range(1,Config.MAXIMUM_BEATS+1) ]
+ self.ticksPerPixel = [0] + [ 1.0/self.pixelsPerTick[i] for i in range(1,Config.MAXIMUM_BEATS+1) ]
+
+ self.beatSpacing = [[0]]
+ for i in range(1,Config.MAXIMUM_BEATS+1):
+ self.beatSpacing.append( [ self.ticksToPixels( i, Config.TICKS_PER_BEAT*j ) for j in range(i) ] )
+
+ for n in self.owner.noteDB.getNotes( self ):
+ n.updateTransform( True )
+
+ self.invalidatePreview( 0, 0, allocation.width, allocation.height, -1, True )
+
+ def on_key_press( self, widget, event ):
+ keyval = event.keyval
+
+ # backspace and del keys
+ if keyval == gtk.keysyms.Delete or keyval == gtk.keysyms.BackSpace:
+ if len( self.selectedNotes[0] ):
+ self.owner.noteDB.deleteNotes(
+ [ self.curPage, 0, len( self.selectedNotes[0] ) ]
+ + [ n.note.id for n in self.selectedNotes[0] ]
+ + [ -1 ] )
+ self.block.updateLoop()
+ else:
+ self.owner.onKeyPress( widget, event )
+
+ #=======================================================
+ # Drawing
+
+ def previewDraw( self ):
+ startX = self.previewDirtyRect.x
+ startY = self.previewDirtyRect.y
+ stopX = self.previewDirtyRect.x + self.previewDirtyRect.width
+ stopY = self.previewDirtyRect.y + self.previewDirtyRect.height
+
+ page = self.block.getData("id")
+ beats = self.owner.noteDB.getPage(page).beats
+
+ self.gc.set_clip_rectangle( self.previewDirtyRect )
+
+ # draw background
+ self.previewBuffer.draw_drawable( self.gc, self.sampleBg, 0, 0, 0, 0, self.previewDA.width-5, self.previewDA.height )
+ self.previewBuffer.draw_drawable( self.gc, self.sampleBg, self.sampleBg.endOffset, 0, self.previewDA.width-5, 0, 5, self.previewDA.height )
+
+ # draw beat lines
+ self.gc.set_line_attributes( Config.BEAT_LINE_SIZE, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.colors["Beat_Line"]
+ for i in range(1,beats):
+ x = self.beatSpacing[beats][i]
+ self.previewBuffer.draw_line( self.gc, x, 1, x, self.previewDA.height-1 )
+
+ # draw notes
+ self.gc.set_clip_mask( self.sampleNoteMask )
+ notes = self.owner.noteDB.getNotesByTrack( page, 0, self )
+ for n in notes:
+ if not n.draw( self.previewBuffer, self.gc, startX, stopX ): break
+
+ self.previewDirty = False
+
+ def handlePreviewExpose( self, widget, event ):
+ if self.previewDirty:
+ self.previewDraw()
+
+ self.gc.set_clip_rectangle( event.area )
+
+ # draw base
+ widget.window.draw_drawable( self.gc, self.previewBuffer, event.area.x, event.area.y, event.area.x, event.area.y, event.area.width, event.area.height )
+
+ if self.marqueeLoc: # draw the selection rect
+ self.gc.set_line_attributes( Config.MARQUEE_SIZE, gtk.gdk.LINE_ON_OFF_DASH, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.colors["Preview_Note_Selected"]
+ widget.window.draw_rectangle( self.gc, False, self.marqueeRect[0][0], self.marqueeRect[0][1], self.marqueeRect[1][0], self.marqueeRect[1][1] )
+
+ if self.recording: # draw playhead
+ self.gc.set_line_attributes( Config.PLAYHEAD_SIZE, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ self.gc.foreground = self.colors["black"]
+ widget.window.draw_line( self.gc, self.playheadX, event.area.y, self.playheadX, event.area.y + event.area.height )
+
+ def invalidatePreview( self, x, y, width, height, page = -1, base = True ):
+ if page != -1 and page != self.getPage():
+ return
+
+ self.dirtyRectToAdd.x = x
+ self.dirtyRectToAdd.y = y
+ self.dirtyRectToAdd.width = width
+ self.dirtyRectToAdd.height = height
+
+ if base: # the base image has been dirtied
+ if not self.previewDirty:
+ self.previewDirtyRect.x = x
+ self.previewDirtyRect.y = y
+ self.previewDirtyRect.width = width
+ self.previewDirtyRect.height = height
+ else:
+ self.previewDirtyRect = self.previewDirtyRect.union( self.dirtyRectToAdd )
+ self.previewDirty = True
+
+ if self.previewDA.window != None:
+ self.previewDA.window.invalidate_rect( self.dirtyRectToAdd, True )
+
+ #=======================================================
+ # Recording
+
+ def startRecording( self ):
+ if self.recording:
+ return
+
+ self.owner.setPaused( True )
+ self.owner.pushInstrument( self.instrument )
+ self.owner.setKeyboardListener( self )
+
+ self.recordLoop = self.owner._playLoop( self.instrument["id"], self.instrument["amplitude"], self.instrument["reverb"], [ self.curPage ], force = True )
+ self.updatePlayhead()
+ self.recordTimeout = gobject.timeout_add( 20, self._record_timeout )
+ self.recording = True
+
+ def stopRecording( self ):
+ if not self.recording:
+ return
+
+ self.owner.setPaused( False )
+ self.owner.popInstrument()
+ self.owner.setKeyboardListener( None )
+
+ gobject.source_remove( self.recordTimeout )
+ self.recording = False
+
+ if self.recordingNote:
+ self.finishNote()
+
+ self.owner._stopLoop( self.recordLoop )
+ self.recordLoop = None
+ self.clearPlayhead()
+
+ def recordNote( self, pitch ):
+ onset = self.csnd.loopGetTick( self.recordLoop )
+ #onset = Config.DEFAULT_GRID * int(onset / Config.DEFAULT_GRID + 0.5)
+
+ cs = CSoundNote( onset,
+ pitch,
+ 0.75,
+ 0.5,
+ Config.DEFAULT_GRID,
+ 0,
+ instrumentId = self.instrument["id"] )
+ cs.pageId = self.curPage
+
+ for n in self.noteDB.getNotesByTrack( self.curPage, 0 ):
+ if onset < n.cs.onset:
+ break
+ if onset >= n.cs.onset + n.cs.duration:
+ continue
+ if onset < n.cs.onset + n.cs.duration - 2:
+ self.noteDB.deleteNote( n.page, n.track, n.id )
+ elif onset - n.cs.onset < 1:
+ self.noteDB.deleteNote( n.page, n.track, n.id )
+ else:
+ self.noteDB.updateNote( n.page, n.track, n.id, PARAMETER.DURATION, onset - n.cs.onset )
+ break
+
+ self.recordingNote = self.noteDB.addNote( -1, self.curPage, 0, cs )
+
+ self.recordLoop = self.owner._playLoop( self.instrument["id"], self.instrument["amplitude"], self.instrument["reverb"], [ self.curPage ], self.recordLoop, force = True )
+
+ def finishNote( self ):
+ self.recordingNote = None
+
+ self.block.updateLoop()
+
+ def _updateNote( self ):
+ tick = self.csnd.loopGetTick( self.recordLoop )
+ #tick = Config.DEFAULT_GRID * int(tick / Config.DEFAULT_GRID + 0.5)
+
+ note = self.noteDB.getNote( self.curPage, 0, self.recordingNote )
+
+ if tick < note.cs.onset:
+ tick = self.noteDB.getPage( self.curPage ).ticks
+ self.noteDB.updateNote( note.page, note.track, note.id, PARAMETER.DURATION, tick - note.cs.onset )
+ for n in self.noteDB.getNotesByTrack( self.curPage, 0 ):
+ if n.cs.onset <= note.cs.onset:
+ continue
+ if n.cs.onset > note.cs.onset and n.cs.onset < note.cs.onset + note.cs.duration:
+ self.noteDB.deleteNote( n.page, n.track, n.id )
+ else:
+ break
+ self.finishNote()
+ elif tick > note.cs.onset + note.cs.duration:
+ self.noteDB.updateNote( note.page, note.track, note.id, PARAMETER.DURATION, tick - note.cs.onset )
+ for n in self.noteDB.getNotesByTrack( self.curPage, 0 ):
+ if n.cs.onset <= note.cs.onset:
+ continue
+ if n.cs.onset > note.cs.onset and n.cs.onset < note.cs.onset + note.cs.duration:
+ self.noteDB.deleteNote( n.page, n.track, n.id )
+ else:
+ break
+
+ def _record_timeout( self ):
+ self.updatePlayhead()
+ if self.recordingNote:
+ self._updateNote()
+ return True
+
+ def updatePlayhead( self ):
+ ticks = self.csnd.loopGetTick( self.recordLoop )
+ if self.playheadT != ticks:
+ self.invalidatePreview( self.playheadX-Config.PLAYHEAD_SIZE/2, 0, Config.PLAYHEAD_SIZE, self.previewDA.height, self.curPage, False )
+ self.playheadX = self.ticksToPixels( self.curBeats, ticks )
+ self.invalidatePreview( self.playheadX-Config.PLAYHEAD_SIZE/2, 0, Config.PLAYHEAD_SIZE, self.previewDA.height, self.curPage, False )
+ self.playheadT = ticks
+
+ return True
+
+ def clearPlayhead( self ):
+ self.invalidatePreview( self.playheadX-Config.PLAYHEAD_SIZE/2, 0, Config.PLAYHEAD_SIZE, self.previewDA.height, self.curPage, False )
+
+ #=======================================================
+ # Actions
+
+ def setCurrentAction( self, action, obj = None ):
+ if self.curAction:
+ self.doneCurrentAction()
+
+ self.curAction = action
+ self.curActionObject = obj
+
+ if action == "note-drag-onset": self.updateDragLimits()
+ elif action == "note-drag-duration": self.updateDragLimits()
+ elif action == "note-drag-pitch": self.updateDragLimits()
+ #elif action == "note-drag-pitch-drum": self.updateDragLimits()
+
+ def doneCurrentAction( self ):
+ if not self.curAction: return
+ action = self.curAction
+ self.curAction = False
+
+ if action == "note-drag-onset": self.doneNoteDrag( action )
+ elif action == "note-drag-duration": self.doneNoteDrag( action )
+ elif action == "note-drag-pitch": self.doneNoteDrag( action )
+ #elif action == "note-drag-pitch-drum": self.doneNoteDrag( action )
+
+ def selectionChanged( self ):
+ if self.curAction == "note-drag-onset": self.updateDragLimits()
+ elif self.curAction == "note-drag-duration": self.updateDragLimits()
+ elif self.curAction == "note-drag-pitch": self.updateDragLimits()
+ #elif self.curAction == "note-drag-pitch-drum": self.updateDragLimits()
+
+ def applyNoteSelection( self, mode, trackN, which, page = -1 ):
+ if page == -1: page = self.curPage
+ if mode == SELECTNOTES.ALL:
+ track = self.noteDB.getNotesByTrack( page, trackN, self )
+ map( lambda note:note.setSelected( True ), track )
+ self.selectedNotes[trackN] = []
+ map( lambda note:self.selectedNotes[trackN].append(note), track )
+ elif mode == SELECTNOTES.NONE:
+ track = self.selectedNotes[trackN] #self.noteDB.getNotesByTrack( page, trackN, self )
+ map( lambda note:note.setSelected( False ), track )
+ self.selectedNotes[trackN] = []
+ elif mode == SELECTNOTES.ADD:
+ for note in which:
+ if note.setSelected( True ):
+ self.selectedNotes[trackN].append( note )
+ elif mode == SELECTNOTES.REMOVE:
+ for note in which:
+ if note.setSelected( False ):
+ self.selectedNotes[trackN].remove( note )
+ elif mode == SELECTNOTES.FLIP:
+ for note in which:
+ if note.getSelected():
+ note.setSelected( False )
+ self.selectedNotes[trackN].remove( note )
+ else:
+ note.setSelected( True )
+ self.selectedNotes[trackN].append( note )
+ elif mode == SELECTNOTES.EXCLUSIVE:
+ notes = self.noteDB.getNotesByTrack( page, trackN, self )
+ for n in range(len(notes)):
+ if notes[n] in which:
+ if notes[n].setSelected( True ):
+ self.selectedNotes[trackN].append( notes[n] )
+ else:
+ if notes[n].setSelected( False ):
+ self.selectedNotes[trackN].remove( notes[n] )
+
+ def selectNotesByBar( self, trackN, start, stop, page = -1 ):
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i == trackN:
+ notes = []
+ track = self.noteDB.getNotesByTrack( self.curPage, trackN, self )
+ for n in range(len(track)):
+ if track[n].testOnset( start, stop ): notes.append(track[n])
+ if not Config.ModKeys.ctrlDown: self.applyNoteSelection( SELECTNOTES.EXCLUSIVE, trackN, notes, page )
+ else: self.applyNoteSelection( SELECTNOTES.ADD, trackN, notes, page )
+ else:
+ if not Config.ModKeys.ctrlDown: self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def selectNotesByTrack( self, trackN, page = -1 ):
+ if Config.ModKeys.ctrlDown:
+ self.applyNoteSelection( SELECTNOTES.ALL, trackN, [], page )
+ else:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i == trackN: self.applyNoteSelection( SELECTNOTES.ALL, trackN, [], page )
+ else: self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def selectNotes( self, noteDic, ignoreCtrl = False, page = -1 ):
+ if Config.ModKeys.ctrlDown and not ignoreCtrl:
+ for i in noteDic:
+ self.applyNoteSelection( SELECTNOTES.FLIP, i, noteDic[i], page )
+ else:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if i in noteDic: self.applyNoteSelection( SELECTNOTES.EXCLUSIVE, i, noteDic[i], page )
+ else: self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def deselectNotes( self, noteDic, page = -1 ):
+ for i in noteDic:
+ self.applyNoteSelection( SELECTNOTES.REMOVE, i, noteDic[i], page )
+ self.selectionChanged()
+
+ def clearSelectedNotes( self, page = -1 ):
+ for i in range(Config.NUMBER_OF_TRACKS):
+ self.applyNoteSelection( SELECTNOTES.NONE, i, [], page )
+ self.selectionChanged()
+
+ def updateDragLimits( self ):
+ self.dragLimits = [ [-9999,9999], [-9999,9999], [-9999,9999] ] # initialize to big numbers!
+ maxRightBound = self.noteDB.getPage(self.curPage).ticks
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ leftBound = 0
+ skip = True # skip the first note
+ for n in range(len(track)):
+ if skip:
+ skip = False
+ thisNote = track[n]
+ continue
+ nextNote = track[n]
+ if not thisNote.getSelected():
+ leftBound = thisNote.getEndTick()
+ else:
+ if not nextNote.getSelected():
+ rightBound = min( nextNote.getStartTick(), maxRightBound )
+ widthBound = rightBound
+ else:
+ rightBound = maxRightBound
+ widthBound = min( nextNote.getStartTick(), maxRightBound )
+ thisNote.updateDragLimits( self.dragLimits, leftBound, rightBound, widthBound, maxRightBound )
+ thisNote = nextNote
+ # do the last note
+ if thisNote.getSelected():
+ thisNote.updateDragLimits( self.dragLimits, leftBound, maxRightBound, maxRightBound, maxRightBound )
+
+ def noteDragOnset( self, event ):
+ do = self.pixelsToTicks( self.curBeats, event.x - self.clickLoc[0] )
+ do = min( self.dragLimits[0][1], max( self.dragLimits[0][0], do ) )
+
+ if do != self.lastDO:
+ self.lastDO = do
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ tstream = []
+ for note in self.selectedNotes[i]:
+ note.noteDragOnset( do, tstream )
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.ONSET, len(tstream)//2 ] + tstream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteDragDuration( self, event ):
+ dd = self.pixelsToTicks( self.curBeats, event.x - self.clickLoc[0] )
+ dd = min( self.dragLimits[2][1], max( self.dragLimits[2][0], dd ) )
+
+ if dd != self.lastDD:
+ self.lastDD = dd
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ tstream = []
+ for note in self.selectedNotes[i]:
+ note.noteDragDuration( dd, tstream )
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.DURATION, len(tstream)//2 ] + tstream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteDragPitch( self, event, drum = False ):
+ if not drum: dp = self.pixelsToPitch( event.y - self.clickLoc[1] )
+ else: dp = self.pixelsToPitchDrum( event.y - self.clickLoc[1] )
+ dp = min( self.dragLimits[1][1], max( self.dragLimits[1][0], dp ) )
+
+ if dp != self.lastDP:
+ self.lastDP = dp
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ tstream = []
+ for note in self.selectedNotes[i]:
+ note.noteDragPitch( dp, tstream )
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.PITCH, len(tstream)//2 ] + tstream
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ self.curActionObject.playSampleNote( True )
+
+ def doneNoteDrag( self, action ):
+ # if action == "note-drag-pitch" or action == "note-drag-pitch-drum":
+ # self.curActionObject.playSampleNote()
+
+ self.lastDO = self.lastDP = self.lastDrumDP = self.lastDD = None
+
+ for i in range(Config.NUMBER_OF_TRACKS):
+ for note in self.selectedNotes[i]:
+ note.doneNoteDrag( self )
+
+ self.block.updateLoop()
+
+ def noteStepOnset( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ if step < 0: # moving to the left, iterate forwards
+ leftBound = 0
+ for n in range(len(track)):
+ leftBound = track[n].noteDecOnset( step, leftBound, tstream )
+ else: # moving to the right, iterate backwards
+ rightBound = self.noteDB.getPage(self.curPage).ticks
+ for n in range(len(track)-1, -1, -1 ):
+ rightBound = track[n].noteIncOnset( step, rightBound, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.ONSET, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteStepPitch( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ if step < 0:
+ for n in self.selectedNotes[i]:
+ n.noteDecPitch( step, tstream )
+ else:
+ for n in self.selectedNotes[i]:
+ n.noteIncPitch( step, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.PITCH, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteStepDuration( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ if step < 0:
+ for n in self.selectedNotes[i]:
+ n.noteDecDuration( step, tstream )
+ else:
+ track = self.noteDB.getNotesByTrack( self.curPage, i, self )
+ for j in range(len(track)-1):
+ track[j].noteIncDuration( step, track[j+1].getStartTick(), tstream )
+ track[len(track)-1].noteIncDuration( step, self.noteDB.getPage(self.curPage).ticks, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.DURATION, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def noteStepVolume( self, step ):
+ stream = []
+ for i in range(Config.NUMBER_OF_TRACKS):
+ if not len(self.selectedNotes[i]): continue # no selected notes here
+
+ tstream = []
+ if step < 0:
+ for n in self.selectedNotes[i]:
+ n.noteDecVolume( step, tstream )
+ else:
+ for n in self.selectedNotes[i]:
+ n.noteIncVolume( step, tstream )
+
+ if len(tstream):
+ stream += [ self.curPage, i, PARAMETER.AMPLITUDE, len(tstream)//2 ] + tstream
+
+ if len(stream):
+ self.noteDB.updateNotes( stream + [-1] )
+
+ def updateMarquee( self, event ):
+ if self.marqueeLoc:
+ oldX = self.marqueeRect[0][0]
+ oldEndX = self.marqueeRect[0][0] + self.marqueeRect[1][0]
+ oldY = self.marqueeRect[0][1]
+ oldEndY = self.marqueeRect[0][1] + self.marqueeRect[1][1]
+ else:
+ oldX = oldEndX = self.clickLoc[0]
+ oldY = oldEndY = self.clickLoc[1]
+
+ self.marqueeLoc = [ int(event.x), int(event.y) ]
+ if self.marqueeLoc[0] < 0: self.marqueeLoc[0] = 0
+ elif self.marqueeLoc[0] > self.previewDA.width: self.marqueeLoc[0] = self.previewDA.width
+ if self.marqueeLoc[1] < 0: self.marqueeLoc[1] = 0
+ elif self.marqueeLoc[1] > self.previewDA.height: self.marqueeLoc[1] = self.previewDA.height
+
+ if self.marqueeLoc[0] > self.clickLoc[0]:
+ self.marqueeRect[0][0] = self.clickLoc[0]
+ self.marqueeRect[1][0] = self.marqueeLoc[0] - self.clickLoc[0]
+ else:
+ self.marqueeRect[0][0] = self.marqueeLoc[0]
+ self.marqueeRect[1][0] = self.clickLoc[0] - self.marqueeLoc[0]
+ if self.marqueeLoc[1] > self.clickLoc[1]:
+ self.marqueeRect[0][1] = self.clickLoc[1]
+ self.marqueeRect[1][1] = self.marqueeLoc[1] - self.clickLoc[1]
+ else:
+ self.marqueeRect[0][1] = self.marqueeLoc[1]
+ self.marqueeRect[1][1] = self.clickLoc[1] - self.marqueeLoc[1]
+
+ x = min( self.marqueeRect[0][0], oldX )
+ width = max( self.marqueeRect[0][0] + self.marqueeRect[1][0], oldEndX ) - x
+ y = min( self.marqueeRect[0][1], oldY )
+ height = max( self.marqueeRect[0][1] + self.marqueeRect[1][1], oldEndY ) - y
+ self.invalidatePreview( x-1, y-1, width+2, height+2, self.curPage, False )
+
+ def doneMarquee( self, event ):
+ if self.marqueeLoc:
+ stop = [ self.marqueeRect[0][0] + self.marqueeRect[1][0], self.marqueeRect[0][1] + self.marqueeRect[1][1] ]
+
+ select = {}
+
+ intersectionY = [ self.marqueeRect[0][1], stop[1] ]
+
+ notes = []
+ track = self.noteDB.getNotesByTrack( self.getPage(), 0, self )
+ for n in range(len(track)):
+ hit = track[n].handleMarqueeSelect( self,
+ [ self.marqueeRect[0][0], intersectionY[0] ], \
+ [ stop[0], intersectionY[1] ] )
+ if hit: notes.append(track[n])
+
+ if len(notes): select[0] = notes
+
+ self.selectNotes( select )
+
+ self.marqueeLoc = False
+ self.doneCurrentAction()
+
+ self.invalidatePreview( self.marqueeRect[0][0]-1, self.marqueeRect[0][1]-1, self.marqueeRect[1][0]+2, self.marqueeRect[1][1]+2, self.getPage(), False )
+
+ def updateTooltip( self, event ):
+
+ notes = self.noteDB.getNotesByTrack( self.getPage(), 0, self )
+ handled = 0
+ for n in range(len(notes)):
+ handled = notes[n].updateTooltip( self, event )
+ if handled == 0: continue
+ elif handled == 1: return # event was handled
+ else: break
+
+ if handled == -2: # event X overlapped with a note
+ self.setCursor("default")
+ return
+
+ self.setCursor("pencil")
+
+ def setCursor( self, cursor ):
+ self.window.set_cursor(self.cursor[cursor])
+
+ def ticksToPixels( self, beats, ticks ):
+ return int(round( ticks * self.pixelsPerTick[beats] ))
+ def pixelsToTicks( self, beats, pixels ):
+ return int(round( pixels * self.ticksPerPixel[beats] ))
+ def pitchToPixels( self, pitch ):
+ return int(round( ( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch ))
+ def ticksToPixelsFloor( self, beats, ticks ):
+ return int( ticks * self.pixelsPerTick[beats] )
+ def pixelsToTicksFloor( self, beats, pixels ):
+ return int( pixels * self.ticksPerPixel[beats] )
+ def pixelsToPitch( self, pixels ):
+ return int(round(-pixels*self.pitchPerPixel))
+ def pitchToPixelsFloor( self, pitch ):
+ return int(( Config.MAXIMUM_PITCH - pitch ) * self.pixelsPerPitch )
+ def pixelsToPitchFloor( self, pixels ):
+ return int(-pixels*self.pitchPerPixel)
+
+
+class Shortcut( Popup ):
+
+ def __init__( self, label, owner ):
+ Popup.__init__( self, label, owner )
+
+ self.gc = self.owner.gc
+
+ self.GUI = {}
+
+ self.GUI["mainBox"] = gtk.VBox()
+ self.set_content( self.GUI["mainBox"] )
+
+ #-- Keys ----------------------------------------------
+ # match keycodes from JamMain.valid_shortcuts
+ layout = [ [ 0.0, [ 18, 19, 20, 21 ] ],
+ [ 0.3, [ 32, 33, 34, 35 ] ],
+ [ 1.7, [ 47, 48, 51 ] ],
+ [ 1.1, [ 60, 61 ] ] ]
+
+ self.GUI["keyBox"] = gtk.VBox()
+ self.GUI["mainBox"].pack_start( self.GUI["keyBox"], padding = style.DEFAULT_PADDING - 2 )
+
+ for row in layout:
+ offset = row[0]
+ hbox = gtk.HBox()
+ self.GUI["keyBox"].pack_start( hbox, padding = 2 )
+ separator = gtk.Label("")
+ separator.set_size_request( int(Block.Block.KEYSIZE*row[0]) + style.DEFAULT_PADDING, -1 )
+ hbox.pack_start( separator, False )
+ separator = gtk.Label("")
+ separator.set_size_request( style.DEFAULT_PADDING, -1 )
+ hbox.pack_end( separator, False )
+ for key in row[1]:
+ self.GUI[key] = gtk.ToggleButton()
+ self.GUI[key].connect( "expose-event", self.keyExpose )
+ self.GUI[key].connect( "toggled", self.keyToggled )
+ self.GUI[key].set_size_request( Block.Block.KEYSIZE, Block.Block.KEYSIZE )
+ self.GUI[key].key = key
+ self.GUI[key].image = [ self.owner.getKeyImage( key, False ),
+ self.owner.getKeyImage( key, True ) ]
+ hbox.pack_start( self.GUI[key], False, padding = 2 )
+
+ #-- None ----------------------------------------------
+ self.GUI["noneBox"] = gtk.HBox()
+ self.GUI["mainBox"].pack_start( self.GUI["noneBox"], padding = style.DEFAULT_PADDING )
+ self.GUI["noneButton"] = gtk.Button( _("None") )
+ self.GUI["noneButton"].connect( "clicked", self.handleNone )
+ self.GUI["noneBox"].pack_start( self.GUI["noneButton"], True, False, padding = style.DEFAULT_PADDING )
+
+ self.GUI["mainBox"].show_all()
+
+ self.key = None
+
+ def setBlock( self, block ):
+ self.ignoreToggle = True
+
+ self.block = block
+ self.key = self.block.getData( "key" )
+
+ if self.key != None:
+ self.GUI[self.key].set_active( True )
+
+ self.ignoreToggle = False
+
+ Popup.setBlock( self, block )
+
+ def on_key_press( self, widget, event ):
+ key = event.hardware_keycode
+ if key in self.owner.valid_shortcuts.keys():
+ self.block.setData( "key", key )
+ if self.key != None: # clear old key
+ self.ignoreToggle = True
+ self.GUI[self.key].set_active( False )
+ self.key = None
+ self.ignoreToggle = False
+ self.popdown( True )
+ else:
+ self.owner.onKeyPress( widget, event )
+
+ def keyExpose( self, widget, event ):
+ self.gc.set_clip_mask( self.owner.blockMask )
+ self.gc.set_clip_origin( event.area.x - Block.Block.KEYMASK_START, event.area.y )
+ widget.window.draw_drawable( self.gc, widget.image[widget.get_active()], 0, 0, event.area.x, event.area.y, event.area.width, event.area.height )
+ return True
+
+ def keyToggled( self, widget ):
+ if self.ignoreToggle:
+ return
+
+ if widget.get_active():
+ self.block.setData( "key", widget.key )
+
+ self.ignoreToggle = True
+
+ if self.key != None: # clear old key
+ self.GUI[self.key].set_active( False )
+ self.key = None
+
+ widget.set_active( False )
+
+ self.ignoreToggle = False
+
+ self.popdown( True )
+
+ def handleNone( self, widget ):
+ if self.key != None:
+ self.ignoreToggle = True
+ self.GUI[self.key].set_active( False )
+ self.key = None
+ self.ignoreToggle = False
+
+ self.block.setData( "key", None )
+
+ self.popdown( True )
diff --git a/TamTamJam.activity/Jam/RythmGenerator.py b/TamTamJam.activity/Jam/RythmGenerator.py
new file mode 100644
index 0000000..4740160
--- /dev/null
+++ b/TamTamJam.activity/Jam/RythmGenerator.py
@@ -0,0 +1,77 @@
+import random
+
+import Config
+from Util.CSoundNote import CSoundNote
+from Generation.GenerationConstants import GenerationConstants
+from GenRythm import GenRythm
+
+def generator( instrument, nbeats, density, regularity, reverbSend ):
+
+ makeRythm = GenRythm()
+
+ noteDuration = GenerationConstants.DOUBLE_TICK_DUR / 2
+ trackId = 5
+ pan = 0.5
+ attack = 0.005
+ decay = 0.095
+ filterType = 0
+ filterCutoff = 1000
+ tied = False
+ mode = 'mini'
+
+ def makePitchSequence(length, drumPitch):
+ pitchSequence = []
+ append = pitchSequence.append
+ list = range(length)
+ max = len(drumPitch) - 1
+ for i in list:
+ append(drumPitch[ random.randint( 0, max ) ] )
+ return pitchSequence
+
+ def makeGainSequence( onsetList ):
+ gainSequence = []
+ append = gainSequence.append
+ for onset in onsetList:
+ if onset == 0:
+ gain = random.uniform(GenerationConstants.GAIN_MID_MAX_BOUNDARY, GenerationConstants.GAIN_MAX_BOUNDARY)
+ elif ( onset % Config.TICKS_PER_BEAT) == 0:
+ gain = random.uniform(GenerationConstants.GAIN_MID_MIN_BOUNDARY, GenerationConstants.GAIN_MID_MAX_BOUNDARY)
+ else:
+ gain = random.uniform(GenerationConstants.GAIN_MIN_BOUNDARY, GenerationConstants.GAIN_MID_MIN_BOUNDARY)
+ append(gain)
+ return gainSequence
+
+ def pageGenerate( regularity, drumPitch ):
+ barLength = Config.TICKS_PER_BEAT * nbeats
+
+ #print 'pageGenerate drumPitch[0] ', drumPitch[0]
+ currentInstrument = Config.INSTRUMENTS[ instrument ].kit[ drumPitch[0] ].name
+
+ rythmSequence = makeRythm.drumRythmSequence(currentInstrument, nbeats, density, regularity)
+ pitchSequence = makePitchSequence(len(rythmSequence), drumPitch )
+ gainSequence = makeGainSequence(rythmSequence)
+
+ trackNotes = []
+ list = range(len(rythmSequence))
+ for i in list:
+ trackNotes.append( CSoundNote( rythmSequence[i], pitchSequence[i], gainSequence[i],
+ pan, noteDuration, trackId,
+ Config.INSTRUMENTS[instrument].instrumentId, attack,
+ decay, reverbSend, filterType, filterCutoff, tied, mode))
+ return trackNotes
+
+##################################################################################
+ # begin generate()
+ if regularity > 0.75:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY1
+ elif regularity > 0.5:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY2
+ elif regularity > 0.25:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY3
+ else:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY4
+
+ trackNotes = []
+ for drumPitch in streamOfPitch:
+ trackNotes.append(pageGenerate( regularity, drumPitch ))
+ return trackNotes
diff --git a/TamTamJam.activity/Jam/Toolbars.py b/TamTamJam.activity/Jam/Toolbars.py
new file mode 100644
index 0000000..8a45c01
--- /dev/null
+++ b/TamTamJam.activity/Jam/Toolbars.py
@@ -0,0 +1,129 @@
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from gettext import gettext as _
+
+from sugar.graphics.palette import Palette, WidgetInvoker
+from sugar.graphics.radiotoolbutton import RadioToolButton
+
+import Config
+
+
+class JamToolbar( gtk.Toolbar ):
+
+ def __init__( self, owner ):
+ gtk.Toolbar.__init__( self )
+
+ self.owner = owner
+
+ self.toolItem = {}
+
+ self.volumeImg = gtk.Image()
+
+ self.volumeAdjustment = gtk.Adjustment( 0.0, 0, 1.0, 0.1, 0.1, 0 )
+ self.volumeAdjustment.connect( 'value-changed', self.handleVolume )
+ self.volumeSlider = gtk.HScale( adjustment = self.volumeAdjustment )
+ self.volumeSlider.set_size_request( 450, -1 )
+ self.volumeSlider.set_draw_value( False )
+ self._add_tooltip( self.volumeSlider, _("Master Volume") )
+ self._insert_widget( self.volumeSlider, -1 )
+ self._insert_widget( self.volumeImg, -1 )
+
+ self._insert_separator( True )
+
+ self.tempoImg = gtk.Image()
+
+ self.tempoAdjustment = gtk.Adjustment( Config.PLAYER_TEMPO_LOWER, Config.PLAYER_TEMPO_LOWER, Config.PLAYER_TEMPO_UPPER+1, 10, 10, 0 )
+ self.tempoAdjustment.connect( 'value-changed', self.handleTempo )
+ self.tempoSlider = gtk.HScale( adjustment = self.tempoAdjustment )
+ self.tempoSlider.set_size_request( 450, -1 )
+ self.tempoSlider.set_draw_value( False )
+ self._add_tooltip( self.tempoSlider, _("Tempo") )
+ self._insert_widget( self.tempoSlider, -1 )
+ self._insert_widget( self.tempoImg, -1 )
+
+ self.show_all()
+
+ #def _add_palette( self, widget, palette, position = Palette.DEFAULT ):
+ def _add_palette( self, widget, palette ):
+ widget._palette = palette
+ widget._palette.props.invoker = WidgetInvoker( widget )
+ #widget._palette.set_property( "position", position )
+
+ def _add_tooltip( self, widget, tooltip ):
+ #self._add_palette( widget, Palette( tooltip ), Palette.DEFAULT )
+ self._add_palette( widget, Palette( tooltip ) )
+
+ def _insert_widget( self, widget, pos ):
+ self.toolItem[ widget ] = gtk.ToolItem()
+ self.toolItem[ widget ].add( widget )
+ self.insert( self.toolItem[ widget ], pos )
+
+ def _insert_separator( self, expand = False ):
+ separator = gtk.SeparatorToolItem()
+ separator.set_draw( False )
+ separator.set_expand( expand )
+ self.insert( separator, -1 )
+
+ def mapRange( self, value, ilower, iupper, olower, oupper ):
+ if value == iupper:
+ return oupper
+ return olower + int( (oupper-olower+1)*(value-ilower)/float(iupper-ilower) )
+
+
+ def handleVolume( self, widget ):
+ self.owner._setVolume( widget.get_value() )
+
+ img = self.mapRange( widget.value, widget.lower, widget.upper, 0, 3 )
+ self.volumeImg.set_from_file(Config.TAM_TAM_ROOT + '/icons/volume' + str(img) + '.svg')
+
+ def handleTempo( self, widget ):
+ self.owner._setTempo( widget.get_value() )
+
+ img = self.mapRange( widget.value, widget.lower, widget.upper, 1, 8 )
+ self.tempoImg.set_from_file(Config.TAM_TAM_ROOT + '/icons/tempo' + str(img) + '.svg')
+
+
+class DesktopToolbar( gtk.Toolbar ):
+
+ def __init__( self, owner ):
+ gtk.Toolbar.__init__( self )
+
+ self.owner = owner
+
+ self._insert_separator( True )
+
+ self.desktop = []
+
+ btn = RadioToolButton( 'preset1', group = None )
+ btn.connect( 'toggled', self.setDesktop, 0 )
+ btn.set_tooltip( _('Desktop 1') )
+ self.insert( btn, -1 )
+ self.desktop.append( btn )
+
+ for i in range(2,11):
+ btn = RadioToolButton( 'preset%d'%i, group = self.desktop[0] )
+ btn.connect( 'toggled', self.setDesktop, i-1 )
+ btn.set_tooltip( _('Desktop %d'%i) )
+ self.insert( btn, -1 )
+ self.desktop.append( btn )
+
+ self._insert_separator( True )
+
+ self.show_all()
+
+ def _insert_separator( self, expand = False ):
+ separator = gtk.SeparatorToolItem()
+ separator.set_draw( False )
+ separator.set_expand( expand )
+ self.insert( separator, -1 )
+
+ def getDesktopButton( self, which ):
+ return self.desktop[which]
+
+ def setDesktop( self, widget, which ):
+ if widget.get_active():
+ self.owner._setDesktop( which )
+
diff --git a/TamTamJam.activity/Jam/__init__.py b/TamTamJam.activity/Jam/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TamTamJam.activity/Jam/__init__.py
diff --git a/TamTamJam.activity/NEWS b/TamTamJam.activity/NEWS
new file mode 100644
index 0000000..8120a07
--- /dev/null
+++ b/TamTamJam.activity/NEWS
@@ -0,0 +1,71 @@
+39
+
+* New activity : TamTamJam (lync)
+* Activities are now separate (TamTamJam, TamTamEdit, TamTamSynthLab)
+* No sound when set to language other than english fixed (#3165) (J5, marcopg, tomeu, Flipo)
+
+38
+
+* Adapt to new Palette API (Flipo)
+
+37
+
+* Small layout change in edit (Flipo)
+* Temporary fix for Palettes causing the audio to stop (Flipo)
+
+36
+
+* Major image cleanup, 700k saved (Flipo)
+* Tune generation back (see leftmost icon on generate tab) (Olipet)
+
+35
+
+* TamTam Edit Toolbars enhancements (Flipo, Olipet)
+* TamTam Edit layout changes (lync)
+* Dual instruments for tracks in Edit (Olipet, lync)
+
+34
+
+* Synthlab sugar integration (olipet, Flipo)
+* Toolbars in edit draft, hit alt-t to show the toolbar, alt-y to hide (Flipo)
+* Bug that prevented sound from working fixed (LeJames)
+
+33
+
+* Added Sugar Toolbar to miniTamTam and Synthlab (Flipo)
+* Network now working in miniTamTam, use the share button on the activity toolbar (lync)
+* Added help subsystem (ethrop, LeJames)
+
+32
+
+* Important microphone fix (Olipet)
+
+31
+
+* Working network (create a FORCE_SHARE file in the / dir) (lync)
+* New tune generator in Edit, click the dice in the tune view (Olipet)
+* Fine tuning of the algorythmic generator and orchestras (Olipet)
+* TamTamJam (miniTamTam) integration with the journal (Flipo)
+* Title according to subactivity displayed in the journal (Flipo)
+
+30
+
+* Clicking the close button in Edit and Synthlab goes back to Sugar. (Flipo)
+* Fix to the Journal load and save. (Flipo, lync)
+* Ogg player on the welcome page. (lync)
+* Demo tune instruments and tempo are randomly generated (Olipet)
+* lab placeholder files were reduced in size by 95% (Olipet)
+
+29
+
+* WelcomeScreen: Removed Typing Game icon. (Flipo)
+* General: Added sounds. (ethrop, Olipet)
+* General: Journal integration. (Flipo, lync)
+* TamTamJam: Microphone semi-working. (James)
+* TamTamEdit: Beats per page setting. (lync, Olipet)
+* TamTamEdit: Mute/Solo controls on tracks. (Flipo)
+* TamTamEdit: Paint tool. (Olipet)
+* TamTamEdit: Properties automation. (Olipet)
+* TamTamEdit: Pages can have different colors. (lync)
+* TamTamEdit: Realtime keyboard recording. (Olipet)
+* TamTamEdit: Export song to ogg file. (Olipet) \ No newline at end of file
diff --git a/TamTamJam.activity/TamTam.py b/TamTamJam.activity/TamTam.py
new file mode 100644
index 0000000..e282df9
--- /dev/null
+++ b/TamTamJam.activity/TamTam.py
@@ -0,0 +1,1229 @@
+import locale
+locale.setlocale(locale.LC_NUMERIC, 'C')
+import signal , time , sys , os, shutil
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import gobject
+import time
+
+import Config
+from Util.CSoundClient import new_csound_client
+from Util.Profiler import TP
+
+from Util.InstrumentPanel import InstrumentPanel
+from miniTamTam.miniTamTamMain import miniTamTamMain
+from Jam.JamMain import JamMain
+from Edit.MainWindow import MainWindow
+from Welcome import Welcome
+from SynthLab.SynthLabWindow import SynthLabWindow
+from Util.Trackpad import Trackpad
+from gettext import gettext as _
+#from Util.KeyboardWindow import KeyboardWindow
+import commands
+
+if __name__ != '__main__':
+ try:
+ from sugar.activity.activity import Activity
+ from sugar.activity import activity
+ FAKE_ACTIVITY = False
+ if Config.DEBUG: print 'using sugar Activity'
+ except ImportError:
+ from FActivity import FakeActivity as Activity
+ FAKE_ACTIVITY = True
+ if Config.DEBUG: print 'using fake activity'
+else:
+ from FActivity import FakeActivity as Activity
+ if Config.DEBUG: print 'using fake activity'
+
+
+class TamTam(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ if self._shared_activity: # if we're joining a shared activity force mini
+ self.set_mode("mini")
+ else:
+ self.set_mode(mode)
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ #if len( self.preloadList ):
+ # self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ #print "-----", event.keyval, event.string, event.hardware_keycode
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ subactivity_name = self.metadata['tamtam_subactivity']
+ if subactivity_name == 'edit' \
+ or subactivity_name == 'synth' \
+ or subactivity_name == 'jam':
+ self.set_mode(subactivity_name)
+ self.modeList[subactivity_name].handleJournalLoad(file_path)
+ elif subactivity_name == 'mini':
+ self.set_mode(subactivity_name)
+ else:
+ return
+
+ def write_file(self,file_path):
+ if self.mode == 'edit':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+ elif self.mode == 'synth':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+ elif self.mode == 'mini':
+ self.metadata['tamtam_subactivity'] = self.mode
+ f = open(file_path,'w')
+ f.close()
+ elif self.mode == 'jam':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+
+class TamTamJam(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Jam')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("jam")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['jam'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['jam'].handleJournalSave(file_path)
+
+class TamTamEdit(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='edit'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Edit')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("edit")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['edit'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['edit'].handleJournalSave(file_path)
+
+class TamTamSynthLab(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='synth'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam SynthLab')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("synth")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['synth'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['synth'].handleJournalSave(file_path)
+
+class TamTamMini(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='mini'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Mini')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("mini")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.metadata['tamtam_subactivity'] = 'mini'
+
+ def write_file(self,file_path):
+ f = open(file_path,'w')
+ f.close()
+
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 :
+ mainwin = TamTam(None, sys.argv[1])
+ else:
+ mainwin = TamTam(None, 'welcome')
+
+ gtk.gdk.threads_init()
+ gtk.main()
+
+ sys.exit(0)
+
+
+
+
+
+
+
+
+ def run_edit_mode():
+ tamtam = MainWindow()
+ mainwin = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ mainwin.set_title('TamTam Player')
+ display = mainwin.get_display()
+ screen = gtk.gdk.Display.get_default_screen(display)
+ mainwin.set_geometry_hints( None, screen.get_width(), screen.get_height(), screen.get_width(), screen.get_height(), screen.get_width(), screen.get_height() )
+ #mainwin.fullscreen() # don't need to specify full screen, it seem to sit properly anyway
+ mainwin.set_resizable(False)
+ mainwin.connect('destroy' , tamtam.destroy )
+ #mainwin.connect( "configure-event", tamtam.handleConfigureEvent )
+ mainwin.connect( "key-press-event", tamtam.onKeyPress )
+ mainwin.connect( "key-release-event", tamtam.onKeyRelease )
+ mainwin.connect( "delete_event", tamtam.delete_event )
+ mainwin.add(tamtam)
+ tamtam.show()
+ mainwin.show()
+ gtk.main()
diff --git a/TamTamJam.activity/actvity/activity-tamtamjam.svg b/TamTamJam.activity/actvity/activity-tamtamjam.svg
new file mode 100644
index 0000000..563df7b
--- /dev/null
+++ b/TamTamJam.activity/actvity/activity-tamtamjam.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-tamtam">
+
+ <path d=" M9.653,18.199h35.54c0.772,0,1.4,0.628,1.4,1.403v2.362c0,0.771-0.628,1.401-1.4,1.401H9.653c-0.775,0-1.403-0.628-1.403-1.401 v-2.361C8.25,18.826,8.877,18.199,9.653,18.199z" display="inline" fill="&stroke_color;" id="path8" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <rect display="inline" fill="&fill_color;" height="22.128" id="rect10" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" width="33.139" x="10.852" y="23.365"/>
+
+ <path d=" M9.653,45.493h35.54c0.772,0,1.4,0.627,1.4,1.401v2.362c0,0.775-0.628,1.405-1.4,1.405H9.653c-0.775,0-1.403-0.629-1.403-1.405 v-2.362C8.25,46.124,8.877,45.493,9.653,45.493z" display="inline" fill="&stroke_color;" id="path17" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <path d=" M10.851,45.491l8.544-22.126l7.896,22.125l7.926-22.126" display="inline" fill="none" id="path19" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <path d=" M43.987,45.491l-8.77-22.126" display="inline" fill="none" id="path21" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <line display="inline" fill="none" id="line27" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="33.69" x2="48.336" y1="13.149" y2="5.948"/>
+
+ <line display="inline" fill="none" id="line29" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="6.042" x2="20.658" y1="2.213" y2="9.48"/>
+
+ <path d=" M25.721,9.802c0.55,1.451-0.171,3.066-1.608,3.612c-1.437,0.545-3.049-0.188-3.599-1.639c-0.547-1.45,0.174-3.067,1.609-3.613 C23.561,7.62,25.172,8.352,25.721,9.802z" display="inline" fill="&fill_color;" id="path23" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25"/>
+
+ <path d=" M33.338,16.442c-1.04,1.125-2.798,1.189-3.928,0.144c-1.128-1.044-1.197-2.801-0.155-3.927c1.041-1.125,2.8-1.19,3.926-0.146 C34.31,13.558,34.381,15.316,33.338,16.442z" display="inline" fill="&fill_color;" id="path25" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25"/>
+</g></svg>
+
diff --git a/TamTamJam.activity/actvity/activity.info b/TamTamJam.activity/actvity/activity.info
new file mode 100644
index 0000000..423ad09
--- /dev/null
+++ b/TamTamJam.activity/actvity/activity.info
@@ -0,0 +1,6 @@
+[Activity]
+name = TamTamJam
+service_name = org.laptop.TamTamJam
+icon = activity-tamtam
+class = TamTam.TamTamJam
+activity_version = 40
diff --git a/TamTamJam.activity/common b/TamTamJam.activity/common
new file mode 120000
index 0000000..60d3b0a
--- /dev/null
+++ b/TamTamJam.activity/common
@@ -0,0 +1 @@
+../common \ No newline at end of file
diff --git a/TamTamJam.activity/icons/XYBut.svg b/TamTamJam.activity/icons/XYBut.svg
new file mode 100644
index 0000000..54d7563
--- /dev/null
+++ b/TamTamJam.activity/icons/XYBut.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<g>
+ <circle fill="#808284" cx="15" cy="15" r="9.376"/>
+ <g>
+ <path fill="#FFFFFF" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.584-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.918-6.501-6.502S11.417,8.5,15.001,8.5C18.585,8.5,21.5,11.413,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.168,28,28,22.165,28,14.998C28,7.831,22.168,2,15.003,2z"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/XYButDown.svg b/TamTamJam.activity/icons/XYButDown.svg
new file mode 100644
index 0000000..201df5f
--- /dev/null
+++ b/TamTamJam.activity/icons/XYButDown.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<g>
+ <circle cx="15" cy="15" r="6.933"/>
+ <g>
+ <path fill="none" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.585-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.917-6.501-6.502c0-3.584,2.917-6.498,6.501-6.498C18.585,8.5,21.5,11.414,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.169,28,28,22.165,28,14.998C28,7.831,22.169,2,15.003,2z"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/XYButDownClick.svg b/TamTamJam.activity/icons/XYButDownClick.svg
new file mode 100644
index 0000000..9e0d222
--- /dev/null
+++ b/TamTamJam.activity/icons/XYButDownClick.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<circle fill="none" cx="15" cy="15" r="6.933"/>
+<g>
+ <path fill="none" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.585-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.917-6.501-6.502c0-3.584,2.917-6.498,6.501-6.498C18.585,8.5,21.5,11.414,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.169,28,28,22.165,28,14.998C28,7.831,22.169,2,15.003,2z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/accept.svg b/TamTamJam.activity/icons/accept.svg
new file mode 100755
index 0000000..a2f9e28
--- /dev/null
+++ b/TamTamJam.activity/icons/accept.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45px" height="45px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.78,28.079c0-12.43,10.071-22.499,22.499-22.499c12.431,0,22.501,10.069,22.501,22.499c0,12.431-10.07,22.501-22.501,22.501
+ C15.851,50.58,5.78,40.51,5.78,28.079z"/>
+</g>
+<g>
+
+ <line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="16.788" y1="26.691" x2="25.781" y2="38.706"/>
+
+ <line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="25.781" y1="38.706" x2="39.773" y2="18.704"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/cancel.svg b/TamTamJam.activity/icons/cancel.svg
new file mode 100755
index 0000000..59512eb
--- /dev/null
+++ b/TamTamJam.activity/icons/cancel.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45px" height="45px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.78,28.08c0-12.431,10.071-22.5,22.5-22.5c12.432,0,22.5,10.069,22.5,22.5c0,12.432-10.068,22.5-22.5,22.5
+ C15.851,50.58,5.78,40.512,5.78,28.08z"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="20.155" y1="19.956" x2="37.029" y2="36.83"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="37.029" y1="19.956" x2="20.155" y2="36.83"/>
+</svg>
diff --git a/TamTamJam.activity/icons/preset1.svg b/TamTamJam.activity/icons/preset1.svg
new file mode 100644
index 0000000..9673b82
--- /dev/null
+++ b/TamTamJam.activity/icons/preset1.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.043 35.334,15.753 44.168,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M26.749,26.727h-0.036L24.48,27.79l-0.45-2.053l3.097-1.44h2.27V36h-2.647V26.727z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset10.svg b/TamTamJam.activity/icons/preset10.svg
new file mode 100644
index 0000000..28e7082
--- /dev/null
+++ b/TamTamJam.activity/icons/preset10.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M20.719,26.395h-0.036l-2.232,1.062l-0.449-2.053l3.097-1.439h2.27v11.704h-2.646v-9.273H20.719z"/>
+ <path fill="#FFFFFF" d="M35.858,29.762c0,3.619-1.458,6.104-4.447,6.104c-3.023,0-4.356-2.719-4.375-6.031
+ c0-3.386,1.44-6.067,4.467-6.067C34.635,23.766,35.858,26.557,35.858,29.762z M29.791,29.834c-0.018,2.683,0.631,3.962,1.692,3.962
+ c1.062,0,1.639-1.333,1.639-3.998c0-2.593-0.559-3.961-1.655-3.961C30.457,25.836,29.773,27.114,29.791,29.834z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset2.svg b/TamTamJam.activity/icons/preset2.svg
new file mode 100644
index 0000000..f376c67
--- /dev/null
+++ b/TamTamJam.activity/icons/preset2.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M22.922,35.168v-1.656l1.513-1.368c2.557-2.287,3.799-3.602,3.835-4.97c0-0.955-0.576-1.711-1.927-1.711
+ c-1.008,0-1.891,0.504-2.502,0.973l-0.774-1.963c0.882-0.666,2.251-1.206,3.835-1.206c2.646,0,4.105,1.548,4.105,3.673
+ c0,1.963-1.423,3.529-3.115,5.042l-1.08,0.9v0.035h4.411v2.251H22.922z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset3.svg b/TamTamJam.activity/icons/preset3.svg
new file mode 100644
index 0000000..a22bb3c
--- /dev/null
+++ b/TamTamJam.activity/icons/preset3.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M23.909,32.65c0.486,0.252,1.604,0.72,2.72,0.72c1.423,0,2.143-0.684,2.143-1.565
+ c0-1.152-1.152-1.674-2.358-1.674h-1.115v-1.963h1.062c0.918-0.019,2.088-0.36,2.088-1.352c0-0.702-0.576-1.224-1.729-1.224
+ c-0.954,0-1.962,0.414-2.448,0.702l-0.559-1.981c0.701-0.45,2.106-0.882,3.618-0.882c2.504,0,3.891,1.313,3.891,2.917
+ c0,1.243-0.702,2.215-2.144,2.719v0.035c1.404,0.253,2.538,1.314,2.538,2.846c0,2.07-1.817,3.583-4.789,3.583
+ c-1.513,0-2.791-0.396-3.475-0.828L23.909,32.65z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset4.svg b/TamTamJam.activity/icons/preset4.svg
new file mode 100644
index 0000000..e6cf5e9
--- /dev/null
+++ b/TamTamJam.activity/icons/preset4.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M27.1,35.835v-2.791h-5.186v-1.782l4.431-7.13h3.349v6.859h1.404v2.054h-1.404v2.791L27.1,35.835
+ L27.1,35.835z M27.1,30.991v-2.592c0-0.703,0.037-1.422,0.09-2.179h-0.07c-0.379,0.756-0.685,1.439-1.082,2.179l-1.565,2.557v0.035
+ H27.1z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset5.svg b/TamTamJam.activity/icons/preset5.svg
new file mode 100644
index 0000000..53f5b08
--- /dev/null
+++ b/TamTamJam.activity/icons/preset5.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,5.769 10.793,49.834 44.012,49.834 44.126,14.444
+ 35.45,5.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,6.042 35.334,14.753 44.166,14.753 "/>
+<path fill="#FFFFFF" d="M31.025,25.407h-4.537l-0.252,1.8c0.252-0.035,0.468-0.035,0.756-0.035c1.117,0,2.251,0.252,3.08,0.846
+ c0.883,0.594,1.422,1.566,1.422,2.936c0,2.179-1.873,4.105-5.022,4.105c-1.423,0-2.611-0.324-3.259-0.666l0.485-2.053
+ c0.522,0.252,1.585,0.575,2.647,0.575c1.134,0,2.34-0.541,2.34-1.782c0-1.207-0.955-1.945-3.295-1.945
+ c-0.648,0-1.098,0.037-1.584,0.109l0.773-6.142h6.445V25.407z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/preset6.svg b/TamTamJam.activity/icons/preset6.svg
new file mode 100644
index 0000000..4c2493c
--- /dev/null
+++ b/TamTamJam.activity/icons/preset6.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.043 35.334,15.753 44.168,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M30.562,26.575c-0.307,0-0.63,0-1.062,0.036c-2.431,0.198-3.511,1.44-3.815,2.811h0.055
+ c0.576-0.596,1.386-0.938,2.484-0.938c1.963,0,3.619,1.387,3.619,3.817c0,2.32-1.782,4.229-4.321,4.229
+ c-3.115,0-4.646-2.321-4.646-5.112c0-2.196,0.812-4.033,2.07-5.203c1.171-1.062,2.686-1.64,4.521-1.729
+ c0.505-0.036,0.828-0.036,1.099-0.018L30.562,26.575L30.562,26.575z M27.501,34.516c0.952,0,1.564-0.883,1.564-2.07
+ c0-1.081-0.576-2.018-1.747-2.018c-0.738,0-1.351,0.451-1.62,1.045c-0.07,0.145-0.106,0.357-0.106,0.684
+ c0.054,1.242,0.646,2.359,1.891,2.359H27.501z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset7.svg b/TamTamJam.activity/icons/preset7.svg
new file mode 100644
index 0000000..d6de26c
--- /dev/null
+++ b/TamTamJam.activity/icons/preset7.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M32.146,25.296v1.729l-4.825,9.977h-2.898l4.824-9.417v-0.036h-5.365v-2.251L32.146,25.296L32.146,25.296z"
+ />
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset8.svg b/TamTamJam.activity/icons/preset8.svg
new file mode 100644
index 0000000..5c4a17f
--- /dev/null
+++ b/TamTamJam.activity/icons/preset8.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="11.793,6.769 11.793,49.501 45.012,49.501 45.126,15.444
+ 36.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="36.334,7.042 36.334,15.753 45.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M26.164,29.784c-1.135-0.575-1.691-1.529-1.691-2.557c0-1.98,1.782-3.295,4.123-3.295
+ c2.735,0,3.871,1.584,3.871,3.007c0,1.008-0.54,1.999-1.692,2.574v0.055c1.134,0.433,2.144,1.404,2.144,2.916
+ c0,2.125-1.783,3.548-4.503,3.548c-2.971,0-4.339-1.675-4.339-3.259c0-1.404,0.812-2.377,2.089-2.936L26.164,29.784L26.164,29.784z
+ M30.126,32.684c0-1.027-0.757-1.639-1.838-1.928c-0.898,0.253-1.422,0.899-1.422,1.747c-0.019,0.847,0.63,1.639,1.656,1.639
+ C29.495,34.142,30.126,33.512,30.126,32.684z M27.046,27.138c0,0.792,0.721,1.296,1.655,1.584c0.631-0.18,1.188-0.756,1.188-1.494
+ c0-0.72-0.414-1.44-1.422-1.44C27.532,25.787,27.046,26.399,27.046,27.138z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/preset9.svg b/TamTamJam.activity/icons/preset9.svg
new file mode 100644
index 0000000..4b803e9
--- /dev/null
+++ b/TamTamJam.activity/icons/preset9.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M24.793,34.164c0.343,0.036,0.647,0.036,1.188,0c0.828-0.055,1.675-0.287,2.305-0.721
+ c0.758-0.521,1.262-1.276,1.478-2.16l-0.054-0.018c-0.522,0.539-1.278,0.846-2.342,0.846c-1.979,0-3.654-1.387-3.654-3.655
+ c0-2.286,1.837-4.213,4.41-4.213c3.008,0,4.431,2.306,4.431,5.042c0,2.431-0.774,4.213-2.053,5.384
+ c-1.116,1.009-2.646,1.565-4.466,1.639c-0.469,0.036-0.937,0.018-1.242,0V34.164z M28.033,26.241c-0.918,0-1.603,0.828-1.584,2.053
+ c0,1.009,0.54,1.873,1.656,1.873c0.738,0,1.261-0.36,1.513-0.774c0.091-0.162,0.145-0.342,0.145-0.684
+ c0-1.243-0.468-2.468-1.71-2.468H28.033z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/tam-help.svg b/TamTamJam.activity/icons/tam-help.svg
new file mode 100644
index 0000000..2923bb3
--- /dev/null
+++ b/TamTamJam.activity/icons/tam-help.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45.395px" height="45.395px" viewBox="0 0 45.395 45.395" enable-background="new 0 0 45.395 45.395" xml:space="preserve">
+<circle fill="#808284" cx="22.297" cy="23.037" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="22.295" cy="23.129" r="21.572"/>
+<circle fill="none" stroke="#4C4D4F" cx="22.628" cy="22.89" r="17.085"/>
+<g>
+ <path fill="#FFFFFF" stroke="#FFFFFF" d="M18.717,15.967c1.383-0.625,2.621-0.938,3.715-0.938c1.477,0,2.617,0.332,3.422,0.996
+ s1.207,1.645,1.207,2.941c0,1.344-0.871,2.738-2.613,4.184c-0.758,0.625-1.221,1.041-1.389,1.248s-0.303,0.459-0.404,0.756
+ s-0.152,0.668-0.152,1.113v0.645h-1.605v-0.668c0-1.359,0.434-2.418,1.301-3.176l1.547-1.359c0.5-0.422,0.867-0.85,1.102-1.283
+ s0.352-0.896,0.352-1.389c0-0.812-0.258-1.436-0.773-1.869s-1.219-0.65-2.109-0.65c-0.805,0-1.82,0.289-3.047,0.867L18.717,15.967z
+ M21.905,29.198c0.414,0,0.762,0.141,1.043,0.422s0.422,0.629,0.422,1.043c0,0.422-0.143,0.783-0.428,1.084
+ s-0.631,0.451-1.037,0.451c-0.398,0-0.738-0.15-1.02-0.451s-0.422-0.662-0.422-1.084s0.139-0.771,0.416-1.049
+ S21.498,29.198,21.905,29.198z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo1.svg b/TamTamJam.activity/icons/tempo1.svg
new file mode 100644
index 0000000..bb9aeec
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo1.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M23.5,6.5c3,3,7,7,9,11c-7,5-4,6-3,26c-1,1-8,1-9,0c0,0,2,1,2-1
+ c0-3-2-7-2-11c0-2,1-4,1-6c0-3-2-1-2-3c0-3,3-8,3-11c0-2-1-1-2-2v-3H23.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo2.svg b/TamTamJam.activity/icons/tempo2.svg
new file mode 100644
index 0000000..4a98310
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo2.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M27.5,44.5v-3C28.5,42.5,28.5,43.5,27.5,44.5z M26.5,10.5
+ c2,2,2,6,2,8c0,4-3,11-3,13s4,7,7,10c-2,2-4,3-5,5h-6c1-1,2-3,2-5c0-3-2-9-3-14c0,0,0-1-1,0v-6c0-3,3-8,3-11c0-1-2-2-2-6h3
+ C23.5,5.5,26.5,9.5,26.5,10.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo3.svg b/TamTamJam.activity/icons/tempo3.svg
new file mode 100644
index 0000000..bd893bd
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo3.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M30.5,17.5c0,3-2,2-2,4c0,3,4,14,7,21c-1,0-3,1-5,1c1-1,2,0,2-3
+ c0-2-4-7-6-10c-3,3-5,8-7,13c-1,0-3-1-4-1c3-3,7-14,7-18s-1-3-4-4c3-2,4-8,4-14h3C23.5,9.5,30.5,14.5,30.5,17.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo4.svg b/TamTamJam.activity/icons/tempo4.svg
new file mode 100644
index 0000000..6fa5afa
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo4.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M34.5,22.5c-1-1-2-4-5-6c-1,2,0,3,0,6c0,2-3,4-3,7c0,2,4,2,4,4
+ c0,3-1,4-2,5c0-1,0-3-1-4c-1,3-2,7-3,10c-4-3,0-6,0-9s-3-11-4-17l-4,4c1-5,8.25-11.12,7.25-16.12c0.68,0.68,3.029,0,2.87,2.12
+ C26.5,10.25,33.62,17.75,34.5,22.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo5.svg b/TamTamJam.activity/icons/tempo5.svg
new file mode 100644
index 0000000..9500e7e
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo5.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M24.5,13.5c2,1,5,3,5,6c0,2-2,3-2,5c0,9,11,4,11,13c-1,0-3-2-4-3
+ c-3-1-9,1-10-3c-2,3-5,7-7,11c-3,0-3-1-4-1c0-2,3-3,4-6s4-8,4-10c0-3-1-3-2-5c-1,0-2,1-3,2c0-1,2-3,2-4c1-2,3-5,2-8c0,0,1-1,4-2
+ C25.5,9.5,25.5,11.5,24.5,13.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo6.svg b/TamTamJam.activity/icons/tempo6.svg
new file mode 100644
index 0000000..9844fd6
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo6.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M22.5,10.5c3,2,7,5,7,7c0,3-4,8-4,10c0,3,1,3,1,5h5l2-2l2,2v4
+ c-1,0-3-2-5-2c-3,0-5,1-8,1c-1,3-2,7-2,10h-5c1-1,3-3,3-4c1-5,1-11,1-18l-1-1c-1,1-1.75,2.88-2.75,2.88c0,0-0.25-0.63-0.25-1.63
+ c4-4,2-8.25,2-13.25c0-1,0.25-2.5,0.38-5.38L22.5,5.5C23.12,6.5,22.5,8.5,22.5,10.5z"/>
+<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#333333" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" points="
+ 25,20 25.25,16.75 26.5,17.88 "/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo7.svg b/TamTamJam.activity/icons/tempo7.svg
new file mode 100644
index 0000000..54bed80
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo7.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M20.5,7.5c1,1,1,3,1,4c10,4,8,6,8,14c0,2,6,9,10,13c-1,2-2,4-4,5
+ c1.62-8.88-8.75-13.88-12-15c-1,1-1,0-1,2c0,3,2,5,3,7c-1,1-3,2-6,2c0-1,2-1,2-4c0-2-4-4-4-6c0-3,3-4,5-6c-3-8-8-2-11-6h6
+ c0-1,1,0,1-3c0-2-1-1-2-2l1-5H20.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/tempo8.svg b/TamTamJam.activity/icons/tempo8.svg
new file mode 100644
index 0000000..2c0154f
--- /dev/null
+++ b/TamTamJam.activity/icons/tempo8.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M20.5,12.5c0.67,0.4,0.4,1.9,1.75,2.25s1.05-0.38,1.5-0.37
+ c4.971,0,10.95-0.88,11.75,7.12c-1-2-3-4-5-5l-4,1c1,2,4,4,5,7c1,1,1,4,1,6c3,3,8-1,11,6c-2.88-0.82-4.25-2.62-12.75-2.75
+ c-1.561-0.02-2.34-1.561-3.75-1.87c-3.42-0.76-4.67-0.38-5.5-0.38c-3,0-8,7-11,7c-2,0-3-1-3-2c4,2,8-4,9-7c2-1,5-1,8-3c-2-4-6-5-8-3
+ l-6-6l2-2c1,1,1,2,1,4c1,0,4.12,0.38,6.12-0.62L16.5,17.5v-5H20.5z"/>
+</svg>
diff --git a/TamTamJam.activity/icons/volume0.svg b/TamTamJam.activity/icons/volume0.svg
new file mode 100644
index 0000000..963ebf0
--- /dev/null
+++ b/TamTamJam.activity/icons/volume0.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/volume1.svg b/TamTamJam.activity/icons/volume1.svg
new file mode 100644
index 0000000..a23fb00
--- /dev/null
+++ b/TamTamJam.activity/icons/volume1.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M8.929,7.078c3.546,3.548,3.546,9.297,0,12.846"
+ />
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/volume2.svg b/TamTamJam.activity/icons/volume2.svg
new file mode 100644
index 0000000..7b719e4
--- /dev/null
+++ b/TamTamJam.activity/icons/volume2.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M14.574,4.015c5.242,5.236,5.242,13.73,0,18.973"
+ />
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M8.929,7.078c3.546,3.548,3.546,9.297,0,12.846"
+ />
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+</svg>
diff --git a/TamTamJam.activity/icons/volume3.svg b/TamTamJam.activity/icons/volume3.svg
new file mode 100644
index 0000000..db92a17
--- /dev/null
+++ b/TamTamJam.activity/icons/volume3.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="28px" height="28px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve">
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M14.574,4.015c5.242,5.236,5.242,13.73,0,18.973"
+ />
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M8.929,7.078c3.546,3.548,3.546,9.297,0,12.846"
+ />
+<g>
+ <path fill="#FFFFFF" d="M6.23,13.818c0,1.617-1.312,2.931-2.934,2.931c-1.618,0-2.931-1.313-2.931-2.931
+ c0-1.614,1.312-2.93,2.932-2.93C4.918,10.889,6.23,12.204,6.23,13.818z"/>
+</g>
+<path fill="none" stroke="#FFFFFF" stroke-width="2.25" stroke-linecap="round" d="M20.135,0.528
+ c7.166,7.164,7.166,18.777-0.002,25.943"/>
+</svg>
diff --git a/TamTamJam.activity/setup.py b/TamTamJam.activity/setup.py
new file mode 100644
index 0000000..5b21f11
--- /dev/null
+++ b/TamTamJam.activity/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+# Copyright (C) 2006, Red Hat, Inc.
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start('TamTam')
diff --git a/TamTamMini.activity/Mini/Fillin.py b/TamTamMini.activity/Mini/Fillin.py
new file mode 100644
index 0000000..162f8ef
--- /dev/null
+++ b/TamTamMini.activity/Mini/Fillin.py
@@ -0,0 +1,105 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import gobject
+
+from RythmGenerator import *
+from common.Util.CSoundClient import new_csound_client
+from common.Util.NoteDB import Note
+import common.Config as Config
+
+class Fillin:
+ def __init__( self, nbeats, tempo, instrument, reverb, volume ):
+ self.notesList = []
+ self.barCount = 0
+ self.gate = 0
+ self.nbeats = nbeats
+ self.tempo = tempo
+ self.instrument = instrument
+ self.reverb = reverb
+ self.volume = volume
+ self.onsets = []
+ self.pitchs = []
+ self.playBackTimeout = None
+ self.csnd = new_csound_client()
+
+ def reset( self ):
+ self.barCount = 0
+ self.gate = 0
+
+ def setInstrument( self, instrument ):
+ self.instrument = instrument
+
+ def setBeats( self, nbeats ):
+ if self.playBackTimeout != None:
+ gobject.source_remove( self.playBackTimeout )
+
+ self.nbeats = nbeats
+ self.clear()
+ self.reset()
+
+ def setTempo( self, tempo ):
+ self.tempo = tempo
+ if self.playBackTimeout != None:
+ gobject.source_remove( self.playBackTimeout )
+ self.play()
+
+ def setReverb( self, reverb ):
+ self.reverb = reverb
+
+ def setVolume( self, volume ):
+ self.volume = volume
+
+ def play( self ):
+ if self.playBackTimeout == None:
+ self.playbackTimeout = gobject.timeout_add( int(60000/self.tempo/8), self.handleClock )
+ self.handleClock()
+
+ def stop( self ):
+ if self.playBackTimeout != None:
+ gobject.source_remove( self.playBackTimeout )
+ self.clear()
+
+ def clear( self ):
+ if self.notesList:
+ for n in self.notesList:
+ self.csnd.loopDelete(n)
+ self.notesList = []
+
+ def handleClock( self ):
+ tick = self.csnd.loopGetTick()
+ if tick < ( Config.TICKS_PER_BEAT / 2 + 1 ):
+ if self.gate == 0:
+ self.gate = 1
+ self.barCount += 1
+ self.barCount %= 4
+ if self.barCount == 1:
+ self.clear()
+
+ if tick > ( ( Config.TICKS_PER_BEAT * self.nbeats ) - ( Config.TICKS_PER_BEAT / 2 ) - 1 ):
+ if self.gate == 1:
+ self.gate = 0
+ if self.barCount == 3:
+ self.regenerate()
+ return True
+
+ def unavailable( self, onsets, pitchs ):
+ self.onsets = onsets
+ self.pitchs = pitchs
+
+ def regenerate(self):
+ def flatten(ll):
+ rval = []
+ for l in ll:
+ rval += l
+ return rval
+ i = 500
+ self.notesList= []
+ for x in flatten( generator(self.instrument, self.nbeats, 0.4, 0.1, self.reverb) ):
+ if x.onset not in self.onsets or x.pitch not in self.pitchs:
+ x.amplitude = x.amplitude*self.volume
+ n = Note(0, x.trackId, i, x)
+ self.notesList.append(n)
+ i += 1
+ self.csnd.loopPlay(n,1) #add as active
+
diff --git a/TamTamMini.activity/Mini/GenRythm.py b/TamTamMini.activity/Mini/GenRythm.py
new file mode 100644
index 0000000..330e174
--- /dev/null
+++ b/TamTamMini.activity/Mini/GenRythm.py
@@ -0,0 +1,80 @@
+import random
+import common.Config as Config
+
+from common.Generation.GenerationConstants import GenerationConstants
+from common.Generation.Utils import *
+
+class GenRythm:
+ def drumRythmSequence(self, instrumentName, nbeats, density, regularity ):
+ rythmSequence = []
+ binSelection = []
+ downBeats = []
+ upBeats = []
+ beats = []
+ countDown = 0
+ onsetTime = None
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.PUNCH:
+ registerDensity = 0.5
+ downBeatRecurence = 4
+ downBeats = [x for x in GenerationConstants.DRUM_PUNCH_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 2 )
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.LOW:
+ registerDensity =1
+ downBeatRecurence = 4
+ downBeats = [x for x in GenerationConstants.DRUM_LOW_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 2 )
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.MID:
+ registerDensity = .75
+ downBeatRecurence = 1
+ downBeats = [x for x in GenerationConstants.DRUM_MID_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 4 )
+
+ if Config.INSTRUMENTS[instrumentName].instrumentRegister == Config.HIGH:
+ registerDensity = 1.5
+ downBeatRecurence = 1
+ downBeats = [x for x in GenerationConstants.DRUM_HIGH_ACCENTS[ nbeats ]]
+ for downBeat in downBeats:
+ upBeats.append( downBeat + Config.TICKS_PER_BEAT / 4 )
+
+ realDensity = density * registerDensity
+ if realDensity > 1.:
+ realDensity = 1.
+
+ list = range( int( realDensity * len( downBeats ) ) )
+ for i in list:
+ if random.random() < ( regularity * downBeatRecurence ) and binSelection.count( 1 ) < len( downBeats ):
+ binSelection.append( 1 )
+ else:
+ if binSelection.count( 0 ) < len( downBeats ):
+ binSelection.append( 0 )
+ else:
+ binSelection.append( 1 )
+
+ countDown = binSelection.count( 1 )
+
+ length = len(downBeats) - 1
+ for i in range( countDown ):
+ ran1 = random.randint(0, length)
+ ran2 = random.randint(0, length)
+ randMin = min(ran1, ran2)
+ onsetTime = downBeats.pop(randMin)
+ rythmSequence.append( onsetTime )
+ length -= 1
+
+ length = len(upBeats) - 1
+ for i in range( len( binSelection ) - countDown ):
+ ran1 = random.randint(0, length)
+ ran2 = random.randint(0, length)
+ randMin = min(ran1, ran2)
+ onsetTime = upBeats.pop(randMin)
+ rythmSequence.append( onsetTime )
+ length -= 1
+
+ rythmSequence.sort()
+ return rythmSequence
diff --git a/TamTamMini.activity/Mini/KeyboardStandAlone.py b/TamTamMini.activity/Mini/KeyboardStandAlone.py
new file mode 100644
index 0000000..e3c3424
--- /dev/null
+++ b/TamTamMini.activity/Mini/KeyboardStandAlone.py
@@ -0,0 +1,142 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import common.Config as Config
+from common.Generation.GenerationConstants import GenerationConstants
+from common.Util.NoteDB import Note
+from common.Util.CSoundNote import CSoundNote
+from common.Util.CSoundClient import new_csound_client
+
+KEY_MAP_PIANO = Config.KEY_MAP_PIANO
+
+#log = file('/home/olpc/log.tamtam','w')
+
+class KeyboardStandAlone:
+ def __init__( self, recordingFunction, adjustDurationFunction, getCurrentTick, getPlayState, loop ):
+ self.csnd = new_csound_client()
+ self.recording = recordingFunction
+ self.adjustDuration = adjustDurationFunction
+ self.getPlayState = getPlayState
+ self.key_dict = dict()
+ self.onset_dict = dict()
+ self.trackCount = 0
+ self.instrument = 'flute'
+ self.reverb = 0
+ self.loop = loop
+ self.loopSustain = False
+ self.sustainedLoop = []
+
+ def setInstrument( self , instrument ):
+ self.instrument = instrument
+
+ def setReverb(self , reverb):
+ self.reverb = reverb
+
+ def onKeyPress(self,widget,event, volume):
+ key = event.hardware_keycode
+ if key == 50 or key == 62: #Left Shift
+ self.loopSustain = True
+
+ # If the key is already in the dictionnary, exit function (to avoir key repeats)
+ if self.key_dict.has_key(key):
+ return
+
+ if key in Config.LOOP_KEYS:
+ if key in self.sustainedLoop:
+ self.loop.stop(key)
+ self.sustainedLoop.remove(key)
+ elif self.loopSustain:
+ self.loop.start(key, self.instrument, self.reverb)
+ self.sustainedLoop.append(key)
+ else:
+ self.loop.start(key, self.instrument, self.reverb)
+ return
+
+ # Assign on which track the note will be created according to the number of keys pressed
+ if self.trackCount >= 9:
+ self.trackCount = 1
+ track = self.trackCount
+ self.trackCount += 1
+ # If the pressed key is in the keymap
+ if KEY_MAP_PIANO.has_key(key):
+ def playkey(pitch,duration,instrument):
+ # Create and play the note
+ self.key_dict[key] = CSoundNote(onset = 0,
+ pitch = pitch,
+ amplitude = volume,
+ pan = 0.5,
+ duration = duration,
+ trackId = track,
+ instrumentId = instrument.instrumentId,
+ reverbSend = self.reverb,
+ tied = True,
+ mode = 'mini')
+ self.csnd.play(self.key_dict[key], 0.3)
+ if self.getPlayState():
+ recOnset = int(self.csnd.loopGetTick())
+ self.onset_dict[key] = recOnset
+ self.recording( CSoundNote(
+ onset = recOnset,
+ pitch = pitch,
+ amplitude = volume,
+ pan = 0.5,
+ duration = 100,
+ trackId = 0,
+ decay = .1,
+ instrumentId = instrument.instrumentId,
+ reverbSend = self.reverb,
+ tied = False,
+ mode = 'mini'))
+
+ instrumentName = self.instrument
+ #print >>log, 'instrumentName:', instrumentName
+ pitch = KEY_MAP_PIANO[key]
+
+ if None != Config.INSTRUMENTS[instrumentName].kit:
+ if pitch in GenerationConstants.DRUMPITCH:
+ pitch = GenerationConstants.DRUMPITCH[pitch]
+ #print >>log, 'kit_element: ', Config.KIT_ELEMENT[pitch]
+ playkey(36,100, Config.INSTRUMENTS[instrumentName].kit[pitch])
+
+ else:
+ if event.state == gtk.gdk.MOD1_MASK:
+ pitch += 5
+
+ instrument = Config.INSTRUMENTS[ instrumentName ]
+ if instrument.csoundInstrumentId == Config.INST_PERC: #Percussions resonance
+ playkey( pitch, 60, instrument)
+ else:
+ playkey( pitch, -1, instrument)
+
+
+ def onKeyRelease(self,widget,event):
+ key = event.hardware_keycode
+ if key == 50 or key == 62:
+ self.loopSustain = False
+
+ if key in Config.LOOP_KEYS:
+ if key in self.sustainedLoop:
+ return
+ else:
+ self.loop.stop(key)
+ return
+
+ if KEY_MAP_PIANO.has_key(key):
+ csnote = self.key_dict[key]
+ if Config.INSTRUMENTSID[ csnote.instrumentId ].csoundInstrumentId == Config.INST_TIED:
+ csnote.duration = .5
+ csnote.decay = 0.7
+ #csnote.amplitude = 1
+ csnote.tied = False
+ csnote.mode = 'mini'
+ self.csnd.play(csnote, 0.3)
+ if self.getPlayState():
+ self.adjustDuration(csnote.pitch, self.onset_dict[key])
+ del self.key_dict[key]
+ if self.getPlayState():
+ if self.onset_dict.has_key(key):
+ del self.onset_dict[key]
+
+ def onButtonPress( self, widget, event ):
+ pass
diff --git a/TamTamMini.activity/Mini/Loop.py b/TamTamMini.activity/Mini/Loop.py
new file mode 100755
index 0000000..b36281e
--- /dev/null
+++ b/TamTamMini.activity/Mini/Loop.py
@@ -0,0 +1,210 @@
+import common.Config as Config
+import random
+import lps
+from common.Generation.Drunk import *
+from common.Util.CSoundNote import CSoundNote
+from common.Util.CSoundClient import new_csound_client
+from common.Util.NoteDB import Note
+from common.Util.NoteDB import PARAMETER
+from common.Generation.GenerationConstants import GenerationConstants
+
+class Loop:
+ def __init__( self, beat, volume ):
+ self.notesDict = {}
+ self.notesList = []
+ self.beat = beat
+ self.volume = volume
+ self.id = 4000
+ self.csnd = new_csound_client()
+
+ def stop( self, key ):
+ if (Config.DEBUG > 3): print 'stop loop at key: ' + str(key)
+ for n in self.notesDict[key]:
+ self.csnd.loopDelete(n)
+ del self.notesDict[key]
+ if (Config.DEBUG > 3): print self.notesDict
+
+ def start(self, key, instrument, reverb):
+ if self.notesDict.has_key(key):
+ return
+ self.notesList = []
+ for i in lps.LOOPS[key][self.beat-2]:
+ note = self.createCsNote(i, instrument, reverb)
+ n = Note(0, note.trackId, self.id, note)
+ self.notesList.append(n)
+ self.id = self.id + 1
+ self.csnd.loopPlay(n,1) #add as active
+ if (Config.DEBUG > 3): print 'play loop at key: ' + str(key)
+ self.notesDict[key] = self.notesList
+ if (Config.DEBUG > 3): print self.notesDict
+
+ def adjustLoopVolume(self, volume):
+ self.volume = volume
+ for k in self.notesDict.keys():
+ for n in self.notesDict[k]:
+ self.csnd.loopUpdate(n, PARAMETER.AMPLITUDE, n.cs.amplitude*self.volume, 1)
+
+ def createCsNote(self, i, instrument, reverb):
+ onset = i[0]
+ pitch = i[1]
+ gain = i[2]*self.volume
+ duration = i[3]
+ if Config.INSTRUMENTS[instrument].kit != None:
+ if GenerationConstants.DRUMPITCH.has_key(pitch):
+ pitch = GenerationConstants.DRUMPITCH[pitch]
+ instrument = Config.INSTRUMENTS[ instrument ].kit[pitch].name
+ pitch = 36
+ return CSoundNote( onset = onset,
+ pitch = pitch,
+ amplitude = gain,
+ pan = 0.5,
+ duration = duration,
+ trackId = 0,
+ instrumentId = Config.INSTRUMENTS[instrument].instrumentId,
+ reverbSend = reverb,
+ tied = False,
+ mode = 'mini')
+
+
+################ precompose all loops and write a dictionary #################
+
+ def precompose(self, maxbeat):
+ def makeGainSequence(onsetList):
+ gainSequence = []
+ append = gainSequence.append
+ for onset in onsetList:
+ if onset == 0:
+ gain = random.uniform(GenerationConstants.GAIN_MID_MAX_BOUNDARY, GenerationConstants.GAIN_MAX_BOUNDARY)
+ elif ( onset % Config.TICKS_PER_BEAT) == 0:
+ gain = random.uniform(GenerationConstants.GAIN_MID_MIN_BOUNDARY, GenerationConstants.GAIN_MID_MAX_BOUNDARY)
+ else:
+ gain = random.uniform(GenerationConstants.GAIN_MIN_BOUNDARY, GenerationConstants.GAIN_MID_MIN_BOUNDARY)
+ append(gain)
+ return gainSequence
+
+ def makeDurationSequence(onsetList, barLength):
+ durationSequence = []
+ append = durationSequence.append
+ if len( onsetList ) > 1:
+ for i in range(len(onsetList) - 1):
+ append((onsetList[i+1] - onsetList[i]))
+ append(( barLength - onsetList[-1]))
+ elif len( onsetList ) == 1:
+ append( ( barLength - onsetList[0] ))
+ return durationSequence
+
+ def makePitchSequence(length, pitchRegularity, step, table_pitch, pitchMethod):
+ pitchSequence = []
+ append = pitchSequence.append
+ numberOfPitch = int( ( 1 - (regularity*.8) ) * 10 + 1 )
+ step = -(8 - (int(step * 8)))
+ max = len(table_pitch)-1
+ nextValue = pitchMethod.getNextValue
+ tonique = GenerationConstants.DEFAULT_TONIQUE
+ for i in range(numberOfPitch):
+ append((table_pitch[nextValue(step, max)]) + tonique)
+ restOfNotes = range( length - numberOfPitch )
+ for i in restOfNotes:
+ position = i % numberOfPitch
+ append( pitchSequence[ position ] )
+ return pitchSequence
+
+
+ def makeRythmSequence(barLength, density, regularity ):
+ rythmSequence = [0, ]
+ self.count = 0
+ lastOnsetTime = 0
+ onsetLen = len(GenerationConstants.LOOP_TABLE_ONSET_VALUES)
+
+ onsetValue = int( ( 1 - density ) * onsetLen )
+ onsetDeviation = int( ( 1 - regularity ) * 20 )
+ currentOnsetValue = onsetValue + ( random.randint( 0, onsetDeviation ) - ( onsetDeviation / 2 ) )
+ if currentOnsetValue < 0:
+ currentOnsetValue = 0
+ elif currentOnsetValue > onsetLen:
+ currentOnsetValue = onsetLen
+ else:
+ currentOnsetValue = currentOnsetValue
+
+ onsetDelta = GenerationConstants.LOOP_TABLE_ONSET_VALUES[ currentOnsetValue ]
+ listLen = range( int( barLength / Config.TICKS_PER_BEAT * 8 ) )
+ randInt = random.randint
+ for i in listLen:
+ if self.count == 0:
+ currentOnsetValue = onsetValue + ( randInt( 0, onsetDeviation ) - ( onsetDeviation / 2 ) )
+ if currentOnsetValue < 0:
+ currentOnsetValue = 0
+ elif currentOnsetValue > onsetLen:
+ currentOnsetValue = onsetLen
+ else:
+ currentOnsetValue = currentOnsetValue
+ onsetDelta = GenerationConstants.LOOP_TABLE_ONSET_VALUES[ currentOnsetValue ]
+
+ if onsetDelta == GenerationConstants.DOUBLE_TICK_DUR:
+ if self.count < (GenerationConstants.DOUBLE_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
+
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength:
+ rythmSequence.append(onsetTime)
+ else:
+ break
+ return rythmSequence
+
+############ begin generate #####################
+ file = open(Config.TAM_TAM_ROOT + '/miniTamTam/lps.py', 'w')
+ file.write('LOOPS = {\n')
+
+ table_pitch = [-12, -10, -12, -7, -5, -4, -2, 0, 2, 0, 5, 7, 8, 10, 12]
+ table_density = [1., .92, .84, .76, .68, .6, .52, .46, .4, .46, .52, .6, .68, .76, .84, .95]
+ table_regularity = [1., .96, .9, .84, .78, .72, .66, .6, .54, .48, .42, .36, .3, .24, .18, .1]
+ table_pitchRegularity = [1., .96, .9, .84, .78, .72, .66, .6, .54, .48, .42, .36, .3, .24, .18, .1]
+ table_step = [2, 4, 3, 2, 4, 6, 5, 4, 6, 8, 7, 6, 8, 9, 8, 10]
+ table_pitchMethod = [0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3]
+
+ numKeys = len(Config.LOOP_KEYS)
+ for key in range(numKeys):
+ file.write(str(Config.LOOP_KEYS[key]) + ': [')
+ for beat in range(2, maxbeat+1):
+ density = table_density[key]
+ regularity = table_regularity[key]
+ pitchRegularity = table_pitchRegularity[key]
+ step = table_step[key]
+ pattern = table_pitchMethod[key]
+ if pattern == 0:
+ pitchMethod = Drunk( 5, 10 )
+ elif pattern == 1:
+ pitchMethod = DroneAndJump( 5, 10 )
+ elif pattern == 2:
+ pitchMethod = Repeter( 5, 10 )
+ elif pattern == 3:
+ pitchMethod = Loopseg( 5, 10 )
+
+ barLength = Config.TICKS_PER_BEAT * beat
+ loopList = []
+
+ rythmSequence = makeRythmSequence(barLength, density, regularity)
+ pitchSequence = makePitchSequence(len(rythmSequence), pitchRegularity, step, table_pitch, pitchMethod )
+ gainSequence = makeGainSequence(rythmSequence)
+ durationSequence = makeDurationSequence(rythmSequence, barLength)
+
+ for k in range(len(rythmSequence)):
+ loopList.append([rythmSequence[k], pitchSequence[k], gainSequence[k], durationSequence[k]])
+ if beat == maxbeat and key == (numKeys-1):
+ file.write(str(loopList) + ']\n')
+ elif beat != maxbeat:
+ file.write(str(loopList) + ',\n')
+ else:
+ file.write(str(loopList) + '],\n')
+ file.write('}')
+ file.close()
diff --git a/TamTamMini.activity/Mini/MiniSequencer.py b/TamTamMini.activity/Mini/MiniSequencer.py
new file mode 100644
index 0000000..991ee13
--- /dev/null
+++ b/TamTamMini.activity/Mini/MiniSequencer.py
@@ -0,0 +1,139 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import gobject
+import time
+import common.Config as Config
+from common.Util.CSoundNote import CSoundNote
+from common.Util.CSoundClient import new_csound_client
+from common.Util.NoteDB import Note
+from common.Util.NoteDB import PARAMETER
+
+class MiniSequencer:
+ def __init__( self, recordButtonState, recordOverSensitivity ):
+ self.notesList = []
+ self.sequencer = []
+ self.pitchs = []
+ self.beat = 4
+ self.volume = 0.5
+ self.tempo = Config.PLAYER_TEMPO
+ self.checkOk = 0
+ self.tick = 0
+ self.id = 1000
+ self.csnd = new_csound_client()
+ self.startLooking = 0
+ self.recordState = 0
+ self.startPoint = 0
+ self.recordButtonState = recordButtonState
+ self.recordOverSensitivity = recordOverSensitivity
+ self.playbackTimeout = None
+ self.playState = 0
+
+ def setTempo( self, tempo ):
+ self.tempo = tempo
+ gobject.source_remove( self.playBackTimeout )
+ self.playState = 0
+
+ def handleRecordButton( self, widget, data=None ):
+ if not self.startLooking:
+ if widget.get_active() == True and not self.recordState:
+ self.button = 1
+ self.recordOverSensitivity( True )
+ self.beats = [i*4 for i in range(self.beat)]
+ self.upBeats = [i+2 for i in self.beats]
+ self.realTick = [i for i in range(self.beat*4)]
+ self.clearSequencer()
+ self.startLooking = 1
+ self.startPlayback()
+
+ def handleOverButton( self, widget, data=None ):
+ if not self.startLooking:
+ if widget.get_active() == True and not self.recordState:
+ self.button = 2
+ self.startLooking = 1
+ self.startPlayback()
+
+ def clearSequencer( self, widget=None ):
+ for n in self.notesList:
+ self.csnd.loopDelete(n)
+ self.notesList = []
+
+ def getPlayState( self ):
+ return self.playState
+
+ def startPlayback( self ):
+ if not self.playState:
+ self.playbackTimeout = gobject.timeout_add( int(60000/self.tempo/12), self.handleClock )
+ self.handleClock()
+ self.playState = 1
+
+ def stopPlayback( self ):
+ if self.playbackTimeout != None:
+ gobject.source_remove( self.playbackTimeout )
+ self.playbackTimeout = None
+ self.playState = 0
+
+ def recording( self, note ):
+ if self.startLooking:
+ self.sequencer = []
+ self.pitchs = []
+ self.recordState = 1
+ self.startLooking = 0
+ self.recordButtonState(self.button, True)
+ self.startPoint = int(self.csnd.loopGetTick())
+ if self.startPoint == 0:
+ self.startPoint = self.beat * Config.TICKS_PER_BEAT - 1
+ if self.recordState:
+ self.pitchs.append( note.pitch )
+ self.sequencer.append( note )
+
+ def quantize( self, onset ):
+ if ( onset % 3 ) == 0:
+ return onset
+ elif ( onset % 3 ) == 1:
+ return ( onset // 3 ) * 3
+ elif ( onset % 3 ) == 2:
+ return ( ( onset // 3 ) + 1 ) * 3
+
+ def adjustDuration( self, pitch, onset ):
+ if pitch in self.pitchs:
+ offset = int(self.csnd.loopGetTick())
+ for note in self.sequencer:
+ if note.pitch == pitch and note.onset == onset:
+ if offset > note.onset:
+ note.duration = ( offset - note.onset ) + 4
+ else:
+ note.duration = ( (offset+(self.beat*Config.TICKS_PER_BEAT)) - note.onset ) + 4
+ note.onset = self.quantize( note.onset )
+ n = Note(0, note.trackId, self.id, note)
+ self.notesList.append(n)
+ self.id = self.id + 1
+ self.csnd.loopPlay(n,1) #add as active
+
+ self.pitchs.remove( pitch )
+
+ def adjustSequencerVolume(self, volume):
+ self.volume = volume
+ for n in self.notesList:
+ self.csnd.loopUpdate(n, PARAMETER.AMPLITUDE, n.cs.amplitude*self.volume, 1)
+
+ def handleClock( self ):
+ currentTick = int(self.csnd.loopGetTick())
+ t = currentTick / 3
+ if self.tick != t:
+ self.tick = t
+ if self.startLooking:
+ if self.tick in self.beats:
+ self.recordButtonState(self.button, True)
+ if self.tick in self.upBeats:
+ self.recordButtonState(self.button, False)
+
+ if self.recordState:
+ if currentTick < self.startPoint:
+ self.checkOk = 1
+ if currentTick >= self.startPoint and self.checkOk:
+ self.checkOk = 0
+ self.recordState = 0
+ self.recordButtonState(self.button, False)
+
+ return True
diff --git a/TamTamMini.activity/Mini/NoteStdAlone.py b/TamTamMini.activity/Mini/NoteStdAlone.py
new file mode 100644
index 0000000..0dd4638
--- /dev/null
+++ b/TamTamMini.activity/Mini/NoteStdAlone.py
@@ -0,0 +1,103 @@
+import common.Config as Config
+from common.Util.CSoundClient import CSoundClient
+from common.Generation.GenerationConstants import GenerationConstants
+
+class NoteStdAlone:
+ def __init__( self, client,
+ onset,
+ pitch,
+ amplitude,
+ pan,
+ duration,
+ trackId,
+ fullDuration = False,
+ instrument = Config.FLUTE,
+ attack = 0.005,
+ decay = 0.095,
+ reverbSend = 0.1,
+ filterType = 0,
+ filterCutoff = 1000,
+ tied = False,
+ overlap = False,
+ instrumentFlag = Config.FLUTE ):
+ self.csnd = client
+ self.onset = onset
+ self.pitch = pitch
+ self.amplitude = amplitude
+ self.pan = pan
+ self.duration = duration
+ self.trackId = trackId
+ self.instrument = instrument
+ self.fullDuration = fullDuration
+ self.attack = attack
+ self.decay = decay
+ self.reverbSend = reverbSend
+ self.filterType = filterType
+ self.filterCutoff = filterCutoff
+ self.tied = tied
+ self.overlap = overlap
+ if self.instrument == 'drum1kit':
+ self.instrumentFlag = Config.DRUM1INSTRUMENTS[ self.pitch ]
+ else:
+ self.instrumentFlag = self.instrument
+
+ def play( self ):
+ self.csnd.sendText( self.getText(120) )
+
+ def getText( self, tempo ):
+ if self.instrument[ 0: 4 ] == 'drum':
+ if GenerationConstants.DRUMPITCH.has_key( self.pitch ):
+ self.pitch = GenerationConstants.DRUMPITCH[ self.pitch ]
+
+ if self.instrument == 'drum1kit':
+ self.instrumentFlag = Config.DRUM1INSTRUMENTS[ self.pitch ]
+ if self.instrument == 'drum2kit':
+ self.instrumentFlag = Config.DRUM2INSTRUMENTS[ self.pitch ]
+ if self.instrument == 'drum3kit':
+ self.instrumentFlag = Config.DRUM3INSTRUMENTS[ self.pitch ]
+ newPitch = 1
+ else:
+ self.instrumentFlag = self.instrument
+ newPitch = pow( GenerationConstants.TWO_ROOT_TWELVE, self.pitch - 36 )
+
+ oneTickDuration = (Config.MS_PER_MINUTE / 1000) / tempo / Config.TICKS_PER_BEAT
+
+ newDuration = oneTickDuration * self.duration
+
+ # condition for tied notes
+ if Config.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentId == 101 and self.tied and self.fullDuration:
+ newDuration = -1
+ # condition for overlaped notes
+ if Config.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentId == 102 and self.overlap:
+ newDuration = oneTickDuration * self.duration + 1.
+
+ if True: newAmplitude = self.amplitude * 0.8
+ else : newAmplitude = self.amplitude * music_volume_get( self.trackId )
+
+ newAttack = newDuration * self.attack
+ if newAttack <= 0.002:
+ newAttack = 0.002
+
+ newDecay = newDuration * self.decay
+ if newDecay <= 0.002:
+ newDecay = 0.002
+
+ loopStart = Config.INSTRUMENTS[ self.instrumentFlag ].loopStart
+ loopEnd = Config.INSTRUMENTS[ self.instrumentFlag ].loopEnd
+ crossDur = Config.INSTRUMENTS[ self.instrumentFlag ].crossDur
+ return Config.PLAY_NOTE_COMMAND % ( Config.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentId,
+ self.trackId,
+ 0,
+ newDuration,
+ newPitch,
+ self.reverbSend,
+ newAmplitude,
+ self.pan,
+ Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ self.instrumentFlag ].instrumentId,
+ newAttack,
+ newDecay,
+ self.filterType,
+ self.filterCutoff,
+ loopStart,
+ loopEnd,
+ crossDur )
diff --git a/TamTamMini.activity/Mini/RythmGenerator.py b/TamTamMini.activity/Mini/RythmGenerator.py
new file mode 100644
index 0000000..537f598
--- /dev/null
+++ b/TamTamMini.activity/Mini/RythmGenerator.py
@@ -0,0 +1,77 @@
+import random
+
+import common.Config as Config
+from common.Util.CSoundNote import CSoundNote
+from common.Generation.GenerationConstants import GenerationConstants
+from GenRythm import GenRythm
+
+def generator( instrument, nbeats, density, regularity, reverbSend ):
+
+ makeRythm = GenRythm()
+
+ noteDuration = GenerationConstants.DOUBLE_TICK_DUR / 2
+ trackId = 5
+ pan = 0.5
+ attack = 0.005
+ decay = 0.095
+ filterType = 0
+ filterCutoff = 1000
+ tied = False
+ mode = 'mini'
+
+ def makePitchSequence(length, drumPitch):
+ pitchSequence = []
+ append = pitchSequence.append
+ list = range(length)
+ max = len(drumPitch) - 1
+ for i in list:
+ append(drumPitch[ random.randint( 0, max ) ] )
+ return pitchSequence
+
+ def makeGainSequence( onsetList ):
+ gainSequence = []
+ append = gainSequence.append
+ for onset in onsetList:
+ if onset == 0:
+ gain = random.uniform(GenerationConstants.GAIN_MID_MAX_BOUNDARY, GenerationConstants.GAIN_MAX_BOUNDARY)
+ elif ( onset % Config.TICKS_PER_BEAT) == 0:
+ gain = random.uniform(GenerationConstants.GAIN_MID_MIN_BOUNDARY, GenerationConstants.GAIN_MID_MAX_BOUNDARY)
+ else:
+ gain = random.uniform(GenerationConstants.GAIN_MIN_BOUNDARY, GenerationConstants.GAIN_MID_MIN_BOUNDARY)
+ append(gain)
+ return gainSequence
+
+ def pageGenerate( regularity, drumPitch ):
+ barLength = Config.TICKS_PER_BEAT * nbeats
+
+ #print 'pageGenerate drumPitch[0] ', drumPitch[0]
+ currentInstrument = Config.INSTRUMENTS[ instrument ].kit[ drumPitch[0] ].name
+
+ rythmSequence = makeRythm.drumRythmSequence(currentInstrument, nbeats, density, regularity)
+ pitchSequence = makePitchSequence(len(rythmSequence), drumPitch )
+ gainSequence = makeGainSequence(rythmSequence)
+
+ trackNotes = []
+ list = range(len(rythmSequence))
+ for i in list:
+ trackNotes.append( CSoundNote( rythmSequence[i], pitchSequence[i], gainSequence[i],
+ pan, noteDuration, trackId,
+ Config.INSTRUMENTS[instrument].instrumentId, attack,
+ decay, reverbSend, filterType, filterCutoff, tied, mode))
+ return trackNotes
+
+##################################################################################
+ # begin generate()
+ if regularity > 0.75:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY1
+ elif regularity > 0.5:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY2
+ elif regularity > 0.25:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY3
+ else:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY4
+
+ trackNotes = []
+ for drumPitch in streamOfPitch:
+ trackNotes.append(pageGenerate( regularity, drumPitch ))
+ return trackNotes
diff --git a/TamTamMini.activity/Mini/__init__.py b/TamTamMini.activity/Mini/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TamTamMini.activity/Mini/__init__.py
diff --git a/TamTamMini.activity/Mini/lps.py b/TamTamMini.activity/Mini/lps.py
new file mode 100755
index 0000000..b3c3aa8
--- /dev/null
+++ b/TamTamMini.activity/Mini/lps.py
@@ -0,0 +1,242 @@
+LOOPS = {
+17: [[[0, 34, 0.91843119391102157, 3], [3, 29, 0.66557397398580609, 3], [6, 34, 0.74069380274636654, 3], [9, 29, 0.73011336026847073, 3], [12, 34, 0.76424227490889152, 3], [15, 29, 0.73027362492984604, 3], [18, 34, 0.65773569328528614, 3], [21, 29, 0.68716281941809831, 3]],
+[[0, 32, 0.90350161334941659, 3], [3, 24, 0.74404055378568157, 3], [6, 32, 0.74323579104314119, 3], [9, 24, 0.73026101785761377, 3], [12, 32, 0.82564066817787785, 3], [15, 24, 0.71019876471482146, 3], [18, 32, 0.73703720538539641, 3], [21, 24, 0.72586200244648191, 3], [24, 32, 0.89346838667834039, 3], [27, 24, 0.6688220031077825, 3], [30, 32, 0.72447517622037272, 3], [33, 24, 0.71313223323927322, 3]],
+[[0, 41, 0.98493978103164381, 3], [3, 29, 0.72792048541450227, 3], [6, 41, 0.72930017355910615, 3], [9, 29, 0.7222293906157744, 3], [12, 41, 0.77214158570437674, 3], [15, 29, 0.74656945166968436, 3], [18, 41, 0.71994918422592669, 3], [21, 29, 0.65296466730336167, 3], [24, 41, 0.86548932085629293, 3], [27, 29, 0.72190994455740853, 3], [30, 41, 0.66445817032603671, 3], [33, 29, 0.65582254041511467, 3], [36, 41, 0.86288823205884557, 3], [39, 29, 0.70485424504749017, 3], [42, 41, 0.74949991272057725, 3], [45, 29, 0.74366606359847276, 3]],
+[[0, 26, 0.9209538754403952, 3], [3, 32, 0.7191358757020283, 3], [6, 26, 0.68816606744610742, 3], [9, 32, 0.70085543192049982, 3], [12, 26, 0.78074279603247598, 3], [15, 32, 0.71046570102178241, 3], [18, 26, 0.68220609744266758, 3], [21, 32, 0.68961180556278423, 3], [24, 26, 0.89235495450144287, 3], [27, 32, 0.73108765393595787, 3], [30, 26, 0.66145010684275285, 3], [33, 32, 0.71956089863127026, 3], [36, 26, 0.77770286704571423, 3], [39, 32, 0.67268162577259594, 3], [42, 26, 0.71422085398818524, 3], [45, 32, 0.73661198907206937, 3], [48, 26, 0.85268386577089572, 3], [51, 32, 0.68631312645239539, 3], [54, 26, 0.72994393067062868, 3], [57, 32, 0.70711912537539956, 3]],
+[[0, 38, 0.97737790621922072, 3], [3, 34, 0.71664569925045352, 3], [6, 38, 0.72532871185907688, 3], [9, 34, 0.68518148281936164, 3], [12, 38, 0.78925884580419003, 3], [15, 34, 0.69974203576026073, 3], [18, 38, 0.73715398854789072, 3], [21, 34, 0.68750831437785886, 3], [24, 38, 0.88144840071678221, 3], [27, 34, 0.69581579089244272, 3], [30, 38, 0.70333582484945179, 3], [33, 34, 0.70741457306014111, 3], [36, 38, 0.86425219747410853, 3], [39, 34, 0.73805060304671832, 3], [42, 38, 0.72754087855196004, 3], [45, 34, 0.65228065482349229, 3], [48, 38, 0.86104449070395883, 3], [51, 34, 0.74287398118701164, 3], [54, 38, 0.73738648278176078, 3], [57, 34, 0.65382138825928426, 3], [60, 38, 0.7633454002433121, 3], [63, 34, 0.70399019680859132, 3], [66, 38, 0.69274066551029645, 3], [69, 34, 0.70712790864283115, 3]],
+[[0, 29, 0.9553559145099455, 3], [3, 34, 0.65224509529059749, 3], [6, 29, 0.71157865209628857, 3], [9, 34, 0.70240500812668449, 3], [12, 29, 0.88616214885784961, 3], [15, 34, 0.73895635876951649, 3], [18, 29, 0.69755099539587506, 3], [21, 34, 0.65486918855381016, 3], [24, 29, 0.78336533925511442, 3], [27, 34, 0.70451467711099092, 3], [30, 29, 0.70812061038005636, 3], [33, 34, 0.66020821023721221, 3], [36, 29, 0.81117409691756392, 3], [39, 34, 0.70629416690338653, 3], [42, 29, 0.73610428492953328, 3], [45, 34, 0.67224868592999165, 3], [48, 29, 0.86358506491378484, 3], [51, 34, 0.70207585661769767, 3], [54, 29, 0.72165965378924424, 3], [57, 34, 0.73464600760895349, 3], [60, 29, 0.76646135730852416, 3], [63, 34, 0.7002474528709377, 3], [66, 29, 0.71362336661016657, 3], [69, 34, 0.6757466245495779, 3], [72, 29, 0.76143897535892247, 3], [75, 34, 0.68217145739800344, 3], [78, 29, 0.74893405173379535, 3], [81, 34, 0.68170173360898101, 3]],
+[[0, 46, 0.97552266177916414, 3], [3, 46, 0.69986456113843698, 3], [6, 46, 0.69920435077044829, 3], [9, 46, 0.68740449998560882, 3], [12, 46, 0.88277391580708886, 3], [15, 46, 0.66925646894688273, 3], [18, 46, 0.74770620434689916, 3], [21, 46, 0.67135592880972694, 3], [24, 46, 0.89774664547381655, 3], [27, 46, 0.69928909955820906, 3], [30, 46, 0.68586466042006333, 3], [33, 46, 0.70895768943399751, 3], [36, 46, 0.84986669051226882, 3], [39, 46, 0.69793940684844358, 3], [42, 46, 0.6857910200277757, 3], [45, 46, 0.7027226374974711, 3], [48, 46, 0.83941134712876864, 3], [51, 46, 0.68083838722102341, 3], [54, 46, 0.65984033342204407, 3], [57, 46, 0.672590746789269, 3], [60, 46, 0.78609392331073746, 3], [63, 46, 0.6701865146944902, 3], [66, 46, 0.65883357444463531, 3], [69, 46, 0.66052134903071158, 3], [72, 46, 0.79184461812687923, 3], [75, 46, 0.70456329331096756, 3], [78, 46, 0.74654736852481196, 3], [81, 46, 0.66733452245976943, 3], [84, 46, 0.77157082412778433, 3], [87, 46, 0.70080352704958349, 3], [90, 46, 0.74979144436734291, 3], [93, 46, 0.70122642685542769, 3]],
+[[0, 46, 0.91932873393188252, 3], [3, 46, 0.71321659243671531, 3], [6, 46, 0.69059282145586165, 3], [9, 46, 0.65981195427017847, 3], [12, 46, 0.76030046411551888, 3], [15, 46, 0.74796721544405365, 3], [18, 46, 0.74057924055206414, 3], [21, 46, 0.66775250665453612, 3], [24, 46, 0.78281128191107929, 3], [27, 46, 0.69803584249894335, 3], [30, 46, 0.69895782528552974, 3], [33, 46, 0.723529751804181, 3], [36, 46, 0.80851570969064313, 3], [39, 46, 0.67139974267760627, 3], [42, 46, 0.72305899861262568, 3], [45, 46, 0.68945043870105571, 3], [48, 46, 0.75610316508036135, 3], [51, 46, 0.71823308483606174, 3], [54, 46, 0.66865797792771575, 3], [57, 46, 0.74657517001426033, 3], [60, 46, 0.87044953529572178, 3], [63, 46, 0.7130297562104132, 3], [66, 46, 0.71351325060250659, 3], [69, 46, 0.69019654834356781, 3], [72, 46, 0.83474178641883123, 3], [75, 46, 0.74929800588928508, 3], [78, 46, 0.68958541192891742, 3], [81, 46, 0.74928116715885551, 3], [84, 46, 0.88840328031723259, 3], [87, 46, 0.65862046873085311, 3], [90, 46, 0.70878836088886332, 3], [93, 46, 0.73885958288345677, 3], [96, 46, 0.85247737085377939, 3], [99, 46, 0.6783759890234814, 3], [102, 46, 0.6825784264775937, 3], [105, 46, 0.738542711969846, 3]],
+[[0, 31, 0.94776975142287834, 3], [3, 41, 0.65590177297158159, 3], [6, 31, 0.65337976704789735, 3], [9, 41, 0.73408902426583011, 3], [12, 31, 0.84968220502602998, 3], [15, 41, 0.70095191213245678, 3], [18, 31, 0.74876524478508144, 3], [21, 41, 0.69533166848117667, 3], [24, 31, 0.85332557823377264, 3], [27, 41, 0.73955678051059492, 3], [30, 31, 0.7252274828939308, 3], [33, 41, 0.7032040738565718, 3], [36, 31, 0.78158754870669478, 3], [39, 41, 0.72361628589076143, 3], [42, 31, 0.71439844284783904, 3], [45, 41, 0.69894336744910734, 3], [48, 31, 0.8106183090724538, 3], [51, 41, 0.70613671246994514, 3], [54, 31, 0.69530745092939739, 3], [57, 41, 0.73359899948360163, 3], [60, 31, 0.89516116030556148, 3], [63, 41, 0.7090745940640214, 3], [66, 31, 0.6884971156573102, 3], [69, 41, 0.74782082130824079, 3], [72, 31, 0.83716873320941154, 3], [75, 41, 0.72114893479035447, 3], [78, 31, 0.68677684180105225, 3], [81, 41, 0.66642756025084182, 3], [84, 31, 0.80013804508992159, 3], [87, 41, 0.68693476263098707, 3], [90, 31, 0.66028364009529072, 3], [93, 41, 0.66229596381452704, 3], [96, 31, 0.88127393320261094, 3], [99, 41, 0.73074370583503645, 3], [102, 31, 0.66781201866137407, 3], [105, 41, 0.66545630618869744, 3], [108, 31, 0.75361150079657258, 3], [111, 41, 0.71854024397575067, 3], [114, 31, 0.72973386512808813, 3], [117, 41, 0.66432200189141311, 3]],
+[[0, 36, 0.98068641760396869, 3], [3, 36, 0.7087581726036245, 3], [6, 36, 0.73999909050052226, 3], [9, 36, 0.66058393549418448, 3], [12, 36, 0.77292030332125072, 3], [15, 36, 0.74928587658650037, 3], [18, 36, 0.73332890611996115, 3], [21, 36, 0.67888400552814432, 3], [24, 36, 0.82060696293857305, 3], [27, 36, 0.66036967490951815, 3], [30, 36, 0.73419017150661336, 3], [33, 36, 0.6664381430435613, 3], [36, 36, 0.85067121782355692, 3], [39, 36, 0.73011586871926704, 3], [42, 36, 0.65481380650717536, 3], [45, 36, 0.66578703136289474, 3], [48, 36, 0.76056215071595079, 3], [51, 36, 0.72235630871144041, 3], [54, 36, 0.72422860004193734, 3], [57, 36, 0.71143393824413537, 3], [60, 36, 0.85734534202384116, 3], [63, 36, 0.66017915357256374, 3], [66, 36, 0.67171228226548818, 3], [69, 36, 0.71272669092748564, 3], [72, 36, 0.8315199331948937, 3], [75, 36, 0.69174347595086216, 3], [78, 36, 0.72788282047363517, 3], [81, 36, 0.69392643322409353, 3], [84, 36, 0.79770454659537937, 3], [87, 36, 0.72739460247920895, 3], [90, 36, 0.67048753950153672, 3], [93, 36, 0.72736539131030409, 3], [96, 36, 0.80285116841828175, 3], [99, 36, 0.713718809999492, 3], [102, 36, 0.73880912377713248, 3], [105, 36, 0.68062980566222953, 3], [108, 36, 0.75214765954225038, 3], [111, 36, 0.6981475157815108, 3], [114, 36, 0.68829052906441512, 3], [117, 36, 0.71685831080048168, 3], [120, 36, 0.75248202994273161, 3], [123, 36, 0.72214570567114489, 3], [126, 36, 0.71084553127838324, 3], [129, 36, 0.65197071023926312, 3]],
+[[0, 46, 0.90280678713865126, 3], [3, 32, 0.67395093764164715, 3], [6, 46, 0.73109179842106886, 3], [9, 32, 0.67170914331957565, 3], [12, 46, 0.80307077663550952, 3], [15, 32, 0.73129358320657789, 3], [18, 46, 0.71903360938852634, 3], [21, 32, 0.7248234653347696, 3], [24, 46, 0.81714859690272912, 3], [27, 32, 0.66348355767076483, 3], [30, 46, 0.67016212651490314, 3], [33, 32, 0.66154132833276358, 3], [36, 46, 0.88048058164239262, 3], [39, 32, 0.6890403995494504, 3], [42, 46, 0.73418414850798452, 3], [45, 32, 0.749772789108889, 3], [48, 46, 0.84890407655338507, 3], [51, 32, 0.65268531302671839, 3], [54, 46, 0.73129437939088149, 3], [57, 32, 0.72989177801115146, 3], [60, 46, 0.85554234610943947, 3], [63, 32, 0.69025635663809293, 3], [66, 46, 0.65272676456968093, 3], [69, 32, 0.70601800003449144, 3], [72, 46, 0.75941955733003041, 3], [75, 32, 0.70531362992122248, 3], [78, 46, 0.70793039214726661, 3], [81, 32, 0.7365052564921184, 3], [84, 46, 0.75567849777664398, 3], [87, 32, 0.70811048770262452, 3], [90, 46, 0.73216776268556005, 3], [93, 32, 0.68187859580205246, 3], [96, 46, 0.82545401413391595, 3], [99, 32, 0.66695370191476799, 3], [102, 46, 0.73641117798869293, 3], [105, 32, 0.74101257223922112, 3], [108, 46, 0.87195002931605747, 3], [111, 32, 0.74482451358298352, 3], [114, 46, 0.66132022723666595, 3], [117, 32, 0.65565430253830792, 3], [120, 46, 0.79306575515647193, 3], [123, 32, 0.72800781978306695, 3], [126, 46, 0.72030742526565961, 3], [129, 32, 0.71176978526356594, 3], [132, 46, 0.79068051095915104, 3], [135, 32, 0.72962608505954019, 3], [138, 46, 0.66901942227248201, 3], [141, 32, 0.68098356883561206, 3]],
+[[0, 24, 0.94996784213780716, 3], [3, 24, 0.71282116076692614, 3], [6, 24, 0.71871672529819786, 3], [9, 24, 0.66273047469727364, 3], [12, 24, 0.766507966649846, 3], [15, 24, 0.69353990056816539, 3], [18, 24, 0.69938860941518211, 3], [21, 24, 0.74598532159248276, 3], [24, 24, 0.81294051419026536, 3], [27, 24, 0.73917500448603701, 3], [30, 24, 0.73681950265708818, 3], [33, 24, 0.69273172587524134, 3], [36, 24, 0.86922807695844395, 3], [39, 24, 0.72763792224268364, 3], [42, 24, 0.73950073663749138, 3], [45, 24, 0.69387556505269421, 3], [48, 24, 0.89848698451539277, 3], [51, 24, 0.6642855396985583, 3], [54, 24, 0.6953886068113142, 3], [57, 24, 0.73159770052310524, 3], [60, 24, 0.83500844769724591, 3], [63, 24, 0.71347376140571228, 3], [66, 24, 0.69196630602724796, 3], [69, 24, 0.65183324905576068, 3], [72, 24, 0.82198645068199483, 3], [75, 24, 0.69589915382384626, 3], [78, 24, 0.70111834688348473, 3], [81, 24, 0.67827302553147273, 3], [84, 24, 0.88450178396412449, 3], [87, 24, 0.7343604369087634, 3], [90, 24, 0.6827419001291879, 3], [93, 24, 0.73930446848684306, 3], [96, 24, 0.79120977614291588, 3], [99, 24, 0.70891952101331734, 3], [102, 24, 0.65553023868092064, 3], [105, 24, 0.68977243408292255, 3], [108, 24, 0.77703598487780079, 3], [111, 24, 0.69538143527301099, 3], [114, 24, 0.68306239968458615, 3], [117, 24, 0.74317390320358623, 3], [120, 24, 0.80334349366584712, 3], [123, 24, 0.68405445266280651, 3], [126, 24, 0.66659853120983548, 3], [129, 24, 0.71501227960244906, 3], [132, 24, 0.82324897961345989, 3], [135, 24, 0.70431450253673944, 3], [138, 24, 0.667598228369227, 3], [141, 24, 0.7230375182466019, 3], [144, 24, 0.79965565220353951, 3], [147, 24, 0.73817545621760028, 3], [150, 24, 0.7440681955330154, 3], [153, 24, 0.7228687635049964, 3]],
+[[0, 24, 0.99966154454043432, 3], [3, 36, 0.72418981430429774, 3], [6, 24, 0.70518891566238151, 3], [9, 36, 0.69807416917517928, 3], [12, 24, 0.79855094267840476, 3], [15, 36, 0.73561616111895778, 3], [18, 24, 0.70810061059214147, 3], [21, 36, 0.68153876715530248, 3], [24, 24, 0.76427434335396438, 3], [27, 36, 0.70006637530314653, 3], [30, 24, 0.73615450050080466, 3], [33, 36, 0.68792120830514814, 3], [36, 24, 0.76588204089615519, 3], [39, 36, 0.67574733551391175, 3], [42, 24, 0.65061915087821531, 3], [45, 36, 0.69092660922113514, 3], [48, 24, 0.85249527480752418, 3], [51, 36, 0.72230801799116062, 3], [54, 24, 0.73274518894797158, 3], [57, 36, 0.66329666666212961, 3], [60, 24, 0.75175967538048838, 3], [63, 36, 0.67622270427738218, 3], [66, 24, 0.72583832150850824, 3], [69, 36, 0.6917055364091359, 3], [72, 24, 0.78348574978638708, 3], [75, 36, 0.73000322507677406, 3], [78, 24, 0.73063779629050585, 3], [81, 36, 0.65402740075456278, 3], [84, 24, 0.80011577068599138, 3], [87, 36, 0.71303511836768496, 3], [90, 24, 0.6934017049718888, 3], [93, 36, 0.70343131927951874, 3], [96, 24, 0.78259572323155779, 3], [99, 36, 0.72858981621488073, 3], [102, 24, 0.7481560231694101, 3], [105, 36, 0.68755827931530411, 3], [108, 24, 0.88206819747354581, 3], [111, 36, 0.72616984943512353, 3], [114, 24, 0.74256950141685751, 3], [117, 36, 0.66158134924215217, 3], [120, 24, 0.76246240828234202, 3], [123, 36, 0.74856742595044767, 3], [126, 24, 0.68420976932639477, 3], [129, 36, 0.66434498040744627, 3], [132, 24, 0.81473844231294035, 3], [135, 36, 0.7131631978481362, 3], [138, 24, 0.73930693395247316, 3], [141, 36, 0.65070235342238492, 3], [144, 24, 0.84393407785915298, 3], [147, 36, 0.7394095318691658, 3], [150, 24, 0.70080455363741645, 3], [153, 36, 0.70464392031853151, 3], [156, 24, 0.8525907875365486, 3], [159, 36, 0.726693437214738, 3], [162, 24, 0.74428130134819526, 3], [165, 36, 0.65639627649148768, 3]],
+[[0, 43, 0.96932979317400125, 3], [3, 48, 0.72174357367422148, 3], [6, 43, 0.67568473222070091, 3], [9, 48, 0.67902133423992483, 3], [12, 43, 0.77530901011594411, 3], [15, 48, 0.65763043577326386, 3], [18, 43, 0.72235842039905918, 3], [21, 48, 0.73049883177095876, 3], [24, 43, 0.84674159070444155, 3], [27, 48, 0.68140428605264913, 3], [30, 43, 0.70876217651075257, 3], [33, 48, 0.71138176998035574, 3], [36, 43, 0.81157816581707343, 3], [39, 48, 0.72597690885886701, 3], [42, 43, 0.65859686769784942, 3], [45, 48, 0.67944998870694162, 3], [48, 43, 0.78805682820876111, 3], [51, 48, 0.72573389983179815, 3], [54, 43, 0.72752262764470577, 3], [57, 48, 0.71254422734755252, 3], [60, 43, 0.81410989190505889, 3], [63, 48, 0.74347871298751889, 3], [66, 43, 0.65280748129230837, 3], [69, 48, 0.734768604573383, 3], [72, 43, 0.8660114662893712, 3], [75, 48, 0.67310548891235633, 3], [78, 43, 0.65811503908707281, 3], [81, 48, 0.73069394322859826, 3], [84, 43, 0.81497037169863573, 3], [87, 48, 0.66833091293351143, 3], [90, 43, 0.66290555752105784, 3], [93, 48, 0.73975604912512694, 3], [96, 43, 0.85298710843815095, 3], [99, 48, 0.72481474740676421, 3], [102, 43, 0.71748055944001021, 3], [105, 48, 0.66779334973360249, 3], [108, 43, 0.88148481633884068, 3], [111, 48, 0.70970250344499031, 3], [114, 43, 0.66045623145991794, 3], [117, 48, 0.70323316891770704, 3], [120, 43, 0.75633466439463315, 3], [123, 48, 0.7445744239461779, 3], [126, 43, 0.71390527840946916, 3], [129, 48, 0.65618291702082587, 3], [132, 43, 0.84268279604292473, 3], [135, 48, 0.68148552249145045, 3], [138, 43, 0.7058720811582202, 3], [141, 48, 0.7050479148335731, 3], [144, 43, 0.8114068029400161, 3], [147, 48, 0.68990423286144009, 3], [150, 43, 0.67216246535605217, 3], [153, 48, 0.65316101456349407, 3], [156, 43, 0.81678837823150263, 3], [159, 48, 0.69329211099146271, 3], [162, 43, 0.72741608592838003, 3], [165, 48, 0.68352397512556962, 3], [168, 43, 0.85539312382434651, 3], [171, 48, 0.67189211679880723, 3], [174, 43, 0.68223496609823819, 3], [177, 48, 0.73544014586003525, 3]],
+[[0, 43, 0.90070611794486921, 3], [3, 34, 0.74282268176871691, 3], [6, 43, 0.68756710950549593, 3], [9, 34, 0.71555053212403752, 3], [12, 43, 0.76034242153260345, 3], [15, 34, 0.67730951568915243, 3], [18, 43, 0.69867346554167542, 3], [21, 34, 0.72558397880899772, 3], [24, 43, 0.85196281806864038, 3], [27, 34, 0.71570624740986799, 3], [30, 43, 0.73508694738983504, 3], [33, 34, 0.69032090145731495, 3], [36, 43, 0.87437358820505495, 3], [39, 34, 0.67342402729972539, 3], [42, 43, 0.69178382616826939, 3], [45, 34, 0.65336233070370653, 3], [48, 43, 0.85800776964317116, 3], [51, 34, 0.69188256970622852, 3], [54, 43, 0.73181839013005545, 3], [57, 34, 0.70770196933922702, 3], [60, 43, 0.83915983734872024, 3], [63, 34, 0.65217804226086096, 3], [66, 43, 0.73448277533520967, 3], [69, 34, 0.73179836697977318, 3], [72, 43, 0.87487891765990311, 3], [75, 34, 0.67044362226809739, 3], [78, 43, 0.70264371065192099, 3], [81, 34, 0.71179057931519618, 3], [84, 43, 0.8740242335524433, 3], [87, 34, 0.69210335033522996, 3], [90, 43, 0.73057490552554627, 3], [93, 34, 0.65742593937409655, 3], [96, 43, 0.897216068824921, 3], [99, 34, 0.67552534074440329, 3], [102, 43, 0.74842407010643885, 3], [105, 34, 0.72578731701562393, 3], [108, 43, 0.84346855188787839, 3], [111, 34, 0.74231512292010116, 3], [114, 43, 0.67456721807401698, 3], [117, 34, 0.70819009938384825, 3], [120, 43, 0.81123700980151492, 3], [123, 34, 0.72871523616383049, 3], [126, 43, 0.74519955954895623, 3], [129, 34, 0.70862154181656833, 3], [132, 43, 0.77956677877797065, 3], [135, 34, 0.7194435062283101, 3], [138, 43, 0.74730077767578429, 3], [141, 34, 0.73315911209236784, 3], [144, 43, 0.75119069282266837, 3], [147, 34, 0.72228001165625955, 3], [150, 43, 0.69583937906463833, 3], [153, 34, 0.72087765015931737, 3], [156, 43, 0.80052711545829425, 3], [159, 34, 0.67415900077645352, 3], [162, 43, 0.71667846452839012, 3], [165, 34, 0.73559050106293478, 3], [168, 43, 0.88190771301091475, 3], [171, 34, 0.70108873146445061, 3], [174, 43, 0.74833356473128465, 3], [177, 34, 0.74947652198211712, 3], [180, 43, 0.81158745527123677, 3], [183, 34, 0.71436322179635559, 3], [186, 43, 0.69504136381694614, 3], [189, 34, 0.69881967450638305, 3]]],
+18: [[[0, 31, 0.91414618042602414, 6], [6, 24, 0.71298982497012386, 6], [12, 32, 0.81303870130608091, 6], [18, 31, 0.70146204478484941, 6]],
+[[0, 24, 0.97420972018144714, 6], [6, 31, 0.65348467360822149, 6], [12, 26, 0.77999759911164923, 6], [18, 24, 0.71499756985534457, 6], [24, 31, 0.76545679617275186, 6], [30, 26, 0.72464043627105301, 6]],
+[[0, 32, 0.96839746371031044, 6], [6, 24, 0.7383135519270827, 6], [12, 26, 0.83678727084047755, 6], [18, 32, 0.68084753804273135, 6], [24, 24, 0.89662063033423611, 6], [30, 26, 0.72027994167313425, 6], [36, 32, 0.88742383921005208, 6], [42, 24, 0.73401091932155238, 6]],
+[[0, 26, 0.96443993724085353, 6], [6, 26, 0.70614731515727813, 6], [12, 26, 0.86340896185180149, 6], [18, 26, 0.74664344369869817, 6], [24, 26, 0.86543903819381884, 6], [30, 26, 0.70031407028854142, 6], [36, 26, 0.80326482970805313, 6], [42, 26, 0.70401718046397721, 6], [48, 26, 0.81717235550659439, 6], [54, 26, 0.73439827435161797, 6]],
+[[0, 26, 0.93948955420019553, 6], [6, 48, 0.65732513243916579, 6], [12, 46, 0.88186182846858496, 6], [18, 26, 0.70620376639714333, 6], [24, 48, 0.89829471318820886, 6], [30, 46, 0.70047567652877019, 6], [36, 26, 0.81028053931891619, 6], [42, 48, 0.6945929689786895, 6], [48, 46, 0.82544710578597713, 6], [54, 26, 0.68096995635386004, 6], [60, 48, 0.7948285180804705, 6], [66, 46, 0.72425718868680433, 6]],
+[[0, 41, 0.92057821058714318, 6], [6, 44, 0.65222437973498593, 6], [12, 24, 0.78839760337611409, 6], [18, 41, 0.66331590721149958, 6], [24, 44, 0.79211585725194678, 6], [30, 24, 0.67054673328728542, 6], [36, 41, 0.86212326778691173, 6], [42, 44, 0.69940801572645628, 6], [48, 24, 0.83188758283454201, 6], [54, 41, 0.74770707328981179, 6], [60, 44, 0.85141841724608025, 6], [66, 24, 0.74140482326703583, 6], [72, 41, 0.87846458088135293, 6], [78, 44, 0.73968773189193271, 6]],
+[[0, 41, 0.94009838336255835, 6], [6, 24, 0.74321383382950013, 6], [12, 24, 0.86544259358995879, 6], [18, 41, 0.67390648995027747, 6], [24, 24, 0.81848211684852012, 6], [30, 24, 0.72188229872365828, 6], [36, 41, 0.81199373434272537, 6], [42, 24, 0.73862007747014657, 6], [48, 24, 0.78500136053179559, 6], [54, 41, 0.74262644148484658, 6], [60, 24, 0.87569372608219065, 6], [66, 24, 0.72781277908185293, 6], [72, 41, 0.88136371399873692, 6], [78, 24, 0.68464806384325505, 6], [84, 24, 0.81710953214328508, 6], [90, 41, 0.73295279908643851, 6]],
+[[0, 38, 0.95847151264927133, 6], [6, 38, 0.72675011545177171, 6], [12, 46, 0.88872965225929113, 6], [18, 38, 0.67495323003089802, 6], [24, 38, 0.77612948128315384, 6], [30, 46, 0.66215329978950488, 6], [36, 38, 0.82684692918756486, 6], [42, 38, 0.73556518773644564, 6], [48, 46, 0.83193093370565208, 6], [54, 38, 0.72003903534059566, 6], [60, 38, 0.77075151079904158, 6], [66, 46, 0.66929193857581626, 6], [72, 38, 0.82784830145602162, 6], [78, 38, 0.67455784048709766, 6], [84, 46, 0.86308083323833107, 6], [90, 38, 0.7482013005918986, 6], [96, 38, 0.75696777108937152, 6], [102, 46, 0.74637868553636455, 6]],
+[[0, 36, 0.92447775497671825, 6], [6, 48, 0.74898108333582325, 6], [12, 29, 0.78663337787438081, 6], [18, 36, 0.65611981652688578, 6], [24, 48, 0.8105687254909405, 6], [30, 29, 0.74161952353006511, 6], [36, 36, 0.86338804652305545, 6], [42, 48, 0.69244908097989222, 6], [48, 29, 0.78251088805851521, 6], [54, 36, 0.65973106118254299, 6], [60, 48, 0.87082007465301114, 6], [66, 29, 0.72185529587579123, 6], [72, 36, 0.76260547137057366, 6], [78, 48, 0.71322132319309894, 6], [84, 29, 0.8698480505616164, 6], [90, 36, 0.74330892636732815, 6], [96, 48, 0.75737903656665917, 6], [102, 29, 0.70274783895554316, 6], [108, 36, 0.88525634845631163, 6], [114, 48, 0.67840890071368631, 6]],
+[[0, 36, 0.99295245890118389, 6], [6, 38, 0.65655867395509682, 6], [12, 41, 0.81092730969330673, 6], [18, 36, 0.74755276683545802, 6], [24, 38, 0.80157940166642683, 6], [30, 41, 0.7064467513123267, 6], [36, 36, 0.85549444601390323, 6], [42, 38, 0.65451918363439476, 6], [48, 41, 0.81854341475983905, 6], [54, 36, 0.69039973128191101, 6], [60, 38, 0.88866133699943328, 6], [66, 41, 0.73502888347862672, 6], [72, 36, 0.8062119553326883, 6], [78, 38, 0.72921143414383771, 6], [84, 41, 0.86630353159134776, 6], [90, 36, 0.68782836978771866, 6], [96, 38, 0.80356547921222932, 6], [102, 41, 0.69164971959839694, 6], [108, 36, 0.88119058150873397, 6], [114, 38, 0.67792047941432731, 6], [120, 41, 0.8623603156626285, 6], [126, 36, 0.7304323057199329, 6]],
+[[0, 46, 0.94455882891483811, 6], [6, 32, 0.6810109373883827, 6], [12, 26, 0.87276983732939439, 6], [18, 46, 0.73947851796835629, 6], [24, 32, 0.78333238100616298, 6], [30, 26, 0.69772457494512086, 6], [36, 46, 0.78120313282331566, 6], [42, 32, 0.74411907655668541, 6], [48, 26, 0.83798882293933119, 6], [54, 46, 0.68423534706676037, 6], [60, 32, 0.81270950196556724, 6], [66, 26, 0.68382277221523335, 6], [72, 46, 0.79647688385855819, 6], [78, 32, 0.74788918762374357, 6], [84, 26, 0.8793117655163567, 6], [90, 46, 0.72417061948939387, 6], [96, 32, 0.86054454376731371, 6], [102, 26, 0.7053740118504882, 6], [108, 46, 0.87171422383591191, 6], [114, 32, 0.67032848719549132, 6], [120, 26, 0.83949593519135435, 6], [126, 46, 0.71247187183526028, 6], [132, 32, 0.78113447005843439, 6], [138, 26, 0.66411769371662599, 6]],
+[[0, 26, 0.90565978750069465, 6], [6, 24, 0.67681864236441625, 6], [12, 36, 0.78586352121137937, 6], [18, 26, 0.71662389509200997, 6], [24, 24, 0.81836354230284503, 6], [30, 36, 0.66640355255582384, 6], [36, 26, 0.80442025759528168, 6], [42, 24, 0.67140460828688076, 6], [48, 36, 0.89157511528241817, 6], [54, 26, 0.71753496307853903, 6], [60, 24, 0.78986310628124778, 6], [66, 36, 0.7001842582953044, 6], [72, 26, 0.80250928733914095, 6], [78, 24, 0.67802578112400336, 6], [84, 36, 0.88866503232395422, 6], [90, 26, 0.68689690864617647, 6], [96, 24, 0.75556326417677289, 6], [102, 36, 0.65608272171718496, 6], [108, 26, 0.8426217626322362, 6], [114, 24, 0.67980098180445103, 6], [120, 36, 0.87918556644956747, 6], [126, 26, 0.71480632484083184, 6], [132, 24, 0.76449998432112509, 6], [138, 36, 0.72310965206758104, 6], [144, 26, 0.8147357033027981, 6], [150, 24, 0.72242852551843351, 6]],
+[[0, 32, 0.9891347085579848, 6], [6, 36, 0.73948461475056693, 6], [12, 36, 0.84663465433464979, 6], [18, 32, 0.71105824965696485, 6], [24, 36, 0.85158941097494467, 6], [30, 36, 0.69583467680036515, 6], [36, 32, 0.75897954529379597, 6], [42, 36, 0.70952493107413617, 6], [48, 36, 0.81384898433683095, 6], [54, 32, 0.71840608920653048, 6], [60, 36, 0.75884114227416599, 6], [66, 36, 0.6568825801183944, 6], [72, 32, 0.80931947506039315, 6], [78, 36, 0.66498770263468931, 6], [84, 36, 0.88957526419840982, 6], [90, 32, 0.67516181964593269, 6], [96, 36, 0.87455783664068143, 6], [102, 36, 0.70414890031389965, 6], [108, 32, 0.81041903265786275, 6], [114, 36, 0.74647617019814616, 6], [120, 36, 0.80494267638514438, 6], [126, 32, 0.68439575086321569, 6], [132, 36, 0.83772021370581284, 6], [138, 36, 0.7207547932256424, 6], [144, 32, 0.84417151210749997, 6], [150, 36, 0.67110055897756804, 6], [156, 36, 0.85180644696505547, 6], [162, 32, 0.70408297062537373, 6]],
+[[0, 36, 0.94589750324498256, 6], [6, 31, 0.70650683889275501, 6], [12, 34, 0.89678386444311187, 6], [18, 36, 0.7116444156767342, 6], [24, 31, 0.89796917050081404, 6], [30, 34, 0.65024508188908459, 6], [36, 36, 0.8008470032993964, 6], [42, 31, 0.68252737723740464, 6], [48, 34, 0.85843801756684446, 6], [54, 36, 0.68629079690778361, 6], [60, 31, 0.80946932600696209, 6], [66, 34, 0.73490689580634017, 6], [72, 36, 0.89175551635831085, 6], [78, 31, 0.69913107125809237, 6], [84, 34, 0.81483156589591899, 6], [90, 36, 0.73517468116067142, 6], [96, 31, 0.82596648659422511, 6], [102, 34, 0.74675078788427196, 6], [108, 36, 0.77790562228419935, 6], [114, 31, 0.67204065617652731, 6], [120, 34, 0.76399141844249108, 6], [126, 36, 0.65249573238827652, 6], [132, 31, 0.86095508523032638, 6], [138, 34, 0.65472001970391147, 6], [144, 36, 0.77812733868646256, 6], [150, 31, 0.68510817247022471, 6], [156, 34, 0.88989614259769378, 6], [162, 36, 0.73552798134010744, 6], [168, 31, 0.76926192377091696, 6], [174, 34, 0.74873584937582416, 6]],
+[[0, 36, 0.94710018697646181, 6], [6, 36, 0.72684070002106593, 6], [12, 24, 0.85379997602992486, 6], [18, 36, 0.70912352509215126, 6], [24, 36, 0.82986901252819634, 6], [30, 24, 0.70840303930267656, 6], [36, 36, 0.80164657570930964, 6], [42, 36, 0.73841986592218956, 6], [48, 24, 0.80721952126894747, 6], [54, 36, 0.68374162078322098, 6], [60, 36, 0.77333538062365392, 6], [66, 24, 0.69864655313561985, 6], [72, 36, 0.86252711987885078, 6], [78, 36, 0.7448207834776871, 6], [84, 24, 0.85545685230388446, 6], [90, 36, 0.66720136156626852, 6], [96, 36, 0.76588239857602491, 6], [102, 24, 0.66745273686057272, 6], [108, 36, 0.78249428968569967, 6], [114, 36, 0.67057374235540768, 6], [120, 24, 0.85316687911401845, 6], [126, 36, 0.67726681032408231, 6], [132, 36, 0.88903529313140184, 6], [138, 24, 0.6519536663260781, 6], [144, 36, 0.76972252753882509, 6], [150, 36, 0.68471346262760124, 6], [156, 24, 0.88373813895967146, 6], [162, 36, 0.69987876485566869, 6], [168, 36, 0.85836647298749191, 6], [174, 24, 0.71623382999520202, 6], [180, 36, 0.85712602985806086, 6], [186, 36, 0.7496672794348419, 6]]],
+19: [[[0, 34, 0.94343743899849775, 12], [12, 48, 0.87445529179868864, 12]],
+[[0, 26, 0.99207816588077435, 6], [6, 24, 0.74385675189819744, 6], [12, 38, 0.79547069010091043, 12], [24, 26, 0.88615671714874711, 6], [30, 24, 0.74777031301955554, 6]],
+[[0, 24, 0.99927423561350259, 12], [12, 24, 0.78692866392335359, 6], [18, 24, 0.69262010288662523, 12], [30, 24, 0.72390730316997276, 12], [42, 24, 0.666115258605529, 6]],
+[[0, 41, 0.99357613169079517, 6], [6, 43, 0.7073630308078257, 12], [18, 46, 0.67165574765193869, 6], [24, 41, 0.86565397555446555, 6], [30, 43, 0.70515213162208334, 6], [36, 46, 0.83971310744003536, 6], [42, 41, 0.74076808030659258, 6], [48, 43, 0.87503158586961882, 12]],
+[[0, 31, 0.9123356313814982, 12], [12, 24, 0.83145940848174249, 12], [24, 31, 0.76565291891357168, 6], [30, 31, 0.72491054618626705, 12], [42, 24, 0.68248618794605331, 12], [54, 31, 0.67093741643924965, 12], [66, 31, 0.70817819944886784, 6]],
+[[0, 46, 0.92394070210858636, 12], [12, 29, 0.78872650461199467, 6], [18, 26, 0.72562351702164596, 12], [30, 46, 0.74624235514010628, 12], [42, 29, 0.74032753000068696, 12], [54, 26, 0.70470937639439069, 12], [66, 46, 0.66702062408473006, 6], [72, 29, 0.76288048605548153, 6], [78, 26, 0.7329026924423967, 6]],
+[[0, 46, 0.9218207823690846, 6], [6, 46, 0.72440415689507387, 6], [12, 46, 0.88291257333910766, 6], [18, 46, 0.65488744402675281, 6], [24, 46, 0.80297114145541504, 12], [36, 46, 0.78810916398459085, 6], [42, 46, 0.66855234661045393, 12], [54, 46, 0.69394552129400777, 12], [66, 46, 0.70684436588875521, 6], [72, 46, 0.8222465872758461, 6], [78, 46, 0.68257743752959854, 6], [84, 46, 0.87804691525871004, 12]],
+[[0, 34, 0.91712879391530266, 12], [12, 24, 0.79097271454287843, 6], [18, 31, 0.66997267166612795, 12], [30, 34, 0.65215984388685366, 6], [36, 24, 0.84259825042217762, 6], [42, 31, 0.66169689160942169, 12], [54, 34, 0.73587904207459476, 6], [60, 24, 0.78907779607308481, 12], [72, 31, 0.80588822352186296, 6], [78, 34, 0.67792808610894528, 12], [90, 24, 0.67743285776228535, 6], [96, 31, 0.80550702000857322, 12]],
+[[0, 32, 0.96581436599992743, 6], [6, 38, 0.73648904141743765, 6], [12, 29, 0.82737735764129694, 6], [18, 32, 0.68251833638103676, 12], [30, 38, 0.68786770972571565, 6], [36, 29, 0.86036448686333278, 6], [42, 32, 0.6633101084571017, 6], [48, 38, 0.77602792136189669, 12], [60, 29, 0.86839390590114118, 12], [72, 32, 0.75505394707711893, 12], [84, 38, 0.87067826104324997, 12], [96, 29, 0.89912005558077346, 12], [108, 32, 0.80977388681856033, 12]],
+[[0, 36, 0.95237975305506806, 12], [12, 43, 0.79782767577304281, 6], [18, 44, 0.65882741671892353, 12], [30, 36, 0.70293047178636514, 12], [42, 43, 0.72147256122516235, 6], [48, 44, 0.84008159104437585, 6], [54, 36, 0.74811384646756707, 6], [60, 43, 0.82222632655187256, 12], [72, 44, 0.87448240113171305, 6], [78, 36, 0.70588912234932855, 6], [84, 43, 0.75276075255447406, 12], [96, 44, 0.87242390448924156, 6], [102, 36, 0.66594745974422076, 12], [114, 43, 0.67948801775363488, 6], [120, 44, 0.86992628936869776, 12]],
+[[0, 41, 0.99112777222264126, 12], [12, 43, 0.89087589773039566, 6], [18, 24, 0.66665736656470376, 6], [24, 41, 0.81555866935308441, 12], [36, 43, 0.78481740812663858, 6], [42, 24, 0.7385447068904949, 12], [54, 41, 0.73780369565835724, 12], [66, 43, 0.65535713405674512, 6], [72, 24, 0.83339358103909855, 6], [78, 41, 0.68674436638729652, 12], [90, 43, 0.70567375337769089, 6], [96, 24, 0.8875537063905713, 6], [102, 41, 0.65666804404080437, 12], [114, 43, 0.74554552396077245, 12], [126, 24, 0.66715146929363489, 6], [132, 41, 0.80316538377684377, 12]],
+[[0, 44, 0.93954441258885535, 12], [12, 31, 0.81913320000678491, 6], [18, 36, 0.680695532249593, 6], [24, 44, 0.8366894534153847, 12], [36, 31, 0.8026552596243991, 6], [42, 36, 0.71772009999836484, 12], [54, 44, 0.69858297237761746, 12], [66, 31, 0.67484326856240484, 12], [78, 36, 0.74191565608174237, 6], [84, 44, 0.80184860855811824, 12], [96, 31, 0.80682965406632745, 12], [108, 36, 0.8142615979036294, 12], [120, 44, 0.8607866310901513, 12], [132, 31, 0.75411793727840359, 6], [138, 36, 0.71103864722197963, 6], [144, 44, 0.76985401780218166, 12]],
+[[0, 24, 0.94644716188105837, 12], [12, 36, 0.85503731016428808, 6], [18, 36, 0.71352189483536232, 6], [24, 24, 0.79053536431115368, 6], [30, 36, 0.70695166452783642, 12], [42, 36, 0.65455966526918685, 6], [48, 24, 0.76423504228572459, 12], [60, 36, 0.76915281186912199, 6], [66, 36, 0.70310761676294375, 12], [78, 24, 0.74492489152756003, 12], [90, 36, 0.71460228182527263, 12], [102, 36, 0.69235583999833594, 12], [114, 24, 0.67593345603784627, 6], [120, 36, 0.84891889178439683, 6], [126, 36, 0.73322349229537309, 12], [138, 24, 0.74127056481376319, 6], [144, 36, 0.8489318392539299, 6], [150, 36, 0.6893822808642277, 6], [156, 24, 0.77615268994022746, 12]],
+[[0, 48, 0.95351308655706091, 12], [12, 44, 0.81395010801511614, 6], [18, 24, 0.7248530757656475, 12], [30, 48, 0.69041849421854029, 6], [36, 44, 0.89326880051449176, 12], [48, 24, 0.8853413229192042, 6], [54, 48, 0.68633025566929762, 12], [66, 44, 0.73566893023118451, 12], [78, 24, 0.73204681176690944, 6], [84, 48, 0.79444090992707872, 12], [96, 44, 0.75303513980062253, 12], [108, 24, 0.77053612037738262, 6], [114, 48, 0.67989534752713043, 12], [126, 44, 0.7452635327884618, 12], [138, 24, 0.67974627183837089, 6], [144, 48, 0.78328325060007897, 6], [150, 44, 0.66883488052235407, 12], [162, 24, 0.74997648748842005, 6], [168, 48, 0.8046815877859248, 6], [174, 44, 0.71021969318216871, 6]],
+[[0, 24, 0.98048614423414093, 12], [12, 34, 0.84487667849534698, 12], [24, 48, 0.85057712677086039, 12], [36, 24, 0.79237595462017762, 6], [42, 34, 0.70513567014739098, 12], [54, 48, 0.66377688614216723, 6], [60, 24, 0.86199370333672676, 12], [72, 34, 0.85788789570493051, 12], [84, 48, 0.7733016197546515, 12], [96, 24, 0.80343083891505451, 12], [108, 34, 0.7717252576335728, 12], [120, 48, 0.86587977527054349, 6], [126, 24, 0.74810256626940796, 6], [132, 34, 0.89391321275001612, 12], [144, 48, 0.8976384557926822, 6], [150, 24, 0.68760464437545943, 12], [162, 34, 0.65471135483412579, 6], [168, 48, 0.8582503974666652, 12], [180, 24, 0.76598962106467339, 12]]],
+20: [[[0, 48, 0.9334435604891832, 6], [6, 46, 0.69477422563241897, 12], [18, 41, 0.70190370619627462, 6]],
+[[0, 36, 0.90972975437806025, 3], [3, 48, 0.74725094097541223, 3], [6, 36, 0.72093733166115115, 3], [9, 36, 0.66874994735892934, 3], [12, 36, 0.84758350745979916, 12], [24, 48, 0.80646774351209127, 3], [27, 36, 0.66735985598565328, 3], [30, 36, 0.67882520133750379, 3], [33, 36, 0.72995464755515871, 3]],
+[[0, 46, 0.92401495794243227, 12], [12, 38, 0.79436811442026689, 6], [18, 44, 0.70702203670973607, 3], [21, 31, 0.66643818643142994, 3], [24, 46, 0.89023538543833058, 3], [27, 38, 0.68124489389695009, 3], [30, 44, 0.71791153703604638, 12], [42, 31, 0.72678065576732043, 6]],
+[[0, 26, 0.91019761440664004, 6], [6, 24, 0.71857198104916264, 6], [12, 24, 0.8884177320837201, 6], [18, 29, 0.71211690742264988, 6], [24, 26, 0.87935334114351438, 3], [27, 24, 0.72910623612054448, 3], [30, 24, 0.68790546879092551, 12], [42, 29, 0.71739190786382701, 3], [45, 26, 0.65665369348985159, 3], [48, 24, 0.85744299702705085, 6], [54, 24, 0.68461209224652642, 3], [57, 29, 0.67824637944893018, 3]],
+[[0, 41, 0.99899372523353847, 12], [12, 36, 0.84218460950513219, 6], [18, 36, 0.74898885127447534, 6], [24, 36, 0.81088761007257193, 12], [36, 41, 0.78946786680115755, 12], [48, 36, 0.81011272034370285, 12], [60, 36, 0.83186695924059617, 12]],
+[[0, 44, 0.97868861386704975, 6], [6, 44, 0.68683717205219552, 6], [12, 48, 0.80771601074539445, 6], [18, 36, 0.68804077468553426, 12], [30, 44, 0.65786274396703259, 6], [36, 44, 0.81618762166174463, 12], [48, 48, 0.88701701353628892, 12], [60, 36, 0.75810899725813652, 6], [66, 44, 0.7329045414874108, 6], [72, 44, 0.88478804162024283, 3], [75, 48, 0.74337903142851336, 3], [78, 36, 0.67724551654537934, 6]],
+[[0, 36, 0.95868246835640758, 3], [3, 48, 0.73066875515745011, 3], [6, 46, 0.66270872253412183, 6], [12, 46, 0.89910792845453491, 6], [18, 36, 0.72317824890282434, 12], [30, 48, 0.73048517956742676, 6], [36, 46, 0.7982647556744471, 3], [39, 46, 0.68022576192612072, 3], [42, 36, 0.68340009259599355, 3], [45, 48, 0.65921691345868128, 3], [48, 46, 0.80038709216342097, 12], [60, 46, 0.75640770007973923, 3], [63, 36, 0.734152853561995, 3], [66, 48, 0.65494433470006885, 3], [69, 46, 0.70082679622548893, 3], [72, 46, 0.89967598786710212, 3], [75, 36, 0.65368600341825578, 3], [78, 48, 0.69003835128878754, 6], [84, 46, 0.88314914621514129, 6], [90, 46, 0.74299900629704951, 6]],
+[[0, 32, 0.9128820526720155, 3], [3, 36, 0.66939154925302169, 3], [6, 32, 0.71892189630359815, 3], [9, 44, 0.73776960671360925, 3], [12, 32, 0.87992118948817066, 6], [18, 36, 0.6532638774187598, 6], [24, 32, 0.84038267243042464, 3], [27, 44, 0.67993318544563763, 3], [30, 32, 0.66063243929586235, 6], [36, 36, 0.89547687299016476, 12], [48, 32, 0.8566375212526679, 6], [54, 44, 0.65374183750140691, 12], [66, 32, 0.65578565423934754, 6], [72, 36, 0.77966695794833951, 12], [84, 32, 0.76116014488654549, 3], [87, 44, 0.68642087704565524, 3], [90, 32, 0.67258545803086844, 12], [102, 36, 0.74135957122562013, 6]],
+[[0, 46, 0.93241514684413163, 6], [6, 48, 0.72390894107288539, 6], [12, 43, 0.84918631031979552, 12], [24, 43, 0.86675833056105944, 6], [30, 46, 0.74766829625436082, 3], [33, 48, 0.72245673457783011, 3], [36, 43, 0.83116877166077729, 3], [39, 43, 0.74994990262731076, 3], [42, 46, 0.69740095676188352, 3], [45, 48, 0.70781119984062235, 3], [48, 43, 0.78451617188720446, 6], [54, 43, 0.72602968929805578, 6], [60, 46, 0.79285483468459161, 3], [63, 48, 0.65526666295273917, 3], [66, 43, 0.66222310585679933, 3], [69, 43, 0.73326341502039272, 3], [72, 46, 0.83037398398650941, 6], [78, 48, 0.74584542038957791, 6], [84, 43, 0.76763285194453934, 6], [90, 43, 0.74372467679243548, 12], [102, 46, 0.67017104194121524, 3], [105, 48, 0.65983771301136807, 3], [108, 43, 0.8935980295278767, 3], [111, 43, 0.66518575285368309, 3], [114, 46, 0.66851356385176597, 6]],
+[[0, 44, 0.90800408710065272, 12], [12, 36, 0.75922412283743212, 12], [24, 32, 0.82618518247614992, 6], [30, 44, 0.70760528022178593, 3], [33, 44, 0.68258142422859824, 3], [36, 36, 0.7526716142145069, 3], [39, 32, 0.66547279516442404, 3], [42, 44, 0.71145146728421693, 12], [54, 44, 0.74225097191342349, 6], [60, 36, 0.76065395376109946, 3], [63, 32, 0.69434021707406701, 3], [66, 44, 0.68676987209868101, 6], [72, 44, 0.82924138864888386, 3], [75, 36, 0.7469230235286054, 3], [78, 32, 0.73692941019440417, 6], [84, 44, 0.78300250630480983, 3], [87, 44, 0.66405194935135425, 3], [90, 36, 0.71114255147077565, 12], [102, 32, 0.69561757437121152, 12], [114, 44, 0.66813139730411575, 3], [117, 44, 0.67463714728473911, 3], [120, 36, 0.89801347038888779, 6], [126, 32, 0.72780647419415945, 6]],
+[[0, 44, 0.99872898073921912, 6], [6, 36, 0.70955468279971834, 12], [18, 43, 0.70932770849134574, 12], [30, 44, 0.73489478138267916, 6], [36, 44, 0.79760261318745918, 12], [48, 36, 0.86135984589033876, 6], [54, 43, 0.67531785903613173, 6], [60, 44, 0.81223531046546027, 6], [66, 44, 0.74165335140927502, 6], [72, 36, 0.82208391373802214, 3], [75, 43, 0.72525515017970787, 3], [78, 44, 0.68603982928640017, 3], [81, 44, 0.67223493241481824, 3], [84, 36, 0.8693389723389312, 6], [90, 43, 0.72966353541581941, 6], [96, 44, 0.78405707320280715, 6], [102, 44, 0.67447814382927906, 12], [114, 36, 0.73771620599151466, 3], [117, 43, 0.68127796658528716, 3], [120, 44, 0.77050769204376157, 12], [132, 44, 0.77374471300709546, 3], [135, 36, 0.65310727178379824, 3], [138, 43, 0.73359712342091599, 6]],
+[[0, 48, 0.93667948675805324, 6], [6, 34, 0.69312388725983676, 6], [12, 26, 0.78427156945627485, 6], [18, 26, 0.69036600091538913, 12], [30, 48, 0.74346725730369312, 12], [42, 34, 0.65929381550375088, 12], [54, 26, 0.6542618006534362, 6], [60, 26, 0.77749657990634169, 12], [72, 48, 0.79215393064381501, 3], [75, 34, 0.65822459760487217, 3], [78, 26, 0.65111471584878733, 6], [84, 26, 0.83141917813722577, 3], [87, 48, 0.74501699336927341, 3], [90, 34, 0.70268959720463475, 12], [102, 26, 0.65195141495820497, 6], [108, 26, 0.83478360275588759, 6], [114, 48, 0.69216039135373952, 6], [120, 34, 0.75841712114634285, 3], [123, 26, 0.72448402452824279, 3], [126, 26, 0.72572126461724962, 6], [132, 48, 0.78941128326311072, 12], [144, 34, 0.77729691359549768, 3], [147, 26, 0.65271817371827645, 3], [150, 26, 0.71717795142674723, 6]],
+[[0, 41, 0.95792220847117671, 6], [6, 34, 0.65060515538861774, 6], [12, 48, 0.856167849374875, 12], [24, 36, 0.8507136899197002, 3], [27, 41, 0.66500849950509489, 3], [30, 34, 0.71247914502532406, 12], [42, 48, 0.73029700331220404, 12], [54, 36, 0.69607536606354969, 3], [57, 41, 0.69509468288190224, 3], [60, 34, 0.86888906072954131, 6], [66, 48, 0.72330841851795957, 12], [78, 36, 0.70406036089772139, 6], [84, 41, 0.7931257083499702, 6], [90, 34, 0.70401106287672977, 6], [96, 48, 0.77706690806155021, 3], [99, 36, 0.69558695745096766, 3], [102, 41, 0.66451997787113992, 3], [105, 34, 0.70111650277106563, 3], [108, 48, 0.8537898273397877, 6], [114, 36, 0.73944078463360496, 12], [126, 41, 0.65097358998155297, 6], [132, 34, 0.78625934669041686, 6], [138, 48, 0.68223077689473244, 6], [144, 36, 0.89064429237481102, 12], [156, 41, 0.82542761331590542, 6], [162, 34, 0.71792391354555563, 6]],
+[[0, 46, 0.90160199895320414, 12], [12, 46, 0.76839671026587919, 6], [18, 36, 0.67519842523621687, 6], [24, 36, 0.84133624952164332, 6], [30, 46, 0.73761239869475126, 12], [42, 46, 0.69767763116584758, 3], [45, 36, 0.65054670433808726, 3], [48, 36, 0.87848912920575306, 6], [54, 46, 0.70285472864346232, 6], [60, 46, 0.89628938390650859, 6], [66, 36, 0.72908990541401342, 6], [72, 36, 0.8880858802021695, 6], [78, 46, 0.71143815888680828, 12], [90, 46, 0.69414053110890017, 3], [93, 36, 0.7462887119942101, 3], [96, 36, 0.77011947516745349, 6], [102, 46, 0.71742720266138427, 3], [105, 46, 0.67708344196095205, 3], [108, 36, 0.78678536062299687, 12], [120, 36, 0.80333681526399303, 6], [126, 46, 0.74929259489173483, 12], [138, 46, 0.73169811668099072, 6], [144, 36, 0.895090857648148, 3], [147, 36, 0.73560880156045239, 3], [150, 46, 0.69944139448706943, 6], [156, 46, 0.87090669792688369, 3], [159, 36, 0.74916521862954222, 3], [162, 36, 0.70580957573629632, 6], [168, 46, 0.77447355863470491, 3], [171, 46, 0.71144556247757762, 3], [174, 36, 0.6737045979441485, 6]],
+[[0, 31, 0.94371327095067403, 6], [6, 24, 0.70407542874921913, 12], [18, 34, 0.73723518174297242, 12], [30, 29, 0.66098725469706188, 6], [36, 31, 0.88552823474198938, 6], [42, 24, 0.71915875647628613, 6], [48, 34, 0.81830848409040913, 3], [51, 29, 0.73260877360112298, 3], [54, 31, 0.65064975196536445, 3], [57, 24, 0.66306467354831533, 3], [60, 34, 0.76488045052910258, 6], [66, 29, 0.73716809316733045, 6], [72, 31, 0.86364744629431522, 6], [78, 24, 0.69451934651503988, 3], [81, 34, 0.67332022058418695, 3], [84, 29, 0.86156668627281807, 6], [90, 31, 0.65577512425246465, 6], [96, 24, 0.79739577988839316, 6], [102, 34, 0.70830764733420892, 6], [108, 29, 0.88987764908936273, 6], [114, 31, 0.68114712911936615, 12], [126, 24, 0.70715692786087259, 12], [138, 34, 0.71264444525678372, 6], [144, 29, 0.78891479284971511, 6], [150, 31, 0.6706549519175693, 6], [156, 24, 0.79964612725018513, 3], [159, 34, 0.73146776455900819, 3], [162, 29, 0.68017694142777652, 3], [165, 31, 0.71592794379192481, 3], [168, 24, 0.81340138643553883, 3], [171, 34, 0.6752449896019499, 3], [174, 29, 0.68712656173959719, 3], [177, 31, 0.73043134757110739, 3], [180, 24, 0.88709579038609165, 3], [183, 34, 0.69105241834098718, 3], [186, 29, 0.74633551326908698, 6]]],
+21: [[[0, 26, 0.9125333251105181, 6], [6, 41, 0.65390739347630444, 6], [12, 26, 0.87789896669984402, 6], [18, 26, 0.72917564298744697, 6]],
+[[0, 29, 0.96463220526363103, 6], [6, 29, 0.73680666252467264, 12], [18, 24, 0.72344819685359796, 6], [24, 44, 0.87167406927642266, 6], [30, 29, 0.66854163123467458, 6]],
+[[0, 29, 0.98099423123262985, 6], [6, 24, 0.65317195756749014, 6], [12, 31, 0.79324809118199024, 6], [18, 31, 0.74134636376433527, 6], [24, 29, 0.87318074292244541, 6], [30, 24, 0.72302948514227638, 6], [36, 31, 0.80099402720643587, 12]],
+[[0, 41, 0.92830895620274334, 6], [6, 24, 0.72324098999488751, 3], [9, 34, 0.68176541315799222, 3], [12, 24, 0.78583872386143738, 12], [24, 41, 0.79792975632675611, 6], [30, 24, 0.72549126817246945, 3], [33, 34, 0.72065313458326608, 3], [36, 24, 0.84591862721329725, 3], [39, 41, 0.72006471348861556, 3], [42, 24, 0.65587137933942408, 6], [48, 34, 0.86356923416280229, 6], [54, 24, 0.67625377500133321, 6]],
+[[0, 24, 0.92061194946642078, 6], [6, 43, 0.68083332705219779, 6], [12, 44, 0.79582491328879779, 6], [18, 44, 0.72537461713192897, 6], [24, 24, 0.78921877620341463, 12], [36, 43, 0.78397151943101973, 6], [42, 44, 0.73910890569872156, 6], [48, 44, 0.89360745588944446, 12], [60, 24, 0.8557109107677392, 3], [63, 43, 0.65781218158082055, 3], [66, 44, 0.6621865248781329, 6]],
+[[0, 24, 0.9803616031708039, 12], [12, 43, 0.76784426787299442, 6], [18, 43, 0.69235241050748086, 12], [30, 41, 0.65633192865831058, 3], [33, 24, 0.72507834211493205, 3], [36, 43, 0.89204268438245304, 6], [42, 43, 0.65221013624644353, 6], [48, 41, 0.76647636536571762, 6], [54, 24, 0.65372340633143966, 6], [60, 43, 0.79255740844304012, 6], [66, 43, 0.72134804888889881, 3], [69, 41, 0.68877657997752617, 3], [72, 24, 0.89361066954413348, 6], [78, 43, 0.66146779733803518, 6]],
+[[0, 43, 0.96310501695118578, 3], [3, 43, 0.74401776465870573, 3], [6, 43, 0.67572988245924881, 3], [9, 43, 0.67441662191264673, 3], [12, 43, 0.76155916634423249, 3], [15, 43, 0.73668593521968107, 3], [18, 43, 0.6667820297470648, 6], [24, 43, 0.88455296595619448, 12], [36, 43, 0.80514080856792469, 6], [42, 43, 0.68494468990114954, 6], [48, 43, 0.85470663768525623, 3], [51, 43, 0.7475529120791915, 3], [54, 43, 0.72731362099881669, 3], [57, 43, 0.7443990109256039, 3], [60, 43, 0.77135268406552537, 3], [63, 43, 0.68355460984733163, 3], [66, 43, 0.71832636249885784, 6], [72, 43, 0.80698122054901122, 12], [84, 43, 0.85596485591898541, 3], [87, 43, 0.66601996297831667, 3], [90, 43, 0.74896104782355866, 6]],
+[[0, 43, 0.95964818681503283, 3], [3, 32, 0.71233592522894917, 3], [6, 24, 0.74644250123211042, 6], [12, 36, 0.75444162692193928, 3], [15, 43, 0.7302344681438474, 3], [18, 32, 0.70488125661182566, 3], [21, 24, 0.74821270394913619, 3], [24, 36, 0.85339489750798669, 12], [36, 43, 0.82986978466140504, 12], [48, 32, 0.7933058643305152, 3], [51, 24, 0.65986540561176732, 3], [54, 36, 0.71147410854717497, 6], [60, 43, 0.7620853512051613, 6], [66, 32, 0.74785527580280453, 6], [72, 24, 0.75187053344505383, 6], [78, 36, 0.69544835378863423, 6], [84, 43, 0.88477468525308289, 6], [90, 32, 0.71601667604962027, 3], [93, 24, 0.67088994622161624, 3], [96, 36, 0.86485163358127692, 6], [102, 43, 0.73923028088142773, 6]],
+[[0, 34, 0.95080629382409165, 6], [6, 29, 0.74951403335844224, 12], [18, 48, 0.69968642644664147, 6], [24, 36, 0.81934067181511971, 12], [36, 34, 0.77652920408421255, 6], [42, 29, 0.73514135622601651, 6], [48, 48, 0.89717507528474216, 12], [60, 36, 0.86864471046516933, 6], [66, 34, 0.7095986437083861, 12], [78, 29, 0.74738843122547804, 6], [84, 48, 0.75324300358623852, 12], [96, 36, 0.76835561747696812, 3], [99, 34, 0.7079612393326099, 3], [102, 29, 0.67615155995723375, 3], [105, 48, 0.69108999600717258, 3], [108, 36, 0.7571644306762384, 3], [111, 34, 0.71773960928004632, 3], [114, 29, 0.71426068845301327, 6]],
+[[0, 48, 0.91262844393203968, 6], [6, 29, 0.66446450011004721, 3], [9, 34, 0.67829162705675461, 3], [12, 24, 0.84295038923855725, 12], [24, 48, 0.75690726441120715, 6], [30, 29, 0.65301891441298465, 12], [42, 34, 0.67972238856594569, 3], [45, 24, 0.72106169705418244, 3], [48, 48, 0.86551467711552843, 6], [54, 29, 0.71516789206244591, 3], [57, 34, 0.69911686504443449, 3], [60, 24, 0.76770254660193948, 6], [66, 48, 0.70499854394928885, 6], [72, 29, 0.81429859396518811, 6], [78, 34, 0.73691244850731552, 12], [90, 24, 0.71240193645182837, 12], [102, 48, 0.70137001652661435, 3], [105, 29, 0.65402276160281236, 3], [108, 34, 0.82573159305557631, 12], [120, 24, 0.82238484359645925, 6], [126, 48, 0.7274672992435125, 6]],
+[[0, 43, 0.99943542026186449, 6], [6, 26, 0.67922017177522043, 12], [18, 24, 0.67203199056640195, 3], [21, 32, 0.74933413563505902, 3], [24, 43, 0.80309331374929693, 3], [27, 26, 0.71937952242351733, 3], [30, 24, 0.70597829422659353, 12], [42, 32, 0.6796295302866574, 3], [45, 43, 0.69451787775714546, 3], [48, 26, 0.88897887349817628, 3], [51, 24, 0.74413634859510802, 3], [54, 32, 0.6504734723624328, 12], [66, 43, 0.66016614206283719, 12], [78, 26, 0.71408641772054526, 3], [81, 24, 0.69679647027408764, 3], [84, 32, 0.89413217261081335, 6], [90, 43, 0.72023816587502598, 6], [96, 26, 0.84639835352908976, 6], [102, 24, 0.69333054269537819, 12], [114, 32, 0.70959550189549558, 6], [120, 43, 0.77953747438278875, 6], [126, 26, 0.65712807098546167, 6], [132, 24, 0.75511591234053854, 12]],
+[[0, 44, 0.90468777996244998, 6], [6, 46, 0.68165535389960097, 3], [9, 41, 0.67551866606254507, 3], [12, 41, 0.78649491997425591, 3], [15, 44, 0.70060452044060084, 3], [18, 46, 0.68048994697794518, 6], [24, 41, 0.89291397019725782, 6], [30, 41, 0.71697796712758199, 12], [42, 44, 0.6573481387442992, 12], [54, 46, 0.7493425871193643, 6], [60, 41, 0.87772075365730129, 6], [66, 41, 0.69858095950932797, 6], [72, 44, 0.79633729826194799, 12], [84, 46, 0.84409930644142683, 6], [90, 41, 0.66175709661673709, 6], [96, 41, 0.76359136862022425, 6], [102, 44, 0.72148896110094041, 6], [108, 46, 0.76836241447044595, 6], [114, 41, 0.73619585308366986, 12], [126, 41, 0.65827540267483131, 12], [138, 44, 0.72482275391711826, 12], [150, 46, 0.69354897082855449, 6]],
+[[0, 48, 0.94739675683296254, 6], [6, 36, 0.69179984093839375, 6], [12, 46, 0.82581156204204054, 3], [15, 46, 0.70465367079506647, 3], [18, 48, 0.6679348135485772, 6], [24, 36, 0.82487168897492669, 6], [30, 46, 0.66738659878104745, 6], [36, 46, 0.86460880662837225, 6], [42, 48, 0.68695347282762209, 3], [45, 36, 0.66583665120910618, 3], [48, 46, 0.87279600693734793, 6], [54, 46, 0.74308966065811677, 6], [60, 48, 0.87519936376406715, 6], [66, 36, 0.66755570592766522, 6], [72, 46, 0.89559431276770551, 6], [78, 46, 0.69084590582489835, 3], [81, 48, 0.73736697550549846, 3], [84, 36, 0.85277350192646184, 6], [90, 46, 0.73182047909075476, 6], [96, 46, 0.80972314380301569, 6], [102, 48, 0.69973426159444996, 6], [108, 36, 0.86622829021896919, 3], [111, 46, 0.65412863683661326, 3], [114, 46, 0.67288040513315839, 6], [120, 48, 0.81723733329998771, 6], [126, 36, 0.6681911257670784, 3], [129, 46, 0.71033043528681683, 3], [132, 46, 0.76088222014492779, 6], [138, 48, 0.68899762102838114, 6], [144, 36, 0.80235366609554237, 3], [147, 46, 0.67668924216456261, 3], [150, 46, 0.67870910013387387, 3], [153, 48, 0.6644788829526852, 3], [156, 36, 0.79754637365476777, 3], [159, 46, 0.70860084582226757, 3], [162, 46, 0.69832568403745543, 6]],
+[[0, 44, 0.98858433253383238, 12], [12, 36, 0.75648899130256975, 3], [15, 46, 0.70053249288479991, 3], [18, 48, 0.68809356161706248, 3], [21, 44, 0.72146323065653939, 3], [24, 36, 0.89140975909633835, 3], [27, 46, 0.72617325446490155, 3], [30, 48, 0.72053509056859399, 12], [42, 44, 0.73524270370739297, 6], [48, 36, 0.80144260938431489, 6], [54, 46, 0.72000012762446675, 3], [57, 48, 0.69026843353344036, 3], [60, 44, 0.82816321896956469, 3], [63, 36, 0.71843677842978004, 3], [66, 46, 0.69246872664179582, 6], [72, 48, 0.84570755281938981, 3], [75, 44, 0.66887838165670088, 3], [78, 36, 0.67873076987891823, 6], [84, 46, 0.83382261284059012, 12], [96, 48, 0.88280430106387908, 6], [102, 44, 0.68946575920592501, 6], [108, 36, 0.7948468342077194, 6], [114, 46, 0.69592025376919142, 6], [120, 48, 0.88039375735006209, 12], [132, 44, 0.82437516958088208, 3], [135, 36, 0.70757279440864074, 3], [138, 46, 0.72668828994318169, 6], [144, 48, 0.82918321114344429, 3], [147, 44, 0.7138062068301585, 3], [150, 36, 0.74199239983869469, 12], [162, 46, 0.65819398964404408, 3], [165, 48, 0.66605946224537071, 3], [168, 44, 0.88431474311298841, 6], [174, 36, 0.70378567260134839, 6]],
+[[0, 46, 0.92142031054221019, 6], [6, 46, 0.70478779789370327, 6], [12, 32, 0.83729834725514596, 6], [18, 44, 0.66973820327677902, 3], [21, 46, 0.68607804791459459, 3], [24, 46, 0.81910449963619036, 3], [27, 32, 0.70425140180150558, 3], [30, 44, 0.74594272452133681, 12], [42, 46, 0.71248862657028, 6], [48, 46, 0.85726377375904439, 6], [54, 32, 0.66665727392386198, 6], [60, 44, 0.805559895383261, 6], [66, 46, 0.67057262820180596, 6], [72, 46, 0.78104212251186578, 6], [78, 32, 0.71768378078700046, 6], [84, 44, 0.87509712501104642, 3], [87, 46, 0.65389449297722768, 3], [90, 46, 0.69765475708775448, 6], [96, 32, 0.85905086580082046, 6], [102, 44, 0.69339482211970682, 6], [108, 46, 0.75167016995860414, 12], [120, 46, 0.7808256804128213, 3], [123, 32, 0.71305419749945753, 3], [126, 44, 0.6753485608766987, 6], [132, 46, 0.81117728365299169, 6], [138, 46, 0.66364938100201376, 3], [141, 32, 0.70478860468321247, 3], [144, 44, 0.79543457012257668, 3], [147, 46, 0.74956585104346096, 3], [150, 46, 0.70096179457305352, 6], [156, 32, 0.796987037796002, 3], [159, 44, 0.72903407136030673, 3], [162, 46, 0.66888673579790092, 6], [168, 46, 0.85153988588164597, 12], [180, 32, 0.83947905532115141, 6], [186, 44, 0.68609484698949164, 6]]],
+32: [[[0, 38, 0.95624260623319235, 6], [6, 48, 0.71743954734270088, 18]],
+[[0, 29, 0.97627467325369621, 6], [6, 29, 0.74326314626179124, 6], [12, 29, 0.77296963553708675, 6], [18, 24, 0.70343920954653494, 6], [24, 36, 0.75090854753173042, 12]],
+[[0, 43, 0.92980250637131268, 12], [12, 46, 0.85461335380708781, 6], [18, 36, 0.69341910507204674, 12], [30, 24, 0.66564724409758724, 6], [36, 31, 0.85911463641628516, 6], [42, 43, 0.6503667584931806, 6]],
+[[0, 36, 0.97213806120505686, 6], [6, 43, 0.66557059825812215, 6], [12, 24, 0.81345008340552538, 6], [18, 24, 0.65919123215914799, 6], [24, 43, 0.79361138276848964, 18], [42, 36, 0.72344022935435981, 6], [48, 43, 0.87631797100207354, 6], [54, 24, 0.662286526651789, 6]],
+[[0, 31, 0.94429667670621553, 12], [12, 32, 0.82702239832716118, 12], [24, 31, 0.88122964884193533, 12], [36, 29, 0.88932296431988034, 18], [54, 38, 0.70410300008531435, 6], [60, 31, 0.85063340218051198, 12]],
+[[0, 29, 0.91120602487385305, 6], [6, 36, 0.73428056560128407, 6], [12, 32, 0.89674271846730269, 18], [30, 24, 0.73375397793953367, 12], [42, 26, 0.74518678290128149, 18], [60, 29, 0.83533701461135179, 6], [66, 36, 0.74910636573297051, 12], [78, 32, 0.73123245653062197, 6]],
+[[0, 44, 0.91726800902118988, 6], [6, 26, 0.7381462328738585, 12], [18, 26, 0.6743043057263457, 6], [24, 24, 0.8393998691765554, 6], [30, 36, 0.71089197464248788, 6], [36, 44, 0.86614340112608068, 6], [42, 26, 0.69103452091113071, 6], [48, 26, 0.82078818512819218, 12], [60, 24, 0.89007673892983097, 18], [78, 36, 0.65971829816405192, 6], [84, 44, 0.88823757539494541, 12]],
+[[0, 24, 0.94873497427266429, 12], [12, 26, 0.79313446421011058, 12], [24, 26, 0.79121707668391061, 12], [36, 36, 0.79276201802418444, 6], [42, 36, 0.71750887024724053, 6], [48, 24, 0.7638473063538529, 6], [54, 26, 0.70303959102950608, 6], [60, 26, 0.88234760806168688, 18], [78, 36, 0.7491413725293089, 18], [96, 36, 0.86606783371537999, 6], [102, 24, 0.73758496511387328, 6]],
+[[0, 32, 0.9344846156732356, 6], [6, 29, 0.69943546095481568, 12], [18, 24, 0.65268600378567576, 12], [30, 43, 0.67494490384745098, 12], [42, 48, 0.72773520955505666, 6], [48, 32, 0.78085557478109435, 18], [66, 29, 0.72590392551517158, 18], [84, 24, 0.79868184909070972, 6], [90, 43, 0.67417368271206213, 6], [96, 48, 0.77806249270300687, 6], [102, 32, 0.72484075785765434, 12], [114, 29, 0.68258525019378991, 6]],
+[[0, 26, 0.93237429231469426, 6], [6, 26, 0.69966393895721501, 18], [24, 24, 0.79197110233541024, 12], [36, 41, 0.87488333190835987, 18], [54, 36, 0.67531245787409588, 6], [60, 26, 0.77106035096433123, 6], [66, 26, 0.68339896120180643, 18], [84, 24, 0.86875437233489561, 18], [102, 41, 0.72457216505662292, 6], [108, 36, 0.88247068190445432, 6], [114, 26, 0.71976246138768851, 6], [120, 26, 0.76566629738256708, 6], [126, 24, 0.74262802711698861, 6]],
+[[0, 36, 0.93194503327303058, 6], [6, 41, 0.65255206722257098, 12], [18, 26, 0.66454916752309301, 6], [24, 26, 0.88537916270412753, 18], [42, 26, 0.65113078620581588, 12], [54, 36, 0.67991386398651765, 6], [60, 41, 0.86334292465548801, 12], [72, 26, 0.85751482074959007, 12], [84, 26, 0.75698400898633278, 18], [102, 26, 0.7486689475829722, 6], [108, 36, 0.82173764104089231, 12], [120, 41, 0.87707242452173706, 18], [138, 26, 0.68013210739196639, 6]],
+[[0, 26, 0.95583592657749417, 12], [12, 46, 0.78979855277055211, 12], [24, 48, 0.84463511986996065, 6], [30, 32, 0.73264893278430621, 6], [36, 41, 0.78779936381990778, 6], [42, 26, 0.74025923505033175, 6], [48, 46, 0.82902699810028735, 12], [60, 48, 0.81722411075977219, 18], [78, 32, 0.68957311041375502, 6], [84, 41, 0.82931474568967289, 6], [90, 26, 0.66851510436396311, 6], [96, 46, 0.77701393011124897, 12], [108, 48, 0.87021552357223397, 12], [120, 32, 0.77386490773473182, 6], [126, 41, 0.73985018415391401, 12], [138, 26, 0.74651508179226689, 6], [144, 46, 0.79548654019890741, 12]],
+[[0, 38, 0.99899825400885844, 12], [12, 29, 0.82562503107812291, 6], [18, 32, 0.74133550940954474, 6], [24, 31, 0.80213981008863322, 12], [36, 26, 0.85278989289166662, 18], [54, 38, 0.68254832503680363, 6], [60, 29, 0.84272040750438215, 6], [66, 32, 0.6745059648634274, 6], [72, 31, 0.81164616099789144, 18], [90, 26, 0.67695508679775851, 12], [102, 38, 0.7183648708319661, 6], [108, 29, 0.7808744904456989, 12], [120, 32, 0.85032315655769752, 6], [126, 31, 0.74840054219675722, 12], [138, 26, 0.69807642198956787, 12], [150, 38, 0.74062397777901801, 6], [156, 29, 0.89025755050286093, 12]],
+[[0, 24, 0.92867306635200841, 18], [18, 24, 0.70719187935365124, 6], [24, 26, 0.88654361290954808, 12], [36, 26, 0.75201106416785302, 6], [42, 26, 0.69347997718156495, 6], [48, 24, 0.84941010310830922, 6], [54, 24, 0.66195554344133456, 6], [60, 26, 0.85913332153051469, 12], [72, 26, 0.79174142342961462, 18], [90, 26, 0.74345549372486719, 12], [102, 24, 0.70549365480295534, 12], [114, 24, 0.74758965766703334, 6], [120, 26, 0.80732721913152938, 18], [138, 26, 0.65768998301773873, 6], [144, 26, 0.82407232597436231, 6], [150, 24, 0.73335116772080178, 6], [156, 24, 0.8745369616137515, 6], [162, 26, 0.68975803519214385, 12], [174, 26, 0.72364331234335533, 6]],
+[[0, 32, 0.94451711389049109, 6], [6, 46, 0.65390420276306094, 12], [18, 31, 0.68331552046098065, 6], [24, 26, 0.87012505266641826, 12], [36, 43, 0.89737377809948871, 6], [42, 32, 0.66043290890699291, 12], [54, 46, 0.67692630714767565, 12], [66, 31, 0.73991603766231917, 18], [84, 26, 0.87560992991972797, 18], [102, 43, 0.71263250813917589, 18], [120, 32, 0.78567554018619656, 6], [126, 46, 0.72072646666358686, 6], [132, 31, 0.89095681839176011, 18], [150, 26, 0.6688085460115254, 6], [156, 43, 0.77379310698571879, 18], [174, 32, 0.66495647086856069, 6], [180, 46, 0.81026746299408992, 6], [186, 31, 0.65070036765006956, 6]]],
+33: [[[0, 46, 0.9771698449965569, 6], [6, 24, 0.70657893816302419, 6], [12, 24, 0.87146738729949413, 12]],
+[[0, 31, 0.94473968743845893, 12], [12, 38, 0.83763796711808558, 6], [18, 24, 0.74789297440145275, 12], [30, 31, 0.68137270565958707, 6]],
+[[0, 26, 0.91941210550478025, 6], [6, 43, 0.71909920951626083, 6], [12, 31, 0.84670362396737309, 12], [24, 38, 0.8610785017549778, 6], [30, 24, 0.7007573728056411, 12], [42, 26, 0.68601231986481348, 6]],
+[[0, 32, 0.91817561554188576, 12], [12, 29, 0.88974524769201868, 12], [24, 38, 0.84146532126019391, 6], [30, 46, 0.65842776130703307, 6], [36, 46, 0.80626525511475133, 12], [48, 32, 0.7791265135371569, 12]],
+[[0, 46, 0.9311023460533876, 6], [6, 29, 0.74572933762350124, 6], [12, 26, 0.7803091993516349, 6], [18, 32, 0.65974607888161019, 6], [24, 24, 0.83331274268307531, 6], [30, 46, 0.71402128505435036, 12], [42, 29, 0.73092642474924818, 18], [60, 26, 0.88040897453813505, 12]],
+[[0, 43, 0.93699558967693097, 18], [18, 24, 0.73583894530849747, 6], [24, 46, 0.83332386902205646, 6], [30, 46, 0.71565162984625841, 18], [48, 24, 0.79584956534961337, 6], [54, 43, 0.72111883792834375, 18], [72, 24, 0.76371127867485666, 12]],
+[[0, 31, 0.90544047407107531, 12], [12, 36, 0.83017321747576034, 12], [24, 36, 0.77802192670995429, 18], [42, 32, 0.69723306155680065, 6], [48, 32, 0.83925138037880953, 12], [60, 31, 0.87036749709309802, 6], [66, 36, 0.68635587538426612, 6], [72, 36, 0.83800349569179744, 12], [84, 32, 0.82917425431820935, 12]],
+[[0, 36, 0.97568253648414727, 6], [6, 24, 0.67411201407390975, 12], [18, 26, 0.73175511353294065, 6], [24, 24, 0.86963559481135877, 12], [36, 24, 0.75647286403450342, 12], [48, 36, 0.81880316766049099, 18], [66, 24, 0.71684525273879829, 6], [72, 26, 0.89954820953376602, 6], [78, 24, 0.68356713701056038, 12], [90, 24, 0.70516107023358887, 12], [102, 36, 0.65035181363787664, 6]],
+[[0, 24, 0.98219154396083319, 18], [18, 36, 0.73982024058097773, 12], [30, 32, 0.6888540688749345, 6], [36, 29, 0.85616582414241327, 12], [48, 24, 0.81924566409378086, 12], [60, 24, 0.83321468991051695, 6], [66, 36, 0.74160315709890368, 12], [78, 32, 0.71483136541781933, 12], [90, 29, 0.74809876058587288, 12], [102, 24, 0.7328752871149451, 12], [114, 24, 0.71033148888213515, 6]],
+[[0, 24, 0.93454293393077581, 12], [12, 34, 0.81323745913534573, 6], [18, 29, 0.65408202919440661, 12], [30, 29, 0.72775833012592162, 12], [42, 36, 0.67480972654910665, 12], [54, 24, 0.705548195013737, 12], [66, 34, 0.74587853156499284, 6], [72, 29, 0.78680714134685903, 6], [78, 29, 0.74203544140035682, 12], [90, 36, 0.73100302125322825, 6], [96, 24, 0.77649851335305253, 6], [102, 34, 0.65984816608814534, 6], [108, 29, 0.86968835589937399, 12], [120, 29, 0.84938666815562269, 12]],
+[[0, 29, 0.98589611881660222, 12], [12, 26, 0.77877720211796375, 12], [24, 26, 0.86374207596813268, 6], [30, 24, 0.74616503791526911, 12], [42, 29, 0.72607158807187011, 6], [48, 29, 0.86083511767480303, 12], [60, 26, 0.82679032236096806, 6], [66, 26, 0.66653580680310076, 12], [78, 24, 0.7246400669286327, 18], [96, 29, 0.84153068073805426, 6], [102, 29, 0.68990149044044313, 6], [108, 26, 0.81842571490364202, 6], [114, 26, 0.72938540271269148, 18], [132, 24, 0.87651860560723427, 12]],
+[[0, 26, 0.9871764005254906, 12], [12, 46, 0.78184433122579788, 12], [24, 46, 0.87052123094156109, 6], [30, 46, 0.65730994193934689, 6], [36, 41, 0.82875808185392386, 6], [42, 26, 0.69808677597371582, 6], [48, 46, 0.83442350050600511, 12], [60, 46, 0.79645571362463874, 12], [72, 46, 0.8846691543712486, 6], [78, 41, 0.74640743177031776, 6], [84, 26, 0.79295625013115512, 6], [90, 46, 0.67488031191907893, 12], [102, 46, 0.65427375529906795, 12], [114, 46, 0.74852067214139129, 12], [126, 41, 0.72364188735303681, 12], [138, 26, 0.71527034251704225, 18]],
+[[0, 48, 0.91560328131582536, 12], [12, 31, 0.79503922677596339, 6], [18, 38, 0.67968227382264801, 6], [24, 36, 0.78352013925710984, 6], [30, 48, 0.73291685178616062, 12], [42, 48, 0.72999088214229402, 6], [48, 31, 0.83222583236052006, 12], [60, 38, 0.81865153638982946, 6], [66, 36, 0.74249917745727245, 12], [78, 48, 0.65059289248322494, 6], [84, 48, 0.77961096342442804, 6], [90, 31, 0.73148020629236132, 6], [96, 38, 0.8371408769977795, 12], [108, 36, 0.75446466794143729, 6], [114, 48, 0.72409972164819147, 18], [132, 48, 0.8375624702261516, 12], [144, 31, 0.80927614386188773, 18], [162, 38, 0.73863289714088554, 6]],
+[[0, 36, 0.92653016861953719, 6], [6, 38, 0.74211995273385689, 6], [12, 38, 0.76608687383270546, 18], [30, 41, 0.65710823906022098, 12], [42, 26, 0.67435326215976454, 6], [48, 36, 0.75331722249649169, 12], [60, 38, 0.79849596058701866, 6], [66, 38, 0.72959502920772312, 12], [78, 41, 0.69181450599309324, 6], [84, 26, 0.82037972811115767, 12], [96, 36, 0.80281827793985738, 12], [108, 38, 0.87586583272239538, 6], [114, 38, 0.72383741289067549, 12], [126, 41, 0.68978690800325992, 6], [132, 26, 0.89719999773018611, 12], [144, 36, 0.78924309576976215, 18], [162, 38, 0.66717951913220452, 6], [168, 38, 0.89027497298371305, 6], [174, 41, 0.66190932146625581, 6]],
+[[0, 48, 0.948894180694422, 12], [12, 34, 0.78235836718021023, 6], [18, 34, 0.66803197878059783, 12], [30, 32, 0.67789538109178971, 6], [36, 32, 0.87783023561170526, 6], [42, 48, 0.66891325737677443, 12], [54, 34, 0.67097769367841298, 12], [66, 34, 0.73988179413004429, 6], [72, 32, 0.84103407105835126, 6], [78, 32, 0.70623663666631131, 12], [90, 48, 0.65996904098901188, 6], [96, 34, 0.76130246771325183, 12], [108, 34, 0.88806606911117714, 12], [120, 32, 0.80076137304196304, 6], [126, 32, 0.69413574748412821, 18], [144, 48, 0.8966623242255316, 6], [150, 34, 0.6887535223053538, 12], [162, 34, 0.66522384724169947, 12], [174, 32, 0.7078060862975516, 12], [186, 32, 0.72248784927601761, 6]]],
+34: [[[0, 48, 0.9113695906873277, 18], [18, 43, 0.65056339439169009, 6]],
+[[0, 34, 0.97038562664649408, 18], [18, 31, 0.65273681696677921, 18]],
+[[0, 36, 0.94631108191589619, 12], [12, 34, 0.85721367837519968, 12], [24, 24, 0.8146544090298089, 6], [30, 24, 0.69893183741397513, 6], [36, 26, 0.86723185065980213, 12]],
+[[0, 41, 0.92741804428879315, 12], [12, 36, 0.82675779236788538, 18], [30, 29, 0.65946767992160271, 18], [48, 26, 0.89298608418281866, 12]],
+[[0, 48, 0.94434078297502799, 6], [6, 36, 0.72639867581164885, 18], [24, 36, 0.8048119938671503, 12], [36, 48, 0.83941670701803595, 12], [48, 36, 0.80215038363904256, 6], [54, 26, 0.74583241608000783, 6], [60, 48, 0.81406543411323384, 12]],
+[[0, 34, 0.90515196402378939, 6], [6, 31, 0.71573571447430462, 6], [12, 24, 0.7560558762350772, 12], [24, 48, 0.86228912254139811, 6], [30, 29, 0.74419336783499113, 6], [36, 29, 0.77798470909992812, 6], [42, 34, 0.70935619803802741, 12], [54, 31, 0.73743248384438731, 18], [72, 24, 0.8202254367092936, 12]],
+[[0, 41, 0.95087510442490109, 12], [12, 24, 0.83510901090963718, 12], [24, 29, 0.88615365680799352, 18], [42, 24, 0.72418747272685624, 12], [54, 32, 0.69081292599869848, 6], [60, 38, 0.75265873091250113, 12], [72, 41, 0.83611959659456381, 6], [78, 24, 0.67359456667708018, 6], [84, 29, 0.83356937919971263, 6], [90, 24, 0.67087597221917683, 6]],
+[[0, 32, 0.96162344795845744, 6], [6, 32, 0.65257234500245997, 12], [18, 26, 0.67607946320281176, 12], [30, 26, 0.70241547120601355, 12], [42, 26, 0.72366501154650231, 18], [60, 26, 0.82864094951580569, 12], [72, 32, 0.81873166574754686, 12], [84, 32, 0.79208964409290594, 12], [96, 26, 0.81380287105594917, 12]],
+[[0, 36, 0.96080317491357348, 12], [12, 24, 0.79131904133096531, 6], [18, 43, 0.74902665426777448, 18], [36, 44, 0.77130598738245848, 12], [48, 29, 0.84928461104462072, 12], [60, 36, 0.76388269271792242, 12], [72, 36, 0.77630483596737065, 6], [78, 24, 0.73306229876229201, 12], [90, 43, 0.71079060067913591, 6], [96, 44, 0.82935724973236524, 6], [102, 29, 0.71641808498480919, 12], [114, 36, 0.7143170395525118, 6]],
+[[0, 44, 0.98597434722388799, 18], [18, 46, 0.65858027213153247, 12], [30, 29, 0.70879168403946047, 18], [48, 26, 0.8128671142176791, 12], [60, 46, 0.76638330497369478, 18], [78, 29, 0.74668719647953607, 12], [90, 44, 0.70550877945470281, 18], [108, 46, 0.88778443162767751, 12], [120, 29, 0.75487181923819668, 6], [126, 26, 0.69055559565625957, 6]],
+[[0, 34, 0.92965924591700067, 12], [12, 43, 0.84952965566839778, 18], [30, 44, 0.66745432238674163, 18], [48, 38, 0.75416395673794234, 18], [66, 24, 0.7142074589016616, 18], [84, 31, 0.81339596197418873, 6], [90, 34, 0.74299381449734214, 12], [102, 43, 0.65396558960724738, 12], [114, 44, 0.708766335849633, 12], [126, 38, 0.70934736516108055, 12], [138, 24, 0.74864341696564551, 6]],
+[[0, 36, 0.93971056894407701, 6], [6, 43, 0.74883428225178128, 12], [18, 46, 0.73040263901533886, 12], [30, 36, 0.71976575780587848, 12], [42, 43, 0.68445590620645869, 12], [54, 46, 0.74934139906152919, 12], [66, 36, 0.67176184644540882, 6], [72, 43, 0.77777474259604462, 18], [90, 46, 0.69040270203889131, 6], [96, 36, 0.79049247968979286, 18], [114, 43, 0.67594874526704796, 12], [126, 46, 0.66362654648442243, 18], [144, 36, 0.89034954844173475, 12]],
+[[0, 34, 0.95705850658737235, 12], [12, 24, 0.832891349012715, 12], [24, 44, 0.80976062091503065, 12], [36, 44, 0.78196280681301666, 12], [48, 43, 0.78821020836531452, 18], [66, 29, 0.70650292335109111, 6], [72, 34, 0.85485951987335396, 12], [84, 24, 0.78160052360577459, 6], [90, 44, 0.71171185856026831, 18], [108, 44, 0.75611145215160558, 6], [114, 43, 0.70135385012290541, 12], [126, 29, 0.69877973879561528, 18], [144, 34, 0.87879810281445681, 12], [156, 24, 0.84937061727450613, 12]],
+[[0, 26, 0.93638675322742571, 6], [6, 26, 0.69775136776081148, 6], [12, 44, 0.83251900087139064, 6], [18, 41, 0.74388233891708699, 18], [36, 41, 0.87651184056698828, 12], [48, 36, 0.84526846528532518, 12], [60, 26, 0.77795763366080639, 18], [78, 26, 0.72567013565137994, 12], [90, 44, 0.66458829667504271, 18], [108, 41, 0.78651003135056941, 12], [120, 41, 0.76735897727600788, 18], [138, 36, 0.66340508942444509, 18], [156, 26, 0.77365383460046777, 6], [162, 26, 0.73774143029374195, 6], [168, 44, 0.83036171075783316, 12]],
+[[0, 44, 0.90241624029280987, 6], [6, 46, 0.70539776336238957, 12], [18, 36, 0.71794011451898965, 12], [30, 32, 0.65887633517919486, 6], [36, 38, 0.8583171159443066, 12], [48, 46, 0.78476913563433937, 12], [60, 44, 0.89368548452197527, 18], [78, 46, 0.68260105851743169, 12], [90, 36, 0.67100689089334287, 12], [102, 32, 0.69727368573224002, 12], [114, 38, 0.69710674566326358, 12], [126, 46, 0.67988731478945952, 12], [138, 44, 0.70645997739451372, 12], [150, 46, 0.70122329731082145, 18], [168, 36, 0.88481047370382759, 12], [180, 32, 0.85264811264663254, 12]]],
+35: [[[0, 43, 0.95630806720929595, 12], [12, 44, 0.87141587274047261, 12]],
+[[0, 34, 0.91928951281434534, 18], [18, 29, 0.70364678420830162, 6], [24, 34, 0.89560430230836086, 6], [30, 36, 0.71140704310858582, 6]],
+[[0, 31, 0.94465780727662807, 12], [12, 38, 0.89476715812674901, 24], [36, 36, 0.83812807524373656, 12]],
+[[0, 46, 0.9539187155473392, 12], [12, 48, 0.77639979512237267, 12], [24, 32, 0.78715386837831047, 24], [48, 32, 0.75257677751217655, 12]],
+[[0, 44, 0.93064759498871386, 24], [24, 44, 0.89407302737123495, 6], [30, 34, 0.6586249998238799, 24], [54, 24, 0.74634517957655477, 18]],
+[[0, 36, 0.98264071117189944, 6], [6, 44, 0.70817379974601835, 12], [18, 44, 0.73066339308815587, 12], [30, 26, 0.66346326195091831, 12], [42, 26, 0.71351358180503899, 18], [60, 24, 0.85237420447917733, 18], [78, 36, 0.74679096442239001, 6]],
+[[0, 26, 0.98084180754706796, 24], [24, 41, 0.79548895958025212, 18], [42, 26, 0.70234016317353254, 18], [60, 24, 0.8874807259612576, 12], [72, 24, 0.89558709497581412, 12], [84, 29, 0.85846397396344276, 12]],
+[[0, 48, 0.95808061392193078, 12], [12, 29, 0.79567837673678099, 12], [24, 36, 0.76769444698533185, 18], [42, 38, 0.71798159119533089, 12], [54, 36, 0.66821340001224472, 18], [72, 34, 0.7987074318109969, 18], [90, 48, 0.74004286555115739, 18]],
+[[0, 36, 0.93176834964088218, 18], [18, 43, 0.65315555152150295, 12], [30, 46, 0.72483039806713412, 12], [42, 48, 0.71303040048106636, 18], [60, 31, 0.79018843024327889, 18], [78, 29, 0.67202398603153346, 18], [96, 36, 0.82098968479411705, 18], [114, 43, 0.65266556381270191, 6]],
+[[0, 24, 0.95137912779447953, 6], [6, 24, 0.66742122604210974, 12], [18, 34, 0.73079414031582246, 24], [42, 24, 0.73737110552447904, 18], [60, 41, 0.79324508811315542, 12], [72, 36, 0.76051142371529434, 24], [96, 24, 0.89431146052142174, 18], [114, 24, 0.74712120245718527, 12], [126, 34, 0.71047155674477969, 6]],
+[[0, 38, 0.94140723033413853, 12], [12, 36, 0.84185786959241837, 12], [24, 36, 0.87801818228263784, 12], [36, 48, 0.89070626849920198, 12], [48, 46, 0.87944064369033725, 6], [54, 24, 0.71960004496644803, 12], [66, 38, 0.6790838654535053, 24], [90, 36, 0.71104636760625317, 12], [102, 36, 0.70180636076818792, 6], [108, 48, 0.85785775029702283, 24], [132, 46, 0.77785447319961853, 12]],
+[[0, 31, 0.99189411569703057, 12], [12, 38, 0.83001504115504399, 18], [30, 36, 0.74404157477514354, 12], [42, 24, 0.67283423256633601, 18], [60, 36, 0.89861065991754807, 12], [72, 38, 0.88314586497155656, 12], [84, 31, 0.85086709279339956, 18], [102, 38, 0.73920864301071754, 18], [120, 36, 0.87262426224370149, 12], [132, 24, 0.79322737058623005, 12], [144, 36, 0.87787191342437565, 12]],
+[[0, 31, 0.99396717868234918, 24], [24, 36, 0.82649144686186116, 12], [36, 36, 0.84636520526586911, 18], [54, 36, 0.73374468087494071, 18], [72, 26, 0.89294833927686368, 24], [96, 43, 0.81330904866414855, 12], [108, 31, 0.8528385967850004, 6], [114, 36, 0.67353234426652864, 24], [138, 36, 0.70915350881533679, 18], [156, 36, 0.81403971022032373, 6], [162, 26, 0.68023556218675918, 6]],
+[[0, 48, 0.93167602994982657, 18], [18, 43, 0.74561739030167007, 12], [30, 46, 0.67665470319990728, 12], [42, 48, 0.73851786387154794, 18], [60, 44, 0.75352126014453424, 12], [72, 46, 0.75590937199845964, 12], [84, 48, 0.8726524645273871, 24], [108, 43, 0.79414220458528362, 24], [132, 46, 0.8598346073676274, 18], [150, 48, 0.66261025791260963, 18], [168, 44, 0.88062785962456802, 12]],
+[[0, 43, 0.93901206412714844, 24], [24, 46, 0.79461956207575446, 12], [36, 48, 0.8536148773884813, 12], [48, 26, 0.77699901346010314, 12], [60, 38, 0.80201927443745236, 12], [72, 46, 0.8824256777989099, 18], [90, 43, 0.66315154329541037, 18], [108, 46, 0.75016329321047814, 24], [132, 48, 0.75189134738586749, 12], [144, 26, 0.78681239233281164, 24], [168, 38, 0.88189368494428921, 12], [180, 46, 0.89247235190963536, 12]]],
+45: [[[0, 44, 0.94518011772794652, 12], [12, 44, 0.7830987484625983, 12]],
+[[0, 46, 0.90290157319075504, 12], [12, 48, 0.86467319246923313, 12], [24, 48, 0.78680262296835513, 12]],
+[[0, 24, 0.96798263466509227, 6], [6, 24, 0.65818567220197688, 12], [18, 24, 0.73908977882088944, 6], [24, 24, 0.82487302557597897, 12], [36, 26, 0.86430561725912269, 12]],
+[[0, 38, 0.90647083194752109, 6], [6, 36, 0.70560977074726849, 12], [18, 41, 0.69958018755318219, 18], [36, 48, 0.82169575818820051, 24]],
+[[0, 31, 0.99860424539456261, 12], [12, 31, 0.82183433042147824, 6], [18, 32, 0.65070866181947695, 12], [30, 32, 0.69905866942133588, 12], [42, 29, 0.72838506173658346, 12], [54, 24, 0.71850797197710214, 18]],
+[[0, 29, 0.91596825589630426, 24], [24, 29, 0.82985385666137657, 18], [42, 26, 0.72742602236538489, 12], [54, 29, 0.66912018256160621, 6], [60, 29, 0.78500748670903264, 18], [78, 26, 0.6881865381976181, 6]],
+[[0, 48, 0.91109124045338852, 12], [12, 43, 0.83779434486013782, 12], [24, 29, 0.89932742780191233, 12], [36, 48, 0.87285699721950749, 18], [54, 48, 0.66667755083210567, 6], [60, 31, 0.77364510838250133, 6], [66, 34, 0.68121017665797934, 18], [84, 48, 0.75458189142889587, 12]],
+[[0, 24, 0.91610988067583499, 6], [6, 24, 0.69283383931976206, 18], [24, 31, 0.86954960388291525, 6], [30, 41, 0.70964172763759636, 24], [54, 41, 0.66869042186439875, 18], [72, 26, 0.85554679935647227, 6], [78, 44, 0.7452593301417868, 12], [90, 24, 0.70230156355309659, 18]],
+[[0, 38, 0.91572604900421906, 12], [12, 24, 0.85669267742049171, 24], [36, 32, 0.75305512563237198, 12], [48, 36, 0.82850275998701117, 12], [60, 43, 0.83752493216328128, 6], [66, 48, 0.69291496385445939, 6], [72, 29, 0.77399872521900726, 18], [90, 38, 0.74717264226707192, 12], [102, 24, 0.70543413934708088, 12], [114, 32, 0.69392877841708356, 6]],
+[[0, 46, 0.97472005688917795, 12], [12, 46, 0.84194119398767975, 18], [30, 43, 0.66555036381555965, 24], [54, 43, 0.74324307756224406, 12], [66, 46, 0.73380256622282092, 6], [72, 46, 0.84708920511565566, 12], [84, 43, 0.84284461264370403, 18], [102, 46, 0.66939371879901843, 18], [120, 46, 0.85476657834858305, 6], [126, 43, 0.7178341263302449, 6]],
+[[0, 26, 0.98477962058813506, 24], [24, 34, 0.80939568735824552, 12], [36, 38, 0.81361073583542709, 18], [54, 32, 0.70869496523362796, 18], [72, 24, 0.84849881576388253, 12], [84, 26, 0.8448979295194714, 24], [108, 34, 0.86787145957287393, 6], [114, 26, 0.69594654735848593, 6], [120, 34, 0.89064174225004222, 6], [126, 38, 0.6513207010090184, 12], [138, 32, 0.71588406162575979, 6]],
+[[0, 36, 0.99299083189814874, 12], [12, 26, 0.7793757352389723, 12], [24, 26, 0.87891262851006913, 12], [36, 26, 0.79508658025197543, 24], [60, 24, 0.78774932578170209, 12], [72, 29, 0.84436565395358665, 6], [78, 29, 0.67047539788121191, 6], [84, 36, 0.85070865648335614, 12], [96, 26, 0.81291157668203173, 12], [108, 26, 0.81137644053328883, 6], [114, 26, 0.7070908405665155, 6], [120, 24, 0.88732118605781773, 18], [138, 29, 0.71363255423629335, 12], [150, 29, 0.6562551224096419, 6]],
+[[0, 48, 0.9145300914728598, 18], [18, 26, 0.65478737597866565, 12], [30, 26, 0.74336143186174841, 18], [48, 24, 0.84832197704222434, 18], [66, 38, 0.66659050215889804, 18], [84, 38, 0.78577271653952674, 18], [102, 36, 0.71240931788152573, 12], [114, 48, 0.72252957409017815, 6], [120, 26, 0.85151588910719545, 12], [132, 26, 0.80101498704787144, 12], [144, 24, 0.75795094023862775, 18], [162, 38, 0.69834423836178239, 6]],
+[[0, 24, 0.93926641458085136, 12], [12, 36, 0.77948389082140968, 24], [36, 36, 0.81289668893186617, 12], [48, 41, 0.75005418101981447, 6], [54, 43, 0.7402004647180116, 12], [66, 36, 0.72028460159357122, 6], [72, 36, 0.82194999205376285, 12], [84, 24, 0.84117002163248311, 12], [96, 36, 0.84614119281567446, 12], [108, 36, 0.79298520925066185, 18], [126, 41, 0.68017066195947329, 6], [132, 43, 0.88204412169984758, 12], [144, 36, 0.85107812256406445, 6], [150, 36, 0.69048958195214882, 18], [168, 24, 0.85921334939658633, 6], [174, 36, 0.68223510218825367, 6]],
+[[0, 31, 0.93020373177928939, 12], [12, 44, 0.7774141704623323, 12], [24, 44, 0.77668890968678994, 6], [30, 34, 0.7008398648588019, 6], [36, 31, 0.75180785152119389, 12], [48, 44, 0.88814818559213593, 6], [54, 44, 0.71784084812885407, 24], [78, 31, 0.7454287952418448, 12], [90, 44, 0.67673745972669574, 24], [114, 44, 0.69200031002048668, 12], [126, 34, 0.7269866015235491, 24], [150, 31, 0.65458208183563982, 12], [162, 44, 0.66738698532035112, 6], [168, 44, 0.76108243126768671, 12], [180, 31, 0.78696367769738274, 6], [186, 44, 0.65426009077752789, 6]]],
+46: [[[0, 24, 0.98936795500214048, 12], [12, 26, 0.8725857199028878, 6], [18, 26, 0.74945130936475657, 6]],
+[[0, 26, 0.91342714955476889, 18], [18, 24, 0.73600634216578031, 18]],
+[[0, 41, 0.92197061830769611, 12], [12, 44, 0.76813597123404553, 6], [18, 48, 0.71965709161257196, 12], [30, 44, 0.74736208209228783, 12], [42, 48, 0.72138004467284511, 6]],
+[[0, 48, 0.96150228874234056, 12], [12, 43, 0.80538313467204981, 6], [18, 34, 0.74763178647986428, 18], [36, 29, 0.86138907624828687, 12], [48, 31, 0.7713336458116129, 6], [54, 32, 0.74059310746856022, 3], [57, 32, 0.74168012043862785, 3]],
+[[0, 43, 0.90267126167564915, 6], [6, 48, 0.68550762338300752, 6], [12, 38, 0.76126051705800368, 6], [18, 24, 0.72658312669571978, 6], [24, 32, 0.82272268436261542, 12], [36, 31, 0.80055989612808154, 6], [42, 34, 0.71512219794000553, 12], [54, 43, 0.67618490654574792, 12], [66, 48, 0.73331563951514755, 6]],
+[[0, 32, 0.90084162354046626, 18], [18, 36, 0.6962202313571485, 6], [24, 44, 0.75228358268274065, 12], [36, 36, 0.89150873779349349, 18], [54, 46, 0.70105755626552368, 6], [60, 46, 0.78080578981485371, 12], [72, 48, 0.77446004801761426, 12]],
+[[0, 29, 0.97922264872346088, 6], [6, 29, 0.72624134929249529, 6], [12, 29, 0.89532351953993428, 6], [18, 44, 0.70807811513951047, 6], [24, 24, 0.8174486196182863, 6], [30, 31, 0.69482363461232732, 12], [42, 24, 0.68288720675014736, 12], [54, 29, 0.74007681157863026, 18], [72, 29, 0.75914951581065127, 12], [84, 29, 0.86976201584168966, 12]],
+[[0, 36, 0.90459510602016191, 12], [12, 46, 0.83499262044908307, 12], [24, 48, 0.79834116807130384, 6], [30, 26, 0.72441664918901216, 6], [36, 44, 0.86919260703192891, 3], [39, 36, 0.70674521984748007, 3], [42, 24, 0.66086469769999889, 12], [54, 36, 0.69522290805382292, 6], [60, 46, 0.84446781753633171, 18], [78, 48, 0.66086658227759887, 18], [96, 26, 0.80897513163593149, 6], [102, 44, 0.73459407489365303, 6]],
+[[0, 43, 0.93924794632572528, 6], [6, 32, 0.6945591611020695, 6], [12, 34, 0.80949229767959985, 18], [30, 46, 0.72919046836919421, 18], [48, 48, 0.8134717788585355, 12], [60, 46, 0.82838615030891716, 18], [78, 46, 0.71028310964592689, 12], [90, 43, 0.68937364956843228, 12], [102, 32, 0.73027000218772553, 6], [108, 34, 0.86475237617393352, 12]],
+[[0, 48, 0.96566111301749458, 6], [6, 32, 0.72917047570486515, 12], [18, 32, 0.71148252742944496, 12], [30, 29, 0.70679605502998832, 18], [48, 26, 0.75584518483053598, 6], [54, 34, 0.6811621127306261, 12], [66, 32, 0.68833408725878464, 6], [72, 48, 0.82235365824929163, 6], [78, 32, 0.66591095525241761, 3], [81, 32, 0.66021028495125067, 3], [84, 29, 0.79173440490329239, 3], [87, 26, 0.67368047069234582, 3], [90, 34, 0.73272042962618922, 6], [96, 32, 0.79542685466292851, 12], [108, 48, 0.82806466407964363, 6], [114, 32, 0.68414571547298542, 18]],
+[[0, 34, 0.97982131352186275, 12], [12, 46, 0.76663601549914517, 12], [24, 46, 0.79522963632211419, 12], [36, 44, 0.87563518029394205, 12], [48, 43, 0.87004933235590276, 12], [60, 38, 0.75515434305697648, 18], [78, 44, 0.73502834003347151, 18], [96, 34, 0.81050043794001714, 6], [102, 46, 0.68458323374698293, 6], [108, 46, 0.75798345906799847, 18], [126, 44, 0.71039049275098332, 12], [138, 43, 0.67242007737444498, 6]],
+[[0, 46, 0.99576252550471833, 6], [6, 46, 0.65428187477849453, 6], [12, 48, 0.79191439619625525, 6], [18, 38, 0.72196581686389361, 3], [21, 38, 0.73848265695895554, 3], [24, 48, 0.78839507949966714, 18], [42, 43, 0.69283161812632166, 6], [48, 46, 0.77057075699121091, 6], [54, 46, 0.67268040267709106, 6], [60, 48, 0.75715342455569856, 12], [72, 38, 0.76865345125453155, 6], [78, 38, 0.71621452637210103, 12], [90, 48, 0.67575520105082076, 12], [102, 43, 0.65545693460725085, 12], [114, 46, 0.68594615809584081, 18], [132, 46, 0.85089178854885861, 12], [144, 48, 0.7775819136615717, 12]],
+[[0, 26, 0.91204589862776331, 6], [6, 24, 0.65725226436622575, 12], [18, 38, 0.70589520354606983, 6], [24, 24, 0.85428233582616908, 12], [36, 36, 0.8210926817074965, 6], [42, 34, 0.72735330726704661, 6], [48, 24, 0.82236616446931021, 6], [54, 26, 0.69523663005024861, 18], [72, 24, 0.77037034472791677, 18], [90, 38, 0.66650664743846366, 6], [96, 24, 0.86557375572850714, 6], [102, 36, 0.71464924511763483, 12], [114, 34, 0.66045460501773134, 18], [132, 24, 0.83215740371008551, 6], [138, 26, 0.65675244007484346, 3], [141, 24, 0.65217040181631092, 3], [144, 38, 0.79095619602758349, 6], [150, 24, 0.72792690053110287, 18]],
+[[0, 48, 0.91353414447482584, 12], [12, 38, 0.80723220783918959, 6], [18, 46, 0.69970937995729621, 18], [36, 48, 0.80601266074097278, 12], [48, 41, 0.78903273705012478, 18], [66, 46, 0.71641414111740565, 6], [72, 46, 0.75028740499683833, 6], [78, 48, 0.65994887433315086, 12], [90, 38, 0.65924310117492835, 12], [102, 46, 0.73345768424869884, 12], [114, 48, 0.71252845506308693, 12], [126, 41, 0.73208435584190035, 18], [144, 46, 0.89875653999865279, 3], [147, 46, 0.73230694567723975, 3], [150, 48, 0.67213046457170633, 18], [168, 38, 0.84145146755179412, 12]],
+[[0, 44, 0.92056142034809041, 12], [12, 36, 0.78341582320301939, 12], [24, 41, 0.86742257622018359, 18], [42, 34, 0.66524939146368733, 6], [48, 36, 0.87145223538443806, 3], [51, 36, 0.69934000929309625, 3], [54, 36, 0.65357590086799888, 6], [60, 44, 0.75669508915750949, 6], [66, 36, 0.67509691447151443, 18], [84, 41, 0.7702148463400027, 12], [96, 34, 0.76626806236210954, 6], [102, 36, 0.71883392128680645, 18], [120, 36, 0.8607349482392016, 18], [138, 36, 0.66983240788185805, 12], [150, 44, 0.69310617366290528, 6], [156, 36, 0.76328775296649676, 18], [174, 41, 0.66317185089445119, 6], [180, 34, 0.82202580930023839, 6], [186, 36, 0.72000925128923243, 6]]],
+47: [[[0, 24, 0.96436166550371705, 12], [12, 36, 0.89596858005994284, 12]],
+[[0, 31, 0.97984081066535356, 6], [6, 24, 0.65050021275323744, 12], [18, 24, 0.66074812271835204, 6], [24, 31, 0.81595555542728559, 3], [27, 38, 0.6814378442138096, 3], [30, 44, 0.65465035832766061, 3], [33, 46, 0.71934609827667628, 3]],
+[[0, 31, 0.92654893791600468, 6], [6, 36, 0.67944996686385473, 3], [9, 34, 0.70392356962536462, 3], [12, 41, 0.78222076421122189, 3], [15, 41, 0.73844016515663435, 3], [18, 34, 0.74932329005321885, 6], [24, 41, 0.85868574917435181, 18], [42, 41, 0.65567752839536675, 6]],
+[[0, 29, 0.95631996032378352, 6], [6, 32, 0.71616432108529993, 12], [18, 31, 0.69983787556030508, 12], [30, 24, 0.6741017619665518, 12], [42, 31, 0.71593320085734369, 12], [54, 29, 0.72130870749001708, 6]],
+[[0, 48, 0.98078574674845964, 12], [12, 48, 0.76321202443526037, 3], [15, 26, 0.67215518427261489, 3], [18, 26, 0.65394749242537942, 12], [30, 26, 0.6535350502919629, 6], [36, 48, 0.87193943203092017, 3], [39, 48, 0.71808674210353562, 3], [42, 26, 0.67600051341633594, 12], [54, 48, 0.72123495667941184, 6], [60, 48, 0.89321034135597643, 6], [66, 26, 0.74578526232041265, 6]],
+[[0, 48, 0.93712811177439304, 6], [6, 43, 0.66564870435097201, 12], [18, 48, 0.74028380083875733, 3], [21, 36, 0.68860784075824222, 3], [24, 24, 0.7802966297096281, 12], [36, 26, 0.86421789340290067, 6], [42, 24, 0.73832915461163307, 18], [60, 43, 0.75718696867154889, 12], [72, 48, 0.77679523252284222, 6], [78, 43, 0.7089038041814234, 6]],
+[[0, 44, 0.96011118545875962, 12], [12, 48, 0.80958581796983653, 6], [18, 29, 0.66166116341307057, 6], [24, 26, 0.81291843015095178, 12], [36, 26, 0.83623976512626863, 12], [48, 48, 0.76597244988267643, 18], [66, 29, 0.69817447895364459, 6], [72, 26, 0.77894655905344223, 6], [78, 44, 0.66191683505768184, 12], [90, 48, 0.68688489955518506, 6]],
+[[0, 26, 0.91403835744678918, 12], [12, 31, 0.82432824074420863, 6], [18, 48, 0.7426177213348174, 3], [21, 41, 0.7104698141081166, 3], [24, 44, 0.81381540617798098, 6], [30, 48, 0.66155237631957042, 6], [36, 41, 0.85785233344621081, 6], [42, 44, 0.68916768861534361, 6], [48, 26, 0.77360390681604285, 12], [60, 31, 0.77104632253770133, 12], [72, 48, 0.79003221372953225, 6], [78, 41, 0.72844679892540587, 3], [81, 44, 0.69195903746608267, 3], [84, 48, 0.84361875554256582, 3], [87, 41, 0.71422509136568124, 3], [90, 44, 0.68104538609955145, 6], [96, 26, 0.8623827696214057, 6], [102, 31, 0.74453671117172249, 6]],
+[[0, 41, 0.99800919268824373, 12], [12, 38, 0.86581234932815587, 12], [24, 48, 0.87579888319654553, 6], [30, 46, 0.66792267472180389, 12], [42, 46, 0.6993955554171144, 6], [48, 38, 0.84723370646891383, 12], [60, 31, 0.7505539215069259, 6], [66, 31, 0.74656554325840685, 6], [72, 41, 0.87223688150903989, 12], [84, 38, 0.7856888122902681, 12], [96, 48, 0.86124015585108871, 6], [102, 46, 0.65428663621264305, 6], [108, 46, 0.76907935042708864, 6], [114, 38, 0.69636050598628829, 6]],
+[[0, 29, 0.99697833355308418, 6], [6, 26, 0.67460788226697121, 6], [12, 24, 0.78045698236785921, 6], [18, 24, 0.69621873294570424, 18], [36, 36, 0.84455295772741079, 3], [39, 36, 0.65587409691953691, 3], [42, 48, 0.74122068767493676, 6], [48, 38, 0.83433637629965007, 6], [54, 29, 0.68138331955117426, 6], [60, 26, 0.83099295045240273, 12], [72, 24, 0.84712521357478177, 6], [78, 24, 0.67390547683173652, 12], [90, 36, 0.66822044867779107, 12], [102, 36, 0.68252019570944111, 6], [108, 48, 0.77988724409287391, 6], [114, 38, 0.70423632263040159, 6], [120, 29, 0.88149376688498593, 6], [126, 26, 0.65490319484847337, 6]],
+[[0, 24, 0.93017094330195482, 6], [6, 41, 0.74807489402756966, 12], [18, 24, 0.66753009486824688, 6], [24, 32, 0.79809166086615801, 12], [36, 41, 0.77314292075660851, 12], [48, 41, 0.88070763408231278, 6], [54, 24, 0.70095422289303155, 6], [60, 32, 0.86435696971092979, 6], [66, 24, 0.66646358407027384, 12], [78, 41, 0.68036199190656155, 6], [84, 24, 0.87954038764659437, 6], [90, 32, 0.73951623472144168, 18], [108, 41, 0.82835069143262463, 6], [114, 41, 0.70549966732057079, 12], [126, 24, 0.74223773650726577, 6], [132, 32, 0.84946088209079007, 12]],
+[[0, 46, 0.90297908855009956, 12], [12, 26, 0.79866419118484133, 6], [18, 26, 0.66913338202691175, 6], [24, 24, 0.77347882923146871, 12], [36, 26, 0.81203140007423813, 6], [42, 24, 0.73539798684034385, 12], [54, 46, 0.71194781810941854, 6], [60, 26, 0.85433963692556647, 12], [72, 46, 0.87689445657447951, 12], [84, 26, 0.84196260448168403, 12], [96, 26, 0.87644670007251124, 12], [108, 24, 0.7549210210990851, 12], [120, 26, 0.76643046199902609, 18], [138, 24, 0.71634106230086525, 6], [144, 46, 0.85359482772541573, 6], [150, 26, 0.67240668470239728, 3], [153, 46, 0.69567792876667001, 3]],
+[[0, 36, 0.96768870078758251, 6], [6, 38, 0.68656724560009963, 3], [9, 43, 0.65546829443655541, 3], [12, 36, 0.80274060698965111, 6], [18, 38, 0.69585012436327243, 12], [30, 43, 0.74718930906061842, 12], [42, 48, 0.69197537366554862, 6], [48, 43, 0.86636613482671421, 3], [51, 36, 0.744467246104074, 3], [54, 38, 0.73609346610103676, 6], [60, 43, 0.83199451794032453, 6], [66, 36, 0.6658128355304358, 12], [78, 38, 0.73439343116763378, 3], [81, 43, 0.65666429101882384, 3], [84, 48, 0.78075183708432538, 12], [96, 43, 0.86322716544829858, 6], [102, 36, 0.72889155937294903, 6], [108, 38, 0.84441202926089609, 12], [120, 43, 0.7792597750446173, 6], [126, 36, 0.66183471258142346, 3], [129, 38, 0.68690149986916704, 3], [132, 43, 0.77484017024605367, 12], [144, 48, 0.86382172928033463, 12], [156, 43, 0.82845496352022174, 12]],
+[[0, 24, 0.95877589814905928, 12], [12, 24, 0.86402668645625536, 6], [18, 38, 0.67654671626649709, 6], [24, 31, 0.75469335642480484, 12], [36, 44, 0.75338304394865629, 6], [42, 36, 0.68532548312939268, 12], [54, 24, 0.65460204182087589, 12], [66, 24, 0.69055422573613345, 6], [72, 24, 0.76571365104017142, 12], [84, 24, 0.87876484135603161, 6], [90, 38, 0.66006265123033936, 12], [102, 31, 0.66784321990659001, 12], [114, 44, 0.66460955797330634, 6], [120, 36, 0.79361056032448984, 6], [126, 24, 0.65863282519248267, 6], [132, 24, 0.7779794960700277, 12], [144, 24, 0.86039971962788286, 6], [150, 24, 0.69794868928649756, 6], [156, 38, 0.75701145978860662, 12], [168, 31, 0.81903747049107334, 12]],
+[[0, 26, 0.92731505235156875, 6], [6, 26, 0.70830731594634944, 6], [12, 38, 0.79439268104124594, 6], [18, 36, 0.66580040303799148, 18], [36, 26, 0.83225693639708787, 12], [48, 38, 0.82408337171411206, 12], [60, 36, 0.76165812649061437, 12], [72, 26, 0.89726190068072686, 6], [78, 26, 0.66681232448147632, 6], [84, 26, 0.84865751983676052, 6], [90, 38, 0.72314954409401377, 12], [102, 36, 0.65118800561733181, 12], [114, 26, 0.65187584402129273, 6], [120, 38, 0.89343952953417505, 12], [132, 36, 0.77214997613009773, 12], [144, 26, 0.87759314660843568, 6], [150, 26, 0.68770781842881901, 12], [162, 26, 0.69421605418181964, 12], [174, 38, 0.73609851193703324, 6], [180, 36, 0.79062766692084263, 6], [186, 26, 0.66180998753627396, 6]]],
+48: [[[0, 31, 0.9519845782009323, 6], [6, 31, 0.66148664109175825, 18]],
+[[0, 43, 0.91532500492313373, 6], [6, 34, 0.7403339511644994, 12], [18, 32, 0.6779900839320373, 6], [24, 38, 0.82051823313134731, 3], [27, 38, 0.65974821012589824, 3], [30, 29, 0.67086094101346394, 6]],
+[[0, 24, 0.94247397519817111, 12], [12, 29, 0.84199947027876887, 3], [15, 36, 0.72689179924952474, 3], [18, 46, 0.7411628066580358, 12], [30, 44, 0.74555256350167287, 6], [36, 46, 0.89146323822368334, 6], [42, 48, 0.65549927868472324, 6]],
+[[0, 24, 0.9808503761982903, 12], [12, 48, 0.77450328215074549, 3], [15, 46, 0.70615547638190712, 3], [18, 46, 0.7454969641584982, 12], [30, 46, 0.74678547682851204, 6], [36, 38, 0.78077895797871344, 3], [39, 48, 0.72198828244836766, 3], [42, 44, 0.72417041099996959, 6], [48, 24, 0.87403047743884932, 3], [51, 48, 0.69486989229810248, 3], [54, 46, 0.7042507192325661, 6]],
+[[0, 44, 0.91188180781469952, 6], [6, 26, 0.7366927499671333, 6], [12, 26, 0.86348436022561226, 6], [18, 24, 0.6756743242488169, 6], [24, 31, 0.78033470861633958, 12], [36, 26, 0.77496034322686391, 18], [54, 26, 0.72419806101814177, 12], [66, 41, 0.68294371531280296, 6]],
+[[0, 46, 0.92798151101057813, 6], [6, 24, 0.72061416945619705, 12], [18, 29, 0.72949356728269543, 6], [24, 34, 0.79280389990678279, 3], [27, 36, 0.69421662656233474, 3], [30, 48, 0.67682744149388785, 6], [36, 36, 0.85250439618108365, 6], [42, 24, 0.71510916671607383, 3], [45, 46, 0.73873132201074709, 3], [48, 24, 0.81948744555493125, 12], [60, 29, 0.79548553736625749, 6], [66, 34, 0.72452034163708356, 12], [78, 36, 0.68536000884940451, 6]],
+[[0, 46, 0.90342579335593731, 6], [6, 46, 0.66490476575762192, 6], [12, 48, 0.80292287003408092, 12], [24, 24, 0.86221231313468571, 6], [30, 38, 0.69099375209944935, 6], [36, 26, 0.80589866931009446, 12], [48, 43, 0.87526374789588757, 12], [60, 48, 0.78721411230441674, 18], [78, 46, 0.66001437891244952, 6], [84, 46, 0.84718022231797663, 6], [90, 48, 0.74438818227729919, 6]],
+[[0, 34, 0.93770175168675274, 12], [12, 29, 0.77090498921403972, 6], [18, 44, 0.68849327491827483, 6], [24, 29, 0.86242519755135338, 6], [30, 41, 0.73533731287626813, 3], [33, 31, 0.71575422366178032, 3], [36, 48, 0.85276040811569664, 6], [42, 32, 0.7397355390011191, 3], [45, 34, 0.67409129361889775, 3], [48, 29, 0.88016497508424241, 6], [54, 44, 0.7497812048863457, 3], [57, 29, 0.68301316873471796, 3], [60, 41, 0.77186513410567581, 6], [66, 31, 0.69429290594744519, 3], [69, 48, 0.74667857629133527, 3], [72, 32, 0.86112461242461691, 6], [78, 34, 0.66333971667947988, 6], [84, 29, 0.75624000582403739, 3], [87, 44, 0.74821289732267859, 3], [90, 29, 0.70020528791581549, 12], [102, 41, 0.73932247740689339, 6]],
+[[0, 48, 0.99724344651642349, 6], [6, 31, 0.69475186417773549, 12], [18, 26, 0.66804122941437505, 3], [21, 36, 0.67715293702264201, 3], [24, 24, 0.82444607529031788, 12], [36, 24, 0.86737774266482226, 12], [48, 34, 0.80470232571193012, 12], [60, 44, 0.76852323168203951, 3], [63, 48, 0.65248258870905151, 3], [66, 31, 0.67080283101652238, 6], [72, 26, 0.82800046156540985, 6], [78, 36, 0.66089124432250068, 6], [84, 24, 0.78068807481894831, 6], [90, 24, 0.71241677172969764, 6], [96, 34, 0.82314485719462338, 12], [108, 44, 0.88205060634196275, 6], [114, 48, 0.66121512628784396, 3], [117, 31, 0.6869402406581181, 3]],
+[[0, 29, 0.98114302925233732, 12], [12, 24, 0.86032943343795687, 12], [24, 26, 0.75186332506936671, 6], [30, 24, 0.70905655529709044, 6], [36, 29, 0.77032812359988923, 6], [42, 29, 0.74640723995290414, 6], [48, 29, 0.88666734900794419, 12], [60, 41, 0.85101348459529869, 6], [66, 29, 0.74511174373503108, 12], [78, 24, 0.66051747217393508, 12], [90, 26, 0.72687112102642848, 6], [96, 24, 0.88250841970159766, 3], [99, 29, 0.74143059236535069, 3], [102, 29, 0.67239561775642986, 6], [108, 29, 0.88191725154236456, 6], [114, 41, 0.73560140482856129, 12], [126, 29, 0.7081332126576193, 3], [129, 24, 0.68983794788026498, 3]],
+[[0, 36, 0.96595818273256528, 12], [12, 31, 0.84436398777525179, 3], [15, 36, 0.72450729579584827, 3], [18, 29, 0.74438957992389043, 6], [24, 34, 0.8768189634671848, 12], [36, 26, 0.85743207173718183, 3], [39, 44, 0.69008383418869457, 3], [42, 24, 0.70944847757565099, 6], [48, 36, 0.81499371421277444, 6], [54, 31, 0.72947094220567699, 6], [60, 36, 0.89655275133783419, 6], [66, 29, 0.7187511681399904, 12], [78, 34, 0.6933835554429989, 3], [81, 26, 0.74111496686863243, 3], [84, 44, 0.83978279767798858, 6], [90, 24, 0.66137695908950145, 12], [102, 36, 0.732209492112884, 6], [108, 31, 0.75056348828755237, 6], [114, 36, 0.74022393982853973, 6], [120, 29, 0.8087512982510201, 6], [126, 34, 0.65364047126839175, 3], [129, 26, 0.73727881786794847, 3], [132, 44, 0.78855945462701182, 12]],
+[[0, 44, 0.91464355200880987, 12], [12, 26, 0.89190697112402662, 12], [24, 26, 0.77056561125832623, 12], [36, 24, 0.88359184969486471, 3], [39, 24, 0.7249299538781746, 3], [42, 34, 0.68282535051255366, 12], [54, 36, 0.66975070693284722, 3], [57, 36, 0.72285153108276079, 3], [60, 44, 0.86685826038148983, 6], [66, 26, 0.67323082698532211, 6], [72, 26, 0.87931775084878305, 6], [78, 24, 0.73870864878076481, 12], [90, 24, 0.73244848057180389, 12], [102, 34, 0.71103604967480161, 12], [114, 36, 0.6707548109158028, 6], [120, 36, 0.87436863593253322, 3], [123, 44, 0.74708637155716939, 3], [126, 26, 0.68600327879947898, 6], [132, 26, 0.8961768994620104, 3], [135, 24, 0.71746522902882126, 3], [138, 24, 0.73932198976408259, 6], [144, 34, 0.79988535620524992, 6], [150, 36, 0.66619714499791627, 6]],
+[[0, 41, 0.95463348434194217, 6], [6, 26, 0.70851865153930138, 3], [9, 43, 0.70222886795777006, 3], [12, 36, 0.75132011300729218, 6], [18, 36, 0.74375444208246821, 6], [24, 43, 0.85718822108503701, 3], [27, 29, 0.73563350547849959, 3], [30, 26, 0.71017541202023149, 12], [42, 41, 0.74962435400571248, 18], [60, 26, 0.82997355917312854, 3], [63, 43, 0.67078704439485903, 3], [66, 36, 0.70237730017512046, 3], [69, 36, 0.65362282475543176, 3], [72, 43, 0.88755913713788015, 3], [75, 29, 0.67546352280279975, 3], [78, 26, 0.68103639567219509, 3], [81, 41, 0.71968625907625206, 3], [84, 26, 0.7899489720240308, 6], [90, 43, 0.72544169148392346, 12], [102, 36, 0.72720827241034625, 12], [114, 36, 0.72693697364201459, 3], [117, 43, 0.66684702262945905, 3], [120, 29, 0.88998305373736775, 3], [123, 26, 0.66204492866375064, 3], [126, 41, 0.71500172487711045, 6], [132, 26, 0.81860063306260966, 12], [144, 43, 0.85908584938115973, 6], [150, 36, 0.69749876493385643, 12], [162, 36, 0.74902807931348048, 6]],
+[[0, 36, 0.90307095049117447, 3], [3, 48, 0.72610164917878661, 3], [6, 44, 0.72977750551822052, 3], [9, 36, 0.68591572662251998, 3], [12, 36, 0.78068176970337999, 6], [18, 44, 0.74405365765520026, 18], [36, 48, 0.79850326213735845, 12], [48, 29, 0.87713229787566283, 6], [54, 36, 0.74418860979845081, 6], [60, 48, 0.81422308476884964, 12], [72, 44, 0.85065876317830047, 12], [84, 36, 0.75690865842308042, 3], [87, 36, 0.6990783435665251, 3], [90, 44, 0.67301633338681688, 6], [96, 48, 0.8276138327257383, 6], [102, 29, 0.68049226775505456, 6], [108, 36, 0.7966531044521572, 6], [114, 48, 0.74435834505880594, 6], [120, 44, 0.8565903479322643, 6], [126, 36, 0.67188137483548993, 18], [144, 36, 0.8647502488189025, 3], [147, 44, 0.67659905220269156, 3], [150, 48, 0.6620787364639551, 12], [162, 29, 0.68878643582028176, 12], [174, 36, 0.7028283501011624, 3], [177, 48, 0.74951708626591462, 3]],
+[[0, 24, 0.93436078191478544, 6], [6, 43, 0.67580812458692985, 6], [12, 44, 0.82866586482264748, 18], [30, 48, 0.67143260653238224, 6], [36, 24, 0.77169242534726412, 12], [48, 24, 0.88151519667429012, 12], [60, 43, 0.86159247507435643, 6], [66, 43, 0.65446589153881629, 3], [69, 24, 0.65834482751684675, 3], [72, 43, 0.86991463923783929, 3], [75, 44, 0.7028434141085188, 3], [78, 48, 0.73463539580328008, 12], [90, 24, 0.74275872107052898, 18], [108, 24, 0.86860947895014051, 6], [114, 43, 0.74634760633904884, 6], [120, 43, 0.75575254291387484, 3], [123, 24, 0.72417709780114592, 3], [126, 43, 0.72629007614077001, 18], [144, 44, 0.884582212278059, 6], [150, 48, 0.67857423305759201, 6], [156, 24, 0.80769295784005646, 6], [162, 24, 0.72307184943733394, 6], [168, 43, 0.83998167334502072, 18], [186, 43, 0.68771023215321669, 3], [189, 24, 0.74879753520920977, 3]]],
+51: [[[0, 36, 0.99541106009076363, 6], [6, 46, 0.73260915769346213, 18]],
+[[0, 36, 0.95686326372439812, 6], [6, 29, 0.66803852617132675, 12], [18, 43, 0.69620494584044779, 3], [21, 48, 0.71732205090126322, 3], [24, 43, 0.87837728290941208, 6], [30, 34, 0.66855319815863457, 3], [33, 48, 0.7204477918766885, 3]],
+[[0, 41, 0.98441254489755303, 12], [12, 24, 0.83875070200413304, 3], [15, 34, 0.67858661840639345, 3], [18, 36, 0.72718943244090883, 6], [24, 41, 0.77340447855700356, 3], [27, 24, 0.66548175645723961, 3], [30, 34, 0.66650306595873321, 6], [36, 36, 0.76605460892682264, 3], [39, 36, 0.74891609241534274, 3], [42, 41, 0.72996864216851987, 6]],
+[[0, 36, 0.93173094953488189, 3], [3, 43, 0.74073950691436141, 3], [6, 48, 0.70072348146699315, 6], [12, 41, 0.76569067925602818, 6], [18, 31, 0.69922249726037244, 3], [21, 26, 0.68786064845143091, 3], [24, 24, 0.76026064513566438, 12], [36, 31, 0.85690315396728145, 18], [54, 48, 0.66886452291774134, 6]],
+[[0, 24, 0.93884332604277865, 6], [6, 44, 0.69197509491892684, 12], [18, 26, 0.7483747098573984, 12], [30, 36, 0.6558579311285917, 12], [42, 36, 0.73335616918422786, 12], [54, 24, 0.65320763147080885, 6], [60, 41, 0.84820638534294346, 12]],
+[[0, 31, 0.96383778280217647, 3], [3, 32, 0.6827880150714456, 3], [6, 29, 0.70447053132698045, 6], [12, 31, 0.87367112434651306, 6], [18, 32, 0.74348275851346324, 6], [24, 29, 0.77360797269140757, 12], [36, 31, 0.79043953832063374, 6], [42, 32, 0.72627113577016511, 6], [48, 29, 0.84376500788700848, 12], [60, 31, 0.81462177207714259, 18], [78, 32, 0.68169125425191512, 6]],
+[[0, 31, 0.96068171090739762, 6], [6, 26, 0.65861447380552907, 12], [18, 26, 0.74101651247292311, 6], [24, 26, 0.78726048069792942, 12], [36, 46, 0.83565851088859266, 6], [42, 38, 0.73391584839476232, 6], [48, 44, 0.82934710206140072, 3], [51, 26, 0.72444014962606285, 3], [54, 46, 0.67278460617157154, 6], [60, 31, 0.77345755765203228, 3], [63, 26, 0.67551175192672341, 3], [66, 26, 0.68034946847861044, 6], [72, 26, 0.82150284683550578, 12], [84, 46, 0.7948886836198481, 6], [90, 38, 0.7037327477333748, 6]],
+[[0, 46, 0.91853925086365051, 6], [6, 48, 0.71034375361418967, 6], [12, 26, 0.80642025296922737, 6], [18, 44, 0.66175212491105695, 6], [24, 48, 0.76165156043098392, 18], [42, 32, 0.70579875836028549, 12], [54, 34, 0.70550361289299857, 6], [60, 44, 0.83584841426872336, 12], [72, 48, 0.78773502919200367, 3], [75, 46, 0.71030351931987157, 3], [78, 48, 0.73706171261138342, 6], [84, 26, 0.76436734995810229, 3], [87, 44, 0.65720279263841008, 3], [90, 48, 0.67912438999196589, 18]],
+[[0, 43, 0.97231796897286327, 3], [3, 26, 0.72658244613224088, 3], [6, 48, 0.73681970189006962, 12], [18, 36, 0.68032126142051519, 3], [21, 24, 0.67535741140257477, 3], [24, 26, 0.78389505191830122, 3], [27, 48, 0.70788715139682046, 3], [30, 36, 0.70687613347167932, 3], [33, 24, 0.70361798003115472, 3], [36, 43, 0.80560120866659679, 3], [39, 26, 0.72308872983396277, 3], [42, 48, 0.68206261793670431, 12], [54, 36, 0.7323321047104826, 3], [57, 24, 0.74968366579280366, 3], [60, 26, 0.75527865850601394, 6], [66, 48, 0.7342044083489675, 3], [69, 36, 0.6672363054315491, 3], [72, 24, 0.89189183056065324, 6], [78, 43, 0.67292403795720823, 6], [84, 26, 0.75614257965761245, 12], [96, 48, 0.84013511294014387, 12], [108, 36, 0.82043615367446099, 12]],
+[[0, 44, 0.94162462678270076, 6], [6, 48, 0.70758802315634106, 6], [12, 43, 0.7712703029104484, 12], [24, 26, 0.80228725499455, 12], [36, 24, 0.79627887815800358, 6], [42, 46, 0.73384835033396267, 3], [45, 48, 0.66943773616310254, 3], [48, 43, 0.81503270622407853, 6], [54, 26, 0.7026295837129779, 3], [57, 44, 0.72849293289411399, 3], [60, 48, 0.84241732215133736, 6], [66, 43, 0.72272501393930599, 6], [72, 26, 0.77484508677855668, 6], [78, 24, 0.70336201048446545, 3], [81, 46, 0.66362489844933381, 3], [84, 48, 0.79850379562086116, 6], [90, 43, 0.70560593407415961, 6], [96, 26, 0.87901638630403822, 6], [102, 44, 0.74054388969005958, 12], [114, 48, 0.73235687793300708, 3], [117, 43, 0.68422042763291202, 3], [120, 26, 0.86692578940904619, 6], [126, 24, 0.72068804918849294, 6]],
+[[0, 29, 0.96256192704686339, 12], [12, 43, 0.83644191013924363, 12], [24, 48, 0.87365209097936702, 3], [27, 29, 0.67152519733045435, 3], [30, 43, 0.68707777109903168, 12], [42, 48, 0.67147736168069372, 12], [54, 29, 0.73243234399052037, 3], [57, 43, 0.65776330067453748, 3], [60, 48, 0.7725591356173247, 6], [66, 29, 0.69106262611054892, 6], [72, 43, 0.79738795870023782, 12], [84, 48, 0.81298152427672787, 3], [87, 29, 0.6892770578442734, 3], [90, 43, 0.67301082230280085, 3], [93, 48, 0.74249401425620687, 3], [96, 29, 0.81091557267987957, 3], [99, 43, 0.66546631289543168, 3], [102, 48, 0.67623614844894886, 6], [108, 29, 0.8676349042942858, 6], [114, 43, 0.74316735913931642, 3], [117, 48, 0.71928697423910515, 3], [120, 29, 0.76838043481181306, 3], [123, 43, 0.67806300432936784, 3], [126, 48, 0.66559009320239737, 3], [129, 29, 0.70113644402896613, 3], [132, 43, 0.82894103239279027, 12]],
+[[0, 46, 0.92776096885657522, 6], [6, 24, 0.73134122605612739, 3], [9, 31, 0.68345375915203654, 3], [12, 44, 0.87420851960683199, 12], [24, 48, 0.8678492318367711, 6], [30, 32, 0.71144667301571618, 6], [36, 24, 0.75153428220284213, 6], [42, 46, 0.71993570546108121, 6], [48, 48, 0.77902857360954858, 18], [66, 46, 0.73711284553879119, 12], [78, 24, 0.71195028564497043, 3], [81, 31, 0.67424411174773646, 3], [84, 44, 0.78512044332988085, 3], [87, 48, 0.70818997136283768, 3], [90, 32, 0.7466392526898834, 6], [96, 24, 0.81655116865225519, 12], [108, 46, 0.80546194638380708, 3], [111, 48, 0.68944727354868562, 3], [114, 46, 0.72776658462333998, 12], [126, 24, 0.66664584210135303, 6], [132, 31, 0.76820075138106436, 6], [138, 44, 0.73942218197476839, 3], [141, 48, 0.68662434669989458, 3], [144, 32, 0.75600496647433579, 12]],
+[[0, 24, 0.94447346683772171, 12], [12, 24, 0.82748642311994747, 3], [15, 26, 0.68771656411080606, 3], [18, 31, 0.72752749656233118, 6], [24, 36, 0.79974025112004887, 3], [27, 34, 0.66923137260807042, 3], [30, 36, 0.67953027812430822, 6], [36, 24, 0.76028612519095962, 3], [39, 24, 0.6906262033787155, 3], [42, 24, 0.65053940906441554, 12], [54, 24, 0.6863614318272907, 12], [66, 26, 0.71947974017820226, 18], [84, 31, 0.76856508797784928, 12], [96, 36, 0.87348145059144677, 6], [102, 34, 0.73171436916605759, 3], [105, 36, 0.74978579055393968, 3], [108, 24, 0.86589898897346063, 6], [114, 24, 0.65715155321904162, 6], [120, 24, 0.82559794401373443, 12], [132, 24, 0.75907585472953332, 6], [138, 26, 0.67966513594643874, 12], [150, 31, 0.72189614576130379, 12], [162, 36, 0.66348043156904546, 3], [165, 34, 0.71246288969432103, 3]],
+[[0, 24, 0.96476677851370174, 18], [18, 24, 0.73153489970804675, 12], [30, 46, 0.65526862093698579, 6], [36, 38, 0.75770643465602272, 3], [39, 38, 0.70502630976199332, 3], [42, 26, 0.65905345820305283, 3], [45, 24, 0.71426954141581767, 3], [48, 24, 0.86442336284178423, 12], [60, 46, 0.86693010636499335, 3], [63, 24, 0.68033137658618004, 3], [66, 24, 0.72012878410836212, 6], [72, 46, 0.85651709516576457, 12], [84, 38, 0.76191899481707759, 3], [87, 38, 0.68513576862496905, 3], [90, 26, 0.65480239055086376, 3], [93, 24, 0.73468527194735422, 3], [96, 24, 0.82671042584779708, 6], [102, 46, 0.74888888911233664, 12], [114, 24, 0.70018194130598388, 6], [120, 24, 0.78554771433546955, 3], [123, 46, 0.70367003907937842, 3], [126, 38, 0.69971125676923995, 12], [138, 38, 0.66326329961671582, 6], [144, 26, 0.84248706140873242, 3], [147, 24, 0.7061422673494, 3], [150, 24, 0.72738625432801973, 3], [153, 46, 0.73857255301164837, 3], [156, 24, 0.82155527238585901, 12], [168, 24, 0.7689170266375428, 3], [171, 46, 0.70917658857947652, 3], [174, 38, 0.71683146061854774, 3], [177, 38, 0.73060733591262572, 3]],
+[[0, 44, 0.90594953197942985, 12], [12, 48, 0.84427460948140198, 12], [24, 24, 0.89938337425993853, 3], [27, 46, 0.73462690905700456, 3], [30, 48, 0.72714428931624742, 12], [42, 41, 0.69231330443415939, 6], [48, 41, 0.89895809465945908, 12], [60, 48, 0.84483983739107837, 12], [72, 41, 0.85755605437050186, 12], [84, 44, 0.78539378658510373, 6], [90, 48, 0.69481376986701071, 18], [108, 24, 0.83558669338406344, 18], [126, 46, 0.70632773695847928, 6], [132, 48, 0.86059238425530005, 3], [135, 41, 0.71512272400183474, 3], [138, 41, 0.74878235700842599, 3], [141, 48, 0.68347688078001578, 3], [144, 41, 0.86236412036937615, 6], [150, 44, 0.68695711055368791, 3], [153, 48, 0.69574560451383161, 3], [156, 24, 0.89574453585474556, 3], [159, 46, 0.68917137441437382, 3], [162, 48, 0.67197177122195872, 3], [165, 41, 0.74566437758167992, 3], [168, 41, 0.76346738520215651, 3], [171, 48, 0.71775023190012277, 3], [174, 41, 0.65393495050357608, 6], [180, 44, 0.82028773327358029, 6], [186, 48, 0.74754757317857623, 3], [189, 24, 0.73598852398275449, 3]]],
+60: [[[0, 46, 0.95495846582732946, 6], [6, 46, 0.7056084509580911, 6], [12, 46, 0.7979565175650446, 6], [18, 48, 0.67692159599480106, 3], [21, 24, 0.70041613490042598, 3]],
+[[0, 24, 0.93457689485656936, 12], [12, 36, 0.82833675359799286, 12], [24, 36, 0.81253761435252581, 3], [27, 24, 0.69315158189008297, 3], [30, 46, 0.66162730059443342, 3], [33, 46, 0.74582388744615435, 3]],
+[[0, 36, 0.95938443142216379, 6], [6, 44, 0.6794744896786209, 3], [9, 31, 0.71929919286346189, 3], [12, 29, 0.88909861618976249, 3], [15, 46, 0.74280227615973171, 3], [18, 34, 0.74877365184948597, 3], [21, 38, 0.70274444701105809, 3], [24, 48, 0.83617335414506033, 6], [30, 43, 0.65304856153150093, 3], [33, 36, 0.66501869909462263, 3], [36, 44, 0.81838608169605209, 3], [39, 31, 0.70396149897103577, 3], [42, 29, 0.69719769574389612, 3], [45, 46, 0.69533207200944447, 3]],
+[[0, 31, 0.94162850716559854, 3], [3, 36, 0.73927224108025391, 3], [6, 44, 0.69802016311305115, 6], [12, 48, 0.77540430982500119, 12], [24, 43, 0.76997809185589494, 3], [27, 48, 0.66223273985824416, 3], [30, 46, 0.66197369510057735, 12], [42, 24, 0.70163447237983689, 6], [48, 24, 0.86834836307232066, 6], [54, 31, 0.71872191656751983, 6]],
+[[0, 43, 0.91990245843783669, 3], [3, 43, 0.74146083463324775, 3], [6, 43, 0.65616352270449152, 6], [12, 41, 0.80722069117291395, 3], [15, 43, 0.72546810029235431, 3], [18, 41, 0.68495197506119287, 6], [24, 29, 0.84031825774509628, 6], [30, 31, 0.74035791924198469, 6], [36, 41, 0.80060477487501536, 3], [39, 43, 0.72329467184807805, 3], [42, 43, 0.67913373726121318, 3], [45, 43, 0.67708116605044721, 3], [48, 41, 0.8351548502246976, 3], [51, 43, 0.71618704381116172, 3], [54, 41, 0.68355808636980042, 3], [57, 29, 0.74261228242457278, 3], [60, 31, 0.89713367585101245, 3], [63, 41, 0.74176998820545847, 3], [66, 43, 0.73811445627502681, 6]],
+[[0, 43, 0.95390602181960815, 6], [6, 38, 0.65981083294909981, 12], [18, 26, 0.66962965674500186, 12], [30, 36, 0.74887415781650646, 3], [33, 31, 0.68610290352329928, 3], [36, 31, 0.75122687499895768, 12], [48, 32, 0.81004220690444317, 3], [51, 26, 0.67828388012894858, 3], [54, 29, 0.69979429218023792, 3], [57, 43, 0.70649727014136543, 3], [60, 38, 0.82259012639831453, 6], [66, 26, 0.68720690881875934, 6], [72, 36, 0.86601093478524205, 3], [75, 31, 0.67226652037962376, 3], [78, 31, 0.69981199664909566, 6]],
+[[0, 34, 0.9152305719509124, 12], [12, 34, 0.86726762262772328, 6], [18, 26, 0.71782087186082666, 3], [21, 26, 0.66074340576680357, 3], [24, 41, 0.79588140214535097, 3], [27, 24, 0.7058420861964666, 3], [30, 41, 0.70968146774175189, 3], [33, 48, 0.74532080425996106, 3], [36, 46, 0.82594126990237027, 3], [39, 34, 0.71394838806424943, 3], [42, 34, 0.74851180681998386, 3], [45, 26, 0.70189165563611711, 3], [48, 26, 0.77142501248406936, 3], [51, 41, 0.72184112190763905, 3], [54, 24, 0.66749799254881259, 12], [66, 41, 0.66916612150586097, 6], [72, 48, 0.8520252879536846, 6], [78, 46, 0.692495161394167, 12], [90, 34, 0.74019235425106189, 3], [93, 34, 0.66649610390608838, 3]],
+[[0, 31, 0.93013831013676551, 3], [3, 26, 0.68116299845483019, 3], [6, 34, 0.65158585617521825, 3], [9, 26, 0.6698563308488612, 3], [12, 24, 0.81930097247203637, 12], [24, 38, 0.86605999717021098, 6], [30, 32, 0.66174295107555625, 6], [36, 24, 0.81048002858834756, 6], [42, 32, 0.67007908310433661, 3], [45, 31, 0.72158537488757135, 3], [48, 26, 0.78043252256917062, 12], [60, 34, 0.80017904216987834, 3], [63, 26, 0.72360203760035968, 3], [66, 24, 0.66759031118370293, 6], [72, 38, 0.88342637365234766, 6], [78, 32, 0.66727459791970334, 3], [81, 24, 0.70976903255313506, 3], [84, 32, 0.75092232713714069, 3], [87, 31, 0.70151180971639759, 3], [90, 26, 0.67298176401612708, 6], [96, 34, 0.76939155851770946, 3], [99, 26, 0.71697205067147529, 3], [102, 24, 0.7110923629003465, 6]],
+[[0, 41, 0.96961028998622656, 6], [6, 36, 0.66521162314572002, 6], [12, 24, 0.86853060093968859, 3], [15, 44, 0.69604624007517679, 3], [18, 44, 0.6620327489008192, 6], [24, 44, 0.78056141734105799, 3], [27, 41, 0.67223179924124066, 3], [30, 24, 0.70314020879854366, 6], [36, 38, 0.88745994431864916, 3], [39, 41, 0.65484492053875998, 3], [42, 36, 0.73957029421457365, 6], [48, 24, 0.83389558812188336, 3], [51, 44, 0.71089476921474981, 3], [54, 44, 0.65064178632498171, 6], [60, 44, 0.85876550861078704, 6], [66, 41, 0.72596804151246874, 3], [69, 24, 0.7348130106333417, 3], [72, 38, 0.81155225760882133, 6], [78, 41, 0.72514282950241093, 6], [84, 36, 0.78841569616598339, 3], [87, 24, 0.67692208275158749, 3], [90, 44, 0.69307008892762434, 3], [93, 44, 0.72701779393814836, 3], [96, 44, 0.75717832604320257, 3], [99, 41, 0.71783239221773709, 3], [102, 24, 0.66216193230899889, 6], [108, 38, 0.82669208944527039, 3], [111, 41, 0.71662804546238112, 3], [114, 36, 0.67816773923692297, 6]],
+[[0, 32, 0.92306828295908494, 6], [6, 41, 0.70180864471674009, 3], [9, 24, 0.65010217166548412, 3], [12, 41, 0.85181440091428151, 6], [18, 44, 0.70524582017888293, 6], [24, 44, 0.77929225760542442, 6], [30, 26, 0.67143643144438148, 6], [36, 38, 0.82427933308272361, 3], [39, 24, 0.7434286582112567, 3], [42, 32, 0.69330549294846378, 3], [45, 41, 0.71464720778213031, 3], [48, 24, 0.89090103695402501, 6], [54, 41, 0.68623041480483804, 6], [60, 44, 0.8976401178784752, 6], [66, 44, 0.74788282309998955, 6], [72, 26, 0.85767968349603674, 12], [84, 38, 0.85374073797558558, 3], [87, 24, 0.65883587139052746, 3], [90, 32, 0.74128669214965215, 6], [96, 41, 0.82957970630471323, 3], [99, 24, 0.73344116891227751, 3], [102, 41, 0.71815419433696415, 3], [105, 44, 0.71174961453864294, 3], [108, 44, 0.89954876784322713, 12], [120, 26, 0.84016982724441513, 12]],
+[[0, 36, 0.94553305377293628, 12], [12, 26, 0.76094322603233466, 6], [18, 43, 0.73120142043478076, 3], [21, 46, 0.71310758397384699, 3], [24, 36, 0.84893761258814182, 6], [30, 24, 0.68033879675520248, 12], [42, 24, 0.68867160184771459, 3], [45, 36, 0.65482839070614995, 3], [48, 44, 0.88911705967638366, 3], [51, 36, 0.68187241405626497, 3], [54, 26, 0.73113811028371611, 3], [57, 43, 0.67340922287161242, 3], [60, 46, 0.82334871836145185, 6], [66, 36, 0.6580581781631849, 12], [78, 24, 0.6812455968723965, 3], [81, 24, 0.72390505378029368, 3], [84, 36, 0.81086632722879981, 6], [90, 44, 0.66906801328995646, 6], [96, 36, 0.76699447419334077, 3], [99, 26, 0.7330186837123307, 3], [102, 43, 0.74563268994297127, 3], [105, 46, 0.74176504016888722, 3], [108, 36, 0.8616703462140598, 6], [114, 24, 0.74786137093126803, 3], [117, 24, 0.66911309312650058, 3], [120, 36, 0.75034948834169379, 6], [126, 44, 0.71018078210400226, 3], [129, 36, 0.70183798240815087, 3], [132, 26, 0.83415853230865933, 6], [138, 43, 0.72578962060430929, 3], [141, 46, 0.71060221653616396, 3]],
+[[0, 31, 0.96542784331595743, 12], [12, 26, 0.87067247938038994, 3], [15, 24, 0.66401779230099056, 3], [18, 48, 0.69880020289757461, 12], [30, 32, 0.69171595681094333, 3], [33, 48, 0.70094088985511316, 3], [36, 31, 0.79738776716302062, 6], [42, 24, 0.71796274483245393, 12], [54, 26, 0.66158243839699749, 3], [57, 31, 0.7420639622600308, 3], [60, 26, 0.85314918570101739, 3], [63, 24, 0.70101750216660674, 3], [66, 48, 0.71645193469440749, 3], [69, 32, 0.67305259558254715, 3], [72, 48, 0.85240116079438266, 12], [84, 31, 0.81830149576320776, 3], [87, 24, 0.65388685799195689, 3], [90, 26, 0.67762848970134737, 12], [102, 31, 0.66384956572364828, 6], [108, 26, 0.87104818532365069, 12], [120, 24, 0.82592190154122591, 6], [126, 48, 0.73725416254133935, 3], [129, 32, 0.67854654499105327, 3], [132, 48, 0.84738866045578709, 3], [135, 31, 0.65367380991184354, 3], [138, 24, 0.66500541177793715, 3], [141, 26, 0.65591637322564367, 3], [144, 31, 0.8671078105575255, 3], [147, 26, 0.71415405591114578, 3], [150, 24, 0.74129039174474842, 3], [153, 48, 0.73043213963564924, 3]],
+[[0, 34, 0.93306849774480394, 3], [3, 26, 0.74389924397748142, 3], [6, 36, 0.70259617708168565, 3], [9, 44, 0.71099554222713968, 3], [12, 48, 0.75584192009825835, 6], [18, 41, 0.73819455213333318, 12], [30, 32, 0.68874352794321869, 3], [33, 43, 0.65349790081353976, 3], [36, 46, 0.78478386648358622, 3], [39, 34, 0.68563555575897661, 3], [42, 26, 0.68749379578998582, 3], [45, 36, 0.66621428925087545, 3], [48, 44, 0.80631038315076486, 3], [51, 48, 0.73839869262249669, 3], [54, 41, 0.7218621947806072, 12], [66, 32, 0.69549067158883193, 3], [69, 43, 0.72586812535028433, 3], [72, 46, 0.82843523835132071, 3], [75, 34, 0.66385996607503861, 3], [78, 26, 0.71924390782459147, 6], [84, 36, 0.8643122705720937, 6], [90, 44, 0.69596098323899502, 12], [102, 48, 0.67881701760834368, 3], [105, 41, 0.6740656203370391, 3], [108, 32, 0.77713400688746803, 3], [111, 43, 0.72042567506467659, 3], [114, 46, 0.66299263547593001, 6], [120, 34, 0.7711400180025928, 6], [126, 26, 0.66882604503784993, 6], [132, 36, 0.87706876804263567, 6], [138, 44, 0.70186304531239674, 6], [144, 48, 0.77648688963809276, 3], [147, 41, 0.65911195466649197, 3], [150, 32, 0.66226834432954984, 6], [156, 43, 0.85964773585449561, 3], [159, 46, 0.67038742151708652, 3], [162, 34, 0.66331990073290137, 6]],
+[[0, 43, 0.90664147192760403, 12], [12, 36, 0.79952726712850075, 3], [15, 36, 0.68558192316178446, 3], [18, 34, 0.69917146760668492, 6], [24, 46, 0.85255805955198571, 3], [27, 46, 0.74168743150396743, 3], [30, 46, 0.73443970527639713, 12], [42, 46, 0.68932574761938403, 6], [48, 46, 0.79373049646638427, 3], [51, 43, 0.67808816973563502, 3], [54, 36, 0.68525199331956321, 3], [57, 36, 0.69825902422093222, 3], [60, 34, 0.75954693700330367, 6], [66, 46, 0.67969727738305208, 6], [72, 46, 0.77443033649191118, 6], [78, 46, 0.74659144431576474, 12], [90, 46, 0.73134829201031859, 3], [93, 46, 0.74753221771174927, 3], [96, 43, 0.80586664077438475, 6], [102, 36, 0.65780858904927475, 3], [105, 36, 0.67552631139181885, 3], [108, 34, 0.84180279745963471, 3], [111, 46, 0.65713417743274738, 3], [114, 46, 0.736732334062141, 3], [117, 46, 0.65399027824636113, 3], [120, 46, 0.84772590011502735, 6], [126, 46, 0.73411222701899936, 6], [132, 43, 0.80006047667252211, 3], [135, 36, 0.70924971280541593, 3], [138, 36, 0.65900034511939087, 12], [150, 34, 0.69552556837490409, 3], [153, 46, 0.6729546286068333, 3], [156, 46, 0.82100778633617288, 6], [162, 46, 0.65360579958931941, 3], [165, 46, 0.72931502646591573, 3], [168, 46, 0.88153252924071035, 6], [174, 43, 0.68411262478542367, 6]],
+[[0, 36, 0.97845489568362931, 3], [3, 43, 0.73125567882132003, 3], [6, 43, 0.69999784120559672, 3], [9, 44, 0.70267003971250386, 3], [12, 24, 0.87973063928893946, 6], [18, 24, 0.72931337377297778, 3], [21, 43, 0.65566042287435122, 3], [24, 36, 0.87877625963396944, 3], [27, 36, 0.66966598508489872, 3], [30, 36, 0.65270846644541758, 3], [33, 43, 0.72884159680076344, 3], [36, 43, 0.87008875879423453, 3], [39, 44, 0.65764793319182624, 3], [42, 24, 0.66886538177213617, 6], [48, 24, 0.80756635302101754, 3], [51, 43, 0.70291327235943823, 3], [54, 36, 0.67814305974099431, 12], [66, 36, 0.7025410516766678, 3], [69, 36, 0.68687658945427787, 3], [72, 43, 0.83653698182410285, 6], [78, 43, 0.74880607623200934, 3], [81, 44, 0.66854817206348593, 3], [84, 24, 0.76598588922790611, 3], [87, 24, 0.74916771510856139, 3], [90, 43, 0.73254023054626449, 3], [93, 36, 0.67381498556189423, 3], [96, 36, 0.85858802556502289, 3], [99, 36, 0.7221239443500872, 3], [102, 43, 0.74599245462773256, 6], [108, 43, 0.81637567767558572, 6], [114, 44, 0.67073548261616578, 3], [117, 24, 0.71787559007408008, 3], [120, 24, 0.79353098610740702, 3], [123, 43, 0.69701026336316774, 3], [126, 36, 0.71973861435642295, 6], [132, 36, 0.86003150790852267, 6], [138, 36, 0.68419751384706384, 3], [141, 43, 0.6819861183006255, 3], [144, 43, 0.89650848323404442, 3], [147, 44, 0.67204674116811658, 3], [150, 24, 0.69689869465092735, 6], [156, 24, 0.78400166906312219, 6], [162, 43, 0.65969217648667067, 6], [168, 36, 0.86497713443635826, 3], [171, 36, 0.66933076119842261, 3], [174, 36, 0.72399491256618242, 3], [177, 43, 0.71407410668327287, 3], [180, 43, 0.83699679422133544, 6], [186, 44, 0.7118423810891551, 3], [189, 24, 0.66908571367439851, 3]]],
+61: [[[0, 31, 0.99851735977950673, 3], [3, 24, 0.70580912393691986, 3], [6, 26, 0.70457302615082384, 3], [9, 43, 0.73418437681674265, 3], [12, 48, 0.7625353123880696, 3], [15, 41, 0.7018653790798165, 3], [18, 43, 0.68938367311179305, 3], [21, 46, 0.74320442835965839, 3]],
+[[0, 26, 0.90876456195162358, 3], [3, 24, 0.66955702224632752, 3], [6, 44, 0.70304114313472243, 3], [9, 34, 0.7339580399675063, 3], [12, 46, 0.76477904444732592, 3], [15, 26, 0.71292504609563523, 3], [18, 24, 0.65378312465455024, 6], [24, 44, 0.84818887438316415, 3], [27, 34, 0.71423054314776091, 3], [30, 46, 0.67614034659764732, 6]],
+[[0, 36, 0.97954345067512949, 3], [3, 26, 0.66342001686621055, 3], [6, 24, 0.73990421863775024, 3], [9, 38, 0.71166826307081654, 3], [12, 24, 0.83723030510408714, 3], [15, 24, 0.6610436069686022, 3], [18, 26, 0.72261671710082853, 3], [21, 26, 0.68972541216839778, 3], [24, 29, 0.81527322800809243, 3], [27, 26, 0.69789256190350346, 3], [30, 36, 0.71872667736365747, 3], [33, 26, 0.69948555095823817, 3], [36, 24, 0.83087205648070228, 3], [39, 38, 0.7004492990969553, 3], [42, 24, 0.7249891819419273, 3], [45, 24, 0.71655955774579072, 3]],
+[[0, 36, 0.97332015779837888, 6], [6, 44, 0.66694284388058256, 3], [9, 44, 0.65685000351051492, 3], [12, 36, 0.76004002272580096, 3], [15, 46, 0.70433763221665269, 3], [18, 38, 0.70542166552203733, 3], [21, 26, 0.73644039204896183, 3], [24, 26, 0.85432915664547082, 3], [27, 24, 0.67773385468490743, 3], [30, 43, 0.68634994250555481, 3], [33, 36, 0.74101734297756472, 3], [36, 44, 0.81746109421506641, 12], [48, 44, 0.77473165951111944, 3], [51, 36, 0.74899338631982104, 3], [54, 46, 0.67778542449124746, 6]],
+[[0, 36, 0.95903451755152014, 3], [3, 24, 0.73278030003642736, 3], [6, 24, 0.70346694462365589, 12], [18, 46, 0.67743514393069615, 6], [24, 48, 0.84989613793009655, 3], [27, 38, 0.73871788959566587, 3], [30, 38, 0.68594231659974014, 3], [33, 46, 0.72271629674329063, 3], [36, 48, 0.76124379159498368, 3], [39, 38, 0.70644193351098827, 3], [42, 36, 0.72699553270336137, 12], [54, 24, 0.72084926809366157, 3], [57, 24, 0.73670002539055013, 3], [60, 46, 0.78257116177731312, 6], [66, 48, 0.70451959296038658, 3], [69, 38, 0.69155692621731846, 3]],
+[[0, 48, 0.92297868437535335, 3], [3, 46, 0.67707908194119804, 3], [6, 41, 0.68215150986870798, 6], [12, 46, 0.84015199321188905, 3], [15, 29, 0.69718414748368163, 3], [18, 41, 0.67116538451906882, 12], [30, 46, 0.6774648244958924, 3], [33, 29, 0.72472129379632799, 3], [36, 29, 0.78492969092219012, 6], [42, 36, 0.66584518187199038, 6], [48, 48, 0.79721329209022906, 3], [51, 46, 0.65738895690561783, 3], [54, 41, 0.70813436377123706, 12], [66, 46, 0.70870329814084987, 3], [69, 29, 0.66202104153935593, 3], [72, 41, 0.84775262232508553, 12]],
+[[0, 36, 0.95028741369132574, 3], [3, 26, 0.71145868170842264, 3], [6, 43, 0.72247169482483442, 6], [12, 44, 0.79129356773228099, 3], [15, 44, 0.67762983643470154, 3], [18, 48, 0.65845426976343691, 6], [24, 29, 0.80265164863551108, 3], [27, 43, 0.74745741160720924, 3], [30, 44, 0.65009520875997606, 3], [33, 44, 0.68466887908141971, 3], [36, 36, 0.89246293037921354, 6], [42, 26, 0.69218682249654817, 3], [45, 43, 0.66259788349916704, 3], [48, 44, 0.799623608978416, 6], [54, 44, 0.68030596051844372, 3], [57, 48, 0.72632804688972519, 3], [60, 29, 0.81671320508980227, 3], [63, 43, 0.74373476583153131, 3], [66, 44, 0.72451758280030465, 6], [72, 44, 0.86677679761023263, 3], [75, 36, 0.66144155023913631, 3], [78, 26, 0.67744069516362793, 6], [84, 43, 0.83125209822496393, 3], [87, 44, 0.68376740119069979, 3], [90, 44, 0.66455523911753445, 3], [93, 48, 0.74245906620961766, 3]],
+[[0, 34, 0.94675607912541471, 3], [3, 29, 0.66751617156867249, 3], [6, 29, 0.65891888509924501, 3], [9, 29, 0.71827214584442556, 3], [12, 43, 0.83365538538333017, 3], [15, 29, 0.65436404866591691, 3], [18, 29, 0.73395829703103799, 3], [21, 29, 0.70760862113339118, 3], [24, 43, 0.85881700726860788, 3], [27, 29, 0.65019703963970588, 3], [30, 34, 0.73555409466820953, 3], [33, 29, 0.72074844868676924, 3], [36, 29, 0.8713815530330058, 3], [39, 29, 0.67048921036741471, 3], [42, 43, 0.71463176375996351, 3], [45, 29, 0.6571743109201349, 3], [48, 29, 0.78145409363862273, 3], [51, 29, 0.71162120329963774, 3], [54, 43, 0.70672989237350026, 6], [60, 29, 0.76744838809926219, 3], [63, 34, 0.68035408064017755, 3], [66, 29, 0.71942915603442603, 3], [69, 29, 0.65321699917015119, 3], [72, 29, 0.88601570009198927, 3], [75, 43, 0.66210892236010499, 3], [78, 29, 0.68756807776516882, 3], [81, 29, 0.74381548166520617, 3], [84, 29, 0.83348877831409496, 3], [87, 43, 0.67425009832344374, 3], [90, 29, 0.72224993291237871, 3], [93, 34, 0.66423324834655439, 3], [96, 29, 0.82328223412815671, 3], [99, 29, 0.65404132947773996, 3], [102, 29, 0.69831822752766914, 3], [105, 43, 0.69884420524403956, 3]],
+[[0, 34, 0.94497862634720597, 3], [3, 26, 0.69728412414033958, 3], [6, 26, 0.66551491173706478, 6], [12, 26, 0.84264970149538554, 3], [15, 32, 0.74855872475349239, 3], [18, 26, 0.66520829339567178, 3], [21, 26, 0.66023784135984798, 3], [24, 26, 0.76108852065160726, 3], [27, 32, 0.71757222790144026, 3], [30, 26, 0.6749591121156886, 3], [33, 34, 0.68093274339028975, 3], [36, 26, 0.80043619542073507, 3], [39, 26, 0.74496110134219018, 3], [42, 26, 0.73823532771978806, 3], [45, 32, 0.69488274792241178, 3], [48, 26, 0.87698938512574953, 3], [51, 26, 0.73138903323754312, 3], [54, 26, 0.74880940106260907, 3], [57, 32, 0.66620317738028845, 3], [60, 26, 0.89817547068969916, 6], [66, 34, 0.74295461985462119, 3], [69, 26, 0.65282412239749787, 3], [72, 26, 0.8819208921790882, 6], [78, 26, 0.748830914219063, 3], [81, 32, 0.68375098806273193, 3], [84, 26, 0.89565988628562898, 3], [87, 26, 0.68434263823676844, 3], [90, 26, 0.72323843021760081, 6], [96, 32, 0.84234459588138499, 3], [99, 26, 0.74918595530226884, 3], [102, 34, 0.70504342210222903, 6], [108, 26, 0.8880359542830325, 6], [114, 26, 0.67601620002740648, 3], [117, 26, 0.723692012436292, 3]],
+[[0, 26, 0.91276084995405327, 3], [3, 26, 0.73288366382170933, 3], [6, 26, 0.67318573513755808, 3], [9, 24, 0.70538062715357674, 3], [12, 46, 0.88753356968650432, 12], [24, 26, 0.88676849535443736, 3], [27, 24, 0.74553024587223282, 3], [30, 46, 0.69951767525037079, 3], [33, 26, 0.72723963802205394, 3], [36, 24, 0.80775248427104784, 3], [39, 26, 0.73677537150693317, 3], [42, 26, 0.65345021049676899, 3], [45, 26, 0.65788466617126895, 3], [48, 24, 0.86095014722436169, 3], [51, 46, 0.65237740074469253, 3], [54, 26, 0.72335625113738067, 3], [57, 24, 0.74022901542739583, 3], [60, 46, 0.87843294486316159, 3], [63, 26, 0.70110453260349337, 3], [66, 24, 0.66511696138670251, 3], [69, 26, 0.722917288022904, 3], [72, 26, 0.83588577593956526, 3], [75, 26, 0.71751680262439166, 3], [78, 24, 0.73473257323300811, 3], [81, 46, 0.7070444398354635, 3], [84, 26, 0.76894281524276131, 6], [90, 24, 0.74031487711854171, 3], [93, 46, 0.71703390201221806, 3], [96, 26, 0.81067747545656721, 3], [99, 24, 0.66296539554780676, 3], [102, 26, 0.72173657717310624, 3], [105, 26, 0.7052136807060625, 3], [108, 26, 0.87006763169196333, 3], [111, 24, 0.70696534405786593, 3], [114, 46, 0.71810825503337239, 3], [117, 26, 0.71084694326717301, 3], [120, 24, 0.79430930779491138, 6], [126, 46, 0.65408944103482469, 3], [129, 26, 0.70305241596065005, 3]],
+[[0, 38, 0.90393022747088414, 3], [3, 32, 0.65012287486116482, 3], [6, 41, 0.69837871855735834, 3], [9, 46, 0.67856291761000065, 3], [12, 26, 0.89138510612608779, 6], [18, 24, 0.74701371784138793, 6], [24, 48, 0.81589995930052994, 6], [30, 36, 0.69511968638863098, 3], [33, 36, 0.67941212539748019, 3], [36, 31, 0.77031603079832955, 6], [42, 38, 0.67328271769132664, 3], [45, 32, 0.67449045449873768, 3], [48, 41, 0.86878396893065524, 3], [51, 46, 0.67916089721541462, 3], [54, 26, 0.66751511796930452, 3], [57, 24, 0.65516251534457715, 3], [60, 48, 0.80799900281736492, 3], [63, 36, 0.67586891926871728, 3], [66, 36, 0.69387935381350918, 3], [69, 31, 0.72005264453935192, 3], [72, 38, 0.75494459446625761, 6], [78, 32, 0.65396727981937852, 3], [81, 41, 0.65505355552087885, 3], [84, 46, 0.79988123573794123, 6], [90, 26, 0.68895490395896275, 6], [96, 24, 0.82954336650295812, 3], [99, 48, 0.70716338804962164, 3], [102, 36, 0.74719099793247101, 12], [114, 36, 0.67247109147314954, 6], [120, 31, 0.81181740134643388, 6], [126, 38, 0.70616879978879188, 3], [129, 32, 0.72128937501382628, 3], [132, 41, 0.76985427936339934, 3], [135, 46, 0.74377270909820825, 3], [138, 26, 0.72763857811911714, 3], [141, 24, 0.6877042483129201, 3]],
+[[0, 32, 0.97931472909186512, 6], [6, 29, 0.71306706667874808, 3], [9, 32, 0.68576955125031225, 3], [12, 44, 0.79991851645360168, 3], [15, 44, 0.67979283411989144, 3], [18, 26, 0.65689458724006278, 3], [21, 29, 0.74514479691793456, 3], [24, 32, 0.87119398627483313, 3], [27, 44, 0.6997230074758507, 3], [30, 44, 0.74386314075148552, 6], [36, 32, 0.87527894188020228, 12], [48, 29, 0.78579710802013869, 3], [51, 32, 0.65174615031964578, 3], [54, 44, 0.72021863635270078, 6], [60, 44, 0.82964499416641191, 6], [66, 26, 0.69777113330744511, 6], [72, 29, 0.87821223628551048, 6], [78, 32, 0.698655314708297, 3], [81, 44, 0.68718899379500498, 3], [84, 44, 0.78128338135643327, 3], [87, 32, 0.73441649689807054, 3], [90, 29, 0.67499829576152692, 12], [102, 32, 0.67201175275973835, 6], [108, 44, 0.76675260280518542, 6], [114, 44, 0.6788059080268013, 12], [126, 26, 0.74297523689208533, 6], [132, 29, 0.84549320745669665, 3], [135, 32, 0.74949160166202566, 3], [138, 44, 0.73810676830932975, 3], [141, 44, 0.65093217422489325, 3], [144, 32, 0.75420763512385958, 3], [147, 29, 0.7280870273118869, 3], [150, 32, 0.7239806295491632, 3], [153, 44, 0.66917272089810886, 3]],
+[[0, 38, 0.92372170367072759, 3], [3, 48, 0.68091440993037144, 3], [6, 34, 0.65166173668696892, 3], [9, 24, 0.65194426139935646, 3], [12, 44, 0.88633020644748917, 3], [15, 38, 0.71851448158011644, 3], [18, 48, 0.66079161065780401, 12], [30, 34, 0.67184123405936513, 3], [33, 24, 0.71797445655929815, 3], [36, 44, 0.84754861543977911, 3], [39, 38, 0.73878057098566385, 3], [42, 48, 0.72683986886609708, 3], [45, 34, 0.72217548926200048, 3], [48, 24, 0.77813773171867251, 3], [51, 44, 0.6539043713143009, 3], [54, 38, 0.73298694676843101, 3], [57, 48, 0.69175767143116207, 3], [60, 34, 0.81249273879036488, 3], [63, 24, 0.67075158710132476, 3], [66, 44, 0.69156020875726032, 3], [69, 38, 0.69279141016036583, 3], [72, 48, 0.76490259166864338, 3], [75, 34, 0.710057745193169, 3], [78, 24, 0.65395531917625305, 3], [81, 44, 0.69138680883694326, 3], [84, 38, 0.76205189797225004, 3], [87, 48, 0.69873302778624202, 3], [90, 34, 0.65594443528532631, 3], [93, 24, 0.69770247736595237, 3], [96, 44, 0.88204728252114739, 3], [99, 38, 0.68575644734700769, 3], [102, 48, 0.67497182129293298, 3], [105, 34, 0.6710743209755119, 3], [108, 24, 0.77846804361313682, 3], [111, 44, 0.74392404656699407, 3], [114, 38, 0.70932648930503639, 6], [120, 48, 0.7700303967283274, 3], [123, 34, 0.7454007213450482, 3], [126, 24, 0.67327017963678193, 3], [129, 44, 0.70589713283721045, 3], [132, 38, 0.880507910838077, 3], [135, 48, 0.68278958704276815, 3], [138, 34, 0.65619110687812288, 6], [144, 24, 0.76529663840128137, 3], [147, 44, 0.67855374283687064, 3], [150, 38, 0.65977189438115746, 6], [156, 48, 0.7517908529996038, 3], [159, 34, 0.7294196310392127, 3], [162, 24, 0.67662259882044884, 3], [165, 44, 0.74889355923330325, 3]],
+[[0, 46, 0.91762193749006549, 3], [3, 48, 0.70032015387768587, 3], [6, 32, 0.68636543809498951, 12], [18, 43, 0.72088760916536021, 6], [24, 46, 0.80513456623341983, 3], [27, 46, 0.70899637727095732, 3], [30, 46, 0.71093028496443378, 3], [33, 48, 0.73256620571156206, 3], [36, 32, 0.79645955879654295, 3], [39, 43, 0.65574477735219727, 3], [42, 46, 0.74945373945022598, 3], [45, 48, 0.7119573508758168, 3], [48, 32, 0.82376374737810765, 3], [51, 43, 0.72070078138378435, 3], [54, 46, 0.7173428852348378, 12], [66, 46, 0.66761392950937204, 6], [72, 46, 0.78154035076545969, 3], [75, 48, 0.70500474422730053, 3], [78, 32, 0.73591180417760116, 3], [81, 43, 0.73406955699554954, 3], [84, 46, 0.75179068985633235, 3], [87, 48, 0.67554147042505241, 3], [90, 32, 0.65253874611771767, 6], [96, 43, 0.78542675770944625, 6], [102, 46, 0.71533231834397415, 6], [108, 46, 0.8986158322314679, 3], [111, 46, 0.72751454153192063, 3], [114, 48, 0.67222036506267435, 3], [117, 32, 0.74842679613867014, 3], [120, 43, 0.84461456887311903, 3], [123, 46, 0.6938815301347836, 3], [126, 48, 0.68213616514221309, 12], [138, 32, 0.72417460293224345, 3], [141, 43, 0.73266095795444464, 3], [144, 46, 0.83810905578395123, 6], [150, 46, 0.73683858008856917, 6], [156, 46, 0.82167226614044386, 3], [159, 48, 0.7233680536045215, 3], [162, 32, 0.69441552632194525, 6], [168, 43, 0.8403550125625342, 3], [171, 46, 0.70790325265868592, 3], [174, 48, 0.74700495514609444, 3], [177, 32, 0.67822040124378946, 3]],
+[[0, 41, 0.90749112369152007, 6], [6, 44, 0.68508196767065499, 3], [9, 24, 0.66717388707033054, 3], [12, 24, 0.78750122741427653, 3], [15, 44, 0.68175269597842658, 3], [18, 24, 0.66704450201538978, 3], [21, 24, 0.66197590004638796, 3], [24, 44, 0.79387083714507367, 3], [27, 24, 0.7265095259828267, 3], [30, 24, 0.69664176362830887, 3], [33, 41, 0.66632996950197809, 3], [36, 44, 0.88865815727771846, 3], [39, 24, 0.73068655333518051, 3], [42, 24, 0.69988978292309578, 12], [54, 44, 0.72005706841248895, 3], [57, 24, 0.68224891301849977, 3], [60, 24, 0.85200725622729323, 3], [63, 44, 0.74944706921332382, 3], [66, 24, 0.66611908995459601, 3], [69, 24, 0.73708796669115784, 3], [72, 41, 0.83566638754822753, 3], [75, 44, 0.67968293794852408, 3], [78, 24, 0.66468795662074787, 3], [81, 24, 0.65696765683891378, 3], [84, 44, 0.79419235576389646, 3], [87, 24, 0.68099109416724579, 3], [90, 24, 0.69043795663447072, 3], [93, 44, 0.71400815090169212, 3], [96, 24, 0.7852518919608229, 3], [99, 24, 0.72155047953854523, 3], [102, 41, 0.71895551265217406, 3], [105, 44, 0.67267812617384704, 3], [108, 24, 0.88878494409916087, 12], [120, 24, 0.85630096458349636, 3], [123, 44, 0.70120192832100581, 3], [126, 24, 0.65664531103638279, 3], [129, 24, 0.72531067110367498, 3], [132, 44, 0.83619454871007504, 6], [138, 24, 0.74363823449954958, 12], [150, 24, 0.73659705693463506, 6], [156, 41, 0.80936672110417818, 3], [159, 44, 0.6527125079174031, 3], [162, 24, 0.73930231736876195, 12], [174, 24, 0.72892089801938209, 3], [177, 44, 0.68072925711402577, 3], [180, 24, 0.76243271274091484, 3], [183, 24, 0.71699422396049095, 3], [186, 44, 0.74550675874850303, 6]]]
+} \ No newline at end of file
diff --git a/TamTamMini.activity/Mini/miniTamTamMain.py b/TamTamMini.activity/Mini/miniTamTamMain.py
new file mode 100644
index 0000000..16836b8
--- /dev/null
+++ b/TamTamMini.activity/Mini/miniTamTamMain.py
@@ -0,0 +1,823 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import gobject
+import os
+import random
+import time
+import xdrlib
+import commands
+
+from types import *
+from math import sqrt
+from common.Util.NoteDB import PARAMETER
+
+import common.Util.Network as Net
+
+import common.Config as Config
+
+from Mini.miniToolbars import playToolbar
+from Mini.miniToolbars import recordToolbar
+from common.Util.ThemeWidgets import *
+from common.Util.CSoundNote import CSoundNote
+from common.Util import NoteDB
+from common.Util.NoteDB import Note
+from common.Util.CSoundClient import new_csound_client
+from common.Util.LoopSettings import LoopSettings
+
+from Fillin import Fillin
+from KeyboardStandAlone import KeyboardStandAlone
+from MiniSequencer import MiniSequencer
+from Loop import Loop
+from RythmGenerator import *
+from common.Util.Trackpad import Trackpad
+from common.Util.InstrumentPanel import InstrumentPanel
+
+from gettext import gettext as _
+
+Tooltips = Config.Tooltips
+
+class miniTamTamMain(gtk.EventBox):
+
+ def __init__(self, activity):
+ gtk.EventBox.__init__(self)
+
+ self.activity = activity
+
+ self.set_border_width(Config.MAIN_WINDOW_PADDING)
+
+ self.firstTime = False
+ self.csnd = new_csound_client()
+ self.timeout_ms = 50
+ self.instVolume = 50
+ self.drumVolume = 0.5
+ self.instrument = 'ocarina'
+ self.regularity = 0.75
+ self.beat = 4
+ self.reverb = 0.
+ self.tempo = Config.PLAYER_TEMPO
+ self.beatDuration = 60.0/self.tempo
+ self.ticksPerSecond = Config.TICKS_PER_BEAT*self.tempo/60.0
+ self.rythmInstrument = 'drum1kit'
+ self.muteInst = False
+ self.drumFillin = Fillin( self.beat, self.tempo, self.rythmInstrument, self.reverb, self.drumVolume )
+ self.sequencer= MiniSequencer(self.recordStateButton, self.recordOverSensitivity)
+ self.loop = Loop(self.beat, sqrt( self.instVolume*0.01 ))
+ self.csnd.setTempo(self.tempo)
+ self.noteList = []
+ time.sleep(0.001) # why?
+ self.trackpad = Trackpad( self )
+ for i in range(21):
+ self.csnd.setTrackVolume( 100, i )
+
+ self.volume = 150
+ self.csnd.setMasterVolume(self.volume)
+ self.sequencer.beat = self.beat
+ self.loop.beat = self.beat
+ self.tooltips = gtk.Tooltips()
+
+ self.masterVBox = gtk.VBox()
+ self.mainWindowBox = gtk.HBox()
+ self.leftBox = gtk.VBox()
+ self.leftBox.set_size_request(950,-1)
+ self.rightBox = gtk.VBox()
+ self.mainWindowBox.pack_start(self.rightBox,True,True)
+ self.mainWindowBox.pack_start(self.leftBox,False,False)
+ self.masterVBox.pack_start(self.mainWindowBox)
+ self.add(self.masterVBox)
+
+ self.enableKeyboard()
+ self.setInstrument(self.instrument)
+
+ self.loopSettingsPopup = gtk.Window(gtk.WINDOW_POPUP)
+ self.loopSettingsPopup.set_modal(True)
+ self.loopSettingsPopup.add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.loopSettingsPopup.connect("button-release-event", lambda w,e:self.doneLoopSettingsPopup() )
+ self.loopSettings = LoopSettings( self.loopSettingsPopup, self.loopSettingsPlayStop, self.loopSettingsChannel, self.doneLoopSettingsPopup )
+ self.loopSettingsPopup.add( self.loopSettings )
+ self.loopSettingsPlaying = False
+
+
+ self.drawInstrumentButtons()
+ self.drawGeneration()
+ self.show_all()
+ if 'a good idea' == True:
+ self.playStartupSound()
+
+ self.synthLabWindow = None
+
+
+ self.beatPickup = True
+ #self.regenerate()
+
+ self.heartbeatStart = time.time()
+ self.syncQueryStart = {}
+ self.syncTimeout = None
+
+ self.network = Net.Network()
+ self.network.addWatcher( self.networkStatusWatcher )
+ self.network.connectMessage( Net.HT_SYNC_REPLY, self.processHT_SYNC_REPLY )
+ self.network.connectMessage( Net.HT_TEMPO_UPDATE, self.processHT_TEMPO_UPDATE )
+ self.network.connectMessage( Net.PR_SYNC_QUERY, self.processPR_SYNC_QUERY )
+ self.network.connectMessage( Net.PR_TEMPO_QUERY, self.processPR_TEMPO_QUERY )
+ self.network.connectMessage( Net.PR_REQUEST_TEMPO_CHANGE, self.processPR_REQUEST_TEMPO_CHANGE )
+
+ # data packing classes
+ self.packer = xdrlib.Packer()
+ self.unpacker = xdrlib.Unpacker("")
+
+ #-- handle forced networking ---------------------------------------
+ if self.network.isHost():
+ self.updateSync()
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+ elif self.network.isPeer():
+ self.sendTempoQuery()
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+ #-------------------------------------------------------------------
+
+ #Play button Image
+ self.playButtonImg = gtk.Image()
+ self.playButtonImg.set_from_icon_name('media-playback-start', gtk.ICON_SIZE_LARGE_TOOLBAR)
+ self.playButtonImg.show()
+
+ #Stop button Image
+ self.stopButtonImg = gtk.Image()
+ self.stopButtonImg.set_from_icon_name('media-playback-stop', gtk.ICON_SIZE_LARGE_TOOLBAR)
+ self.stopButtonImg.show()
+ # Toolbar
+ self.activity.activity_toolbar.share.show()
+ self._playToolbar = playToolbar(self.activity.toolbox, self)
+ self._recordToolbar = recordToolbar(self.activity.toolbox, self)
+ self.activity.toolbox.add_toolbar(_('Play'), self._playToolbar)
+ self.activity.toolbox.add_toolbar(_('Record'), self._recordToolbar)
+ self.activity.toolbox.set_current_toolbar(1)
+ self._playToolbar.show()
+ self._recordToolbar.show()
+
+ self.activity.connect( "shared", self.shared )
+
+ if os.path.isfile("FORCE_SHARE"): # HOST
+ r = random.random()
+ #print "::::: Sharing as TTDBG%f :::::" % r
+ #self.activity.set_title(_("TTDBG%f" % r))
+ print "::::: Sharing as TamTam :::::"
+ self.activity.set_title(_("TamTam"))
+ self.activity.share()
+ elif self.activity._shared_activity: # PEER
+ self.activity._shared_activity.connect( "buddy-joined", self.buddy_joined )
+ self.activity._shared_activity.connect( "buddy-left", self.buddy_left )
+ self.activity.connect( "joined", self.joined )
+ self.network.setMode( Net.MD_WAIT )
+ #self.activity.activity_toolbar.share.hide()
+
+ def drawGeneration( self ):
+
+ slidersBox = RoundVBox(fillcolor = Config.PANEL_COLOR, bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
+ slidersBox.set_border_width(Config.PANEL_SPACING)
+ geneButtonBox = RoundHBox(fillcolor = Config.PANEL_COLOR, bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
+ geneButtonBox.set_border_width(Config.PANEL_SPACING)
+
+ geneSliderBox = gtk.VBox()
+ self.geneSliderBoxImgTop = gtk.Image()
+ self.geneSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'complex6.png')
+ geneAdjustment = gtk.Adjustment(value=self.regularity, lower=0, upper=1, step_incr=0.01, page_incr=0, page_size=0)
+ geneSlider = ImageVScale( Config.IMAGE_ROOT + "sliderbutbleu.png", geneAdjustment, 5 )
+ geneSlider.set_inverted(False)
+ geneSlider.set_size_request(15,305)
+ geneAdjustment.connect("value_changed" , self.handleGenerationSlider)
+ geneSlider.connect("button-release-event", self.handleGenerationSliderRelease)
+ geneSliderBox.pack_start(self.geneSliderBoxImgTop, False, padding=10)
+ geneSliderBox.pack_start(geneSlider, True, 20)
+ self.tooltips.set_tip(geneSlider,Tooltips.COMPL)
+
+ beatSliderBox = gtk.VBox()
+ self.beatSliderBoxImgTop = gtk.Image()
+ self.beatSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'beat3.png')
+ self.beatAdjustment = gtk.Adjustment(value=self.beat, lower=2, upper=12, step_incr=1, page_incr=0, page_size=0)
+ self.beatSlider = ImageVScale( Config.IMAGE_ROOT + "sliderbutjaune.png", self.beatAdjustment, 5, snap = 1 )
+ self.beatSlider.set_inverted(True)
+ self.beatSlider.set_size_request(15,305)
+ self.beatAdjustment.connect("value_changed" , self.handleBeatSlider)
+ self.beatSlider.connect("button-release-event", self.handleBeatSliderRelease)
+ beatSliderBox.pack_start(self.beatSliderBoxImgTop, False, padding=10)
+ beatSliderBox.pack_start(self.beatSlider, True, 20)
+ self.tooltips.set_tip(self.beatSlider,Tooltips.BEAT)
+
+ self.delayedTempo = 0 # used to store tempo updates while the slider is active
+ self.tempoSliderActive = False
+
+ tempoSliderBox = gtk.VBox()
+ self.tempoSliderBoxImgTop = gtk.Image()
+ self.tempoSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'tempo5.png')
+ self.tempoAdjustment = gtk.Adjustment(value=self.tempo, lower=Config.PLAYER_TEMPO_LOWER, upper=Config.PLAYER_TEMPO_UPPER, step_incr=1, page_incr=1, page_size=1)
+ tempoSlider = ImageVScale( Config.IMAGE_ROOT + "sliderbutvert.png", self.tempoAdjustment, 5)
+ tempoSlider.set_inverted(True)
+ tempoSlider.set_size_request(15,305)
+ self.tempoAdjustmentHandler = self.tempoAdjustment.connect("value_changed" , self.handleTempoSliderChange)
+ tempoSlider.connect("button-press-event", self.handleTempoSliderPress)
+ tempoSlider.connect("button-release-event", self.handleTempoSliderRelease)
+ tempoSliderBox.pack_start(self.tempoSliderBoxImgTop, False, padding=10)
+ tempoSliderBox.pack_start(tempoSlider, True)
+ self.tooltips.set_tip(tempoSlider,Tooltips.TEMPO)
+
+ volumeSliderBox = gtk.VBox()
+ self.volumeSliderBoxImgTop = gtk.Image()
+ self.volumeSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'volume2.png')
+ self.volumeAdjustment = gtk.Adjustment(value=self.volume, lower=0, upper=200, step_incr=1, page_incr=1, page_size=1)
+ volumeSlider = ImageVScale( Config.IMAGE_ROOT + "sliderbutbleu.png", self.volumeAdjustment, 5)
+ volumeSlider.set_inverted(True)
+ volumeSlider.set_size_request(15,305)
+ self.volumeAdjustment.connect("value_changed" , self.handleVolumeSlider)
+ #volumeSlider.connect("button-release-event", self.handleVolumeSliderRelease)
+ volumeSliderBox.pack_start(self.volumeSliderBoxImgTop, False, padding=10)
+ volumeSliderBox.pack_start(volumeSlider, True)
+ self.tooltips.set_tip(volumeSlider,Tooltips.VOL)
+
+
+ slidersBoxSub = gtk.HBox()
+ slidersBoxSub.pack_start(beatSliderBox)
+ slidersBoxSub.pack_start(geneSliderBox)
+ slidersBoxSub.pack_start(tempoSliderBox)
+ slidersBoxSub.pack_start(volumeSliderBox)
+ slidersBox.pack_start(slidersBoxSub)
+
+ generateBtnSub = gtk.HBox()
+ generateBtn = ImageButton(Config.IMAGE_ROOT + 'dice.png', clickImg_path = Config.IMAGE_ROOT + 'diceblur.png')
+ generateBtn.connect('button-press-event', self.handleGenerateBtn)
+ generateBtnSub.pack_start(generateBtn)
+ slidersBox.pack_start(generateBtnSub)
+ self.tooltips.set_tip(generateBtn,Tooltips.GEN)
+
+ #Generation Button Box
+ geneVBox = gtk.VBox()
+ geneTopBox = gtk.HBox()
+ geneMidBox = gtk.HBox()
+ geneLowBox = gtk.HBox()
+
+ generationDrumBtn1 = ImageRadioButton(group = None , mainImg_path = Config.IMAGE_ROOT + 'drum1kit.png' , altImg_path = Config.IMAGE_ROOT + 'drum1kitselgen.png')
+ generationDrumBtn1.connect('clicked' , self.handleGenerationDrumBtn , 'drum1kit')
+ geneTopBox.pack_start(generationDrumBtn1)
+ generationDrumBtn2 = ImageRadioButton(group = generationDrumBtn1 , mainImg_path = Config.IMAGE_ROOT + 'drum2kit.png' , altImg_path = Config.IMAGE_ROOT + 'drum2kitselgen.png')
+ generationDrumBtn2.connect('clicked' , self.handleGenerationDrumBtn , 'drum2kit')
+ geneTopBox.pack_start(generationDrumBtn2)
+ generationDrumBtn3 = ImageRadioButton(group = generationDrumBtn1 , mainImg_path = Config.IMAGE_ROOT + 'drum3kit.png' , altImg_path = Config.IMAGE_ROOT + 'drum3kitselgen.png')
+ generationDrumBtn3.connect('clicked' , self.handleGenerationDrumBtn , 'drum3kit')
+ generationDrumBtn4 = ImageRadioButton(group = generationDrumBtn1 , mainImg_path = Config.IMAGE_ROOT + 'drum4kit.png' , altImg_path = Config.IMAGE_ROOT + 'drum4kitselgen.png')
+ generationDrumBtn4.connect('clicked' , self.handleGenerationDrumBtn , 'drum4kit')
+ geneLowBox.pack_start(generationDrumBtn3, True)
+ geneLowBox.pack_start(generationDrumBtn4, True)
+ generationDrumBtn5 = ImageRadioButton(group = generationDrumBtn1 , mainImg_path = Config.IMAGE_ROOT + 'drum5kit.png' , altImg_path = Config.IMAGE_ROOT + 'drum5kitselgen.png')
+ generationDrumBtn5.connect('clicked' , self.handleGenerationDrumBtn , 'drum5kit')
+ geneMidBox.pack_start(generationDrumBtn5, True)
+ geneVBox.pack_start(geneTopBox, True)
+ geneVBox.pack_start(geneMidBox, True)
+ geneVBox.pack_start(geneLowBox, True)
+ geneButtonBox.pack_start(geneVBox,True)
+ self.tooltips.set_tip(generationDrumBtn1,Tooltips.JAZZ)
+ self.tooltips.set_tip(generationDrumBtn2,Tooltips.ARAB)
+ self.tooltips.set_tip(generationDrumBtn3,Tooltips.AFRI)
+ self.tooltips.set_tip(generationDrumBtn4,Tooltips.ELEC)
+ self.tooltips.set_tip(generationDrumBtn5,Tooltips.BRES)
+
+ self.rightBox.pack_start(slidersBox, True)
+ self.rightBox.pack_start(geneButtonBox, True)
+
+ def loopSettingsChannel(self, channel, value):
+ self.csnd.setChannel(channel, value)
+
+ def loopSettingsPlayStop(self, state, loop):
+ if not state:
+ if loop:
+ self.loopSettingsPlaying = True
+ self.csnd.inputMessage(Config.CSOUND_PLAY_LS_NOTE % 5022)
+ else:
+ self.csnd.inputMessage(Config.CSOUND_PLAY_LS_NOTE % 5023)
+ else:
+ if loop:
+ self.loopSettingsPlaying = False
+ self.csnd.inputMessage(Config.CSOUND_STOP_LS_NOTE)
+
+ def doneLoopSettingsPopup(self):
+ if self._recordToolbar.loopSetButton.get_active():
+ if self.loopSettingsPlaying:
+ self.csnd.inputMessage(Config.CSOUND_STOP_LS_NOTE)
+ self.loopSettingsPlaying = False
+ self._recordToolbar.loopSetButton.set_active(False)
+
+ def handleLoopSettingsBtn(self, widget, data=None):
+ if widget.get_active():
+
+ chooser = gtk.FileChooserDialog(title='Edit SoundFile Preference',action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+
+ #filter = gtk.FileFilter()
+ #filter.add_pattern('*.wav')
+ #chooser.set_filter(filter)
+ chooser.set_current_folder(Config.SNDS_DIR)
+
+ for f in chooser.list_shortcut_folder_uris():
+ chooser.remove_shortcut_folder_uri(f)
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ try:
+ tempName = chooser.get_filename()
+ soundName = os.path.split(tempName)[1]
+ except IOError:
+ print 'ERROR: failed to load Sound from file %s' % chooser.get_filename()
+ chooser.destroy()
+ results = commands.getstatusoutput("csound -U sndinfo %s" % tempName)
+ if results[0] == 0:
+ list = results[1].split()
+ pos = list.index('seconds')
+ soundLength = float(list[pos-1])
+ self.loopSettings.set_name(soundName)
+ self.loopSettings.setButtonState()
+ self.loopSettingsPopup.show()
+ self.loopSettingsPopup.move( 600, 200 )
+ self.timeoutLoad = gobject.timeout_add(1000, self.load_ls_instrument, soundName, soundLength)
+ else:
+ self.loopSettingsPopup.hide()
+
+ def load_ls_instrument(self, soundName, soundLength):
+ self.csnd.load_ls_instrument(soundName)
+ self.loopSettings.set_values(soundLength)
+ gobject.source_remove( self.timeoutLoad )
+
+ def drawInstrumentButtons(self):
+ self.instrumentPanelBox = gtk.HBox()
+ # InstrumentPanel(elf.setInstrument,self.playInstrumentNote, False, self.micRec, self.synthRec)
+ self.leftBox.pack_start(self.instrumentPanelBox,True,True)
+
+ def setInstrumentPanel( self, instrumentPanel ):
+ instrumentPanel.configure( self.setInstrument,self.playInstrumentNote, False, self.micRec )
+ self.instrumentPanel = instrumentPanel
+ self.instrumentPanelBox.pack_start( instrumentPanel )
+
+ def releaseInstrumentPanel( self ):
+ self.instrumentPanelBox.remove( self.instrumentPanel )
+
+ def micRec(self, widget, mic):
+ os.system('rm ' + Config.SNDS_DIR + '/' + mic)
+ self.csnd.inputMessage("i5600 0 4")
+ (s1,o1) = commands.getstatusoutput("arecord -f S16_LE -t wav -r 16000 -d 4 " + Config.SNDS_DIR + "/tempMic.wav")
+ (s2, o2) = commands.getstatusoutput("csound " + Config.FILES_DIR + "/crop.csd")
+ (s3, o3) = commands.getstatusoutput("mv " + Config.SNDS_DIR + "/micTemp " + Config.SNDS_DIR + "/" + mic)
+ (s4, o4) = commands.getstatusoutput("rm " + Config.SNDS_DIR + "/tempMic.wav")
+ self.micTimeout = gobject.timeout_add(200, self.loadMicInstrument, mic)
+ self.instrumentPanel.set_activeInstrument(mic,True)
+ self.setInstrument(mic)
+
+ def recordStateButton( self, button, state ):
+ if button == 1:
+ self._recordToolbar.keyboardRecButton.set_active( state )
+ else:
+ self._recordToolbar.keyboardRecOverButton.set_active( state )
+
+ def recordOverSensitivity( self, state ):
+ self._recordToolbar.keyboardRecOverButton.set_sensitive( state )
+
+ def synthLabWindowOpen(self):
+ return self.synthLabWindow != None and self.synthLabWindow.get_property('visible')
+
+ def loadMicInstrument( self, data ):
+ self.csnd.load_mic_instrument( data )
+
+ def closeSynthLab(self):
+ if self.synthLabWindow != None:
+ self.synthLabWindow.destroy()
+ self.synthLabWindow = None
+
+ def regenerate(self):
+ def flatten(ll):
+ rval = []
+ for l in ll:
+ rval += l
+ return rval
+ if self.beatPickup:
+ self.pickupNewBeat()
+ noteOnsets = []
+ notePitchs = []
+ i = 0
+ self.noteList= []
+ self.csnd.loopClear()
+ for x in flatten( generator(self.rythmInstrument, self.beat, 0.8, self.regularity, self.reverb) ):
+ x.amplitude = x.amplitude * self.drumVolume
+ noteOnsets.append(x.onset)
+ notePitchs.append(x.pitch)
+ n = Note(0, x.trackId, i, x)
+ self.noteList.append( (x.onset, n) )
+ i = i + 1
+ self.csnd.loopPlay(n,1) #add as active
+ self.csnd.loopSetNumTicks( self.beat * Config.TICKS_PER_BEAT)
+ self.drumFillin.unavailable( noteOnsets, notePitchs )
+ self.recordOverSensitivity( False )
+
+ def adjustDrumVolume(self):
+ for n in self.noteList:
+ self.csnd.loopUpdate(n[1], PARAMETER.AMPLITUDE, n[1].cs.amplitude*self.drumVolume, 1)
+
+ def handleClose(self,widget):
+ if self.playStopButton.get_active() == True:
+ self.playStopButton.set_active(False)
+ self.sequencer.clearSequencer()
+ self.csnd.loopClear()
+ self.activity.close()
+
+ def handleGenerationSlider(self, adj):
+ img = int(adj.value * 7)+1
+ self.geneSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'complex' + str(img) + '.png')
+
+ def handleGenerationSliderRelease(self, widget, event):
+ self.regularity = widget.get_adjustment().value
+ self.beatPickup = False
+ self.regenerate()
+ self.beatPickup = True
+
+ def pickupNewBeat(self):
+ self.beat = random.randint(2, 12)
+ img = self.scale(self.beat,2,12,1,11)
+ self.beatSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'beat' + str(img) + '.png')
+ self.beatAdjustment.set_value(self.beat)
+ self.sequencer.beat = self.beat
+ self.loop.beat = self.beat
+ self.drumFillin.setBeats( self.beat )
+
+ def handleBeatSlider(self, adj):
+ img = self.scale(int(adj.value),2,12,1,11)
+ self.beatSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'beat' + str(img) + '.png')
+ self.sequencer.beat = self.beat
+ self.loop.beat = self.beat
+ self.drumFillin.setBeats( self.beat )
+
+ def handleBeatSliderRelease(self, widget, event):
+ self.beat = int(widget.get_adjustment().value)
+ self.sequencer.beat = self.beat
+ self.loop.beat = self.beat
+ self.drumFillin.setBeats( self.beat )
+ self.beatPickup = False
+ self.regenerate()
+ self.beatPickup = True
+
+ def handleTempoSliderPress(self, widget, event):
+ self.tempoSliderActive = True
+
+ def handleTempoSliderRelease(self, widget, event):
+ self.tempoSliderActive = False
+ if self.network.isPeer() and self.delayedTempo != 0:
+ if self.tempo != self.delayedTempo:
+ self.tempoAdjustment.handler_block( self.tempoAdjustmentHandler )
+ self.tempoAdjustment.set_value( self.delayedTempo )
+ self._updateTempo( self.delayedTempo )
+ self.tempoAdjustment.handler_unblock( self.tempoAdjustmentHandler )
+ self.delayedTempo = 0
+ self.sendSyncQuery()
+
+ def handleTempoSliderChange(self,adj):
+ if self.network.isPeer():
+ self.requestTempoChange(int(adj.value))
+ else:
+ self._updateTempo( int(adj.value) )
+
+ def _updateTempo( self, val ):
+
+ if self.network.isHost():
+ t = time.time()
+ percent = self.heartbeatElapsed() / self.beatDuration
+
+ self.tempo = val
+ self.beatDuration = 60.0/self.tempo
+ self.ticksPerSecond = Config.TICKS_PER_BEAT*self.tempo/60.0
+ self.csnd.setTempo(self.tempo)
+ self.sequencer.tempo = self.tempo
+ self.drumFillin.setTempo(self.tempo)
+
+ if self.network.isHost():
+ self.heatbeatStart = t - percent*self.beatDuration
+ self.updateSync()
+ self.sendTempoUpdate()
+
+ img = int(self.scale( self.tempo,
+ Config.PLAYER_TEMPO_LOWER,Config.PLAYER_TEMPO_UPPER,
+ 1,9))
+ self.tempoSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'tempo' + str(img) + '.png')
+
+ def handleBalanceSlider(self, adj):
+ self.instVolume = int(adj.value)
+ self.drumVolume = sqrt( (100-self.instVolume)*0.01 )
+ self.adjustDrumVolume()
+ self.drumFillin.setVolume(self.drumVolume)
+ instrumentVolume = sqrt( self.instVolume*0.01 )
+ self.loop.adjustLoopVolume(instrumentVolume)
+ self.sequencer.adjustSequencerVolume(instrumentVolume)
+ img = int(self.scale(self.instVolume,100,0,0,4.9))
+ self._playToolbar.balanceSliderImgLeft.set_from_file(Config.IMAGE_ROOT + 'dru' + str(img) + '.png')
+ img2 = int(self.scale(self.instVolume,0,100,0,4.9))
+ self._playToolbar.balanceSliderImgRight.set_from_file(Config.IMAGE_ROOT + 'instr' + str(img2) + '.png')
+
+ def handleReverbSlider(self, adj):
+ self.reverb = adj.value
+ self.drumFillin.setReverb( self.reverb )
+ img = int(self.scale(self.reverb,0,1,0,4))
+ self._playToolbar.reverbSliderImgRight.set_from_file(Config.IMAGE_ROOT + 'reverb' + str(img) + '.png')
+ self.keyboardStandAlone.setReverb(self.reverb)
+
+ def handleVolumeSlider(self, adj):
+ self.volume = adj.value
+ self.csnd.setMasterVolume(self.volume)
+ img = int(self.scale(self.volume,0,200,0,3.9))
+ self.volumeSliderBoxImgTop.set_from_file(Config.IMAGE_ROOT + 'volume' + str(img) + '.png')
+
+ def handlePlayButton(self, widget, data = None):
+ # use widget.get_active() == False when calling this on 'clicked'
+ # use widget.get_active() == True when calling this on button-press-event
+ if widget.get_active() == False:
+ self.drumFillin.stop()
+ self.sequencer.stopPlayback()
+ self.csnd.loopPause()
+ widget.set_icon_widget(self.playButtonImg)
+ else:
+ if not self.firstTime:
+ self.regenerate()
+ self.firstTime = True
+ self.drumFillin.play()
+ #self.csnd.loopSetTick(0)
+ nextInTicks = self.nextHeartbeatInTicks()
+ #print "play:: next beat in %f ticks. bpb == %d. setting ticks to %d" % (nextInTicks, self.beat, Config.TICKS_PER_BEAT*self.beat - int(round(nextInTicks)))
+ self.csnd.loopSetTick( Config.TICKS_PER_BEAT*self.beat - int(round(nextInTicks)) )
+ self.csnd.loopStart()
+ widget.set_icon_widget(self.stopButtonImg)
+
+
+ def handleGenerationDrumBtn(self , widget , data):
+ #data is drum1kit, drum2kit, or drum3kit
+ #print 'HANDLE: Generate Button'
+ self.rythmInstrument = data
+ instrumentId = Config.INSTRUMENTS[data].instrumentId
+ for (o,n) in self.noteList :
+ self.csnd.loopUpdate(n, NoteDB.PARAMETER.INSTRUMENT, instrumentId, -1)
+ self.drumFillin.setInstrument( self.rythmInstrument )
+
+ def handleGenerateBtn(self , widget , data=None):
+ self.regenerate()
+ if not self._playToolbar.playButton.get_active():
+ self._playToolbar.playButton.set_active(True)
+
+ #this calls sends a 'clicked' event,
+ #which might be connected to handlePlayButton
+ self.playStartupSound()
+
+ def enableKeyboard( self ):
+ self.keyboardStandAlone = KeyboardStandAlone( self.sequencer.recording, self.sequencer.adjustDuration, self.csnd.loopGetTick, self.sequencer.getPlayState, self.loop )
+ self.add_events(gtk.gdk.BUTTON_PRESS_MASK)
+
+ def setInstrument( self , instrument ):
+ self.instrument = instrument
+ self.keyboardStandAlone.setInstrument(instrument)
+
+ def playInstrumentNote(self , instrument, secs_per_tick = 0.025):
+ if not self.muteInst:
+ self.csnd.play(
+ CSoundNote( onset = 0,
+ pitch = 36,
+ amplitude = 1,
+ pan = 0.5,
+ duration = 20,
+ trackId = 1,
+ instrumentId = Config.INSTRUMENTS[instrument].instrumentId,
+ reverbSend = 0,
+ tied = False,
+ mode = 'mini'),
+ secs_per_tick)
+
+ def onKeyPress(self, widget, event):
+ if event.hardware_keycode == 219: #'/*' button to reset drum loop
+ if self.playStopButton.get_active() == True:
+ self.handlePlayButton(self.playStopButton)
+ self.playStopButton.set_active(False)
+ self.handlePlayButton(self.playStopButton)
+ self.playStopButton.set_active(True)
+
+ if event.hardware_keycode == 37:
+ if self.muteInst:
+ self.muteInst = False
+ else:
+ self.muteInst = True
+
+ if event.hardware_keycode == 65: #what key is this? what feature is this?
+ pass
+ #if self.playStopButton.get_active():
+ #self.playStopButton.set_active(False)
+ #else:
+ #self.playStopButton.set_active(True)
+
+ self.keyboardStandAlone.onKeyPress(widget, event, sqrt( self.instVolume*0.01 ))
+
+ def onKeyRelease(self, widget, event):
+ self.keyboardStandAlone.onKeyRelease(widget, event)
+
+ def playStartupSound(self):
+ r = str(random.randrange(1,11))
+ self.playInstrumentNote('guidice' + r)
+
+ def onActivate( self, arg ):
+ self.csnd.loopPause()
+ self.csnd.loopClear()
+
+ def onDeactivate( self ):
+ SubActivity.onDeactivate( self )
+ self.releaseInstrumentPanel()
+ self.csnd.loopPause()
+ self.csnd.loopClear()
+
+ def onDestroy( self ):
+ self.network.shutdown()
+
+ def scale(self, input,input_min,input_max,output_min,output_max):
+ range_input = input_max - input_min
+ range_output = output_max - output_min
+ result = (input - input_min) * range_output / range_input + output_min
+
+ if (input_min > input_max and output_min > output_max) or (output_min > output_max and input_min < input_max):
+ if result > output_min:
+ return output_min
+ elif result < output_max:
+ return output_max
+ else:
+ return result
+
+ if (input_min < input_max and output_min < output_max) or (output_min < output_max and input_min > input_max):
+ if result > output_max:
+ return output_max
+ elif result < output_min:
+ return output_min
+ else:
+ return result
+
+
+ #-----------------------------------------------------------------------
+ # Network
+
+ #-- Activity -----------------------------------------------------------
+
+ def shared( self, activity ):
+ if Config.DEBUG: print "miniTamTam:: successfully shared, start host mode"
+ self.activity._shared_activity.connect( "buddy-joined", self.buddy_joined )
+ self.activity._shared_activity.connect( "buddy-left", self.buddy_left )
+ self.network.setMode( Net.MD_HOST )
+ self.updateSync()
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+
+ def joined( self, activity ):
+ print "miniTamTam:: joined activity!!"
+ for buddy in self.activity._shared_activity.get_joined_buddies():
+ print buddy.props.ip4_address
+
+ def buddy_joined( self, activity, buddy ):
+ print "buddy joined " + str(buddy)
+ try:
+ print buddy.props.ip4_address
+ except:
+ print "bad ip4_address"
+ if self.network.isHost():
+ # TODO how do I figure out if this buddy is me?
+ if buddy.props.ip4_address:
+ self.network.introducePeer( buddy.props.ip4_address )
+ else:
+ print "miniTamTam:: new buddy does not have an ip4_address!!"
+
+ def buddy_left( self, activity, buddy):
+ print "buddy left"
+
+ #def joined( self, activity ):
+ # if Config.DEBUG: print "miniTamTam:: successfully joined, wait for host"
+ # self.net.waitForHost()
+
+ #-- Senders ------------------------------------------------------------
+
+ def sendSyncQuery( self ):
+ self.packer.pack_float(random.random())
+ hash = self.packer.get_buffer()
+ self.packer.reset()
+ self.syncQueryStart[hash] = time.time()
+ self.network.send( Net.PR_SYNC_QUERY, hash)
+
+ def sendTempoUpdate( self ):
+ self.packer.pack_int(self.tempo)
+ self.network.sendAll( Net.HT_TEMPO_UPDATE, self.packer.get_buffer() )
+ self.packer.reset()
+
+ def sendTempoQuery( self ):
+ self.network.send( Net.PR_TEMPO_QUERY )
+
+ def requestTempoChange( self, val ):
+ self.packer.pack_int(val)
+ self.network.send( Net.PR_REQUEST_TEMPO_CHANGE, self.packer.get_buffer() )
+ self.packer.reset()
+
+ #-- Handlers -----------------------------------------------------------
+
+ def networkStatusWatcher( self, mode ):
+ if mode == Net.MD_OFFLINE:
+ if self.syncTimeout:
+ gobject.source_remove( self.syncTimeout )
+ self.syncTimeout = None
+ if mode == Net.MD_PEER:
+ self.updateSync()
+ if not self.syncTimeout:
+ self.syncTimeout = gobject.timeout_add( 1000, self.updateSync )
+ self.sendTempoQuery()
+
+ def processHT_SYNC_REPLY( self, sock, message, data ):
+ t = time.time()
+ hash = data[0:4]
+ latency = t - self.syncQueryStart[hash]
+ self.unpacker.reset(data[4:8])
+ nextBeat = self.unpacker.unpack_float()
+ #print "mini:: got sync: next beat in %f, latency %d" % (nextBeat, latency*1000)
+ self.heartbeatStart = t + nextBeat - self.beatDuration - latency/2
+ self.correctSync()
+ self.syncQueryStart.pop(hash)
+
+ def processHT_TEMPO_UPDATE( self, sock, message, data ):
+ self.unpacker.reset(data)
+ val = self.unpacker.unpack_int()
+ if self.tempoSliderActive:
+ self.delayedTempo = val
+ return
+ self.tempoAdjustment.handler_block( self.tempoAdjustmentHandler )
+ self.tempoAdjustment.set_value( val )
+ self._updateTempo( val )
+ self.tempoAdjustment.handler_unblock( self.tempoAdjustmentHandler )
+ self.sendSyncQuery()
+
+ def processPR_SYNC_QUERY( self, sock, message, data ):
+ self.packer.pack_float(self.nextHeartbeat())
+ self.network.send( Net.HT_SYNC_REPLY, data + self.packer.get_buffer(), sock )
+ self.packer.reset()
+
+ def processPR_TEMPO_QUERY( self, sock, message, data ):
+ self.packer.pack_int(self.tempo)
+ self.network.send( Net.HT_TEMPO_UPDATE, self.packer.get_buffer(), to = sock )
+ self.packer.reset()
+
+ def processPR_REQUEST_TEMPO_CHANGE( self, sock, message, data ):
+ if self.tempoSliderActive:
+ return
+ self.unpacker.reset(data)
+ val = self.unpacker.unpack_int()
+ self.tempoAdjustment.set_value( val )
+
+ #-----------------------------------------------------------------------
+ # Sync
+
+ def nextHeartbeat( self ):
+ delta = time.time() - self.heartbeatStart
+ return self.beatDuration - (delta % self.beatDuration)
+
+ def nextHeartbeatInTicks( self ):
+ delta = time.time() - self.heartbeatStart
+ next = self.beatDuration - (delta % self.beatDuration)
+ return self.ticksPerSecond*next
+
+ def heartbeatElapsed( self ):
+ delta = time.time() - self.heartbeatStart
+ return delta % self.beatDuration
+
+ def heartbeatElapsedTicks( self ):
+ delta = time.time() - self.heartbeatStart
+ return self.ticksPerSecond*(delta % self.beatDuration)
+
+ def updateSync( self ):
+ if self.network.isOffline():
+ return False
+ elif self.network.isWaiting():
+ return True
+ elif self.network.isHost():
+ self.correctSync()
+ else:
+ self.sendSyncQuery()
+ return True
+
+ def correctSync( self ):
+ curTick = self.csnd.loopGetTick()
+ curTicksIn = curTick % Config.TICKS_PER_BEAT
+ ticksIn = self.heartbeatElapsedTicks()
+ err = curTicksIn - ticksIn
+ if err > Config.TICKS_PER_BEAT_DIV2:
+ err -= Config.TICKS_PER_BEAT
+ elif err < -Config.TICKS_PER_BEAT_DIV2:
+ err += Config.TICKS_PER_BEAT
+ correct = curTick - err
+ ticksPerLoop = Config.TICKS_PER_BEAT*self.beat
+ if correct > ticksPerLoop:
+ correct -= ticksPerLoop
+ elif correct < 0:
+ correct += ticksPerLoop
+ #print "correct:: %f ticks, %f ticks in, %f expected, %f err, correct %f" % (curTick, curTicksIn, ticksIn, err, correct)
+ if abs(err) > 0.25:
+ self.csnd.adjustTick(-err)
+
+
+if __name__ == "__main__":
+ MiniTamTam = miniTamTam()
+ #start the gtk event loop
+ gtk.main()
diff --git a/TamTamMini.activity/Mini/miniToolbars.py b/TamTamMini.activity/Mini/miniToolbars.py
new file mode 100644
index 0000000..7fc518e
--- /dev/null
+++ b/TamTamMini.activity/Mini/miniToolbars.py
@@ -0,0 +1,152 @@
+#!/usr/bin/env python
+
+import gtk
+import common.Config as Config
+
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.palette import Palette
+from gettext import gettext as _
+
+class playToolbar(gtk.Toolbar):
+ def __init__(self,toolbox, miniTamTam):
+ gtk.Toolbar.__init__(self)
+
+ def _insertSeparator(x = 1):
+ for i in range(x):
+ self.separator = gtk.SeparatorToolItem()
+ self.separator.set_draw(True)
+ self.insert(self.separator,-1)
+ self.separator.show()
+
+ self.toolbox = toolbox
+ self.miniTamTam = miniTamTam
+
+ self.tooltips = gtk.Tooltips()
+
+ self.playButton = ToggleToolButton('media-playback-start')
+ self.playButton.connect('clicked',self.miniTamTam.handlePlayButton)
+ self.insert(self.playButton, -1)
+ self.playButton.show()
+ self.playButton.set_tooltip(_('Play / Stop'))
+
+ _insertSeparator(1)
+
+ self.balanceSliderImgLeft = gtk.Image()
+ self.balanceSliderImgRight = gtk.Image()
+ self.balanceSliderImgLeft.set_from_file(Config.IMAGE_ROOT + 'dru2.png')
+ self.balanceSliderImgRight.set_from_file(Config.IMAGE_ROOT + 'instr2.png')
+ self.balanceSliderImgLeftTool = gtk.ToolItem()
+ self.balanceSliderImgLeftTool.add(self.balanceSliderImgLeft)
+ self.balanceSliderImgRightTool = gtk.ToolItem()
+ self.balanceSliderImgRightTool.add(self.balanceSliderImgRight)
+ self.balanceSliderAdj = gtk.Adjustment(value=50, lower=0, upper=100, step_incr=1, page_incr=0, page_size=0)
+ self.balanceSliderAdj.connect("value_changed" , self.miniTamTam.handleBalanceSlider)
+ self.balanceSlider = gtk.HScale(adjustment = self.balanceSliderAdj)
+ self.balanceSlider.set_size_request(250,15)
+ self.balanceSlider.set_inverted(False)
+ self.balanceSlider.set_draw_value(False)
+ self.balanceSliderTool = gtk.ToolItem()
+ self.balanceSliderTool.add(self.balanceSlider)
+ self.insert(self.balanceSliderImgLeftTool, -1)
+ self.insert(self.balanceSliderTool, -1)
+ self.insert(self.balanceSliderImgRightTool, -1)
+ self.balanceSliderImgLeft.show()
+ self.balanceSliderImgLeftTool.show()
+ self.balanceSliderImgRight.show()
+ self.balanceSliderImgRightTool.show()
+ self.balanceSlider.show()
+ self.balanceSliderTool.show()
+ self.balanceSliderTool.set_tooltip(self.tooltips, _('Balance'))
+
+ _insertSeparator(1)
+
+ self.reverbSliderImgRight = gtk.Image()
+ self.reverbSliderImgRight.set_from_file(Config.IMAGE_ROOT + 'reverb0.png')
+ self.reverbSliderImgRightTool = gtk.ToolItem()
+ self.reverbSliderImgRightTool.add(self.reverbSliderImgRight)
+
+ self.reverbSliderAdj = gtk.Adjustment(value=0, lower=0, upper=1, step_incr=0.1, page_incr=0, page_size=0)
+ self.reverbSliderAdj.connect("value_changed" , self.miniTamTam.handleReverbSlider)
+ self.reverbSlider = gtk.HScale(adjustment = self.reverbSliderAdj)
+ self.reverbSlider.set_size_request(250,15)
+ self.reverbSlider.set_inverted(False)
+ self.reverbSlider.set_draw_value(False)
+ self.reverbSliderTool = gtk.ToolItem()
+ self.reverbSliderTool.add(self.reverbSlider)
+ self.insert(self.reverbSliderTool, -1)
+ self.insert(self.reverbSliderImgRightTool, -1)
+ self.reverbSliderImgRight.show()
+ self.reverbSliderImgRightTool.show()
+ self.reverbSlider.show()
+ self.reverbSliderTool.show()
+ self.reverbSliderTool.set_tooltip(self.tooltips, _('Reverb'))
+
+
+class recordToolbar(gtk.Toolbar):
+ def __init__(self,toolbox, miniTamTam):
+ gtk.Toolbar.__init__(self)
+
+ def _insertSeparator(x = 1):
+ for i in range(x):
+ self.separator = gtk.SeparatorToolItem()
+ self.separator.set_draw(True)
+ self.insert(self.separator,-1)
+ self.separator.show()
+
+ self.toolbox = toolbox
+ self.miniTamTam = miniTamTam
+
+ self.micRec1Button = ToolButton('rec1')
+ self.micRec1Button.connect('clicked',self.miniTamTam.micRec,'mic1')
+ self.insert(self.micRec1Button, -1)
+ self.micRec1Button.show()
+ self.micRec1Button.set_tooltip(_('Record microphone into slot 1'))
+
+ self.micRec2Button = ToolButton('rec2')
+ self.micRec2Button.connect('clicked',self.miniTamTam.micRec,'mic2')
+ self.insert(self.micRec2Button, -1)
+ self.micRec2Button.show()
+ self.micRec2Button.set_tooltip(_('Record microphone into slot 2'))
+
+ self.micRec3Button = ToolButton('rec3')
+ self.micRec3Button.connect('clicked',self.miniTamTam.micRec,'mic3')
+ self.insert(self.micRec3Button, -1)
+ self.micRec3Button.show()
+ self.micRec3Button.set_tooltip(_('Record microphone into slot 3'))
+
+ self.micRec4Button = ToolButton('rec4')
+ self.micRec4Button.connect('clicked',self.miniTamTam.micRec,'mic4')
+ self.insert(self.micRec4Button, -1)
+ self.micRec4Button.show()
+ self.micRec4Button.set_tooltip(('Record microphone into slot 4'))
+
+ _insertSeparator()
+
+ self.keyboardRecButton = ToggleToolButton('keyrec')
+ self.keyboardRecButton.connect('clicked', self.miniTamTam.sequencer.handleRecordButton )
+ self.insert(self.keyboardRecButton, -1)
+ self.keyboardRecButton.show()
+ self.keyboardRecButton.set_tooltip(_('Click to record a loop'))
+
+ self.keyboardRecOverButton = ToggleToolButton('overrec')
+ self.keyboardRecOverButton.connect('clicked', self.miniTamTam.sequencer.handleOverButton )
+ self.insert(self.keyboardRecOverButton, -1)
+ self.keyboardRecOverButton.show()
+ self.keyboardRecOverButton.set_tooltip(_('Click to add a loop'))
+ self.keyboardRecOverButton.set_sensitive(False)
+
+ self.keyboardRecMinusButton = ToolButton('minusrec')
+ self.keyboardRecMinusButton.connect('clicked', self.miniTamTam.sequencer.clearSequencer )
+ self.insert(self.keyboardRecMinusButton, -1)
+ self.keyboardRecMinusButton.show()
+ self.keyboardRecMinusButton.set_tooltip(_('Click to clear all loops'))
+
+ _insertSeparator()
+
+ self.loopSetButton = ToggleToolButton('loop')
+ self.loopSetButton.connect('clicked', self.miniTamTam.handleLoopSettingsBtn)
+ self.insert(self.loopSetButton, -1)
+ self.loopSetButton.show()
+ self.loopSetButton.set_tooltip(_('Add new sound'))
+ \ No newline at end of file
diff --git a/TamTamMini.activity/NEWS b/TamTamMini.activity/NEWS
new file mode 100644
index 0000000..8120a07
--- /dev/null
+++ b/TamTamMini.activity/NEWS
@@ -0,0 +1,71 @@
+39
+
+* New activity : TamTamJam (lync)
+* Activities are now separate (TamTamJam, TamTamEdit, TamTamSynthLab)
+* No sound when set to language other than english fixed (#3165) (J5, marcopg, tomeu, Flipo)
+
+38
+
+* Adapt to new Palette API (Flipo)
+
+37
+
+* Small layout change in edit (Flipo)
+* Temporary fix for Palettes causing the audio to stop (Flipo)
+
+36
+
+* Major image cleanup, 700k saved (Flipo)
+* Tune generation back (see leftmost icon on generate tab) (Olipet)
+
+35
+
+* TamTam Edit Toolbars enhancements (Flipo, Olipet)
+* TamTam Edit layout changes (lync)
+* Dual instruments for tracks in Edit (Olipet, lync)
+
+34
+
+* Synthlab sugar integration (olipet, Flipo)
+* Toolbars in edit draft, hit alt-t to show the toolbar, alt-y to hide (Flipo)
+* Bug that prevented sound from working fixed (LeJames)
+
+33
+
+* Added Sugar Toolbar to miniTamTam and Synthlab (Flipo)
+* Network now working in miniTamTam, use the share button on the activity toolbar (lync)
+* Added help subsystem (ethrop, LeJames)
+
+32
+
+* Important microphone fix (Olipet)
+
+31
+
+* Working network (create a FORCE_SHARE file in the / dir) (lync)
+* New tune generator in Edit, click the dice in the tune view (Olipet)
+* Fine tuning of the algorythmic generator and orchestras (Olipet)
+* TamTamJam (miniTamTam) integration with the journal (Flipo)
+* Title according to subactivity displayed in the journal (Flipo)
+
+30
+
+* Clicking the close button in Edit and Synthlab goes back to Sugar. (Flipo)
+* Fix to the Journal load and save. (Flipo, lync)
+* Ogg player on the welcome page. (lync)
+* Demo tune instruments and tempo are randomly generated (Olipet)
+* lab placeholder files were reduced in size by 95% (Olipet)
+
+29
+
+* WelcomeScreen: Removed Typing Game icon. (Flipo)
+* General: Added sounds. (ethrop, Olipet)
+* General: Journal integration. (Flipo, lync)
+* TamTamJam: Microphone semi-working. (James)
+* TamTamEdit: Beats per page setting. (lync, Olipet)
+* TamTamEdit: Mute/Solo controls on tracks. (Flipo)
+* TamTamEdit: Paint tool. (Olipet)
+* TamTamEdit: Properties automation. (Olipet)
+* TamTamEdit: Pages can have different colors. (lync)
+* TamTamEdit: Realtime keyboard recording. (Olipet)
+* TamTamEdit: Export song to ogg file. (Olipet) \ No newline at end of file
diff --git a/TamTamMini.activity/TamTamMini.py b/TamTamMini.activity/TamTamMini.py
new file mode 100644
index 0000000..70ed410
--- /dev/null
+++ b/TamTamMini.activity/TamTamMini.py
@@ -0,0 +1,175 @@
+import locale
+locale.setlocale(locale.LC_NUMERIC, 'C')
+import signal , time , sys , os, shutil
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import gobject
+import time
+
+import common.Config as Config
+from common.Util.CSoundClient import new_csound_client
+from common.Util.Profiler import TP
+
+from common.Util.InstrumentPanel import InstrumentPanel
+from Mini.miniTamTamMain import miniTamTamMain
+from common.Util.Trackpad import Trackpad
+from gettext import gettext as _
+import commands
+from sugar.activity import activity
+
+class TamTamMini(activity.Activity):
+ def __init__(self, handle):
+ activity.Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Mini')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.trackpad.setContext('mini')
+ self.mini = miniTamTamMain(self)
+ #self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.mini.setInstrumentPanel( self.instrumentPanel )
+
+ self.set_canvas( self.mini )
+
+ self.mini.onActivate(arg = None)
+ self.show()
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.metadata['tamtam_subactivity'] = 'mini'
+
+ def write_file(self,file_path):
+ f = open(file_path,'w')
+ f.close()
diff --git a/TamTamMini.activity/activity/activity-tamtam.svg b/TamTamMini.activity/activity/activity-tamtam.svg
new file mode 100644
index 0000000..563df7b
--- /dev/null
+++ b/TamTamMini.activity/activity/activity-tamtam.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-tamtam">
+
+ <path d=" M9.653,18.199h35.54c0.772,0,1.4,0.628,1.4,1.403v2.362c0,0.771-0.628,1.401-1.4,1.401H9.653c-0.775,0-1.403-0.628-1.403-1.401 v-2.361C8.25,18.826,8.877,18.199,9.653,18.199z" display="inline" fill="&stroke_color;" id="path8" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <rect display="inline" fill="&fill_color;" height="22.128" id="rect10" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" width="33.139" x="10.852" y="23.365"/>
+
+ <path d=" M9.653,45.493h35.54c0.772,0,1.4,0.627,1.4,1.401v2.362c0,0.775-0.628,1.405-1.4,1.405H9.653c-0.775,0-1.403-0.629-1.403-1.405 v-2.362C8.25,46.124,8.877,45.493,9.653,45.493z" display="inline" fill="&stroke_color;" id="path17" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <path d=" M10.851,45.491l8.544-22.126l7.896,22.125l7.926-22.126" display="inline" fill="none" id="path19" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <path d=" M43.987,45.491l-8.77-22.126" display="inline" fill="none" id="path21" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+
+ <line display="inline" fill="none" id="line27" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="33.69" x2="48.336" y1="13.149" y2="5.948"/>
+
+ <line display="inline" fill="none" id="line29" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="6.042" x2="20.658" y1="2.213" y2="9.48"/>
+
+ <path d=" M25.721,9.802c0.55,1.451-0.171,3.066-1.608,3.612c-1.437,0.545-3.049-0.188-3.599-1.639c-0.547-1.45,0.174-3.067,1.609-3.613 C23.561,7.62,25.172,8.352,25.721,9.802z" display="inline" fill="&fill_color;" id="path23" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25"/>
+
+ <path d=" M33.338,16.442c-1.04,1.125-2.798,1.189-3.928,0.144c-1.128-1.044-1.197-2.801-0.155-3.927c1.041-1.125,2.8-1.19,3.926-0.146 C34.31,13.558,34.381,15.316,33.338,16.442z" display="inline" fill="&fill_color;" id="path25" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.25"/>
+</g></svg>
+
diff --git a/TamTamMini.activity/activity/activity.info b/TamTamMini.activity/activity/activity.info
new file mode 100644
index 0000000..14e41d2
--- /dev/null
+++ b/TamTamMini.activity/activity/activity.info
@@ -0,0 +1,6 @@
+[Activity]
+name = TamTamMini
+service_name = org.laptop.TamTamMini
+icon = activity-tamtam
+class = TamTamMini.TamTamMini
+activity_version = 40 \ No newline at end of file
diff --git a/TamTamMini.activity/common b/TamTamMini.activity/common
new file mode 120000
index 0000000..60d3b0a
--- /dev/null
+++ b/TamTamMini.activity/common
@@ -0,0 +1 @@
+../common \ No newline at end of file
diff --git a/TamTamMini.activity/icons/keyrec.svg b/TamTamMini.activity/icons/keyrec.svg
new file mode 100644
index 0000000..90d9fe8
--- /dev/null
+++ b/TamTamMini.activity/icons/keyrec.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="28.1" cy="27.84" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="28.098" cy="27.932" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M24.121,21.796h2.719v5.365h0.055c0.27-0.468,0.558-0.899,0.828-1.333l2.755-4.032h3.367l-4.017,5.167
+ l4.23,6.968h-3.205l-2.971-5.239l-1.045,1.278v3.961H24.12L24.121,21.796L24.121,21.796z"/>
+</g>
+<circle fill="none" stroke="#4C4D4F" cx="28.431" cy="27.692" r="17.085"/>
+</svg>
diff --git a/TamTamMini.activity/icons/loop.svg b/TamTamMini.activity/icons/loop.svg
new file mode 100644
index 0000000..c085ee6
--- /dev/null
+++ b/TamTamMini.activity/icons/loop.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="28.1" cy="27.84" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="28.098" cy="27.932" r="21.572"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="0.75" cx="28.431" cy="27.692" r="18.793"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" x1="25.001" y1="22.501" x2="30.501" y2="19.001"/>
+<path fill="none" stroke="#FFFFFF" stroke-width="2" d="M28.626,22.001c8.491,0,15.325-0.156,15.375,6.25
+ c0.043,5.498-6.884,6.25-15.375,6.25c-8.492,0-15.179-0.318-15.375-6.25C13.221,22.015,20.134,22.001,28.626,22.001z"/>
+<line fill="none" stroke="#FFFFFF" stroke-width="2" x1="25.751" y1="22.751" x2="30.501" y2="25.001"/>
+</svg>
diff --git a/TamTamMini.activity/icons/micrec1.svg b/TamTamMini.activity/icons/micrec1.svg
new file mode 100644
index 0000000..38f1b2b
--- /dev/null
+++ b/TamTamMini.activity/icons/micrec1.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M26.582,24.229h-0.035l-2.233,1.062l-0.45-2.052l3.098-1.439h2.269v11.704h-2.647V24.229z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/micrec2.svg b/TamTamMini.activity/icons/micrec2.svg
new file mode 100644
index 0000000..505347e
--- /dev/null
+++ b/TamTamMini.activity/icons/micrec2.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M23.09,33.501v-1.656l1.512-1.369c2.557-2.286,3.8-3.602,3.835-4.969c0-0.954-0.576-1.711-1.926-1.711
+ c-1.008,0-1.892,0.504-2.503,0.973l-0.774-1.963c0.882-0.666,2.25-1.206,3.835-1.206c2.647,0,4.105,1.548,4.105,3.673
+ c0,1.963-1.423,3.529-3.115,5.042l-1.08,0.899v0.035h4.411v2.252H23.09z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/micrec3.svg b/TamTamMini.activity/icons/micrec3.svg
new file mode 100644
index 0000000..d203fdf
--- /dev/null
+++ b/TamTamMini.activity/icons/micrec3.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M23.575,30.818c0.486,0.252,1.604,0.72,2.72,0.72c1.423,0,2.143-0.684,2.143-1.565
+ c0-1.152-1.152-1.674-2.358-1.674h-1.116v-1.963h1.062c0.918-0.02,2.088-0.36,2.088-1.352c0-0.702-0.576-1.224-1.728-1.224
+ c-0.955,0-1.962,0.414-2.449,0.702l-0.558-1.981c0.701-0.45,2.105-0.882,3.618-0.882c2.502,0,3.89,1.313,3.89,2.917
+ c0,1.242-0.702,2.215-2.144,2.719v0.036c1.404,0.252,2.539,1.314,2.539,2.845c0,2.07-1.818,3.583-4.79,3.583
+ c-1.512,0-2.791-0.396-3.475-0.828L23.575,30.818z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/micrec4.svg b/TamTamMini.activity/icons/micrec4.svg
new file mode 100644
index 0000000..1e63c67
--- /dev/null
+++ b/TamTamMini.activity/icons/micrec4.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M27.934,33.501V30.71h-5.187v-1.782l4.43-7.13h3.349v6.859h1.404v2.054h-1.404v2.791L27.934,33.501
+ L27.934,33.501z M27.934,28.657v-2.593c0-0.702,0.036-1.422,0.09-2.178h-0.072c-0.378,0.756-0.684,1.439-1.081,2.178l-1.565,2.557
+ v0.036H27.934z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/micrec5.svg b/TamTamMini.activity/icons/micrec5.svg
new file mode 100644
index 0000000..b5c7b21
--- /dev/null
+++ b/TamTamMini.activity/icons/micrec5.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M31.522,23.832H26.48l-0.279,2c0.279-0.039,0.521-0.039,0.841-0.039c1.239,0,2.501,0.279,3.421,0.939
+ c0.979,0.66,1.58,1.74,1.58,3.261c0,2.42-2.08,4.562-5.581,4.562c-1.58,0-2.9-0.359-3.621-0.74l0.54-2.281
+ c0.58,0.281,1.761,0.642,2.94,0.642c1.26,0,2.602-0.601,2.602-1.98c0-1.34-1.062-2.16-3.661-2.16c-0.72,0-1.222,0.04-1.761,0.12
+ l0.859-6.822h7.162V23.832z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/micrec6.svg b/TamTamMini.activity/icons/micrec6.svg
new file mode 100644
index 0000000..6b0ccc0
--- /dev/null
+++ b/TamTamMini.activity/icons/micrec6.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M30.809,23.825c-0.34,0-0.7,0-1.18,0.04c-2.701,0.221-3.901,1.601-4.241,3.121h0.061
+ c0.641-0.66,1.54-1.04,2.761-1.04c2.181,0,4.021,1.54,4.021,4.241c0,2.58-1.98,4.7-4.801,4.7c-3.461,0-5.161-2.58-5.161-5.682
+ c0-2.44,0.899-4.48,2.3-5.78c1.301-1.182,2.98-1.821,5.021-1.92c0.56-0.04,0.92-0.04,1.22-0.021V23.825z M27.408,32.647
+ c1.062,0,1.74-0.979,1.74-2.3c0-1.201-0.64-2.241-1.939-2.241c-0.82,0-1.5,0.5-1.801,1.16c-0.08,0.16-0.12,0.4-0.12,0.761
+ c0.061,1.38,0.721,2.62,2.102,2.62H27.408z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/minusrec.svg b/TamTamMini.activity/icons/minusrec.svg
new file mode 100644
index 0000000..fb6463c
--- /dev/null
+++ b/TamTamMini.activity/icons/minusrec.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="28.1" cy="27.84" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="28.098" cy="27.932" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M19.121,21.796h2.721v5.363h0.055c0.271-0.468,0.558-0.897,0.828-1.333l2.755-4.03h3.367l-4.019,5.167
+ l4.23,6.968h-3.205l-2.971-5.239l-1.045,1.278v3.961h-2.72L19.121,21.796L19.121,21.796z"/>
+</g>
+<circle fill="none" cx="28.431" cy="27.692" r="17.085"/>
+<text transform="matrix(1 0 0 1 30.917 28.667)" fill="#FFFFFF" font-family="'MyriadPro-Bold'" font-size="16">-</text>
+<circle fill="none" stroke="#4C4D4F" cx="28.431" cy="27.692" r="17.085"/>
+</svg>
diff --git a/TamTamMini.activity/icons/overrec.svg b/TamTamMini.activity/icons/overrec.svg
new file mode 100644
index 0000000..bf11488
--- /dev/null
+++ b/TamTamMini.activity/icons/overrec.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="28.1" cy="27.84" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="28.098" cy="27.932" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M19.121,21.796h2.72v5.364h0.055c0.27-0.468,0.558-0.898,0.828-1.333l2.755-4.031h3.367l-4.018,5.167
+ l4.23,6.968h-3.205l-2.971-5.239l-1.045,1.278v3.961h-2.719L19.121,21.796L19.121,21.796z"/>
+</g>
+<circle fill="none" cx="28.431" cy="27.692" r="17.085"/>
+<text transform="matrix(1 0 0 1 29.667 28.667)" fill="#FFFFFF" font-family="'MyriadPro-Bold'" font-size="16">+</text>
+<circle fill="none" stroke="#4C4D4F" cx="28.431" cy="27.692" r="17.085"/>
+</svg>
diff --git a/TamTamMini.activity/icons/rec1.svg b/TamTamMini.activity/icons/rec1.svg
new file mode 100644
index 0000000..4a88eec
--- /dev/null
+++ b/TamTamMini.activity/icons/rec1.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M26.582,24.229h-0.034l-2.233,1.062l-0.45-2.052l3.099-1.438h2.269v11.703h-2.649V24.229z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/rec2.svg b/TamTamMini.activity/icons/rec2.svg
new file mode 100644
index 0000000..108ea7e
--- /dev/null
+++ b/TamTamMini.activity/icons/rec2.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M23.09,33.501v-1.656l1.512-1.369c2.557-2.286,3.8-3.603,3.835-4.969c0-0.954-0.576-1.711-1.926-1.711
+ c-1.008,0-1.893,0.504-2.503,0.973l-0.774-1.963c0.882-0.666,2.25-1.206,3.835-1.206c2.647,0,4.105,1.548,4.105,3.673
+ c0,1.963-1.423,3.529-3.115,5.042l-1.08,0.899v0.034h4.411v2.253H23.09z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/rec3.svg b/TamTamMini.activity/icons/rec3.svg
new file mode 100644
index 0000000..2c64c70
--- /dev/null
+++ b/TamTamMini.activity/icons/rec3.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M23.575,30.818c0.486,0.252,1.604,0.72,2.721,0.72c1.423,0,2.143-0.684,2.143-1.564
+ c0-1.152-1.152-1.674-2.358-1.674h-1.117v-1.963h1.062c0.918-0.021,2.088-0.36,2.088-1.353c0-0.702-0.576-1.224-1.728-1.224
+ c-0.955,0-1.962,0.414-2.449,0.702l-0.558-1.981c0.7-0.45,2.104-0.882,3.617-0.882c2.502,0,3.891,1.312,3.891,2.917
+ c0,1.242-0.702,2.215-2.145,2.719v0.036c1.404,0.252,2.539,1.314,2.539,2.845c0,2.07-1.817,3.583-4.79,3.583
+ c-1.512,0-2.791-0.396-3.475-0.828L23.575,30.818z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/rec4.svg b/TamTamMini.activity/icons/rec4.svg
new file mode 100644
index 0000000..14b2d0a
--- /dev/null
+++ b/TamTamMini.activity/icons/rec4.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M27.934,33.501V30.71h-5.188v-1.782l4.431-7.13h3.349v6.858h1.404v2.055h-1.404v2.791L27.934,33.501
+ L27.934,33.501z M27.934,28.657v-2.593c0-0.702,0.036-1.422,0.09-2.178h-0.072c-0.378,0.756-0.684,1.438-1.081,2.178l-1.564,2.557
+ v0.036H27.934z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/rec5.svg b/TamTamMini.activity/icons/rec5.svg
new file mode 100644
index 0000000..b5c7b21
--- /dev/null
+++ b/TamTamMini.activity/icons/rec5.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M31.522,23.832H26.48l-0.279,2c0.279-0.039,0.521-0.039,0.841-0.039c1.239,0,2.501,0.279,3.421,0.939
+ c0.979,0.66,1.58,1.74,1.58,3.261c0,2.42-2.08,4.562-5.581,4.562c-1.58,0-2.9-0.359-3.621-0.74l0.54-2.281
+ c0.58,0.281,1.761,0.642,2.94,0.642c1.26,0,2.602-0.601,2.602-1.98c0-1.34-1.062-2.16-3.661-2.16c-0.72,0-1.222,0.04-1.761,0.12
+ l0.859-6.822h7.162V23.832z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/icons/rec6.svg b/TamTamMini.activity/icons/rec6.svg
new file mode 100644
index 0000000..6b0ccc0
--- /dev/null
+++ b/TamTamMini.activity/icons/rec6.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M30.809,23.825c-0.34,0-0.7,0-1.18,0.04c-2.701,0.221-3.901,1.601-4.241,3.121h0.061
+ c0.641-0.66,1.54-1.04,2.761-1.04c2.181,0,4.021,1.54,4.021,4.241c0,2.58-1.98,4.7-4.801,4.7c-3.461,0-5.161-2.58-5.161-5.682
+ c0-2.44,0.899-4.48,2.3-5.78c1.301-1.182,2.98-1.821,5.021-1.92c0.56-0.04,0.92-0.04,1.22-0.021V23.825z M27.408,32.647
+ c1.062,0,1.74-0.979,1.74-2.3c0-1.201-0.64-2.241-1.939-2.241c-0.82,0-1.5,0.5-1.801,1.16c-0.08,0.16-0.12,0.4-0.12,0.761
+ c0.061,1.38,0.721,2.62,2.102,2.62H27.408z"/>
+</g>
+</svg>
diff --git a/TamTamMini.activity/setup.py b/TamTamMini.activity/setup.py
new file mode 100644
index 0000000..5b21f11
--- /dev/null
+++ b/TamTamMini.activity/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+# Copyright (C) 2006, Red Hat, Inc.
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start('TamTam')
diff --git a/TamTamSynthLab.activity/NEWS b/TamTamSynthLab.activity/NEWS
new file mode 100644
index 0000000..8120a07
--- /dev/null
+++ b/TamTamSynthLab.activity/NEWS
@@ -0,0 +1,71 @@
+39
+
+* New activity : TamTamJam (lync)
+* Activities are now separate (TamTamJam, TamTamEdit, TamTamSynthLab)
+* No sound when set to language other than english fixed (#3165) (J5, marcopg, tomeu, Flipo)
+
+38
+
+* Adapt to new Palette API (Flipo)
+
+37
+
+* Small layout change in edit (Flipo)
+* Temporary fix for Palettes causing the audio to stop (Flipo)
+
+36
+
+* Major image cleanup, 700k saved (Flipo)
+* Tune generation back (see leftmost icon on generate tab) (Olipet)
+
+35
+
+* TamTam Edit Toolbars enhancements (Flipo, Olipet)
+* TamTam Edit layout changes (lync)
+* Dual instruments for tracks in Edit (Olipet, lync)
+
+34
+
+* Synthlab sugar integration (olipet, Flipo)
+* Toolbars in edit draft, hit alt-t to show the toolbar, alt-y to hide (Flipo)
+* Bug that prevented sound from working fixed (LeJames)
+
+33
+
+* Added Sugar Toolbar to miniTamTam and Synthlab (Flipo)
+* Network now working in miniTamTam, use the share button on the activity toolbar (lync)
+* Added help subsystem (ethrop, LeJames)
+
+32
+
+* Important microphone fix (Olipet)
+
+31
+
+* Working network (create a FORCE_SHARE file in the / dir) (lync)
+* New tune generator in Edit, click the dice in the tune view (Olipet)
+* Fine tuning of the algorythmic generator and orchestras (Olipet)
+* TamTamJam (miniTamTam) integration with the journal (Flipo)
+* Title according to subactivity displayed in the journal (Flipo)
+
+30
+
+* Clicking the close button in Edit and Synthlab goes back to Sugar. (Flipo)
+* Fix to the Journal load and save. (Flipo, lync)
+* Ogg player on the welcome page. (lync)
+* Demo tune instruments and tempo are randomly generated (Olipet)
+* lab placeholder files were reduced in size by 95% (Olipet)
+
+29
+
+* WelcomeScreen: Removed Typing Game icon. (Flipo)
+* General: Added sounds. (ethrop, Olipet)
+* General: Journal integration. (Flipo, lync)
+* TamTamJam: Microphone semi-working. (James)
+* TamTamEdit: Beats per page setting. (lync, Olipet)
+* TamTamEdit: Mute/Solo controls on tracks. (Flipo)
+* TamTamEdit: Paint tool. (Olipet)
+* TamTamEdit: Properties automation. (Olipet)
+* TamTamEdit: Pages can have different colors. (lync)
+* TamTamEdit: Realtime keyboard recording. (Olipet)
+* TamTamEdit: Export song to ogg file. (Olipet) \ No newline at end of file
diff --git a/TamTamSynthLab.activity/SynthLab/SynthLabConstants.py b/TamTamSynthLab.activity/SynthLab/SynthLabConstants.py
new file mode 100755
index 0000000..a16ffe3
--- /dev/null
+++ b/TamTamSynthLab.activity/SynthLab/SynthLabConstants.py
@@ -0,0 +1,374 @@
+from gettext import gettext as _
+
+class SynthLabConstants:
+
+ PIC_SIZE = 80
+ HALF_SIZE = PIC_SIZE // 2
+ PIC_SIZE_HIGHLIGHT = PIC_SIZE + 4
+
+ GT_CONTROL_OUTPUT = 0
+ GT_CONTROL_INPUT = 1
+ GT_SOUND_OUTPUT = 2
+ GT_SOUND_INPUT = 3
+ # GATE_POINT[objecttype][gatetype][gatenum] = (x,y)
+ # relative to object center
+ GATE_POINT = [ [ [ (-1,33) ] ],
+ [ [], [ (-24,-34),(-9,-34),(8,-34),(24,-34) ], [ (-1,33) ] ],
+ [ [], [ (31,-20),(31,-6),(31,6),(31,19) ], [ (-3,33) ], [ (-3,-34) ] ],
+ [ [], [], [], [ (2,-35) ] ] ]
+ # GATE_MAP[objecttype][gatetype][gatenum] = [ sx, sy, ex, ey, (wireX,wireY) ]
+ # gate locations relative to object center
+ GATE_MAP = [ [ [ [-7,26,4,39] ] ],
+ [ [], [[-30,-40,-19,-28], [-15,-40,-3,-28], [3,-40,14,-28], [19,-40,28,-28]], [[-6,28,5,40]] ],
+ [ [], [[25,-25,37,-14], [25,-12,37,-1], [25,1,37,12], [25,13,37,25]], [[-8,27,3,40]], [[-8,-40,3,-27]] ],
+ [ [], [], [], [[-4,-40,7,-29]] ] ]
+ # insert wire locations into map
+ GATE_OFFSET = 15
+ for oT in GATE_MAP:
+ for gT in oT:
+ for m in gT:
+ x = (m[2]+m[0])//2
+ y = (m[3]+m[1])//2
+ # snap to edges
+ if x < -HALF_SIZE+GATE_OFFSET: x = m[0]
+ elif x > HALF_SIZE-GATE_OFFSET: x = m[2]
+ if y < -HALF_SIZE+GATE_OFFSET: y = m[1]
+ elif y > HALF_SIZE-GATE_OFFSET: y = m[3]
+ m.append( ( x, y ) )
+
+ OBJ_Y_LOC = 710
+ INIT_LOCATIONS = [ [450,OBJ_Y_LOC], [450,OBJ_Y_LOC], [450,OBJ_Y_LOC],
+ [450, OBJ_Y_LOC], [225,OBJ_Y_LOC], [225,OBJ_Y_LOC],
+ [225,OBJ_Y_LOC], [225, OBJ_Y_LOC], [675,OBJ_Y_LOC],
+ [675,OBJ_Y_LOC], [675,OBJ_Y_LOC], [675, OBJ_Y_LOC],
+ [450, 625]]
+
+ FLOAT1 = [.1, 1]
+ FLOAT = [.01, 2]
+ INTEGER = [1, 0]
+
+ # s1 s2 s3 s4 s1min s1max s2min s2max s3min s3max s4min s4max [s1step s1digits] [s2step s2digits] [s3step s3digits]
+ TYPES = { 'lfo': [.5, 1, 0, 0, 0, 1, 0, 20, 0, 5, 0, 1, FLOAT, FLOAT, INTEGER],
+ 'rand': [.5, 1.5, 2, 0, 0, 2, 0, 2, 0, 20, 0, 1, FLOAT, FLOAT, FLOAT],
+ 'adsr': [.02, .05, .8, .1, 0, 1, 0, 1, 0, 1, 0, 1, FLOAT, FLOAT, FLOAT],
+ 'trackpadX': [0, 1, 0, 0, -1, 1, 0, 2, 0, 1, 0, 1, FLOAT, FLOAT, INTEGER],
+ 'trackpadY': [0, 1, 0, 0, -1, 1, 0, 2, 0, 1, 0, 1, FLOAT, FLOAT, INTEGER],
+ 'fm': [1, .5, 5, 1, 0, 2, 0, 2, 0, 10, 0, 2, FLOAT, FLOAT, FLOAT],
+ 'buzz': [1, 30, .85, 1, 0, 2, 0, 40, 0, 1, 0, 2, FLOAT, INTEGER, FLOAT],
+ 'vco': [1, 1, .2, 1, 0, 2, 0, 2, 0, .5, 0, 2, FLOAT, INTEGER, FLOAT],
+ 'pluck': [1, 5000, 0, 1, 0, 2, 100, 8000, 0, 8, 0, 2, FLOAT, INTEGER, FLOAT],
+ 'noise': [0, 3000, 4000, 1, 0, 2, 0, 8000, 0, 6000, 0, 2, INTEGER, INTEGER,INTEGER],
+ 'sample': [1, 5, 5000, 1, 0, 2, 0, 99, 100, 8000, 0, 2, FLOAT, INTEGER, INTEGER],
+ 'voice': [1, 3, 5, 1, 0, 2, 0, 8, 1, 10, 0, 2, FLOAT, INTEGER, FLOAT],
+ 'grain': [1, 4, 1, 1, 0, 2, 0, 99, 0, 1, 0, 2, FLOAT, INTEGER, FLOAT],
+ 'addSynth': [1, .005, 5, 1, 0, 2, 0, 20, 0, 9, 0, 2, FLOAT, FLOAT, INTEGER],
+ 'wguide': [100, 3000, .8, 1, 0, 200, 100, 5000, 0, 1, 0, 2, FLOAT1, INTEGER, FLOAT],
+ 'distort': [800, .7, .7, 1, 0, 1000, 0, 1, 0, 1, 0, 2, INTEGER, FLOAT, FLOAT],
+ 'filter': [1000, .6, 0, 1, 200, 5000, 0, 1, 0, 2, 0, 2, INTEGER, FLOAT, INTEGER],
+ 'ring': [500, 1, 0, 1, 0, 1000, 0, 1, 0, 5, 0, 2, INTEGER, FLOAT, INTEGER],
+ 'reverb': [1.5, 3000, .5, 1, 0, 4, 100, 7000, 0, 1, 0, 2, FLOAT, INTEGER, FLOAT],
+ 'harmon': [1.25, .04, .5, 1, 0, 2, 0, 1, 0, 1, 0, 2, FLOAT, FLOAT, FLOAT],
+ 'eq4band': [1., 1., 1., 1., 0, 2, 0, 2, 0, 2, 0, 2, FLOAT, FLOAT, FLOAT],
+ 'chorus': [.5, 1., 5., .5, 0, 3, 0, 10, 0, 30, 0, 1, FLOAT, FLOAT, FLOAT]}
+
+ CONTROL_TYPES = ['lfo', 'rand', 'adsr', 'trackpadX', 'trackpadY']
+ CONTROL_TYPES_SEL = [type + 'sel' for type in CONTROL_TYPES]
+ CONTROL_TYPES_PLUS = [type + '+' for type in CONTROL_TYPES]
+ SOURCE_TYPES = ['fm', 'buzz', 'vco', 'pluck', 'noise', 'sample', 'voice', 'grain', 'addSynth']
+ SOURCE_TYPES_SEL = [type + 'sel' for type in SOURCE_TYPES]
+ SOURCE_TYPES_PLUS = [type + '+' for type in SOURCE_TYPES]
+ FX_TYPES = ['wguide', 'distort','filter', 'ring', 'reverb', 'harmon', 'eq4band', 'chorus']
+ FX_TYPES_SEL = [type + 'sel' for type in FX_TYPES]
+ FX_TYPES_PLUS = [type + '+' for type in FX_TYPES]
+ OUTPUT_TYPE = ['adsr']
+ OUTPUT_TYPE_SEL = ['adsrsel']
+ CHOOSE_TYPE = [CONTROL_TYPES, SOURCE_TYPES, FX_TYPES, OUTPUT_TYPE]
+ CHOOSE_TYPE2 = [CONTROL_TYPES_SEL, SOURCE_TYPES_SEL, FX_TYPES_SEL, OUTPUT_TYPE_SEL]
+ CHOOSE_TYPE_PLUS = [CONTROL_TYPES_PLUS, SOURCE_TYPES_PLUS, FX_TYPES_PLUS]
+
+# SynthLab Tooltips
+ SOURCE = _('Source')
+ EFFECT = _('Effect')
+ CONTROL = _('Control')
+ SOUNDOUT = _('Sound Output')
+
+ #Controls
+ LFO = _('LFO')
+ AMP = _('Amplitude')
+ FREQ = _('Frequency')
+ WAVEFORM = _('Waveform')
+ LFO_WAVEFORMS = [_('Sine'), _('Triangle'), _('Bi-Square'), _('Uni-Square'), _('Sawtooth'), _('Sawtooth-down')]
+ OFFSET = _('Offset')
+ LFO_INFO = _('A low frequency oscillation (LFO) is a signal usually below 20 Hz which creates a pulsating rythm rather than a audible tone. This signal is commonly used to control sound parameters.')
+ LFO_PARA1 = _('The amplitude (volume) of the LFO signal. More amplitude means the effect will be more noticeable.')
+ LFO_PARA2 = _('The speed of the signal beteen 0 Hz and 20 hz.')
+ LFO_PARA3 = _('The type of waveform that will be used for the LFO.')
+ LFO_PARA4 = _('Offset: ')
+
+ RANDOM = _('Random')
+ MIN = _('Minimum')
+ MAX = _('Maximum')
+ FREQ = FREQ
+ SEED = _('Seed')
+ RANDOM_INFO = _('A random number generator is a computational device designed to generate a sequence of numbers that lack any pattern.')
+ RANDOM_PARA1 = _('')
+ RANDOM_PARA2 = _('The minimum value that can be generated.')
+ RANDOM_PARA3 = _('The maximum value that can be generated.')
+ RANDOM_PARA4 = _('')
+
+ ADSR = _('Envelope')
+ ATTACK = _('Attack')
+ DECAY = _('Decay')
+ SUSTAIN = _('Sustain')
+ RELEASE = _('Release')
+ ADSR_INFO = _("An ADSR envelope is a component of many sythesizers, samplers, and other electronic musical instruments. Its function is to modulate some aspect of the instrument's sound - often its volume - over time.")
+ ADSR_PARA1 = _('How quickly the sound reaches full volume after the sound is activated.')
+ ADSR_PARA2 = _('How quickly the sound drops to the sustain level after the initial peak.')
+ ADSR_PARA3= _('The "constant" volume that the sound takes after decay until the note is released.')
+ ADSR_PARA4 = _('How quickly the sound fades when a note ends.')
+
+ TRACKPADX = _('Trackpad X')
+ MIN = MIN
+ MAX = MAX
+ SCALING = _('Scaling')
+ SCALING_TYPES = [_('Lin'), _('Log')]
+ POLL = _('Poll time')
+ TRACKPADX_INFO = _('The XO trackpad can be used to control sound parameters. This is the x axis, from left to right.')
+ TRACKPADX_PARA1 = _('The minimum value the trackpad will send.')
+ TRACKPADX_PARA2 = _('The maximum value de trackpad will send.')
+ TRACKPADX_PARA3 = _('The type of scaling, logarithmic or linear.')
+ TRACKPADX_PARA4= _('The time interval between each event coming from the trackpad.')
+
+ TRACKPADY = _('Trackpad Y')
+ MIN = MIN
+ MAX = MAX
+ SCALING = SCALING
+ SCALING_TYPES = SCALING_TYPES
+ POLL = POLL
+ TRACKPADY_INFO = _('The XO trackpad can be used to control sound parameters. This is the y axis, from top to bottom.')
+ TRACKPADY_PARA1 = _('The minimum value the trackpad will send.')
+ TRACKPADY_PARA2 = _('The maximum value de trackpad will send.')
+ TRACKPADY_PARA3 = _('The type of scaling, logarithmic or linear.')
+ TRACKPADY_PARA4 = _('The time interval between each event coming from the trackpad.')
+
+ #Source
+ FM = _('FM')
+ CAR = _('Carrier Frequency')
+ MOD = _('Modulator Frequency')
+ INDEX = _('Index')
+ GAIN = _('Gain')
+ FM_INFO = _('Frequency modulation synthesis is a form of audio synthesis where the timbre of a simple waveform is changed by frequency modulating it with a modulating frequency that is also in the audio range, resulting in a more complex waveform and a different-sounding tone.')
+ FM_PARA1 = _('The main waveform frequency.')
+ FM_PARA2 = _('The frequency of the waveform that will modulate the Carrier waveform.')
+ FM_PARA3 = _('The variation in frequency of the Carrier waveform.')
+ FM_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ BUZZ = _('Buzz')
+ FREQ = FREQ
+ NHARM = _('Number of harmonics')
+ FSLOPE = _('Filter Slope')
+ GAIN = GAIN
+ BUZZ_INFO = _('')
+ BUZZ_PARA1 = _('')
+ BUZZ_PARA2 = _('')
+ BUZZ_PARA3 = _('')
+ BUZZ_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ VCO = _('VCO')
+ FREQ = FREQ
+ WAVEFORM = WAVEFORM
+ VCO_WAVEFORMS = [_('Sawtooth'), _('Square'), _('Triangle')]
+ FSLOPE = FSLOPE
+ GAIN = GAIN
+ VCO_INFO = _('')
+ VCO_PARA1 = _('')
+ VCO_PARA2 = _('')
+ VCO_PARA3 = _('')
+ VCO_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ PLUCK = _('Pluck')
+ FREQ = FREQ
+ LFILTER = _('Lowpass Filter')
+ VIBRATO = _('Vibrato')
+ GAIN = GAIN
+ PLUCK_INFO = _('')
+ PLUCK_PARA1 = _('')
+ PLUCK_PARA2 = _('')
+ PLUCK_PARA3 = _('')
+ PLUCK_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ NOISE = _('Noise')
+ NOISETYPE = _('Type')
+ NOISE_TYPES = [_('White'), _('Pink'), _('Gauss')]
+ FREQ = FREQ
+ BANDWITH = _('Bandwith')
+ GAIN = GAIN
+ NOISE_INFO = _('')
+ NOISE_PARA1 = _('')
+ NOISE_PARA2 = _('')
+ NOISE_PARA3 = _('')
+ NOISE_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ SAMPLE = _('Sound Sample')
+ FREQ = FREQ
+ SAMPLEN = _('Sample Number')
+ SAMPLE_NAMES = _('Sample name')
+ LFILTER = LFILTER
+ GAIN = GAIN
+ SAMPLE_INFO = _('')
+ SAMPLE_PARA1 = _('')
+ SAMPLE_PARA2 = _('')
+ SAMPLE_PARA3 = _('')
+ SAMPLE_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ VOICE = _('Voice')
+ FREQ = FREQ
+ VOWEL = _('Vowel')
+ VOWEL_TYPES = ['i', 'e', 'ee', 'a', 'u', 'o1', 'o2', 'oa', 'oe']
+ VIBRATO = VIBRATO
+ GAIN = GAIN
+ VOICE_INFO = _('')
+ VOICE_PARA1 = _('')
+ VOICE_PARA2 = _('')
+ VOICE_PARA3 = _('')
+ VOICE_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ GRAIN = _('Grain')
+ FREQ = FREQ
+ SAMPLEN = SAMPLEN
+ INDEX = _('Index')
+ GAIN = GAIN
+ GRAIN_INFO = _('')
+ GRAIN_PARA1 = _('')
+ GRAIN_PARA2 = _('')
+ GRAIN_PARA3 = _('')
+ GRAIN_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ ADDSYNTH = _('Additive Synthesis')
+ FREQ = FREQ
+ SPREAD = _('Spread')
+ WAVE = _('Waveform')
+ GAIN = GAIN
+ ADDSYNTH_INFO = _('')
+ ADDSYNTH_PARA1 = _('')
+ ADDSYNTH_PARA2 = _('')
+ ADDSYNTH_PARA3 = _('')
+ ADDSYNTH_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ #Effects
+ DELAY = _('Delay')
+ FREQ = FREQ
+ LFILTER = LFILTER
+ FEEDBACK = _('Feedback')
+ GAIN = GAIN
+ DELAY_INFO = _('')
+ DELAY_PARA1 = _('')
+ DELAY_PARA2 = _('')
+ DELAY_PARA3 = _('')
+ DELAY_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ DIST = _('Distortion')
+ FREQ = FREQ
+ RESON = _('Resonance')
+ DISTL = _('Distotion Level')
+ GAIN = GAIN
+ DIST_INFO = _('')
+ DIST_PARA1 = _('')
+ DIST_PARA2 = _('')
+ DIST_PARA3 = _('')
+ DIST_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ FILTER = _('Filter')
+ FREQ = FREQ
+ FSLOPE = FSLOPE
+ FTYPE = _('Type')
+ FILTER_TYPES = [_('Lowpass'), _('Highpass'), _('Bandpass')]
+ GAIN = GAIN
+ FILTER_INFO = _('')
+ FILTER_PARA1 = _('')
+ FILTER_PARA2 = _('')
+ FILTER_PARA3 = _('')
+ FILTER_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ RINGMOD = _('Ring Modulator')
+ FREQ = FREQ
+ MIX = _('Mix')
+ WAVEFORM = WAVEFORM
+ LFO_WAVEFORMS = LFO_WAVEFORMS
+ GAIN = GAIN
+ RINGMOD_INFO = _('')
+ RINGMOD_PARA1 = _('')
+ RINGMOD_PARA2 = _('')
+ RINGMOD_PARA3 = _('')
+ RINGMOD_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ REVERB = _('Reverb')
+ REVERBD = _('Length')
+ REVERBF = _('Lowpass Filter')
+ REVERBL = _('Reverb Level')
+ GAIN = GAIN
+ REVERB_INFO = _('Reverberation is the persistence od sound in a particular space after the original sound is removed.')
+ REVERB_PARA1 = _('')
+ REVERB_PARA2 = _('')
+ REVERB_PARA3 = _('')
+ REVERB_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ HARMON = _('Harmonizer')
+ FREQ = FREQ
+ DRYDELAY = _('Dry delay')
+ MIX = MIX
+ GAIN = GAIN
+ HARMON_INFO = _('')
+ HARMON_PARA1 = _('')
+ HARMON_PARA2 = _('')
+ HARMON_PARA3 = _('')
+ HARMON_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ EQ4BAND = _('Equalizer 4 bands')
+ FREQ1 = _('Band one gain')
+ FREQ2 = _('Band two gain')
+ FREQ3 = _('Band three gain')
+ FREQ4 = _('Band four gain')
+ EQ4BAND_INFO = _('A 4 band equalizer is an effect that splits the spectrum into 4 bands and allows the bands to be set at different levels.')
+ EQ4BAND_PARA1 = _('The gain (volume) of band 1.')
+ EQ4BAND_PARA2 = _('The gain (volume) of band 2.')
+ EQ4BAND_PARA3 = _('The gain (volume) of band 3.')
+ EQ4BAND_PARA4 = _('The gain (volume) of band 4.')
+
+ CHORUS = _('Chorus')
+ LFODEPTH = _('LFO Depth')
+ LFOFREQ = _('LFO Frequency')
+ DELAY = _('Delay')
+ FEEDBACK = FEEDBACK
+ CHORUS_INFO = _('A chorus effect is a condition in the way people perceive similar sounds coming from multiple sources.')
+ CHORUS_PARA1 = _('LFO Depth: The amplitude of the LFO signal.')
+ CHORUS_PARA2 = _('LFO Frequency: the frequency of the LFO signal.')
+ CHORUS_PARA3 = _('Delay: The amount of delay between the two signals.')
+ CHORUS_PARA4 = _('The overall gain (volume) of the sound source.')
+
+ SYNTHTYPES = [[LFO, RANDOM, ADSR, TRACKPADX, TRACKPADY],
+ [FM, BUZZ, VCO, PLUCK, NOISE, SAMPLE, VOICE, GRAIN, ADDSYNTH],
+ [DELAY, DIST, FILTER, RINGMOD, REVERB, HARMON, EQ4BAND, CHORUS], [ADSR]]
+
+ SYNTHPARA = { _('lfo'): [AMP, FREQ, WAVEFORM, OFFSET, LFO_INFO, LFO_PARA1, LFO_PARA2, LFO_PARA3, LFO_PARA4],
+ _('rand'): [MIN, MAX, FREQ, SEED, RANDOM_INFO, RANDOM_PARA1, RANDOM_PARA2, RANDOM_PARA3, RANDOM_PARA4],
+ _('adsr'): [ATTACK, DECAY, SUSTAIN, RELEASE, ADSR_INFO, ADSR_PARA1, ADSR_PARA2, ADSR_PARA3, ADSR_PARA4],
+ _('trackpadX'): [MIN, MAX, SCALING, POLL, TRACKPADX_INFO, TRACKPADX_PARA1, TRACKPADX_PARA2, TRACKPADX_PARA3, TRACKPADX_PARA4],
+ _('trackpadY'): [MIN, MAX, SCALING, POLL, TRACKPADY_INFO, TRACKPADY_PARA1, TRACKPADY_PARA2, TRACKPADY_PARA3, TRACKPADY_PARA4],
+ _('fm'): [CAR, MOD, INDEX, GAIN, FM_INFO, FM_PARA1, FM_PARA2, FM_PARA3, FM_PARA4],
+ _('buzz'): [FREQ, NHARM, FSLOPE, GAIN, BUZZ_INFO, BUZZ_PARA1, BUZZ_PARA2, BUZZ_PARA3, BUZZ_PARA4],
+ _('vco'): [FREQ, WAVEFORM, FSLOPE, GAIN, VCO_INFO, VCO_PARA1, VCO_PARA2, VCO_PARA3, VCO_PARA4],
+ _('pluck'): [FREQ, LFILTER, VIBRATO, GAIN, PLUCK_INFO, PLUCK_PARA1, PLUCK_PARA2, PLUCK_PARA3, PLUCK_PARA4],
+ _('noise'): [NOISETYPE, FREQ, BANDWITH, GAIN, NOISE_INFO, NOISE_PARA1, NOISE_PARA2, NOISE_PARA3, NOISE_PARA4],
+ _('sample'): [FREQ, SAMPLEN, LFILTER, GAIN, SAMPLE_INFO, SAMPLE_PARA1, SAMPLE_PARA2, SAMPLE_PARA3, SAMPLE_PARA4],
+ _('voice'): [FREQ, VOWEL, VIBRATO, GAIN, VOICE_INFO, VOICE_PARA1, VOICE_PARA2, VOICE_PARA3, VOICE_PARA4],
+ _('grain'): [FREQ, SAMPLEN, INDEX, GAIN, GRAIN_INFO, GRAIN_PARA1, GRAIN_PARA2, GRAIN_PARA3, GRAIN_PARA4],
+ _('addSynth'): [FREQ, SPREAD, WAVE, GAIN, ADDSYNTH_INFO, ADDSYNTH_PARA1, ADDSYNTH_PARA2, ADDSYNTH_PARA3, ADDSYNTH_PARA4],
+ _('wguide'): [FREQ, LFILTER, FEEDBACK, GAIN, DELAY_INFO, DELAY_PARA1, DELAY_PARA2, DELAY_PARA3, DELAY_PARA4],
+ _('distort'): [FREQ, RESON, DISTL, GAIN, DIST_INFO, DIST_PARA1, DIST_PARA2, DIST_PARA3, DIST_PARA4],
+ _('filter'): [FREQ, FSLOPE, FTYPE, GAIN, FILTER_INFO, FILTER_PARA1, FILTER_PARA2, FILTER_PARA3, FILTER_PARA4],
+ _('ring'): [FREQ, MIX, WAVEFORM, GAIN, RINGMOD_INFO, RINGMOD_PARA1, RINGMOD_PARA2, RINGMOD_PARA3, RINGMOD_PARA4],
+ _('reverb'): [REVERBD, REVERBF, REVERBL, GAIN, REVERB_INFO, REVERB_PARA1, REVERB_PARA2, REVERB_PARA3, REVERB_PARA4],
+ _('harmon'): [FREQ, DRYDELAY, MIX, GAIN, HARMON_INFO, HARMON_PARA1, HARMON_PARA2, HARMON_PARA3, HARMON_PARA4],
+ _('eq4band'): [FREQ1, FREQ2, FREQ3, FREQ4, EQ4BAND_INFO, EQ4BAND_PARA1, EQ4BAND_PARA2, EQ4BAND_PARA3, EQ4BAND_PARA4],
+ _('chorus'): [LFODEPTH, LFOFREQ, DELAY, FEEDBACK, CHORUS_INFO, CHORUS_PARA1, CHORUS_PARA2, CHORUS_PARA3, CHORUS_PARA4]}
diff --git a/TamTamSynthLab.activity/SynthLab/SynthLabToolbars.py b/TamTamSynthLab.activity/SynthLab/SynthLabToolbars.py
new file mode 100644
index 0000000..8b535eb
--- /dev/null
+++ b/TamTamSynthLab.activity/SynthLab/SynthLabToolbars.py
@@ -0,0 +1,170 @@
+#!/usr/bin/env python
+
+import gtk
+import Config
+
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.radiotoolbutton import RadioToolButton
+from gettext import gettext as _
+
+class mainToolbar(gtk.Toolbar):
+ def __init__(self,toolbox, synthLab):
+ gtk.Toolbar.__init__(self)
+
+ def _insertSeparator(x = 1):
+ for i in range(x):
+ self.separator = gtk.SeparatorToolItem()
+ self.separator.set_draw(False)
+ self.insert(self.separator,-1)
+ self.separator.show()
+
+ self.toolbox = toolbox
+ self.synthLab = synthLab
+
+ self.tooltips = gtk.Tooltips()
+
+ self.durationSliderLabel = gtk.Label(_('Duration: '))
+ self.durationSliderLabelTool = gtk.ToolItem()
+ self.durationSliderLabelTool.add(self.durationSliderLabel)
+ self.durationSliderLabelSecond = gtk.Label(_(' s.'))
+ self.durationSliderLabelSecondTool = gtk.ToolItem()
+ self.durationSliderLabelSecondTool.add(self.durationSliderLabelSecond)
+ self.durationSliderAdj = gtk.Adjustment(2, .5, 10, .01, .01, 0)
+ self.durationSliderAdj.connect("value_changed" , self.synthLab.handleDuration)
+ self.durationSlider = gtk.HScale(adjustment = self.durationSliderAdj)
+ self.durationSlider.set_size_request(250,15)
+ self.durationSlider.set_inverted(False)
+ self.durationSlider.set_value_pos(gtk.POS_RIGHT)
+ self.durationSliderTool = gtk.ToolItem()
+ self.durationSliderTool.add(self.durationSlider)
+ self.insert(self.durationSliderLabelTool, -1)
+ self.insert(self.durationSliderTool, -1)
+ self.insert(self.durationSliderLabelSecondTool, -1)
+ self.durationSliderLabelTool.show()
+ self.durationSliderLabel.show()
+ self.durationSliderLabelSecondTool.show()
+ self.durationSliderLabelSecond.show()
+ self.durationSlider.show()
+ self.durationSliderTool.show()
+ self.durationSliderTool.set_tooltip(self.tooltips, _('Duration'))
+
+ _insertSeparator(1)
+
+ self.synthRec1Button = ToggleToolButton('rec1')
+ self.synthRec1Button.connect('clicked',self.synthLab.recordSound,1)
+ self.insert(self.synthRec1Button, -1)
+ self.synthRec1Button.show()
+ self.synthRec1Button.set_tooltip(_('Record Synth sound into slot 1'))
+
+ self.synthRec2Button = ToggleToolButton('rec2')
+ self.synthRec2Button.connect('clicked',self.synthLab.recordSound,2)
+ self.insert(self.synthRec2Button, -1)
+ self.synthRec2Button.show()
+ self.synthRec2Button.set_tooltip(_('Record Synth sound into slot 2'))
+
+ self.synthRec3Button = ToggleToolButton('rec3')
+ self.synthRec3Button.connect('clicked',self.synthLab.recordSound,3)
+ self.insert(self.synthRec3Button, -1)
+ self.synthRec3Button.show()
+ self.synthRec3Button.set_tooltip(_('Record Synth sound into slot 3'))
+
+ self.synthRec4Button = ToggleToolButton('rec4')
+ self.synthRec4Button.connect('clicked',self.synthLab.recordSound,4)
+ self.insert(self.synthRec4Button, -1)
+ self.synthRec4Button.show()
+ self.synthRec4Button.set_tooltip(_('Record Synth sound into slot 4'))
+
+ self.synthRec5Button = ToggleToolButton('rec5')
+ self.synthRec5Button.connect('clicked',self.synthLab.recordSound,5)
+ self.insert(self.synthRec5Button, -1)
+ self.synthRec5Button.show()
+ self.synthRec5Button.set_tooltip(_('Record Synth sound into slot 5'))
+
+ self.synthRec6Button = ToggleToolButton('rec6')
+ self.synthRec6Button.connect('clicked',self.synthLab.recordSound,6)
+ self.insert(self.synthRec6Button, -1)
+ self.synthRec6Button.show()
+ self.synthRec6Button.set_tooltip(_('Record Synth sound into slot 6'))
+
+ _insertSeparator(1)
+
+ self.resetButton = ToolButton('sl-reset')
+ self.resetButton.connect('clicked',self.synthLab.handleReset)
+ self.insert(self.resetButton, -1)
+ self.resetButton.show()
+ self.resetButton.set_tooltip(_('Reset the worktable'))
+
+class presetToolbar(gtk.Toolbar):
+ def __init__(self,toolbox, synthLab):
+ gtk.Toolbar.__init__(self)
+
+ def _insertSeparator(x = 1):
+ for i in range(x):
+ self.separator = gtk.SeparatorToolItem()
+ self.separator.set_draw(False)
+ self.insert(self.separator,-1)
+ self.separator.show()
+
+ self.toolbox = toolbox
+ self.synthLab = synthLab
+
+ self.preset1Button = RadioToolButton('preset1', group = None)
+ self.preset1Button.connect('clicked',self.synthLab.presetCallback,1)
+ self.insert(self.preset1Button, -1)
+ self.preset1Button.show()
+ self.preset1Button.set_tooltip(_('Preset 1'))
+
+ self.preset2Button = RadioToolButton('preset2', group = self.preset1Button)
+ self.preset2Button.connect('clicked',self.synthLab.presetCallback,2)
+ self.insert(self.preset2Button, -1)
+ self.preset2Button.show()
+ self.preset2Button.set_tooltip(_('Preset 2'))
+
+ self.preset3Button = RadioToolButton('preset3', group = self.preset1Button)
+ self.preset3Button.connect('clicked',self.synthLab.presetCallback,3)
+ self.insert(self.preset3Button, -1)
+ self.preset3Button.show()
+ self.preset3Button.set_tooltip(_('Preset 3'))
+
+ self.preset4Button = RadioToolButton('preset4', group = self.preset1Button)
+ self.preset4Button.connect('clicked',self.synthLab.presetCallback,4)
+ self.insert(self.preset4Button, -1)
+ self.preset4Button.show()
+ self.preset4Button.set_tooltip(_('Preset 4'))
+
+ self.preset5Button = RadioToolButton('preset5', group = self.preset1Button)
+ self.preset5Button.connect('clicked',self.synthLab.presetCallback,5)
+ self.insert(self.preset5Button, -1)
+ self.preset5Button.show()
+ self.preset5Button.set_tooltip(_('Preset 5'))
+
+ self.preset6Button = RadioToolButton('preset6', group = self.preset1Button)
+ self.preset6Button.connect('clicked',self.synthLab.presetCallback,6)
+ self.insert(self.preset6Button, -1)
+ self.preset6Button.show()
+ self.preset6Button.set_tooltip(_('Preset 6'))
+
+ self.preset7Button = RadioToolButton('preset7', group = self.preset1Button)
+ self.preset7Button.connect('clicked',self.synthLab.presetCallback,7)
+ self.insert(self.preset7Button, -1)
+ self.preset7Button.show()
+ self.preset7Button.set_tooltip(_('Preset 7'))
+
+ self.preset8Button = RadioToolButton('preset8', group = self.preset1Button)
+ self.preset8Button.connect('clicked',self.synthLab.presetCallback,8)
+ self.insert(self.preset8Button, -1)
+ self.preset8Button.show()
+ self.preset8Button.set_tooltip(_('Preset 8'))
+
+ self.preset9Button = RadioToolButton('preset9', group = self.preset1Button)
+ self.preset9Button.connect('clicked',self.synthLab.presetCallback,9)
+ self.insert(self.preset9Button, -1)
+ self.preset9Button.show()
+ self.preset9Button.set_tooltip(_('Preset 9'))
+
+ self.preset10Button = RadioToolButton('preset10', group = self.preset1Button)
+ self.preset10Button.connect('clicked',self.synthLab.presetCallback,10)
+ self.insert(self.preset10Button, -1)
+ self.preset10Button.show()
+ self.preset10Button.set_tooltip(_('Preset 10'))
diff --git a/TamTamSynthLab.activity/SynthLab/SynthLabWindow.py b/TamTamSynthLab.activity/SynthLab/SynthLabWindow.py
new file mode 100644
index 0000000..194f71e
--- /dev/null
+++ b/TamTamSynthLab.activity/SynthLab/SynthLabWindow.py
@@ -0,0 +1,1395 @@
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+from Util.Profiler import TP
+
+import gobject
+import time
+import shelve
+from gettext import gettext as _
+import os
+
+from sugar.graphics.toolcombobox import ToolComboBox
+from Util.ThemeWidgets import BigComboBox
+
+import Config
+from Util.ThemeWidgets import *
+from Util.CSoundClient import new_csound_client
+from SynthLab.SynthObjectsParameters import SynthObjectsParameters
+from SynthLab.SynthLabConstants import SynthLabConstants
+from SynthLab.SynthLabToolbars import mainToolbar
+from SynthLab.SynthLabToolbars import presetToolbar
+from Util.Trackpad import Trackpad
+from SubActivity import SubActivity
+
+as_window = False
+
+class SynthLabWindow(SubActivity):
+ def __init__( self, activity, set_mode, dummy_to_change_signature ):
+ SubActivity.__init__(self, set_mode)
+ if as_window:
+ color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+ self.set_border_width(Config.MAIN_WINDOW_PADDING)
+ self.set_keep_above(False)
+ self.set_decorated(False)
+ self.activity = activity
+ self.csnd = new_csound_client()
+ self.trackpad = Trackpad( self )
+ self.synthObjectsParameters = SynthObjectsParameters()
+ self.resetLocations()
+ self.objectCount = len(self.locations)
+ self.connections = []
+ self.initializeConnections()
+ self.bounds = []
+ for i in range(self.objectCount):
+ self.bounds.append([0,0,0,0])
+ self.updateBounds(i)
+ self.instanceOpen = 0
+ self.recordWait = 0
+ self.recCount = 0
+ self.new = True
+ self.duration = 2
+ self.viewType = ''
+ self.viewParam = ''
+ self.curSlider = 1
+ self.durString = '%.2f' % self.duration
+ self.playingPitch = []
+ self.journalCalled = True
+
+ #Toolbars
+ self.activity.activity_toolbar.keep.show()
+ self._mainToolbar = mainToolbar(self.activity.toolbox, self)
+ self._presetToolbar = presetToolbar(self.activity.toolbox, self)
+ self.activity.toolbox.add_toolbar(_('Main'), self._mainToolbar)
+ self.activity.toolbox.add_toolbar(_('Presets'), self._presetToolbar)
+ self.activity.toolbox.set_current_toolbar(1)
+ self._mainToolbar.show()
+ self._presetToolbar.show()
+
+ loopPointsTable = []
+ sample_names = [name for i in range( len( Config.INSTRUMENTS ) ) for name in Config.INSTRUMENTS.keys() if Config.INSTRUMENTS[ name ].instrumentId == i ]
+ for inst in sample_names:
+ loopStart = Config.INSTRUMENTS[ inst ].loopStart
+ loopEnd = Config.INSTRUMENTS[ inst ].loopEnd
+ crossDur = Config.INSTRUMENTS[ inst ].crossDur
+ loopPointsTable.extend( [ loopStart, loopEnd, crossDur ] )
+ mess = "f5755 0 512 -2 " + " " .join([str(n) for n in loopPointsTable])
+ self.csnd.inputMessage( mess )
+
+ self.lineWidth = 3
+ self.lineWidthMUL2 = self.lineWidth*2
+ self.lineWidthMUL4 = self.lineWidth*4
+ self.lineWidthMUL4SQ = self.lineWidthMUL4*self.lineWidthMUL4
+ self.clockStart = 0
+ self.sample_names = [name for i in range( len( Config.INSTRUMENTS ) ) for name in Config.INSTRUMENTS.keys() if Config.INSTRUMENTS[ name ].instrumentId == i ]
+ if as_window:
+ self.add_events(gtk.gdk.KEY_PRESS_MASK|gtk.gdk.KEY_RELEASE_MASK)
+
+ self.action = None
+ self.dragObject = None
+ self.overWire = None
+ self.overGate = None
+ self.overGateObj = None
+ self.overGateReject = False
+ self.overGateSize = 32
+ self.overGateSizeDIV2 = self.overGateSize//2
+ self.overLineWidth = self.lineWidth*2
+ self.overLineWidthMUL2 = self.overLineWidth*2
+
+ self.gatePoint = SynthLabConstants.GATE_POINT
+ self.gateMap = SynthLabConstants.GATE_MAP
+ # look up gate type to find the matching gate type
+ self.gateMatch = [ SynthLabConstants.GT_CONTROL_INPUT,
+ SynthLabConstants.GT_CONTROL_OUTPUT,
+ SynthLabConstants.GT_SOUND_INPUT,
+ SynthLabConstants.GT_SOUND_OUTPUT ]
+
+ # set up window
+ if as_window:
+ self.set_position( gtk.WIN_POS_CENTER_ON_PARENT )
+ self.set_title("Synth Lab")
+ self.mainBox = gtk.HBox()
+ self.subBox = gtk.HBox()
+ self.drawingBox = RoundVBox( 10, Config.PANEL_COLOR, Config.PANEL_COLOR )
+ self.drawingBox.set_border_width(0)
+ self.infoBox = RoundVBox( 10, Config.TOOLBAR_BCK_COLOR, Config.TOOLBAR_BCK_COLOR )
+ self.infoBox.set_border_width(Config.PANEL_SPACING)
+ self.infoBox.set_size_request(300, 750)
+ self.subBox.pack_start(self.drawingBox, True, True)
+ self.subBox.pack_start(self.infoBox, True, True)
+ self.mainBox.pack_start(self.subBox)
+
+ menuBox = gtk.HBox()
+ self.objComboBox = BigComboBox()
+ self.objComboBox.append_item(0, 'Envelope', Config.TAM_TAM_ROOT + '/icons/sl-adsr-menu.svg')
+ self.objComboBox.set_active(0)
+ self.objComboBox.connect('changed', self.changeObject)
+ comboMenu = ToolComboBox(self.objComboBox)
+ menuBox.pack_start(comboMenu)
+ self.infoBox.pack_start(menuBox, False, False, 5)
+
+ slidersBox = gtk.HBox()
+
+ self.instanceID = 12 # object number
+ self.objectType = self.instanceID / 4 #(control, source, fx, output)
+ self.choosenType = 0 # self.synthObjectsParameters.types[self.instanceID] module as an index
+ selectedType = SynthLabConstants.CHOOSE_TYPE[self.objectType][self.choosenType] #module as a string
+
+ slider1Min = SynthLabConstants.TYPES[selectedType][4]
+ slider1Max = SynthLabConstants.TYPES[selectedType][5]
+ slider2Min = SynthLabConstants.TYPES[selectedType][6]
+ slider2Max = SynthLabConstants.TYPES[selectedType][7]
+ slider3Min = SynthLabConstants.TYPES[selectedType][8]
+ slider3Max = SynthLabConstants.TYPES[selectedType][9]
+ slider4Min = SynthLabConstants.TYPES[selectedType][10]
+ slider4Max = SynthLabConstants.TYPES[selectedType][11]
+
+ slider1Step = SynthLabConstants.TYPES[selectedType][12][0]
+ slider1Snap = SynthLabConstants.TYPES[selectedType][12][1]
+ slider2Step = SynthLabConstants.TYPES[selectedType][13][0]
+ slider2Snap = SynthLabConstants.TYPES[selectedType][13][1]
+ slider3Step = SynthLabConstants.TYPES[selectedType][14][0]
+ slider3Snap = SynthLabConstants.TYPES[selectedType][14][1]
+
+ parametersTable = self.synthObjectsParameters.choiceParamsSet[self.objectType]
+ tablePos = (self.instanceID % 4)*4
+ slider1Init = parametersTable[tablePos]
+ slider2Init = parametersTable[tablePos+1]
+ slider3Init = parametersTable[tablePos+2]
+ slider4Init = parametersTable[tablePos+3]
+
+ sliderTextColor = gtk.gdk.color_parse(Config.WHITE_COLOR)
+ sliderHeight = 240
+
+ self.p1Adjust = gtk.Adjustment(slider1Init, slider1Min, slider1Max, slider1Step, slider1Step, 0)
+ self.p1Adjust.connect("value-changed", self.sendTables, 1)
+ self.slider1 = gtk.VScale(self.p1Adjust)
+ self.slider1.connect("button-release-event", self.handleSliderRelease)
+ self.slider1.connect("enter-notify-event", self.handleSliderEnter, 1)
+ self.slider1.set_digits(slider1Snap)
+ self.slider1.set_inverted(True)
+ self.slider1.set_size_request(55, sliderHeight)
+ self.slider1.modify_fg(gtk.STATE_NORMAL, sliderTextColor)
+ slidersBox.pack_start(self.slider1, True, False)
+
+ self.p2Adjust = gtk.Adjustment(slider2Init, slider2Min, slider2Max, slider2Step, slider2Step, 0)
+ self.p2Adjust.connect("value-changed", self.sendTables, 2)
+ self.slider2 = gtk.VScale(self.p2Adjust)
+ self.slider2.connect("button-release-event", self.handleSliderRelease)
+ self.slider2.connect("enter-notify-event", self.handleSliderEnter, 2)
+ self.slider2.set_digits(slider2Snap)
+ self.slider2.set_inverted(True)
+ self.slider2.set_size_request(55, sliderHeight)
+ self.slider2.modify_fg(gtk.STATE_NORMAL, sliderTextColor)
+ slidersBox.pack_start(self.slider2, True, False)
+
+ self.p3Adjust = gtk.Adjustment(slider3Init, slider3Min, slider3Max, slider3Step, slider3Step, 0)
+ self.p3Adjust.connect("value-changed", self.sendTables, 3)
+ self.slider3 = gtk.VScale(self.p3Adjust)
+ self.slider3.connect("button-release-event", self.handleSliderRelease)
+ self.slider3.connect("enter-notify-event", self.handleSliderEnter, 3)
+ self.slider3.set_digits(slider3Snap)
+ self.slider3.set_inverted(True)
+ self.slider3.set_size_request(55, sliderHeight)
+ self.slider3.modify_fg(gtk.STATE_NORMAL, sliderTextColor)
+ slidersBox.pack_start(self.slider3, True, False)
+
+ self.p4Adjust = gtk.Adjustment(slider4Init, slider4Min, slider4Max, .01, .01, 0)
+ self.p4Adjust.connect("value-changed", self.sendTables, 4)
+ self.slider4 = gtk.VScale(self.p4Adjust)
+ self.slider4.connect("button-release-event", self.handleSliderRelease)
+ self.slider4.connect("enter-notify-event", self.handleSliderEnter, 4)
+ self.slider4.set_digits(2)
+ self.slider4.set_inverted(True)
+ self.slider4.set_size_request(55, sliderHeight)
+ self.slider4.modify_fg(gtk.STATE_NORMAL, sliderTextColor)
+ slidersBox.pack_start(self.slider4, True, False)
+
+ self.infoBox.pack_start(slidersBox, False, False, 5)
+
+ self.infoText = 'ADSR envelope apply on the overall signal'
+ textBox = gtk.HBox()
+ text_color = gtk.gdk.color_parse(Config.WHITE_COLOR)
+ text_bg_color = gtk.gdk.color_parse(Config.TOOLBAR_BCK_COLOR)
+ textScroller = gtk.ScrolledWindow()
+ textScroller.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ textScroller.set_size_request(270, 301)
+ self.textBuf = gtk.TextBuffer(None)
+ self.textBuf.set_text(self.infoText)
+ self.textViewer = gtk.TextView(self.textBuf)
+ self.textViewer.modify_text(gtk.STATE_NORMAL, text_color)
+ self.textViewer.modify_base(gtk.STATE_NORMAL, text_bg_color)
+ self.textViewer.set_border_window_size(gtk.TEXT_WINDOW_LEFT, 1)
+ self.textViewer.set_border_window_size(gtk.TEXT_WINDOW_RIGHT, 1)
+ self.textViewer.set_border_window_size(gtk.TEXT_WINDOW_TOP, 1)
+ self.textViewer.set_border_window_size(gtk.TEXT_WINDOW_BOTTOM, 1)
+ self.textViewer.set_wrap_mode(gtk.WRAP_WORD)
+ self.textViewer.set_editable(False)
+ self.textViewer.set_overwrite(True)
+ self.textViewer.set_cursor_visible(False)
+ self.textViewer.set_left_margin(10)
+ self.textViewer.set_right_margin(10)
+ self.textViewer.set_pixels_above_lines(7)
+ self.textViewer.set_justification(gtk.JUSTIFY_LEFT)
+ textScroller.add(self.textViewer)
+ textBox.pack_start(textScroller, False, False, 10)
+ self.infoBox.pack_start(textBox, False, False, 5)
+
+ self.infoLabel = gtk.Label()
+ self.infoBox.pack_end(self.infoLabel, False, False, 20)
+ textColor = gtk.gdk.color_parse(Config.WHITE_COLOR)
+ self.infoLabel.set_justify(gtk.JUSTIFY_LEFT)
+ self.infoLabel.modify_fg(gtk.STATE_NORMAL, textColor)
+
+ self.drawingAreaWidth = 900
+ self.drawingAreaHeight = 750
+ self.separatorY = 660
+
+ self.clearMask = gtk.gdk.Rectangle(0,0,self.drawingAreaWidth,self.drawingAreaHeight)
+
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ self.gc.set_line_attributes( self.lineWidth, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+
+
+ self.dirtyRectToAdd = gtk.gdk.Rectangle()
+ self.dirty = False
+
+ self.screenBuf = gtk.gdk.Pixmap( win, self.drawingAreaWidth, self.drawingAreaHeight )
+ self.screenBufDirtyRect = gtk.gdk.Rectangle()
+ self.screenBufDirty = False
+
+ self.drawingArea = gtk.DrawingArea()
+ self.drawingArea.set_size_request( self.drawingAreaWidth, self.drawingAreaHeight )
+ self.col = gtk.gdk.color_parse(Config.PANEL_COLOR)
+ colormap = self.drawingArea.get_colormap()
+ self.bgColor = colormap.alloc_color( Config.PANEL_COLOR, True, True )
+ self.lineColor = colormap.alloc_color( Config.SL_LINE_COLOR, True, True )
+ self.highlightColor = colormap.alloc_color( Config.SL_HIGHLIGHT_COLOR, True, True )
+ self.overWireColor = colormap.alloc_color( Config.SL_OVER_WIRE_COLOR, True, True )
+ self.overGateColor = colormap.alloc_color( Config.SL_OVER_GATE_COLOR, True, True )
+ self.overGateRejectColor = colormap.alloc_color( Config.SL_OVER_GATE_REJECT_COLOR, True, True )
+ self.drawingArea.modify_bg(gtk.STATE_NORMAL, self.col)
+
+ self.loadPixmaps()
+
+ self.drawingArea.add_events( gtk.gdk.BUTTON_PRESS_MASK
+ | gtk.gdk.BUTTON_RELEASE_MASK
+ | gtk.gdk.POINTER_MOTION_MASK
+ | gtk.gdk.POINTER_MOTION_HINT_MASK )
+ self.drawingArea.connect( "button-press-event", self.handleButtonPress )
+ self.drawingArea.connect( "button-release-event", self.handleButtonRelease )
+ self.drawingArea.connect( "motion-notify-event", self.handleMotion )
+ self.drawingArea.connect("expose-event", self.draw)
+ self.drawingBox.pack_start(self.drawingArea, False, False, 0)
+
+ tempFile = 'synthTemp'
+ if tempFile in os.listdir(Config.PREF_DIR):
+ self.handleLoadTemp()
+ else:
+ self.presetCallback(None,1)
+ self.add(self.mainBox)
+ self.show_all()
+
+ def onDestroy(self):
+ pass
+
+ def select(self, i):
+ if i == self.instanceID:
+ return
+ self.new = False
+ if self.instanceID > 0:
+ self.invalidate_rect( self.bounds[self.instanceID][0], self.bounds[self.instanceID][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+ self.instanceID = i
+ self.invalidate_rect( self.bounds[i][0], self.bounds[i][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+
+ if self.instanceID / 4 != self.objectType:
+ self.objectType = self.instanceID / 4
+ self.objComboBox.remove_all()
+ for i in range(len(SynthLabConstants.CHOOSE_TYPE[self.objectType])):
+ self.objComboBox.append_item(i, SynthLabConstants.SYNTHTYPES[self.objectType][i], Config.TAM_TAM_ROOT + '/icons/sl-' + SynthLabConstants.CHOOSE_TYPE[self.objectType][i] + '-menu.svg')
+
+ oldChoosen = self.choosenType
+ if self.instanceID != 12:
+ self.choosenType = self.synthObjectsParameters.types[self.instanceID]
+ else:
+ self.choosenType = 0
+
+ self.objComboBox.set_active(self.choosenType)
+ #Not sure about this
+ self.slider1.grab_focus()
+ self.sendTables(self.slider1, 1)
+
+ def changeObject(self, widget):
+ self.choosenType = widget.props.value
+ self.resize()
+ if self.instanceID != 12:
+ self.synthObjectsParameters.setType(self.instanceID, self.choosenType)
+ self.invalidate_rect( self.bounds[self.instanceID][0], self.bounds[self.instanceID][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+ if self.new:
+ self.writeTables( self.synthObjectsParameters.types,
+ self.synthObjectsParameters.controlsParameters,
+ self.synthObjectsParameters.sourcesParameters,
+ self.synthObjectsParameters.fxsParameters )
+
+ def updateViewer(self):
+ selectedType = SynthLabConstants.CHOOSE_TYPE[self.objectType][self.choosenType]
+ infoType = SynthLabConstants.SYNTHPARA[selectedType][4]
+ infoPara = SynthLabConstants.SYNTHPARA[selectedType][4+self.curSlider]
+ #infoPara = "Parameter's info not yet set"
+ self.infoText = infoType + '\n\n' + SynthLabConstants.SYNTHPARA[selectedType][self.curSlider-1] + ': ' + infoPara
+ self.textBuf.set_text(self.infoText)
+
+ def recallSliderValue( self, num ):
+ if num == 1:
+ if SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.NOISE:
+ return SynthLabConstants.NOISE_TYPES[int(self.slider1Val)]
+ else:
+ return '%.2f' % self.slider1Val
+ if num == 2:
+ if SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.VCO:
+ return SynthLabConstants.VCO_WAVEFORMS[int(self.slider2Val)]
+ elif SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.SAMPLE or SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.GRAIN:
+ return self.sample_names[int(self.slider2Val)]
+ elif SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.VOICE:
+ return SynthLabConstants.VOWEL_TYPES[int(self.slider2Val)]
+ else:
+ return '%.2f' % self.slider2Val
+ if num == 3:
+ if SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.LFO:
+ return SynthLabConstants.LFO_WAVEFORMS[int(self.slider3Val)]
+ elif SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.TRACKPADX:
+ return SynthLabConstants.SCALING_TYPES[int(self.slider3Val)]
+ elif SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.TRACKPADY:
+ return SynthLabConstants.SCALING_TYPES[int(self.slider3Val)]
+ elif SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.FILTER:
+ return SynthLabConstants.FILTER_TYPES[int(self.slider3Val)]
+ elif SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] == SynthLabConstants.RINGMOD:
+ return SynthLabConstants.LFO_WAVEFORMS[int(self.slider3Val)]
+ else:
+ return '%.2f' % self.slider3Val
+ if num == 4: return '%.2f' % self.slider4Val
+
+ def resize( self ):
+ selectedType = SynthLabConstants.CHOOSE_TYPE[self.objectType][self.choosenType]
+ if self.new:
+ slider1Init = SynthLabConstants.TYPES[selectedType][0]
+ slider2Init = SynthLabConstants.TYPES[selectedType][1]
+ slider3Init = SynthLabConstants.TYPES[selectedType][2]
+ slider4Init = SynthLabConstants.TYPES[selectedType][3]
+ else:
+ parametersTable = self.synthObjectsParameters.choiceParamsSet[self.objectType]
+ tablePos = (self.instanceID % 4)*4
+ slider1Init = parametersTable[tablePos]
+ slider2Init = parametersTable[tablePos+1]
+ slider3Init = parametersTable[tablePos+2]
+ slider4Init = parametersTable[tablePos+3]
+
+ slider1Min = SynthLabConstants.TYPES[selectedType][4]
+ slider1Max = SynthLabConstants.TYPES[selectedType][5]
+ slider2Min = SynthLabConstants.TYPES[selectedType][6]
+ slider2Max = SynthLabConstants.TYPES[selectedType][7]
+ slider3Min = SynthLabConstants.TYPES[selectedType][8]
+ slider3Max = SynthLabConstants.TYPES[selectedType][9]
+ slider4Min = SynthLabConstants.TYPES[selectedType][10]
+ slider4Max = SynthLabConstants.TYPES[selectedType][11]
+
+ slider1Step = SynthLabConstants.TYPES[selectedType][12][0]
+ slider1Snap = SynthLabConstants.TYPES[selectedType][12][1]
+ slider2Step = SynthLabConstants.TYPES[selectedType][13][0]
+ slider2Snap = SynthLabConstants.TYPES[selectedType][13][1]
+ slider3Step = SynthLabConstants.TYPES[selectedType][14][0]
+ slider3Snap = SynthLabConstants.TYPES[selectedType][14][1]
+
+ self.p1Adjust.set_all(slider1Init, slider1Min, slider1Max, slider1Step, slider1Step, 0)
+ self.p2Adjust.set_all(slider2Init, slider2Min, slider2Max, slider2Step, slider2Step, 0)
+ self.p3Adjust.set_all(slider3Init, slider3Min, slider3Max, slider3Step, slider3Step, 0)
+ self.p4Adjust.set_all(slider4Init, slider4Min, slider4Max, 0.01, 0.01, 0)
+
+ self.slider1.set_digits(slider1Snap)
+ self.slider2.set_digits(slider2Snap)
+ self.slider3.set_digits(slider3Snap)
+
+ self.new = True
+
+ def sendTables( self, widget, data ):
+ self.curSlider = data
+ self.slider1Val = self.p1Adjust.value
+ self.slider2Val = self.p2Adjust.value
+ self.slider3Val = self.p3Adjust.value
+ self.slider4Val = self.p4Adjust.value
+ if self.instanceID != 12:
+ self.synthObjectsParameters.setType(self.instanceID, self.choosenType)
+ sliderListValue = [ self.p1Adjust.value, self.p2Adjust.value, self.p3Adjust.value, self.p4Adjust.value ]
+ if self.objectType == 0:
+ for i in range(4):
+ self.synthObjectsParameters.setControlParameter((self.instanceID % 4)*4+i, sliderListValue[i])
+ elif self.objectType == 1:
+ for i in range(4):
+ self.synthObjectsParameters.setSourceParameter((self.instanceID % 4)*4+i, sliderListValue[i])
+ elif self.objectType == 2:
+ for i in range(4):
+ self.synthObjectsParameters.setFxParameter((self.instanceID % 4)*4+i, sliderListValue[i])
+ elif self.objectType == 3:
+ for i in range(4):
+ self.synthObjectsParameters.setOutputParameter(i, sliderListValue[i])
+ self.updateViewer()
+ selectedType = SynthLabConstants.CHOOSE_TYPE[self.objectType][self.choosenType]
+ _str = SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] + '\n' + SynthLabConstants.SYNTHPARA[selectedType][self.curSlider-1] + ': ' + self.recallSliderValue(self.curSlider)
+ self.parameterUpdate(_str)
+
+ def handleSliderRelease(self, widget, data=None):
+ if self.instanceID != 12:
+ self.writeTables( self.synthObjectsParameters.types, self.synthObjectsParameters.controlsParameters,
+ self.synthObjectsParameters.sourcesParameters, self.synthObjectsParameters.fxsParameters )
+
+ def handleSliderEnter(self, widget, data, slider):
+ widget.grab_focus()
+ self.sendTables(widget, slider)
+
+ #selectedType = SynthLabConstants.CHOOSE_TYPE[self.objectType][self.choosenType]
+ #_str = SynthLabConstants.SYNTHTYPES[self.objectType][self.choosenType] + '\n' + SynthLabConstants.SYNTHPARA[selectedType][self.curSlider-1] + ': ' + self.recallSliderValue(self.curSlider)
+ #self.parameterUpdate(_str)
+
+ def onKeyPress(self,widget,event):
+ key = event.hardware_keycode
+ if key not in Config.KEY_MAP:
+ return
+ midiPitch = Config.KEY_MAP[key]
+ if midiPitch not in self.playingPitch:
+ if self.recordWait == 0:
+ self.playingPitch.append( midiPitch )
+ self.playNote( midiPitch, 0 )
+ else:
+ self.recordWait = 0
+ self.playingPitch.append( midiPitch )
+ self.playNote( midiPitch, self.table )
+ self.waitRecording()
+
+ def resetRecord( self ):
+ gobject.source_remove( self.wait )
+ self.recordButton.set_active(False)
+ inst = 'lab' + str(self.table-85)
+ self.csnd.load_synth_instrument(inst)
+ self.table = 0
+ return True
+
+ def waitRecording(self):
+ self.wait = gobject.timeout_add(int(self.duration*1000) , self.resetRecord )
+
+ def onKeyRelease( self, widget, event ):
+ key = event.hardware_keycode
+ if key not in Config.KEY_MAP:
+ return
+ midiPitch = Config.KEY_MAP[key]
+ if midiPitch in self.playingPitch:
+ self.playingPitch.remove( midiPitch )
+
+ def handleDuration( self, adjustment ):
+ self.duration = adjustment.value
+
+ def parameterUpdate( self, string ):
+ self.infoLabel.set_text(string)
+
+ def playNote( self, midiPitch, table ):
+ cpsPitch = 261.626*pow(1.0594633, midiPitch-36)
+ self.recCount += 1
+ mess = "i5203." + str(self.recCount) + " 0 " + str(self.duration) + " " + str(cpsPitch) + " " + str(table) + " " + " " .join([str(n) for n in self.synthObjectsParameters.getOutputParameters()])
+ self.csnd.inputMessage( mess )
+ if self.recCount >= 9: self.recCount = 0
+
+ def handleClose( self, widget, data ):
+ if self.journalCalled:
+ self.activity.close()
+ return
+ self.set_mode('welcome')
+ if as_window:
+ self.set_keep_above(False)
+ self.hide()
+
+ def resetLocations( self ):
+ # deep copy the list
+ self.locations = [ loc[:] for loc in SynthLabConstants.INIT_LOCATIONS ]
+
+ def handleReset( self, widget, data = None):
+ self.resetLocations()
+ self.objectCount = len(self.locations)
+ for i in range(self.objectCount):
+ self.updateBounds( i )
+ self.duration = 2
+ self._mainToolbar.durationSliderAdj.set_value(self.duration)
+ self.connections = []
+ self.synthObjectsParameters.__init__()
+ self.writeTables( self.synthObjectsParameters.types, self.synthObjectsParameters.controlsParameters, self.synthObjectsParameters.sourcesParameters, self.synthObjectsParameters.fxsParameters )
+ self.synthObjectsParameters.update()
+ self.initializeConnections()
+ self.invalidate_rect( 0, 0, self.drawingAreaWidth, self.drawingAreaHeight )
+ time.sleep(.01)
+ self.controlToSrcConnections()
+ time.sleep(.01)
+ self.controlToFxConnections()
+ time.sleep(.01)
+ self.audioConnections()
+ time.sleep(.01)
+
+ def setAction( self, action ):
+ self.action = action
+
+ def doneAction( self ):
+ if self.action == "drag-object": self.doneDragObject()
+ self.action = None
+
+ def handleButtonRelease( self, widget, event ):
+
+ self.highlightWire( None )
+ self.highlightGate( None )
+
+ if self.action == "drag-object":
+ self.doneAction()
+ elif self.action == "draw-wire":
+ for i in range(self.objectCount):
+ if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
+ if i == self.wireObj:
+ break
+ gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
+ if gate:
+ self.connectWire( i, gate )
+ break
+ # if we don't connect the wire here they can try to click it somewhere, so don't end the action
+
+ def handleButtonPress( self, widget, event):
+ self.clickLoc = (int(event.x),int(event.y))
+
+ self.highlightWire( None )
+ self.highlightGate( None )
+
+ if event.button == 1:
+ for i in range(self.objectCount-1,-1,-1):
+ if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
+ if self.locations[i][1] == SynthLabConstants.INIT_LOCATIONS[i][1] \
+ and i != self.objectCount-1:
+ gate = False
+ else:
+ gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
+ if gate:
+ if self.action == "draw-wire":
+ self.connectWire( i, gate )
+ else:
+ self.startWire( i, gate )
+ else:
+ if self.action == "draw-wire":
+ self.doneWire()
+ if i != self.objectCount-1:
+ self.startDragObject( i )
+ else:
+ self.select( i )
+ return
+ if self.action == "draw-wire": # didn't hit anything
+ self.doneWire()
+ else:
+ # check if we clicked a wire
+ i = self.wireUnderLoc( event.x, event.y )
+ if i >= 0: self.deleteWire( i )
+
+
+ def handleMotion( self, widget, event ):
+
+ if event.is_hint:
+ x, y, state = widget.window.get_pointer()
+ event.x = float(x)
+ event.y = float(y)
+ event.state = state
+
+ if self.action == "drag-object":
+ self.updateDragObject( int(event.x), int(event.y) )
+ elif self.action == "draw-wire":
+ self.updateWire( int(event.x), int(event.y) )
+ for i in range(self.objectCount):
+ if self.locations[i] == SynthLabConstants.INIT_LOCATIONS[i] \
+ and i != self.objectCount-1: continue
+ if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
+ gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
+ if gate and ( gate != self.wireGate or i != self.wireObj ):
+ if gate[0] == SynthLabConstants.GT_CONTROL_OUTPUT or gate[0] == SynthLabConstants.GT_SOUND_OUTPUT:
+ ok = self.testConnection( i, gate, self.wireObj, self.wireGate )
+ else:
+ ok = self.testConnection( self.wireObj, self.wireGate, i, gate )
+ self.highlightGate( i, gate, not ok )
+ else: self.highlightGate( None )
+ return
+ self.highlightGate( None )
+ else: # check for mouse overs
+ for i in range(self.objectCount):
+ if self.locations[i] == SynthLabConstants.INIT_LOCATIONS[i] \
+ and i != self.objectCount-1: continue
+
+ if self.bounds[i][0] < event.x < self.bounds[i][2] and self.bounds[i][1] < event.y < self.bounds[i][3]:
+ gate = self.testGates( i, event.x-self.locations[i][0], event.y-self.locations[i][1] )
+ if gate:
+ self.highlightGate( i, gate )
+ else:
+ self.highlightGate( None )
+ self.highlightWire( None )
+ return
+ # didn't find a gate
+ self.highlightGate( None )
+ # check for wires
+ i = self.wireUnderLoc( event.x, event.y )
+ if i >= 0: self.highlightWire( i )
+ else: self.highlightWire( None )
+
+ def testGates( self, i, x, y ):
+ oT = i >> 2
+ for gT in range(len(self.gateMap[oT])):
+ for n in range(len(self.gateMap[oT][gT])):
+ if self.gateMap[oT][gT][n][0] <= x <= self.gateMap[oT][gT][n][2] \
+ and self.gateMap[oT][gT][n][1] <= y <= self.gateMap[oT][gT][n][3]:
+ return ( gT, n, self.gateMap[oT][gT][n][4], self.gatePoint[oT][gT][n] ) # type, index, wire loc, center loc
+ return False
+
+ def startWire( self, obj, gate ):
+ self.wireObj = obj
+ self.wireGate = gate
+ x = gate[2][0] + self.locations[obj][0]
+ y = gate[2][1] + self.locations[obj][1]
+ self.wirePoint = [ [ x, y ], [ x, y ] ]
+ self.wireRect = [ 0, 0, 0, 0 ]
+ self.setAction( "draw-wire" )
+
+ def updateWire( self, x, y ):
+ if x < 0: x = 0
+ elif x > self.drawingAreaWidth: x = self.drawingAreaWidth
+ if y < 0: y = 0
+ elif y > self.separatorY: y = self.separatorY
+ self.invalidate_rect( self.wireRect[0], self.wireRect[1], self.wireRect[2], self.wireRect[3], False )
+ if x < self.wirePoint[0][0]: self.wireRect[0], self.wireRect[2] = x-self.lineWidth, self.wirePoint[0][0]-x+self.lineWidthMUL2
+ else: self.wireRect[0], self.wireRect[2] = self.wirePoint[0][0]-self.lineWidth, x-self.wirePoint[0][0]+self.lineWidthMUL2
+ if y < self.wirePoint[0][1]: self.wireRect[1], self.wireRect[3] = y-self.lineWidth, self.wirePoint[0][1]-y+self.lineWidthMUL2
+ else: self.wireRect[1], self.wireRect[3] = self.wirePoint[0][1]-self.lineWidth, y-self.wirePoint[0][1]+self.lineWidthMUL2
+ self.wirePoint[1][0] = x
+ self.wirePoint[1][1] = y
+ self.invalidate_rect( self.wireRect[0], self.wireRect[1], self.wireRect[2], self.wireRect[3], False )
+
+ def connectWire( self, obj, gate ):
+ if gate[0] == SynthLabConstants.GT_CONTROL_OUTPUT or gate[0] == SynthLabConstants.GT_SOUND_OUTPUT:
+ bObj, eObj = obj, self.wireObj
+ bGate, eGate = gate, self.wireGate
+ else:
+ bObj, eObj = self.wireObj, obj
+ bGate, eGate = self.wireGate, gate
+
+ i = self.newConnection( bObj, bGate, eObj, eGate )
+ if i >= 0: # successful connection
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3] )
+ self.doneWire()
+
+ def deleteWire( self, i ):
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3] )
+ self.delConnection( i )
+
+ def doneWire( self ):
+ self.invalidate_rect( self.wireRect[0], self.wireRect[1], self.wireRect[2], self.wireRect[3] )
+ self.doneAction()
+
+ def wireUnderLoc( self, x, y ):
+ for i in range(len(self.connections)):
+ if x < self.cBounds[i][0] or x > self.cBounds[i][4]: continue
+ if y < self.cBounds[i][1] or y > self.cBounds[i][5]: continue
+ if self.cPoints[i][0] == self.cPoints[i][2]: # vertical line
+ if abs(x-self.cPoints[i][0]) < self.lineWidthMUL4:
+ return i
+ else:
+ slope = (self.cPoints[i][3]-self.cPoints[i][1])/float(self.cPoints[i][2]-self.cPoints[i][0])
+ if abs(slope) < 1:
+ yy = self.cPoints[i][1] + (x-self.cPoints[i][0])*slope
+ if abs(y-yy) < self.lineWidthMUL4:
+ return i
+ else:
+ xx = self.cPoints[i][0] + (y-self.cPoints[i][1])/slope
+ if abs(x-xx) < self.lineWidthMUL4:
+ return i
+ return -1 # nothing found
+
+ # pass in i = None to clear
+ def highlightWire( self, i ):
+ if self.overWire != i:
+ if self.overWire != None:
+ self.invalidate_rect( self.cBounds[self.overWire][0], self.cBounds[self.overWire][1], self.cBounds[self.overWire][2], self.cBounds[self.overWire][3] )
+ self.overWire = i
+ if self.overWire != None:
+ self.invalidate_rect( self.cBounds[self.overWire][0], self.cBounds[self.overWire][1], self.cBounds[self.overWire][2], self.cBounds[self.overWire][3] )
+
+ # pass in obj = None to clear
+ def highlightGate( self, obj, gate = None, reject = False ):
+ if obj == None:
+ self.parameterUpdate('')
+ if self.overGateObj != obj or self.overGate != gate or self.overGateReject != reject:
+ if self.overGate != None:
+ self.invalidate_rect( self.overGateLoc[0], self.overGateLoc[1], self.overGateSize, self.overGateSize )
+ self.overGateObj = obj
+ self.overGate = gate
+ self.overGateReject = reject
+ if self.overGate != None:
+ oT = self.overGateObj//4
+ x = self.locations[self.overGateObj][0] + self.overGate[3][0] - self.overGateSizeDIV2
+ y = self.locations[self.overGateObj][1] + self.overGate[3][1] - self.overGateSizeDIV2
+ self.overGateLoc = ( x, y )
+ self.invalidate_rect( self.overGateLoc[0], self.overGateLoc[1], self.overGateSize, self.overGateSize )
+ if True: #obj != 12:
+ if gate[0] == 0:
+ _str = SynthLabConstants.SYNTHTYPES[obj/4][self.typesTable[obj]] + _(': controller output')
+ elif gate[0] == 1:
+ choosen = SynthLabConstants.CHOOSE_TYPE[obj/4][self.typesTable[obj]]
+ parametersTable = self.synthObjectsParameters.choiceParamsSet[obj/4]
+ tablePos = (obj % 4)*4+gate[1]
+ paraVal = '%.2f' % parametersTable[tablePos]
+ _str = SynthLabConstants.SYNTHTYPES[obj/4][self.typesTable[obj]] + '\n' + SynthLabConstants.SYNTHPARA[choosen][gate[1]] + ': ' + paraVal
+ if self.overGateObj == self.instanceID:
+ gateNum = self.overGate[1]+1
+ exec 'self.slider%s.grab_focus()' % str(gateNum)
+ exec 'self.sendTables(self.slider%s, %d)' % (str(gateNum), gateNum)
+ elif gate[0] == 2:
+ _str = SynthLabConstants.SYNTHTYPES[obj/4][self.typesTable[obj]] + _(': sound output')
+ elif gate[0] == 3:
+ if obj != 12:
+ _str = SynthLabConstants.SYNTHTYPES[obj/4][self.typesTable[obj]] + _(': sound input')
+ else:
+ _str = _('Send sound to the speakers')
+ self.parameterUpdate( _str )
+
+ def startDragObject( self, i ):
+ self.dragObject = i
+ self.dragInitialLoc = (self.locations[i][0],self.locations[i][1])
+ self.potentialDisconnect = False
+ self.invalidate_rect( self.bounds[i][0], self.bounds[i][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+ for i in self.outputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3] )
+ for i in self.inputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3] )
+ self.setAction( "drag-object" )
+
+ def updateDragObject( self, x, y ):
+ delta = [ x-self.clickLoc[0], y-self.clickLoc[1] ]
+ x = self.dragInitialLoc[0]+delta[0]
+ if x-SynthLabConstants.HALF_SIZE < 0: x = SynthLabConstants.HALF_SIZE
+ elif x+SynthLabConstants.HALF_SIZE > self.drawingAreaWidth: x = self.drawingAreaWidth - SynthLabConstants.HALF_SIZE
+ y = self.dragInitialLoc[1]+delta[1]
+ if y-SynthLabConstants.HALF_SIZE < 0: y = SynthLabConstants.HALF_SIZE
+ elif y+SynthLabConstants.HALF_SIZE > self.drawingAreaHeight: y = self.drawingAreaHeight - SynthLabConstants.HALF_SIZE
+
+ self.invalidate_rect(self.bounds[self.dragObject][0], self.bounds[self.dragObject][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT, False )
+ if not self.potentialDisconnect:
+ for i in self.outputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3], False )
+ for i in self.inputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3], False )
+
+ if y > (self.separatorY-5): self.potentialDisconnect = True
+ else: self.potentialDisconnect = False
+
+ self.locations[self.dragObject][0] = int( x )
+ self.locations[self.dragObject][1] = int( y )
+ self.updateBounds(self.dragObject)
+
+ self.invalidate_rect(self.bounds[self.dragObject][0], self.bounds[self.dragObject][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT, False )
+ if not self.potentialDisconnect:
+ for i in self.outputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3], False )
+ for i in self.inputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3], False )
+
+ def doneDragObject( self ):
+ if self.potentialDisconnect:
+ self.invalidate_rect( self.bounds[self.dragObject][0], self.bounds[self.dragObject][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT, False )
+ m = self.outputMap[self.dragObject][:]
+ m.sort(reverse=True)
+ for i in m: self.delConnection( i )
+ m = self.inputMap[self.dragObject][:]
+ m.sort(reverse=True)
+ for i in m: self.delConnection( i )
+ self.locations[self.dragObject][0] = SynthLabConstants.INIT_LOCATIONS[self.dragObject][0]
+ self.locations[self.dragObject][1] = SynthLabConstants.INIT_LOCATIONS[self.dragObject][1]
+ self.updateBounds( self.dragObject )
+ #self.invalidate_rect(self.bounds[self.dragObject][0], self.bounds[self.dragObject][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+ else:
+ #self.invalidate_rect( self.bounds[self.dragObject][0], self.bounds[self.dragObject][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+ for i in self.outputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3] )
+ for i in self.inputMap[self.dragObject]:
+ self.invalidate_rect( self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3] )
+
+ # NOTE: select function invalidates the rect so no need to do it above
+ self.select( self.dragObject )
+
+ self.dragObject = None
+ self.handleSaveTemp()
+
+ def updateBounds( self, i ):
+ self.bounds[i][0] = self.locations[i][0]-SynthLabConstants.HALF_SIZE
+ self.bounds[i][1] = self.locations[i][1]-SynthLabConstants.HALF_SIZE
+ self.bounds[i][2] = self.locations[i][0]+SynthLabConstants.HALF_SIZE
+ self.bounds[i][3] = self.locations[i][1]+SynthLabConstants.HALF_SIZE
+
+ for c in self.outputMap[i]:
+ self.updateConnection( c )
+ for c in self.inputMap[i]:
+ self.updateConnection( c )
+
+ def updateConnection( self, i ):
+ c = self.connections[i]
+ oT = c[0][0]//4
+ x1 = self.locations[c[0][0]][0] + self.gateMap[oT][c[0][1]][c[0][2]][4][0]
+ y1 = self.locations[c[0][0]][1] + self.gateMap[oT][c[0][1]][c[0][2]][4][1]
+ oT = c[1][0]//4
+ x2 = self.locations[c[1][0]][0] + self.gateMap[oT][c[1][1]][c[1][2]][4][0]
+ y2 = self.locations[c[1][0]][1] + self.gateMap[oT][c[1][1]][c[1][2]][4][1]
+ self.cPoints[i][0], self.cPoints[i][1], self.cPoints[i][2], self.cPoints[i][3] = ( x1, y1, x2, y2 )
+ if x1 > x2: x1, x2 = ( x2, x1 )
+ if y1 > y2: y1, y2 = ( y2, y1 )
+ self.cBounds[i][0], self.cBounds[i][1], self.cBounds[i][2], self.cBounds[i][3], self.cBounds[i][4], self.cBounds[i][5] = ( x1-self.lineWidth, y1-self.lineWidth, x2-x1+self.lineWidthMUL2, y2-y1+self.lineWidthMUL2, x2+self.lineWidth, y2+self.lineWidth )
+
+ def findRecursive( self, obj, target ):
+ if obj == target: return True
+ for c in self.outputMap[obj]:
+ if self.findRecursive( self.straightConnections[c][1], target ):
+ return True
+ return False
+
+ def testConnection( self, bObj, bGate, eObj, eGate ):
+ if self.gateMatch[bGate[0]] != eGate[0]:
+ return False # type mismatch
+
+ for c in self.inputMap[eObj]:
+ if self.connections[c][1][1] == eGate[0] \
+ and self.connections[c][1][2] == eGate[1] : # same type and port
+ if self.connections[c][0][0] == bObj:
+ return False # connections already exists
+
+ if self.findRecursive( eObj, bObj ):
+ return False # loop
+
+ return True
+
+ def newConnection( self, bObj, bGate, eObj, eGate ):
+ if not self.testConnection( bObj, bGate, eObj, eGate ):
+ return -1 # connection failed
+
+ ind = len(self.connections)
+ # connection format: [ ( outputObject, gate type, gate num ), ( inputObject, gate type, gate num ) ]
+ self.connections.append ( [ ( bObj, bGate[0], bGate[1] ),
+ ( eObj, eGate[0], eGate[1] ) ] )
+ self.straightConnections.append( ( bObj, eObj ) )
+ self.outputMap[bObj].append(ind)
+ self.inputMap[eObj].append(ind)
+ self.outputs.append( bObj )
+ self.cPoints.append( [ 0, 0, 0, 0 ] )
+ self.cBounds.append( [ 0, 0, 0, 0, 0, 0 ] )
+ self.updateConnection( ind )
+
+ self.updateSound()
+
+ self.handleSaveTemp()
+
+ return ind
+
+ def delConnection( self, i ):
+ b = self.straightConnections[i][0]
+ e = self.straightConnections[i][1]
+ self.straightConnections.pop(i)
+ self.outputMap[b].remove(i)
+ self.inputMap[e].remove(i)
+ self.outputs.pop(i)
+ self.cPoints.pop(i)
+ self.cBounds.pop(i)
+ self.connections.pop(i)
+ for o in range(self.objectCount):
+ for m in range(len(self.outputMap[o])):
+ if self.outputMap[o][m] > i: self.outputMap[o][m] -= 1
+ for m in range(len(self.inputMap[o])):
+ if self.inputMap[o][m] > i: self.inputMap[o][m] -= 1
+
+ self.updateSound()
+
+ self.handleSaveTemp()
+
+ def initializeConnections( self ):
+ self.straightConnections = []
+ self.outputMap = [ [] for i in self.locations ]
+ self.inputMap = [ [] for i in self.locations ]
+ self.outputs = []
+ self.cPoints = []
+ self.cBounds = []
+ for i in range(len(self.connections)):
+ c = self.connections[i]
+ first = c[0][0]
+ second = c[1][0]
+ self.straightConnections.append([first, second])
+ self.outputMap[first].append(i)
+ self.inputMap[second].append(i)
+ self.outputs.append(first)
+ self.cPoints.append( [ 0, 0, 0, 0 ] )
+ self.cBounds.append( [ 0, 0, 0, 0, 0, 0 ] )
+ self.updateConnection( i )
+
+ self.updateSound()
+
+ def predraw( self, buf ):
+ startX = self.screenBufDirtyRect.x
+ startY = self.screenBufDirtyRect.y
+ stopX = self.screenBufDirtyRect.x + self.screenBufDirtyRect.width
+ stopY = self.screenBufDirtyRect.y + self.screenBufDirtyRect.height
+
+ # draw bg
+ self.gc.foreground = self.bgColor
+ buf.draw_rectangle( self.gc, True, startX, startY, self.screenBufDirtyRect.width, self.screenBufDirtyRect.height )
+
+ # draw separator
+ self.gc.foreground = self.lineColor
+ buf.draw_line( self.gc, startX, 1, stopX, 1 )
+ buf.draw_line( self.gc, startX, self.separatorY, stopX, self.separatorY )
+
+ # draw objects
+ types = self.synthObjectsParameters.getTypes() + [0] # speaker
+ self.gc.set_clip_mask( self.clipMask )
+ for i in range(self.objectCount):
+ if i == self.dragObject or i == self.instanceID:
+ continue
+ if startX > self.bounds[i][2] or stopX < self.bounds[i][0] or startY > self.bounds[i][3] or stopY < self.bounds[i][1]:
+ continue
+ type = i >> 2
+ self.gc.set_clip_origin( self.bounds[i][0]-SynthLabConstants.PIC_SIZE*type, self.bounds[i][1] )
+ buf.draw_drawable( self.gc, self.pixmap[type][types[i]], 0, 0, self.bounds[i][0], self.bounds[i][1], SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE )
+
+ if self.dragObject != self.instanceID:
+ i = self.instanceID
+ type = i >> 2
+ #draw object
+ self.gc.set_clip_origin( self.bounds[i][0]-SynthLabConstants.PIC_SIZE*type, self.bounds[i][1] )
+ buf.draw_drawable( self.gc, self.pixmap[type][types[i]], 0, 0, self.bounds[i][0], self.bounds[i][1], SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE )
+ # draw selectionHighlight
+ self.gc.set_clip_origin( self.bounds[i][0]-SynthLabConstants.PIC_SIZE*type, self.bounds[i][1]-82 )
+ self.gc.foreground = self.highlightColor
+ buf.draw_rectangle( self.gc, True, self.bounds[i][0], self.bounds[i][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+ self.gc.foreground = self.lineColor
+
+ self.gc.set_clip_rectangle( self.clearMask )
+
+ # draw wires
+ for c in range(len(self.connections)):
+ if self.straightConnections[c][0] == self.dragObject or self.straightConnections[c][1] == self.dragObject:
+ continue
+ if startX > self.cBounds[c][4] or stopX < self.cBounds[c][0] or startY > self.cBounds[c][5] or stopY < self.cBounds[c][1]:
+ continue
+ buf.draw_line( self.gc, self.cPoints[c][0], self.cPoints[c][1],
+ self.cPoints[c][2], self.cPoints[c][3] )
+
+ self.screenBufDirty = False
+
+ def draw( self, widget, event ):
+ #TP.ProfileBegin("SL::draw")
+ startX = event.area.x
+ startY = event.area.y
+ stopX = event.area.x + event.area.width
+ stopY = event.area.y + event.area.height
+
+ if self.screenBufDirty:
+ self.predraw( self.screenBuf )
+
+ # draw base
+ widget.window.draw_drawable( self.gc, self.screenBuf, startX, startY, startX, startY, event.area.width, event.area.height )
+
+ if self.action == "drag-object":
+ # draw dragObject
+ types = self.synthObjectsParameters.getTypes()
+ self.gc.set_clip_mask( self.clipMask )
+ type = self.dragObject >> 2
+ self.gc.set_clip_origin( self.bounds[self.dragObject][0]-SynthLabConstants.PIC_SIZE*type, self.bounds[self.dragObject][1] )
+ widget.window.draw_drawable( self.gc, self.pixmap[type][types[self.dragObject]], 0, 0, self.bounds[self.dragObject][0], self.bounds[self.dragObject][1], SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE )
+
+ if self.instanceID == self.dragObject:
+ # draw selectionHighlight
+ self.gc.set_clip_origin( self.bounds[self.dragObject][0]-SynthLabConstants.PIC_SIZE*type, self.bounds[self.dragObject][1]-82 )
+ self.gc.foreground = self.highlightColor
+ widget.window.draw_rectangle( self.gc, True, self.bounds[self.dragObject][0], self.bounds[self.dragObject][1]-2, SynthLabConstants.PIC_SIZE, SynthLabConstants.PIC_SIZE_HIGHLIGHT )
+
+ self.gc.set_clip_rectangle( self.clearMask )
+
+ # draw wires
+ if not self.potentialDisconnect:
+ self.gc.foreground = self.lineColor
+ for c in self.outputMap[self.dragObject]:
+ if startX > self.cBounds[c][4] or stopX < self.cBounds[c][0] or startY > self.cBounds[c][5] or stopY < self.cBounds[c][1]:
+ continue
+ widget.window.draw_line( self.gc, self.cPoints[c][0], self.cPoints[c][1],
+ self.cPoints[c][2], self.cPoints[c][3] )
+ for c in self.inputMap[self.dragObject]:
+ if startX > self.cBounds[c][4] or stopX < self.cBounds[c][0] or startY > self.cBounds[c][5] or stopY < self.cBounds[c][1]:
+ continue
+ widget.window.draw_line( self.gc, self.cPoints[c][0], self.cPoints[c][1],
+ self.cPoints[c][2], self.cPoints[c][3] )
+ elif self.action == "draw-wire":
+ # draw the wire
+ self.gc.foreground = self.lineColor
+ widget.window.draw_line( self.gc, self.wirePoint[0][0], self.wirePoint[0][1],
+ self.wirePoint[1][0], self.wirePoint[1][1] )
+
+ # draw highlights
+ if self.overWire != None:
+ self.gc.foreground = self.overWireColor
+ widget.window.draw_line( self.gc, self.cPoints[self.overWire][0], self.cPoints[self.overWire][1],
+ self.cPoints[self.overWire][2], self.cPoints[self.overWire][3] )
+ elif self.overGate != None:
+ self.gc.set_line_attributes( self.overLineWidth, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+ if self.overGateReject:
+ self.gc.foreground = self.overGateRejectColor
+ widget.window.draw_line( self.gc, self.overGateLoc[0]+self.overLineWidth, self.overGateLoc[1]+self.overLineWidth, self.overGateLoc[0]+self.overGateSize-self.overLineWidth, self.overGateLoc[1]+self.overGateSize-self.overLineWidth )
+ widget.window.draw_line( self.gc, self.overGateLoc[0]+self.overLineWidth, self.overGateLoc[1]+self.overGateSize-self.overLineWidth, self.overGateLoc[0]+self.overGateSize-self.overLineWidth, self.overGateLoc[1]+self.overLineWidth )
+ else:
+ self.gc.foreground = self.overGateColor
+ widget.window.draw_arc( self.gc, False, self.overGateLoc[0]+self.overLineWidth, self.overGateLoc[1]+self.overLineWidth, self.overGateSize-self.overLineWidthMUL2, self.overGateSize-self.overLineWidthMUL2, 0, 23040 )
+ self.gc.set_line_attributes( self.lineWidth, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER )
+
+ #print TP.ProfileEndAndPrint("SL::draw")
+ return True
+
+ def invalidate_rect( self, x, y, w, h, dirtyScreenBuf = True ):
+ self.dirtyRectToAdd.x = x
+ self.dirtyRectToAdd.y = y
+ self.dirtyRectToAdd.width = w
+ self.dirtyRectToAdd.height = h
+
+ if dirtyScreenBuf:
+ if self.screenBufDirty:
+ self.screenBufDirtyRect = self.screenBufDirtyRect.union(self.dirtyRectToAdd)
+ else:
+ self.screenBufDirtyRect.x = x
+ self.screenBufDirtyRect.y = y
+ self.screenBufDirtyRect.width = w
+ self.screenBufDirtyRect.height = h
+ self.screenBufDirty = True
+
+ if self.drawingArea.window != None:
+ self.drawingArea.window.invalidate_rect( self.dirtyRectToAdd, True )
+
+ self.dirty = True
+
+ def writeTables( self, typesTable, controlParametersTable, sourceParametersTable, fxParametersTable ):
+ mess = 'f5200 0 16 -2 ' + " ".join([str(n) for n in controlParametersTable])
+ self.csnd.inputMessage( mess )
+ time.sleep(0.001)
+ mess = "f5201 0 16 -2 " + " " .join([str(n) for n in sourceParametersTable])
+ self.csnd.inputMessage( mess )
+ time.sleep(.001)
+ mess = "f5202 0 16 -2 " + " " .join([str(n) for n in fxParametersTable])
+ self.csnd.inputMessage( mess )
+ time.sleep(.001)
+ self.typesTable = typesTable
+ lastTable = [0]*12
+ for i in range(12):
+ if i in self.outputs:
+ lastTable[i] = (typesTable[i]+1)
+ mess = "f5203 0 16 -2 " + " " .join([str(n) for n in lastTable]) + " 0 0 0 0"
+ self.csnd.inputMessage( mess )
+ time.sleep(.001)
+ if lastTable[4] == 8:
+ snd = Config.SOUNDS_DIR + '/' + self.sample_names[int(sourceParametersTable[1])]
+ mess = "f5501 0 32768 -1 " + "\"%s\" 0 0 0" % snd
+ self.csnd.inputMessage( mess )
+ if lastTable[5] == 8:
+ snd = Config.SOUNDS_DIR + '/' + self.sample_names[int(sourceParametersTable[5])]
+ mess = "f5502 0 32768 -1 " + "\"%s\" 0 0 0" % snd
+ self.csnd.inputMessage( mess )
+ if lastTable[6] == 8:
+ snd = Config.SOUNDS_DIR + '/' + self.sample_names[int(sourceParametersTable[9])]
+ mess = "f5503 0 32768 -1 " + "\"%s\" 0 0 0" % snd
+ self.csnd.inputMessage( mess )
+ if lastTable[7] == 8:
+ snd = Config.SOUNDS_DIR + '/' + self.sample_names[int(sourceParametersTable[13])]
+ mess = "f5504 0 32768 -1 " + "\"%s\" 0 0 0" % snd
+ self.csnd.inputMessage( mess )
+ time.sleep(.005)
+
+ def recordSound( self, widget, data ):
+ if widget.get_active() == True:
+ self.recordButton = widget
+ self.recordWait = 1
+ os.system('rm ' + Config.SNDS_DIR + '/lab' + str(data))
+ self.table = 85 + data
+ else:
+ self.recordWait = 0
+
+ def updateSound( self ):
+ self.controlToSrcConnections()
+ time.sleep(.01)
+ self.controlToFxConnections()
+ time.sleep(.01)
+ self.audioConnections()
+ time.sleep(.01)
+ lastTable = [0]*12
+ for i in range(12):
+ if i in self.outputs:
+ lastTable[i] = (self.synthObjectsParameters.types[i]+1)
+ mess = "f5203 0 16 -2 " + " " .join([str(n) for n in lastTable]) + " 0 0 0 0"
+ self.csnd.inputMessage( mess )
+ time.sleep(.01)
+
+ def updateTables( self ):
+ self.writeTables( self.synthObjectsParameters.types, self.synthObjectsParameters.controlsParameters, self.synthObjectsParameters.sourcesParameters, self.synthObjectsParameters.fxsParameters )
+
+ def controlToSrcConnections( self ):
+ self.contSrcConnections = []
+ for i in self.connections:
+ if i[0][0] < 4 and 3 < i[1][0] < 8:
+ offset = i[1][2]
+ self.contSrcConnections.append([i[0][0], i[1][0], offset])
+ table = [0 for i in range(16)]
+ sources = [source for source in range(4,8) if source in self.outputs]
+ for source in sources:
+ for entre in range(4):
+ value = sum([2**(li[0]+1) for li in self.contSrcConnections if li[1] == source and li[2] == entre], 1)
+ table[(source % 4) * 4 + entre] = value
+ mess = "f5204 0 16 -2 " + " " .join([str(n) for n in table])
+ self.csnd.inputMessage( mess )
+
+ def controlToFxConnections( self ):
+ self.contFxConnections = []
+ for i in self.connections:
+ if i[0][0] < 4 and 7 < i[1][0] < 12:
+ offset = i[1][2]
+ self.contFxConnections.append([i[0][0], i[1][0], offset])
+ table = [0 for i in range(16)]
+ fxs = [fx for fx in range(8,12) if fx in self.outputs]
+ for fx in fxs:
+ for entre in range(4):
+ value = sum([2**(li[0]+1) for li in self.contFxConnections if li[1] == fx and li[2] == entre], 1)
+ table[(fx % 4) * 4 + entre] = value
+ mess = "f5205 0 16 -2 " + " " .join([str(n) for n in table])
+ self.csnd.inputMessage( mess )
+
+ def audioConnections( self ):
+ self.srcFxConnections = [i for i in self.straightConnections if 3 < i[0] < 8 and 7 < i[1] < 12]
+ self.fxConnections = [i for i in self.straightConnections if 7 < i[0] < 12 and 7 < i[1] < 12]
+ self.outConnections = [i[0] for i in self.straightConnections if i[1] == 12]
+
+ table = []
+ for fx in range(8, 12):
+ value = 0
+ for li in self.srcFxConnections:
+ if li[1] == fx:
+ value += pow(2, li[0]-4)
+ table.append(value)
+
+ for fx in range(8, 12):
+ value = 0
+ for li in self.fxConnections:
+ if li[1] == fx:
+ value += pow(2, li[0]-8)
+ table.append(value)
+
+ for sig in range(4, 12):
+ value = 0
+ if sig in self.outConnections:
+ value = 1
+ table.append(value)
+ mess = "f5206 0 16 -2 " + " " .join([str(n) for n in table])
+ self.csnd.inputMessage( mess )
+
+ def loadPixmaps( self ):
+ win = gtk.gdk.get_default_root_window()
+ gc = gtk.gdk.GC( win )
+ gc.foreground = self.bgColor
+ self.pixmap = [ [], [], [], [] ]
+
+ def loadImg( type, img ):
+ pix = gtk.gdk.pixbuf_new_from_file(Config.TAM_TAM_ROOT + '/icons/sl-' + img + '.svg')
+ map = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ map.draw_rectangle( gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ map.draw_pixbuf( gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.pixmap[type].append(map)
+
+ for i in range(len(SynthLabConstants.CONTROL_TYPES_PLUS)):
+ loadImg( 0, SynthLabConstants.CONTROL_TYPES_PLUS[i] )
+ for i in range(len(SynthLabConstants.SOURCE_TYPES_PLUS)):
+ loadImg( 1, SynthLabConstants.SOURCE_TYPES_PLUS[i] )
+ for i in range(len(SynthLabConstants.FX_TYPES_PLUS)):
+ loadImg( 2, SynthLabConstants.FX_TYPES_PLUS[i] )
+ loadImg( 3, "speaker" )
+
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT+'synthlabMask.png')
+ pixels = pix.get_pixels()
+ stride = pix.get_rowstride()
+ channels = pix.get_n_channels()
+ bitmap = ""
+ byte = 0
+ shift = 0
+ for j in range(pix.get_height()):
+ offset = stride*j
+ for i in range(pix.get_width()):
+ r = pixels[i*channels+offset]
+ if r != "\0": byte += 1 << shift
+ shift += 1
+ if shift > 7:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ if shift > 0:
+ bitmap += "%c" % byte
+ byte = 0
+ shift = 0
+ self.clipMask = gtk.gdk.bitmap_create_from_data( None, bitmap, pix.get_width(), pix.get_height() )
+
+ def handleSave(self, widget, data):
+ chooser = gtk.FileChooserDialog(title='Save SynthLab Preset',action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
+ filter = gtk.FileFilter()
+ filter.add_pattern('*.syn')
+ chooser.set_filter(filter)
+ chooser.set_current_folder(Config.SYNTH_DIR)
+
+ for f in chooser.list_shortcut_folder_uris():
+ chooser.remove_shortcut_folder_uri(f)
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ ofilename = chooser.get_filename()
+ if ofilename[-4:] != '.syn':
+ ofilename += '.syn'
+ try:
+ print 'INFO: save SynthLab file %s' % chooser.get_filename()
+ f = shelve.open(ofilename, 'n')
+ self.saveState(f)
+ f.close()
+ except IOError:
+ print 'ERROR: failed to save SynthLab to file %s' % chooser.get_filename()
+
+ chooser.destroy()
+
+ def handleJournalSave(self, file_path):
+ f = shelve.open(file_path, 'n')
+ self.saveState(f)
+ f.close()
+
+ def handleLoad(self, widget, data):
+ chooser = gtk.FileChooserDialog(title='Load SynthLab Preset',action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+
+ filter = gtk.FileFilter()
+ filter.add_pattern('*.syn')
+ chooser.set_filter(filter)
+ chooser.set_current_folder(Config.SYNTH_DIR)
+
+ for f in chooser.list_shortcut_folder_uris():
+ chooser.remove_shortcut_folder_uri(f)
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ try:
+ print 'INFO: load SynthLab state from file %s' % chooser.get_filename()
+ f = shelve.open( chooser.get_filename(), 'r')
+ self.loadState(f)
+ f.close()
+ except IOError:
+ print 'ERROR: failed to load SynthLab state from file %s' % chooser.get_filename()
+
+ chooser.destroy()
+
+ def handleJournalLoad(self, file_path):
+ f = shelve.open( file_path, 'r')
+ self.loadState(f)
+ f.close()
+
+ def handleSaveTemp( self ):
+ file = Config.PREF_DIR + '/synthTemp'
+ f = shelve.open(file, 'n')
+ self.saveState(f)
+ f.close()
+
+ def handleLoadTemp( self ):
+ file = Config.PREF_DIR + '/synthTemp'
+ f = shelve.open(file, 'r')
+ self.loadState(f)
+ f.close()
+
+ def saveState( self, state ):
+ state['types'] = self.synthObjectsParameters.types
+ state['controls'] = self.synthObjectsParameters.controlsParameters
+ state['sources'] = self.synthObjectsParameters.sourcesParameters
+ state['fxs'] = self.synthObjectsParameters.fxsParameters
+ state['envelope'] = self.synthObjectsParameters.outputParameters
+ state['locations'] = self.locations
+ state['connections'] = self.connections
+ state['duration'] = self.duration
+
+ def tempVerifyLocations(self):
+ for l in self.locations:
+ l[0] = int(l[0])
+ l[1] = int(l[1])
+
+ def tempVerifyConnectionFormat(self):
+ for c in self.connections:
+ if c[0][1] > 3 or c[0][2] > 3 \
+ or c[1][1] > 3 or c[1][2] > 3:
+ print "old format"
+ print c
+ i = c[0]
+ if i[1] == 0 and i[2] == 40:
+ if i[0] < 4: t,n = 0,0 # control output
+ else: t,n = 2,0 # sound output
+ else:
+ print "unhandled loc"
+ t,n = i[1],i[2]
+ c[0] = ( c[0][0], t, n )
+ i = c[1]
+ if i[1] == 0 and i[2] == -40: t,n = 3,0
+ elif i[1] == 40 and i[2] == -19: t,n = 1,0
+ elif i[1] == -25 and i[2] == -40: t,n = 1,0
+ elif i[1] == -9 and i[2] == -40: t,n = 1,1
+ elif i[1] == 8 and i[2] == -40: t,n = 1,2
+ elif i[1] == 25 and i[2] == -40: t,n = 1,3
+ else:
+ print "unhandled loc"
+ t,n = i[1],i[2]
+ c[1] = ( c[1][0], t, n )
+
+ def loadState( self, state ):
+ self.synthObjectsParameters.types = state['types']
+ self.synthObjectsParameters.controlsParameters = state['controls']
+ self.synthObjectsParameters.sourcesParameters = state['sources']
+ self.synthObjectsParameters.fxsParameters = state['fxs']
+ self.synthObjectsParameters.outputParameters = state['envelope']
+ self.locations = state['locations']
+ #self.tempVerifyLocations()
+ self.objectCount = len(self.locations)
+ for i in range(self.objectCount):
+ self.updateBounds( i )
+ self.connections = state['connections']
+ #self.tempVerifyConnectionFormat()
+ self.duration = state['duration']
+ self._mainToolbar.durationSliderAdj.set_value(self.duration)
+
+ self.initializeConnections()
+ self.controlToSrcConnections()
+ time.sleep(.01)
+ self.controlToFxConnections()
+ time.sleep(.01)
+ self.audioConnections()
+ time.sleep(.01)
+ self.synthObjectsParameters.update()
+ self.writeTables( self.synthObjectsParameters.types, self.synthObjectsParameters.controlsParameters, self.synthObjectsParameters.sourcesParameters, self.synthObjectsParameters.fxsParameters )
+ time.sleep(.01)
+ self.invalidate_rect( 0, 0, self.drawingAreaWidth, self.drawingAreaHeight )
+
+ def presetCallback( self, widget, data ):
+ preset = 'synthFile' + str(data)
+ f = shelve.open( Config.TAM_TAM_ROOT + '/Resources/SynthFiles/' + preset, 'r')
+ self.loadState(f)
+ f.close()
+ self.handleSaveTemp()
+
+ def initRadioButton( self, labelList, methodCallback, box ):
+ for i in range( len( labelList ) ):
+ label = labelList[i]
+ if i == 0:
+ button = ImageRadioButton( group = None, mainImg_path = Config.IMAGE_ROOT + label + '.png', altImg_path = Config.IMAGE_ROOT + label + 'sel.png' )
+ else:
+ button = ImageRadioButton( group = button, mainImg_path = Config.IMAGE_ROOT + label + '.png', altImg_path = Config.IMAGE_ROOT + label + 'sel.png' )
+ button.connect( "toggled", methodCallback, i )
+ box.pack_start( button, True, True )
diff --git a/TamTamSynthLab.activity/SynthLab/SynthObjectsParameters.py b/TamTamSynthLab.activity/SynthLab/SynthObjectsParameters.py
new file mode 100755
index 0000000..7a9b8f3
--- /dev/null
+++ b/TamTamSynthLab.activity/SynthLab/SynthObjectsParameters.py
@@ -0,0 +1,42 @@
+class SynthObjectsParameters:
+
+ def __init__( self ):
+ self.types = [0,0,0,0,0,0,0,0,0,0,0,0]
+ self.controlsParameters = [.5,1,0,0,.5,1,0,0,.5,1,0,0,.5,1,0,0]
+ self.sourcesParameters = [1,.5,5,1,1,.5,5,1,1,.5,5,1,1,.5,5,1]
+ self.fxsParameters = [100,3000,.8,1,100,3000,.8,1,100,3000,.8,1,100,3000,.8,1]
+ self.outputParameters = [.01, .05, .9, .05]
+ self.choiceParamsSet = [self.controlsParameters, self.sourcesParameters, self.fxsParameters, self.outputParameters]
+
+ def update( self ):
+ self.choiceParamsSet = [self.controlsParameters, self.sourcesParameters, self.fxsParameters, self.outputParameters]
+
+ def getTypes( self ):
+ return self.types
+
+ def getControlsParameters( self ):
+ return self.controlsParameters
+
+ def getSourcesParameters( self ):
+ return self.sourcesParameters
+
+ def getFxsParameters( self ):
+ return self.fxsParameters
+
+ def getOutputParameters( self ):
+ return self.outputParameters
+
+ def setType( self, pos, value ):
+ self.types[pos] = value
+
+ def setControlParameter( self, pos, value ):
+ self.controlsParameters[pos] = value
+
+ def setSourceParameter( self, pos, value ):
+ self.sourcesParameters[pos] = value
+
+ def setFxParameter( self, pos, value ):
+ self.fxsParameters[pos] = value
+
+ def setOutputParameter( self, pos, value ):
+ self.outputParameters[pos] = value
diff --git a/TamTamSynthLab.activity/SynthLab/__init__.py b/TamTamSynthLab.activity/SynthLab/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/TamTamSynthLab.activity/SynthLab/__init__.py
diff --git a/TamTamSynthLab.activity/TamTam.py b/TamTamSynthLab.activity/TamTam.py
new file mode 100644
index 0000000..e282df9
--- /dev/null
+++ b/TamTamSynthLab.activity/TamTam.py
@@ -0,0 +1,1229 @@
+import locale
+locale.setlocale(locale.LC_NUMERIC, 'C')
+import signal , time , sys , os, shutil
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import gobject
+import time
+
+import Config
+from Util.CSoundClient import new_csound_client
+from Util.Profiler import TP
+
+from Util.InstrumentPanel import InstrumentPanel
+from miniTamTam.miniTamTamMain import miniTamTamMain
+from Jam.JamMain import JamMain
+from Edit.MainWindow import MainWindow
+from Welcome import Welcome
+from SynthLab.SynthLabWindow import SynthLabWindow
+from Util.Trackpad import Trackpad
+from gettext import gettext as _
+#from Util.KeyboardWindow import KeyboardWindow
+import commands
+
+if __name__ != '__main__':
+ try:
+ from sugar.activity.activity import Activity
+ from sugar.activity import activity
+ FAKE_ACTIVITY = False
+ if Config.DEBUG: print 'using sugar Activity'
+ except ImportError:
+ from FActivity import FakeActivity as Activity
+ FAKE_ACTIVITY = True
+ if Config.DEBUG: print 'using fake activity'
+else:
+ from FActivity import FakeActivity as Activity
+ if Config.DEBUG: print 'using fake activity'
+
+
+class TamTam(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ if self._shared_activity: # if we're joining a shared activity force mini
+ self.set_mode("mini")
+ else:
+ self.set_mode(mode)
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ #if len( self.preloadList ):
+ # self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ #print "-----", event.keyval, event.string, event.hardware_keycode
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ subactivity_name = self.metadata['tamtam_subactivity']
+ if subactivity_name == 'edit' \
+ or subactivity_name == 'synth' \
+ or subactivity_name == 'jam':
+ self.set_mode(subactivity_name)
+ self.modeList[subactivity_name].handleJournalLoad(file_path)
+ elif subactivity_name == 'mini':
+ self.set_mode(subactivity_name)
+ else:
+ return
+
+ def write_file(self,file_path):
+ if self.mode == 'edit':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+ elif self.mode == 'synth':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+ elif self.mode == 'mini':
+ self.metadata['tamtam_subactivity'] = self.mode
+ f = open(file_path,'w')
+ f.close()
+ elif self.mode == 'jam':
+ self.metadata['tamtam_subactivity'] = self.mode
+ self.modeList[self.mode].handleJournalSave(file_path)
+
+class TamTamJam(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Jam')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("jam")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['jam'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['jam'].handleJournalSave(file_path)
+
+class TamTamEdit(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='edit'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Edit')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("edit")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['edit'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['edit'].handleJournalSave(file_path)
+
+class TamTamSynthLab(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='synth'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam SynthLab')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("synth")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.modeList['synth'].handleJournalLoad(file_path)
+
+ def write_file(self,file_path):
+ self.modeList['synth'].handleJournalSave(file_path)
+
+class TamTamMini(Activity):
+ # TamTam is the topmost container in the TamTam application
+ # At all times it has one child, which may be one of
+ # - the welcome screen
+ # - the mini-tamtam
+ # - the synth lab
+ # - edit mode
+
+ def __init__(self, handle, mode='mini'):
+ Activity.__init__(self, handle)
+ self.ensure_dirs()
+
+ color = gtk.gdk.color_parse(Config.WS_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.set_title('TamTam Mini')
+ self.set_resizable(False)
+
+ self.trackpad = Trackpad( self )
+ #self.keyboardWindow = KeyboardWindow(size = 8, popup = True)
+ #self.keyboardWindow.color_piano()
+
+ self.preloadTimeout = None
+
+ self.focusInHandler = self.connect('focus_in_event',self.onFocusIn)
+ self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut)
+ self.connect('notify::active', self.onActive)
+ self.connect('destroy', self.onDestroy)
+ self.connect( "key-press-event", self.onKeyPress )
+ self.connect( "key-release-event", self.onKeyRelease )
+ #self.connect( "key-press-event", self.keyboardWindow.handle_keypress)
+ #self.connect( "key-release-event", self.keyboardWindow.handle_keyrelease)
+ #self.connect( "button-press-event", self.keyboardWindow.handle_mousePress)
+ #self.connect( "button-release-event", self.keyboardWindow.handle_mouseRelease)
+
+ self.mode = None
+ self.modeList = {}
+
+ self.instrumentPanel = InstrumentPanel( force_load = False )
+ self.preloadList = [ self.instrumentPanel ]
+
+ #load the sugar toolbar
+ self.toolbox = activity.ActivityToolbox(self)
+ self.set_toolbox(self.toolbox)
+
+ self.activity_toolbar = self.toolbox.get_activity_toolbar()
+ self.activity_toolbar.share.hide()
+ self.activity_toolbar.keep.hide()
+
+ self.toolbox.show()
+
+ self.set_mode("mini")
+
+ def onPreloadTimeout( self ):
+ if Config.DEBUG > 4: print "TamTam::onPreloadTimeout", self.preloadList
+
+ t = time.time()
+ if self.preloadList[0].load( t + 0.100 ): # finished preloading this object
+ self.preloadList.pop(0)
+ if not len(self.preloadList):
+ if Config.DEBUG > 1: print "TamTam::finished preloading", time.time() - t
+ self.preloadTimeout = False
+ return False # finished preloading everything
+
+ if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t
+
+ return True
+
+ def doNothing(): #a callback function to appease SynthLab
+ pass
+
+ def set_mode(self, mode, arg = None):
+ if Config.DEBUG: print 'DEBUG: TamTam::set_mode from', self.mode, 'to', mode
+
+ if self.mode != None:
+ self.modeList[ self.mode ].onDeactivate()
+ if FAKE_ACTIVITY:
+ self.remove( self.modeList[ self.mode ] )
+
+ self.mode = None
+ self.trackpad.setContext(mode)
+
+ if mode == 'welcome':
+ if not (mode in self.modeList):
+ self.modeList[mode] = Welcome(self, self.set_mode)
+ self.mode = mode
+ if len( self.preloadList ):
+ self.preloadTimeout = gobject.timeout_add( 300, self.onPreloadTimeout )
+ elif self.preloadTimeout:
+ gobject.source_remove( self.preloadTimeout )
+ self.predrawTimeout = False
+
+ if mode == 'jam':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Jam'
+ self.modeList[mode] = JamMain(self, self.set_mode)
+ self.mode = mode
+
+ if mode == 'mini':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Mini'
+ self.modeList[mode] = miniTamTamMain(self, self.set_mode)
+ else:
+ self.modeList[mode].regenerate()
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'edit':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam Edit'
+ self.modeList[mode] = MainWindow(self, self.set_mode)
+ if self.instrumentPanel in self.preloadList:
+ self.instrumentPanel.load() # finish loading
+ self.modeList[mode].setInstrumentPanel( self.instrumentPanel )
+ self.mode = mode
+
+ if mode == 'synth':
+ if not (mode in self.modeList):
+ self.metadata['title'] = 'TamTam SynthLab'
+ self.modeList[mode] = SynthLabWindow(self, self.set_mode, None)
+ self.mode = mode
+
+ if self.mode == None:
+ print 'DEBUG: TamTam::set_mode invalid mode:', mode
+ else:
+ try: # activity mode
+ self.set_canvas( self.modeList[ self.mode ] )
+ except: # fake mode
+ self.add( self.modeList[ self.mode ] )
+ self.modeList[ self.mode ].onActivate(arg)
+ self.show()
+
+ def onFocusIn(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(True)
+ if self.mode == 'synth':
+ self.modeList[ self.mode ].updateSound()
+ self.modeList[ self.mode ].updateTables()
+ #csnd.load_instruments()
+
+ def onFocusOut(self, event, data=None):
+ if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py'
+ csnd = new_csound_client()
+ csnd.connect(False)
+
+ def onActive(self, widget = None, event = None):
+ pass
+
+ def onKeyPress(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyPress in TamTam.py'
+ if event.state == gtk.gdk.MOD1_MASK:
+ key = event.keyval
+ if key == gtk.keysyms.j:
+ self.set_mode("jam")
+ return
+ elif key == gtk.keysyms.m:
+ self.set_mode('mini')
+ return
+ elif key == gtk.keysyms.s:
+ self.set_mode('synth')
+ return
+ elif key == gtk.keysyms.w:
+ self.set_mode('welcome')
+ return
+ elif key == gtk.keysyms.e:
+ self.set_mode('edit')
+ return
+ elif key == gtk.keysyms.t:
+ self.toolbox.show()
+ return
+ elif key == gtk.keysyms.y:
+ self.toolbox.hide()
+ if self.mode:
+ self.modeList[ self.mode ].onKeyPress(widget, event)
+
+ def onKeyRelease(self, widget, event):
+ if Config.DEBUG > 5: print 'DEBUG: TamTam::onKeyRelease in TamTam.py'
+ self.modeList[ self.mode ].onKeyRelease(widget, event)
+ pass
+
+ def onDestroy(self, arg2):
+ if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()'
+ os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*')
+
+ for m in self.modeList:
+ if self.modeList[m] != None:
+ self.modeList[m].onDestroy()
+
+ csnd = new_csound_client()
+ csnd.connect(False)
+ csnd.destroy()
+
+ gtk.main_quit()
+
+ def ensure_dir(self, dir, perms=0777, rw=os.R_OK|os.W_OK):
+ if not os.path.isdir( dir ):
+ try:
+ os.makedirs(dir, perms)
+ except OSError, e:
+ print 'ERROR: failed to make dir %s: %i (%s)\n' % (dir, e.errno, e.strerror)
+ if not os.access(dir, rw):
+ print 'ERROR: directory %s is missing required r/w access\n' % dir
+
+ def ensure_dirs(self):
+ self.ensure_dir(Config.TUNE_DIR)
+ self.ensure_dir(Config.SYNTH_DIR)
+ self.ensure_dir(Config.SNDS_DIR)
+ self.ensure_dir(Config.SCRATCH_DIR)
+
+ if not os.path.isdir(Config.PREF_DIR):
+ os.mkdir(Config.PREF_DIR)
+ os.system('chmod 0777 ' + Config.PREF_DIR + ' &')
+ for snd in ['mic1','mic2','mic3','mic4','lab1','lab2','lab3','lab4', 'lab5', 'lab6']:
+ shutil.copyfile(Config.SOUNDS_DIR + '/' + snd , Config.SNDS_DIR + '/' + snd)
+ os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &')
+
+ def read_file(self,file_path):
+ self.metadata['tamtam_subactivity'] = 'mini'
+
+ def write_file(self,file_path):
+ f = open(file_path,'w')
+ f.close()
+
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1 :
+ mainwin = TamTam(None, sys.argv[1])
+ else:
+ mainwin = TamTam(None, 'welcome')
+
+ gtk.gdk.threads_init()
+ gtk.main()
+
+ sys.exit(0)
+
+
+
+
+
+
+
+
+ def run_edit_mode():
+ tamtam = MainWindow()
+ mainwin = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ mainwin.set_title('TamTam Player')
+ display = mainwin.get_display()
+ screen = gtk.gdk.Display.get_default_screen(display)
+ mainwin.set_geometry_hints( None, screen.get_width(), screen.get_height(), screen.get_width(), screen.get_height(), screen.get_width(), screen.get_height() )
+ #mainwin.fullscreen() # don't need to specify full screen, it seem to sit properly anyway
+ mainwin.set_resizable(False)
+ mainwin.connect('destroy' , tamtam.destroy )
+ #mainwin.connect( "configure-event", tamtam.handleConfigureEvent )
+ mainwin.connect( "key-press-event", tamtam.onKeyPress )
+ mainwin.connect( "key-release-event", tamtam.onKeyRelease )
+ mainwin.connect( "delete_event", tamtam.delete_event )
+ mainwin.add(tamtam)
+ tamtam.show()
+ mainwin.show()
+ gtk.main()
diff --git a/TamTamSynthLab.activity/activity/activity-tamtamsynthlab.svg b/TamTamSynthLab.activity/activity/activity-tamtamsynthlab.svg
new file mode 100644
index 0000000..7e3feb6
--- /dev/null
+++ b/TamTamSynthLab.activity/activity/activity-tamtamsynthlab.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+ <!ENTITY stroke_color "#010101">
+ <!ENTITY fill_color "#FFFFFF">
+]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-synthlab">
+ <g display="inline">
+ <path d="M7.729,12.592 c0-2.215,3.275-4.948,5.925-4.948h28.149c2.648,0,5.925,2.734,5.925,4.948v18.347c0,9.233-8.953,16.705-20,16.705 c-11.048,0-19.999-7.475-19.999-16.705V12.592z" fill="&fill_color;" stroke="&stroke_color;" stroke-linecap="square" stroke-width="3.5"/>
+ <g>
+ <path d="M16.743,27.703c5.927-24.441,11.436,0,11.436,0 " fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-width="3.5"/>
+ <path d="M39.252,25.977 c-5.926,24.444-11.436,0-11.436,0" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+ </g>
+ </g>
+</g></svg> \ No newline at end of file
diff --git a/TamTamSynthLab.activity/activity/activity.info b/TamTamSynthLab.activity/activity/activity.info
new file mode 100644
index 0000000..7a64eec
--- /dev/null
+++ b/TamTamSynthLab.activity/activity/activity.info
@@ -0,0 +1,6 @@
+[Activity]
+name = TamTamSynthLab
+service_name = org.laptop.TamTamSynthLab
+icon = activity-tamtamsynthlab
+class = TamTam.TamTamSynthLab
+activity_version = 40
diff --git a/TamTamSynthLab.activity/common b/TamTamSynthLab.activity/common
new file mode 120000
index 0000000..60d3b0a
--- /dev/null
+++ b/TamTamSynthLab.activity/common
@@ -0,0 +1 @@
+../common \ No newline at end of file
diff --git a/TamTamSynthLab.activity/icons/XYBut.svg b/TamTamSynthLab.activity/icons/XYBut.svg
new file mode 100644
index 0000000..54d7563
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/XYBut.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<g>
+ <circle fill="#808284" cx="15" cy="15" r="9.376"/>
+ <g>
+ <path fill="#FFFFFF" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.584-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.918-6.501-6.502S11.417,8.5,15.001,8.5C18.585,8.5,21.5,11.413,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.168,28,28,22.165,28,14.998C28,7.831,22.168,2,15.003,2z"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/XYButDown.svg b/TamTamSynthLab.activity/icons/XYButDown.svg
new file mode 100644
index 0000000..201df5f
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/XYButDown.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<g>
+ <circle cx="15" cy="15" r="6.933"/>
+ <g>
+ <path fill="none" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.585-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.917-6.501-6.502c0-3.584,2.917-6.498,6.501-6.498C18.585,8.5,21.5,11.414,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.169,28,28,22.165,28,14.998C28,7.831,22.169,2,15.003,2z"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/XYButDownClick.svg b/TamTamSynthLab.activity/icons/XYButDownClick.svg
new file mode 100644
index 0000000..9e0d222
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/XYButDownClick.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<circle fill="none" cx="15" cy="15" r="6.933"/>
+<g>
+ <path fill="none" stroke="#808284" stroke-width="2.25" d="M21.5,14.998c0,3.585-2.915,6.502-6.499,6.502
+ c-3.584,0-6.501-2.917-6.501-6.502c0-3.584,2.917-6.498,6.501-6.498C18.585,8.5,21.5,11.414,21.5,14.998z M15.003,2
+ C7.832,2,2,7.831,2,14.998C2,22.165,7.832,28,15.003,28C22.169,28,28,22.165,28,14.998C28,7.831,22.169,2,15.003,2z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/accept.svg b/TamTamSynthLab.activity/icons/accept.svg
new file mode 100755
index 0000000..a2f9e28
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/accept.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45px" height="45px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.78,28.079c0-12.43,10.071-22.499,22.499-22.499c12.431,0,22.501,10.069,22.501,22.499c0,12.431-10.07,22.501-22.501,22.501
+ C15.851,50.58,5.78,40.51,5.78,28.079z"/>
+</g>
+<g>
+
+ <line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="16.788" y1="26.691" x2="25.781" y2="38.706"/>
+
+ <line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="25.781" y1="38.706" x2="39.773" y2="18.704"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/cancel.svg b/TamTamSynthLab.activity/icons/cancel.svg
new file mode 100755
index 0000000..59512eb
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/cancel.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45px" height="45px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.78,28.08c0-12.431,10.071-22.5,22.5-22.5c12.432,0,22.5,10.069,22.5,22.5c0,12.432-10.068,22.5-22.5,22.5
+ C15.851,50.58,5.78,40.512,5.78,28.08z"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="20.155" y1="19.956" x2="37.029" y2="36.83"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" x1="37.029" y1="19.956" x2="20.155" y2="36.83"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset1.svg b/TamTamSynthLab.activity/icons/preset1.svg
new file mode 100644
index 0000000..9673b82
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset1.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.043 35.334,15.753 44.168,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M26.749,26.727h-0.036L24.48,27.79l-0.45-2.053l3.097-1.44h2.27V36h-2.647V26.727z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset10.svg b/TamTamSynthLab.activity/icons/preset10.svg
new file mode 100644
index 0000000..28e7082
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset10.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M20.719,26.395h-0.036l-2.232,1.062l-0.449-2.053l3.097-1.439h2.27v11.704h-2.646v-9.273H20.719z"/>
+ <path fill="#FFFFFF" d="M35.858,29.762c0,3.619-1.458,6.104-4.447,6.104c-3.023,0-4.356-2.719-4.375-6.031
+ c0-3.386,1.44-6.067,4.467-6.067C34.635,23.766,35.858,26.557,35.858,29.762z M29.791,29.834c-0.018,2.683,0.631,3.962,1.692,3.962
+ c1.062,0,1.639-1.333,1.639-3.998c0-2.593-0.559-3.961-1.655-3.961C30.457,25.836,29.773,27.114,29.791,29.834z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset2.svg b/TamTamSynthLab.activity/icons/preset2.svg
new file mode 100644
index 0000000..f376c67
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset2.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M22.922,35.168v-1.656l1.513-1.368c2.557-2.287,3.799-3.602,3.835-4.97c0-0.955-0.576-1.711-1.927-1.711
+ c-1.008,0-1.891,0.504-2.502,0.973l-0.774-1.963c0.882-0.666,2.251-1.206,3.835-1.206c2.646,0,4.105,1.548,4.105,3.673
+ c0,1.963-1.423,3.529-3.115,5.042l-1.08,0.9v0.035h4.411v2.251H22.922z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset3.svg b/TamTamSynthLab.activity/icons/preset3.svg
new file mode 100644
index 0000000..a22bb3c
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset3.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M23.909,32.65c0.486,0.252,1.604,0.72,2.72,0.72c1.423,0,2.143-0.684,2.143-1.565
+ c0-1.152-1.152-1.674-2.358-1.674h-1.115v-1.963h1.062c0.918-0.019,2.088-0.36,2.088-1.352c0-0.702-0.576-1.224-1.729-1.224
+ c-0.954,0-1.962,0.414-2.448,0.702l-0.559-1.981c0.701-0.45,2.106-0.882,3.618-0.882c2.504,0,3.891,1.313,3.891,2.917
+ c0,1.243-0.702,2.215-2.144,2.719v0.035c1.404,0.253,2.538,1.314,2.538,2.846c0,2.07-1.817,3.583-4.789,3.583
+ c-1.513,0-2.791-0.396-3.475-0.828L23.909,32.65z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset4.svg b/TamTamSynthLab.activity/icons/preset4.svg
new file mode 100644
index 0000000..e6cf5e9
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset4.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M27.1,35.835v-2.791h-5.186v-1.782l4.431-7.13h3.349v6.859h1.404v2.054h-1.404v2.791L27.1,35.835
+ L27.1,35.835z M27.1,30.991v-2.592c0-0.703,0.037-1.422,0.09-2.179h-0.07c-0.379,0.756-0.685,1.439-1.082,2.179l-1.565,2.557v0.035
+ H27.1z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset5.svg b/TamTamSynthLab.activity/icons/preset5.svg
new file mode 100644
index 0000000..53f5b08
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset5.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,5.769 10.793,49.834 44.012,49.834 44.126,14.444
+ 35.45,5.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,6.042 35.334,14.753 44.166,14.753 "/>
+<path fill="#FFFFFF" d="M31.025,25.407h-4.537l-0.252,1.8c0.252-0.035,0.468-0.035,0.756-0.035c1.117,0,2.251,0.252,3.08,0.846
+ c0.883,0.594,1.422,1.566,1.422,2.936c0,2.179-1.873,4.105-5.022,4.105c-1.423,0-2.611-0.324-3.259-0.666l0.485-2.053
+ c0.522,0.252,1.585,0.575,2.647,0.575c1.134,0,2.34-0.541,2.34-1.782c0-1.207-0.955-1.945-3.295-1.945
+ c-0.648,0-1.098,0.037-1.584,0.109l0.773-6.142h6.445V25.407z"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset6.svg b/TamTamSynthLab.activity/icons/preset6.svg
new file mode 100644
index 0000000..4c2493c
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset6.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.043 35.334,15.753 44.168,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M30.562,26.575c-0.307,0-0.63,0-1.062,0.036c-2.431,0.198-3.511,1.44-3.815,2.811h0.055
+ c0.576-0.596,1.386-0.938,2.484-0.938c1.963,0,3.619,1.387,3.619,3.817c0,2.32-1.782,4.229-4.321,4.229
+ c-3.115,0-4.646-2.321-4.646-5.112c0-2.196,0.812-4.033,2.07-5.203c1.171-1.062,2.686-1.64,4.521-1.729
+ c0.505-0.036,0.828-0.036,1.099-0.018L30.562,26.575L30.562,26.575z M27.501,34.516c0.952,0,1.564-0.883,1.564-2.07
+ c0-1.081-0.576-2.018-1.747-2.018c-0.738,0-1.351,0.451-1.62,1.045c-0.07,0.145-0.106,0.357-0.106,0.684
+ c0.054,1.242,0.646,2.359,1.891,2.359H27.501z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset7.svg b/TamTamSynthLab.activity/icons/preset7.svg
new file mode 100644
index 0000000..d6de26c
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset7.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M32.146,25.296v1.729l-4.825,9.977h-2.898l4.824-9.417v-0.036h-5.365v-2.251L32.146,25.296L32.146,25.296z"
+ />
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset8.svg b/TamTamSynthLab.activity/icons/preset8.svg
new file mode 100644
index 0000000..5c4a17f
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset8.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="11.793,6.769 11.793,49.501 45.012,49.501 45.126,15.444
+ 36.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="36.334,7.042 36.334,15.753 45.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M26.164,29.784c-1.135-0.575-1.691-1.529-1.691-2.557c0-1.98,1.782-3.295,4.123-3.295
+ c2.735,0,3.871,1.584,3.871,3.007c0,1.008-0.54,1.999-1.692,2.574v0.055c1.134,0.433,2.144,1.404,2.144,2.916
+ c0,2.125-1.783,3.548-4.503,3.548c-2.971,0-4.339-1.675-4.339-3.259c0-1.404,0.812-2.377,2.089-2.936L26.164,29.784L26.164,29.784z
+ M30.126,32.684c0-1.027-0.757-1.639-1.838-1.928c-0.898,0.253-1.422,0.899-1.422,1.747c-0.019,0.847,0.63,1.639,1.656,1.639
+ C29.495,34.142,30.126,33.512,30.126,32.684z M27.046,27.138c0,0.792,0.721,1.296,1.655,1.584c0.631-0.18,1.188-0.756,1.188-1.494
+ c0-0.72-0.414-1.44-1.422-1.44C27.532,25.787,27.046,26.399,27.046,27.138z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/preset9.svg b/TamTamSynthLab.activity/icons/preset9.svg
new file mode 100644
index 0000000..4b803e9
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/preset9.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="10.793,6.769 10.793,49.501 44.012,49.501 44.126,15.444
+ 35.45,6.996 "/>
+<polyline fill="#E6E3E1" stroke="#5D6060" stroke-width="2" points="35.334,7.042 35.334,15.753 44.166,15.753 "/>
+<g>
+ <path fill="#FFFFFF" d="M24.793,34.164c0.343,0.036,0.647,0.036,1.188,0c0.828-0.055,1.675-0.287,2.305-0.721
+ c0.758-0.521,1.262-1.276,1.478-2.16l-0.054-0.018c-0.522,0.539-1.278,0.846-2.342,0.846c-1.979,0-3.654-1.387-3.654-3.655
+ c0-2.286,1.837-4.213,4.41-4.213c3.008,0,4.431,2.306,4.431,5.042c0,2.431-0.774,4.213-2.053,5.384
+ c-1.116,1.009-2.646,1.565-4.466,1.639c-0.469,0.036-0.937,0.018-1.242,0V34.164z M28.033,26.241c-0.918,0-1.603,0.828-1.584,2.053
+ c0,1.009,0.54,1.873,1.656,1.873c0.738,0,1.261-0.36,1.513-0.774c0.091-0.162,0.145-0.342,0.145-0.684
+ c0-1.243-0.468-2.468-1.71-2.468H28.033z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/rec1.svg b/TamTamSynthLab.activity/icons/rec1.svg
new file mode 100644
index 0000000..4a88eec
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/rec1.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M26.582,24.229h-0.034l-2.233,1.062l-0.45-2.052l3.099-1.438h2.269v11.703h-2.649V24.229z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/rec2.svg b/TamTamSynthLab.activity/icons/rec2.svg
new file mode 100644
index 0000000..108ea7e
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/rec2.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M23.09,33.501v-1.656l1.512-1.369c2.557-2.286,3.8-3.603,3.835-4.969c0-0.954-0.576-1.711-1.926-1.711
+ c-1.008,0-1.893,0.504-2.503,0.973l-0.774-1.963c0.882-0.666,2.25-1.206,3.835-1.206c2.647,0,4.105,1.548,4.105,3.673
+ c0,1.963-1.423,3.529-3.115,5.042l-1.08,0.899v0.034h4.411v2.253H23.09z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/rec3.svg b/TamTamSynthLab.activity/icons/rec3.svg
new file mode 100644
index 0000000..2c64c70
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/rec3.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M23.575,30.818c0.486,0.252,1.604,0.72,2.721,0.72c1.423,0,2.143-0.684,2.143-1.564
+ c0-1.152-1.152-1.674-2.358-1.674h-1.117v-1.963h1.062c0.918-0.021,2.088-0.36,2.088-1.353c0-0.702-0.576-1.224-1.728-1.224
+ c-0.955,0-1.962,0.414-2.449,0.702l-0.558-1.981c0.7-0.45,2.104-0.882,3.617-0.882c2.502,0,3.891,1.312,3.891,2.917
+ c0,1.242-0.702,2.215-2.145,2.719v0.036c1.404,0.252,2.539,1.314,2.539,2.845c0,2.07-1.817,3.583-4.79,3.583
+ c-1.512,0-2.791-0.396-3.475-0.828L23.575,30.818z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/rec4.svg b/TamTamSynthLab.activity/icons/rec4.svg
new file mode 100644
index 0000000..14b2d0a
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/rec4.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g enable-background="new ">
+ <path fill="#FFFFFF" d="M27.934,33.501V30.71h-5.188v-1.782l4.431-7.13h3.349v6.858h1.404v2.055h-1.404v2.791L27.934,33.501
+ L27.934,33.501z M27.934,28.657v-2.593c0-0.702,0.036-1.422,0.09-2.178h-0.072c-0.378,0.756-0.684,1.438-1.081,2.178l-1.564,2.557
+ v0.036H27.934z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/rec5.svg b/TamTamSynthLab.activity/icons/rec5.svg
new file mode 100644
index 0000000..b5c7b21
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/rec5.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M31.522,23.832H26.48l-0.279,2c0.279-0.039,0.521-0.039,0.841-0.039c1.239,0,2.501,0.279,3.421,0.939
+ c0.979,0.66,1.58,1.74,1.58,3.261c0,2.42-2.08,4.562-5.581,4.562c-1.58,0-2.9-0.359-3.621-0.74l0.54-2.281
+ c0.58,0.281,1.761,0.642,2.94,0.642c1.26,0,2.602-0.601,2.602-1.98c0-1.34-1.062-2.16-3.661-2.16c-0.72,0-1.222,0.04-1.761,0.12
+ l0.859-6.822h7.162V23.832z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/rec6.svg b/TamTamSynthLab.activity/icons/rec6.svg
new file mode 100644
index 0000000..6b0ccc0
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/rec6.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<circle fill="#808284" cx="27.501" cy="27.408" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="27.499" cy="27.5" r="21.572"/>
+<g>
+ <path fill="#FFFFFF" d="M30.809,23.825c-0.34,0-0.7,0-1.18,0.04c-2.701,0.221-3.901,1.601-4.241,3.121h0.061
+ c0.641-0.66,1.54-1.04,2.761-1.04c2.181,0,4.021,1.54,4.021,4.241c0,2.58-1.98,4.7-4.801,4.7c-3.461,0-5.161-2.58-5.161-5.682
+ c0-2.44,0.899-4.48,2.3-5.78c1.301-1.182,2.98-1.821,5.021-1.92c0.56-0.04,0.92-0.04,1.22-0.021V23.825z M27.408,32.647
+ c1.062,0,1.74-0.979,1.74-2.3c0-1.201-0.64-2.241-1.939-2.241c-0.82,0-1.5,0.5-1.801,1.16c-0.08,0.16-0.12,0.4-0.12,0.761
+ c0.061,1.38,0.721,2.62,2.102,2.62H27.408z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-addSynth+.svg b/TamTamSynthLab.activity/icons/sl-addSynth+.svg
new file mode 100755
index 0000000..23d3fbc
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-addSynth+.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679v32.205c0,16.188-15.414,29.311-34.446,29.311c-19.033,0-34.446-13.122-34.446-29.311V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.985"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.514" y1="45.028" x2="66.32" y2="45.028"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="25.362" y1="23.57" x2="25.362" y2="44.363"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="43.483" y1="30.514" x2="43.569" y2="44.363"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="34.374" y1="27.188" x2="34.471" y2="44.363"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="52.593" y1="33.344" x2="52.667" y2="44.363"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="63.058" y1="37.16" x2="63.069" y2="44.363"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.208,2.228,5.208,4.985c0,2.745-2.327,4.986-5.208,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.819,5.818
+ c0-2.758,2.327-4.985,5.194-4.985c2.87,0,5.209,2.228,5.209,4.985c0,2.745-2.339,4.986-5.209,4.986
+ C62.146,10.804,59.819,8.563,59.819,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.847
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.986-5.195,4.986
+ C36.638,78.833,34.299,76.604,34.299,73.847z"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-addSynth-menu.svg b/TamTamSynthLab.activity/icons/sl-addSynth-menu.svg
new file mode 100644
index 0000000..b26b996
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-addSynth-menu.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,16.825c0-3.389,4.911-7.559,8.889-7.559h42.222
+ c3.979,0,8.89,4.171,8.89,7.559v28.048c0,14.1-13.424,25.528-30,25.528c-16.577,0-30-11.429-30-25.528V16.825z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.02" x2="21.547" y2="57.384"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="22.115" y1="44.357" x2="62.88" y2="44.357"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="27.208" y1="25.669" x2="27.208" y2="43.778"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="42.99" y1="31.717" x2="43.064" y2="43.778"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="35.057" y1="28.82" x2="35.142" y2="43.778"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="50.925" y1="34.182" x2="50.989" y2="43.778"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="60.039" y1="37.505" x2="60.048" y2="43.778"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-adsr+.svg b/TamTamSynthLab.activity/icons/sl-adsr+.svg
new file mode 100755
index 0000000..bbf18d5
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-adsr+.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="5.5,8.569 9.615,4.812
+ 69.386,4.812 73.5,8.569 73.5,49.617 57.114,72.812 24.151,72.812 5.5,49.617 "/>
+ <circle fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" cx="39.5" cy="73.125" r="5.375"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="28.171" y1="21.042" x2="33.98" y2="30.479"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="20.727" y1="46.264" x2="28.05" y2="20.789"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="34.01" y1="30.533" x2="50.566" y2="30.533"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="51.307" y1="30.533" x2="59.51" y2="46.671"/>
+ <polyline fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" points="67.712,48.695 18.166,48.734
+ 18.61,14.689 "/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-adsr-menu.svg b/TamTamSynthLab.activity/icons/sl-adsr-menu.svg
new file mode 100644
index 0000000..35960ab
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-adsr-menu.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="9.5,12.127 13.131,8.812
+ 65.871,8.812 69.5,12.127 69.5,48.346 55.041,68.812 25.957,68.812 9.5,48.346 "/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="29.504" y1="23.133" x2="34.629" y2="31.459"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="22.936" y1="45.387" x2="29.397" y2="22.91"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="34.656" y1="31.507" x2="49.265" y2="31.507"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="49.918" y1="31.507" x2="57.155" y2="45.746"/>
+ <polyline fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" points="64.393,47.532 20.676,47.567
+ 21.067,17.527 "/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-buzz+.svg b/TamTamSynthLab.activity/icons/sl-buzz+.svg
new file mode 100755
index 0000000..9ca65f0
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-buzz+.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.869,0,5.209,2.228,5.209,4.985c0,2.745-2.34,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="49.277" x2="65.82" y2="49.277"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="23.713" y1="28.747" x2="23.713" y2="48.747"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="43.046" y1="28.747" x2="43.046" y2="48.747"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="33.38" y1="28.747" x2="33.38" y2="48.747"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="52.685" y1="28.747" x2="52.685" y2="48.747"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="63.712" y1="28.747" x2="63.712" y2="48.747"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-buzz-menu.svg b/TamTamSynthLab.activity/icons/sl-buzz-menu.svg
new file mode 100644
index 0000000..570a530
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-buzz-menu.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M10.224,17.252c0-3.326,4.82-7.418,8.724-7.418h41.438
+ c3.905,0,8.725,4.093,8.725,7.418v27.527c0,13.838-13.175,25.055-29.443,25.055c-16.269,0-29.443-11.217-29.443-25.055V17.252z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.884" y1="20.388" x2="21.884" y2="57.058"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="22.014" y1="47.906" x2="62.021" y2="47.906"/>
+<line fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="26.03" y1="30.357" x2="26.03" y2="47.452"/>
+<line fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="42.555" y1="30.357" x2="42.555" y2="47.452"/>
+<line fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="34.293" y1="30.357" x2="34.293" y2="47.452"/>
+<line fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="50.794" y1="30.357" x2="50.794" y2="47.452"/>
+<line fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="60.22" y1="30.357" x2="60.22" y2="47.452"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-chorus+.svg b/TamTamSynthLab.activity/icons/sl-chorus+.svg
new file mode 100755
index 0000000..e58b602
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-chorus+.svg
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M5.598,23.098c0-9.332,7.571-16.902,16.902-16.902h33.804c9.332,0,16.89,7.571,16.89,16.902v33.806
+ c0,9.331-7.558,16.901-16.89,16.901H22.5c-9.332,0-16.902-7.57-16.902-16.901V23.098z"/>
+</g>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M68,20.5c0-2.869,2.326-5.195,5.194-5.195c2.881,0,5.208,2.327,5.208,5.195c0,2.868-2.327,5.194-5.208,5.194
+ C70.326,25.695,68,23.369,68,20.5z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M68,33.5c0-2.869,2.326-5.195,5.194-5.195c2.881,0,5.208,2.327,5.208,5.195c0,2.868-2.327,5.194-5.208,5.194
+ C70.326,38.695,68,36.368,68,33.5z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M68,46.499c0-2.867,2.326-5.193,5.194-5.193c2.881,0,5.208,2.326,5.208,5.193c0,2.868-2.327,5.196-5.208,5.196
+ C70.326,51.695,68,49.367,68,46.499z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M68,59.5c0-2.869,2.326-5.195,5.194-5.195c2.881,0,5.208,2.326,5.208,5.195c0,2.868-2.327,5.195-5.208,5.195
+ C70.326,64.695,68,62.368,68,59.5z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M34.299,6.195C34.299,3.327,36.638,1,39.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C36.638,11.403,34.299,9.076,34.299,6.195z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M34.299,73.805c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C36.638,78.999,34.299,76.673,34.299,73.805z"/>
+<line fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="9.008" y1="42.13" x2="68.099" y2="42.13"/>
+<g>
+ <g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M11.778,41.12c6.118-46.263,11.806,0,11.806,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M34.712,37.907c-6.119,46.263-11.794,0-11.794,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M11.778,41.896c3.065-23.131,5.909,0,5.909,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M23.251,40.283c-3.065,23.131-5.896,0-5.896,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M34.712,40.283c-3.053,23.131-5.897,0-5.897,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M23.251,41.896c3.053-23.131,5.897,0,5.897,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M34.528,42.45c6.119-46.263,11.805,0,11.805,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M57.463,39.237c-6.119,46.263-11.794,0-11.794,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M34.528,43.226c3.065-23.132,5.909,0,5.909,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M46.001,41.613c-3.065,23.131-5.897,0-5.897,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M57.463,41.613c-3.054,23.131-5.898,0-5.898,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M46.001,43.226c3.054-23.132,5.896,0,5.896,0"/>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M17.687,41.12c6.119-46.263,11.806,0,11.806,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M40.621,37.907c-6.118,46.263-11.793,0-11.793,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M17.687,41.896c3.066-23.131,5.909,0,5.909,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M29.16,40.283c-3.065,23.131-5.896,0-5.896,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M40.621,40.283c-3.053,23.131-5.897,0-5.897,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M29.16,41.896c3.053-23.131,5.897,0,5.897,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M40.437,42.45c6.118-46.263,11.806,0,11.806,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M63.37,39.237c-6.116,46.263-11.793,0-11.793,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M40.437,43.226c3.066-23.132,5.908,0,5.908,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M51.91,41.613c-3.064,23.131-5.897,0-5.897,0"/>
+ </g>
+ <g>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M63.37,41.613c-3.052,23.131-5.896,0-5.896,0"/>
+
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="
+ M51.91,43.226c3.052-23.132,5.896,0,5.896,0"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-chorus-menu.svg b/TamTamSynthLab.activity/icons/sl-chorus-menu.svg
new file mode 100644
index 0000000..7dcb3f4
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-chorus-menu.svg
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.783" y1="41.923" x2="60.792" y2="41.923"/>
+ <g>
+ <g>
+ <g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M17.807,40.903
+ c4.737-36.621,9.141,0,9.141,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M35.563,38.361
+ c-4.738,36.62-9.131,0-9.131,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M17.807,41.52
+ c2.373-18.312,4.575,0,4.575,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M26.689,40.241
+ c-2.373,18.31-4.564,0-4.564,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M35.563,40.241
+ c-2.364,18.31-4.565,0-4.565,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M26.689,41.52
+ c2.364-18.312,4.565,0,4.565,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M35.42,41.957
+ c4.737-36.622,9.14,0,9.14,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M53.178,39.413
+ c-4.737,36.62-9.133,0-9.133,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M35.42,42.571
+ c2.373-18.312,4.575,0,4.575,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M44.303,41.295
+ c-2.373,18.309-4.565,0-4.565,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M53.178,41.295
+ c-2.364,18.309-4.567,0-4.567,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M44.303,42.571
+ c2.364-18.312,4.565,0,4.565,0"/>
+ </g>
+ </g>
+ </g>
+ <g>
+ <g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M22.382,40.903
+ c4.737-36.621,9.141,0,9.141,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M40.138,38.361
+ c-4.737,36.62-9.13,0-9.13,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M22.382,41.52
+ c2.374-18.312,4.575,0,4.575,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M31.265,40.241
+ c-2.373,18.31-4.565,0-4.565,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M40.138,40.241
+ c-2.364,18.31-4.566,0-4.566,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M31.265,41.52
+ c2.363-18.312,4.565,0,4.565,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M39.996,41.957
+ c4.737-36.622,9.14,0,9.14,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M57.751,39.413
+ c-4.735,36.62-9.131,0-9.131,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M39.996,42.571
+ c2.375-18.312,4.574,0,4.574,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M48.878,41.295
+ c-2.373,18.309-4.565,0-4.565,0"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M57.751,41.295
+ c-2.362,18.309-4.565,0-4.565,0"/>
+ <path fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" d="M48.878,42.571
+ c2.363-18.312,4.565,0,4.565,0"/>
+ </g>
+ </g>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-distort+.svg b/TamTamSynthLab.activity/icons/sl-distort+.svg
new file mode 100644
index 0000000..12c99a1
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-distort+.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.054" y1="41.664" x2="59.055" y2="41.664"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="37.712" y1="29.043" x2="37.712" y2="54.624"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="37.232" y1="28.376" x2="16.055" y2="28.376"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="59.055" y1="54.874" x2="37.878" y2="54.874"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-distort-menu.svg b/TamTamSynthLab.activity/icons/sl-distort-menu.svg
new file mode 100644
index 0000000..bc7bca9
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-distort-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="18.677" y1="41.477" x2="58.621" y2="41.477"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.676" y1="30.276" x2="39.676" y2="52.979"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.25" y1="29.684" x2="20.453" y2="29.684"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="58.621" y1="53.2" x2="39.824" y2="53.2"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-eq4band+.svg b/TamTamSynthLab.activity/icons/sl-eq4band+.svg
new file mode 100644
index 0000000..3684361
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-eq4band+.svg
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="11.5" y1="54.664" x2="56.5" y2="54.664"/>
+<g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M13.386,55.637
+ c4.614,0,3.671-27.935,7.045-26.991"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M27.525,55.637
+ c-4.638,0-3.671-27.935-7.045-26.991"/>
+</g>
+<g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M23.655,55.637
+ c4.639,0,3.672-33.242,7.07-32.126"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M37.823,55.637
+ c-4.641,0-3.673-33.242-7.072-32.126"/>
+</g>
+<g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M33.951,55.637
+ c4.637,0,3.672-18.604,7.068-17.986"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M48.09,55.637
+ c-4.613,0-3.67-18.604-7.045-17.986"/>
+</g>
+<g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M44.248,55.637
+ c4.637,0,3.67-25.279,7.045-24.411"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M58.385,55.637
+ c-4.637,0-3.672-25.279-7.045-24.411"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-eq4band-menu.svg b/TamTamSynthLab.activity/icons/sl-eq4band-menu.svg
new file mode 100644
index 0000000..36928a5
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-eq4band-menu.svg
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.006,25c0-8.282,6.72-15,15-15h30
+ c8.283,0,14.988,6.719,14.988,15v30.001C69.994,63.282,63.289,70,55.006,70h-30c-8.281,0-15-6.718-15-14.999V25z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="17.021" y1="53.014" x2="56.957" y2="53.014"/>
+ <g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M18.693,53.876
+ c4.095,0,3.258-24.79,6.252-23.952"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M31.241,53.876
+ c-4.117,0-3.258-24.79-6.251-23.952"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M27.808,53.876
+ c4.116,0,3.259-29.5,6.274-28.51"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M40.381,53.876
+ c-4.119,0-3.261-29.5-6.276-28.51"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M36.944,53.876
+ c4.116,0,3.261-16.511,6.272-15.96"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M49.492,53.876
+ c-4.095,0-3.257-16.511-6.25-15.96"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M46.082,53.876
+ c4.115,0,3.258-22.434,6.252-21.663"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M58.629,53.876
+ c-4.115,0-3.26-22.434-6.252-21.663"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-filter+.svg b/TamTamSynthLab.activity/icons/sl-filter+.svg
new file mode 100644
index 0000000..c86b558
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-filter+.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.054" y1="49.664" x2="59.055" y2="49.664"/>
+<path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M18.319,48.688
+ c12.197,0,9.664-22.544,18.569-21.765"/>
+<path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M55.552,48.688
+ c-12.196,0-9.663-22.544-18.569-21.765"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="36.889" y1="27.469" x2="36.889" y2="49.188"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-filter-menu.svg b/TamTamSynthLab.activity/icons/sl-filter-menu.svg
new file mode 100644
index 0000000..1dca673
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-filter-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="18.677" y1="48.576" x2="58.621" y2="48.576"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M22.462,47.71
+ c10.827,0,8.578-20.007,16.483-19.315"/>
+ <path fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M55.512,47.71
+ c-10.826,0-8.577-20.007-16.482-19.315"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="38.946" y1="28.879" x2="38.946" y2="48.153"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-fm+.svg b/TamTamSynthLab.activity/icons/sl-fm+.svg
new file mode 100755
index 0000000..b517986
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-fm+.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.869,0,5.209,2.228,5.209,4.985c0,2.745-2.34,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+<g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="
+ M19.98,40.324c12-48.823,23.172,0,23.172,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="
+ M64.979,36.926c-11.996,48.822-23.129,0-23.129,0"/>
+</g>
+<g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="
+ M19.98,41.132c6-24.411,11.566,0,11.566,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="
+ M42.481,39.447c-6.001,24.415-11.567,0-11.567,0"/>
+</g>
+<g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="
+ M64.979,39.447c-5.998,24.415-11.564,0-11.564,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="
+ M42.481,41.132c5.998-24.411,11.604,0,11.604,0"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-fm-menu.svg b/TamTamSynthLab.activity/icons/sl-fm-menu.svg
new file mode 100644
index 0000000..94cb8e3
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-fm-menu.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,17.252c0-3.326,4.911-7.418,8.889-7.418h42.222
+ c3.979,0,8.89,4.093,8.89,7.418v27.527c0,13.838-13.424,25.055-30,25.055c-16.577,0-30-11.217-30-25.055V17.252z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.388" x2="21.547" y2="57.058"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.358" x2="62.444" y2="39.358"/>
+ <g>
+ <path fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="M22.521,40.253c10.451-41.732,20.181,0,20.181,0"
+ />
+ <path fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="M61.712,37.348c-10.448,41.731-20.144,0-20.144,0"
+ />
+ </g>
+ <g>
+ <path fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="M22.521,40.943c5.226-20.865,10.073,0,10.073,0"/>
+ <path fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="M42.117,39.503c-5.226,20.868-10.073,0-10.073,0"
+ />
+ </g>
+ <g>
+ <path fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="M61.712,39.503c-5.225,20.868-10.071,0-10.071,0"
+ />
+ <path fill="none" stroke="#2D3238" stroke-width="2" stroke-linecap="round" d="M42.117,40.943c5.224-20.865,10.106,0,10.106,0"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-grain+.svg b/TamTamSynthLab.activity/icons/sl-grain+.svg
new file mode 100755
index 0000000..1a270cf
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-grain+.svg
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.868,0,5.209,2.228,5.209,4.985c0,2.745-2.341,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.983,5.207-4.983c2.869,0,5.195,2.239,5.195,4.983c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+<g>
+ <g>
+ <g id="XMLID_1_">
+ <g>
+ <path fill="#0A0A0A" d="M26.16,34.95c3.34-0.1,2.38,3.18,6.95,3.18v0.15c-4.57,0-3.61,3.28-6.95,3.18h-0.05
+ c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15c4.57,0,3.62-3.28,6.95-3.18H26.16z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M19.16,38.13
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M33.11,38.13
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M33.11,38.28
+ c-4.57,0-3.61,3.28-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M19.16,38.28
+ c4.57,0,3.62,3.28,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_2_">
+ <g>
+ <path fill="#0A0A0A" d="M40.11,35.296v0.15c-4.57,0-3.61,3.28-6.95,3.18h-0.05c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C36.5,32.016,35.54,35.296,40.11,35.296z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M26.16,35.296
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M40.11,35.296
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M40.11,35.446
+ c-4.57,0-3.61,3.28-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M26.16,35.446
+ c4.57,0,3.62,3.28,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_3_">
+ <g>
+ <path fill="#0A0A0A" d="M42.568,41.129v0.15c-4.57,0-3.61,3.279-6.95,3.18h-0.05c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C38.958,37.849,37.998,41.129,42.568,41.129z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M28.618,41.129
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M42.568,41.129
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M42.568,41.279
+ c-4.57,0-3.61,3.279-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M28.618,41.279
+ c4.57,0,3.62,3.279,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_4_">
+ <g>
+ <path fill="#0A0A0A" d="M49.61,36.879v0.15c-4.57,0-3.61,3.28-6.95,3.18h-0.05c-3.331,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C46,33.599,45.04,36.879,49.61,36.879z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M35.66,36.879
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M49.61,36.879
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M49.61,37.029
+ c-4.57,0-3.61,3.28-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M35.66,37.029
+ c4.57,0,3.62,3.28,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_5_">
+ <g>
+ <path fill="#0A0A0A" d="M53.61,42.754v0.15c-4.57,0-3.61,3.279-6.95,3.18h-0.05c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C50,39.474,49.04,42.754,53.61,42.754z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M39.66,42.754
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M53.61,42.754
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M53.61,42.904
+ c-4.57,0-3.61,3.279-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M39.66,42.904
+ c4.57,0,3.62,3.279,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_6_">
+ <g>
+ <path fill="#0A0A0A" d="M49.319,32.629v0.15c-4.57,0-3.61,3.28-6.95,3.18h-0.05c-3.331,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C45.709,29.349,44.749,32.629,49.319,32.629z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M35.369,32.629
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M49.319,32.629
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M49.319,32.779
+ c-4.57,0-3.61,3.28-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M35.369,32.779
+ c4.57,0,3.62,3.28,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_7_">
+ <g>
+ <path fill="#0A0A0A" d="M58.652,37.17v0.15c-4.57,0-3.61,3.28-6.95,3.18h-0.05c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C55.042,33.89,54.082,37.17,58.652,37.17z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M44.702,37.17
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M58.652,37.17
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M58.652,37.32
+ c-4.57,0-3.61,3.28-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M44.702,37.32
+ c4.57,0,3.62,3.28,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_8_">
+ <g>
+ <path fill="#0A0A0A" d="M64.277,41.587v0.15c-4.57,0-3.61,3.279-6.95,3.18h-0.05c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C60.667,38.307,59.707,41.587,64.277,41.587z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M50.327,41.587
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M64.277,41.587
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M64.277,41.737
+ c-4.57,0-3.61,3.279-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M50.327,41.737
+ c4.57,0,3.62,3.279,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_9_">
+ <g>
+ <path fill="#0A0A0A" d="M60.485,33.671v0.15c-4.57,0-3.61,3.28-6.95,3.18h-0.05c-3.33,0.1-2.38-3.18-6.95-3.18v-0.15
+ c4.57,0,3.62-3.28,6.95-3.18h0.05C56.875,30.391,55.915,33.671,60.485,33.671z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M46.535,33.671
+ c4.57,0,3.62-3.28,6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M60.485,33.671
+ c-4.57,0-3.61-3.28-6.95-3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M60.485,33.821
+ c-4.57,0-3.61,3.28-6.95,3.18"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M46.535,33.821
+ c4.57,0,3.62,3.28,6.95,3.18"/>
+ </g>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-grain-menu.svg b/TamTamSynthLab.activity/icons/sl-grain-menu.svg
new file mode 100644
index 0000000..fa772a1
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-grain-menu.svg
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,16.825c0-3.389,4.911-7.559,8.888-7.559h42.222
+ c3.979,0,8.89,4.171,8.89,7.559v28.048c0,14.099-13.424,25.528-30,25.528c-16.577,0-30-11.43-30-25.528V16.825z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.02" x2="21.547" y2="57.383"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.35" x2="62.444" y2="39.35"/>
+<g>
+ <g>
+ <g id="XMLID_1_">
+ <g>
+ <path fill="#0A0A0A" d="M27.903,35.58c2.909-0.087,2.073,2.77,6.053,2.77v0.131c-3.98,0-3.144,2.856-6.053,2.77H27.86
+ c-2.9,0.087-2.073-2.77-6.053-2.77V38.35c3.98,0,3.153-2.856,6.053-2.77H27.903z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M21.807,38.35
+ c3.98,0,3.153-2.856,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M33.956,38.35
+ c-3.98,0-3.144-2.856-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M33.956,38.48
+ c-3.98,0-3.144,2.856-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M21.807,38.48
+ c3.98,0,3.153,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_2_">
+ <g>
+ <path fill="#0A0A0A" d="M40.053,35.882v0.13c-3.98,0-3.144,2.857-6.053,2.77h-0.044c-2.9,0.087-2.073-2.77-6.053-2.77v-0.13
+ c3.98,0,3.153-2.857,6.053-2.77H34C36.909,33.025,36.073,35.882,40.053,35.882z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M27.903,35.882
+ c3.98,0,3.153-2.857,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M40.053,35.882
+ c-3.98,0-3.144-2.857-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M40.053,36.012
+ c-3.98,0-3.144,2.857-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M27.903,36.012
+ c3.98,0,3.153,2.857,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_3_">
+ <g>
+ <path fill="#0A0A0A" d="M42.193,40.962v0.131c-3.98,0-3.144,2.856-6.053,2.77h-0.043c-2.9,0.087-2.073-2.77-6.053-2.77v-0.131
+ c3.98,0,3.153-2.857,6.053-2.77h0.043C39.049,38.105,38.213,40.962,42.193,40.962z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M30.044,40.962
+ c3.98,0,3.153-2.857,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M42.193,40.962
+ c-3.98,0-3.144-2.857-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M42.193,41.093
+ c-3.98,0-3.144,2.856-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M30.044,41.093
+ c3.98,0,3.153,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_4_">
+ <g>
+ <path fill="#0A0A0A" d="M48.326,37.26v0.131c-3.979,0-3.144,2.856-6.053,2.77H42.23c-2.9,0.087-2.073-2.77-6.053-2.77V37.26
+ c3.98,0,3.153-2.856,6.053-2.77h0.043C45.183,34.404,44.347,37.26,48.326,37.26z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M36.177,37.26
+ c3.98,0,3.153-2.856,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M48.326,37.26
+ c-3.979,0-3.144-2.856-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M48.326,37.391
+ c-3.979,0-3.144,2.856-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M36.177,37.391
+ c3.98,0,3.153,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_5_">
+ <g>
+ <path fill="#0A0A0A" d="M51.811,42.377v0.131c-3.98,0-3.145,2.856-6.054,2.77h-0.043c-2.9,0.087-2.073-2.77-6.053-2.77v-0.131
+ c3.98,0,3.153-2.856,6.053-2.77h0.043C48.666,39.521,47.83,42.377,51.811,42.377z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M39.661,42.377
+ c3.98,0,3.153-2.856,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M51.811,42.377
+ c-3.98,0-3.145-2.856-6.054-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M51.811,42.508
+ c-3.98,0-3.145,2.856-6.054,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M39.661,42.508
+ c3.98,0,3.153,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_6_">
+ <g>
+ <path fill="#0A0A0A" d="M48.073,33.559v0.13c-3.98,0-3.145,2.857-6.053,2.77h-0.044c-2.9,0.087-2.073-2.77-6.053-2.77v-0.13
+ c3.98,0,3.152-2.857,6.053-2.77h0.044C44.929,30.702,44.093,33.559,48.073,33.559z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M35.924,33.559
+ c3.98,0,3.152-2.857,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M48.073,33.559
+ c-3.98,0-3.145-2.857-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M48.073,33.689
+ c-3.98,0-3.145,2.857-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M35.924,33.689
+ c3.98,0,3.152,2.857,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_7_">
+ <g>
+ <path fill="#0A0A0A" d="M56.201,37.514v0.131c-3.979,0-3.144,2.856-6.053,2.77h-0.044c-2.899,0.087-2.072-2.77-6.053-2.77
+ v-0.131c3.98,0,3.153-2.856,6.053-2.77h0.044C53.058,34.657,52.222,37.514,56.201,37.514z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M44.052,37.514
+ c3.98,0,3.153-2.856,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M56.201,37.514
+ c-3.979,0-3.144-2.856-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M56.201,37.645
+ c-3.979,0-3.144,2.856-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M44.052,37.645
+ c3.98,0,3.153,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_8_">
+ <g>
+ <path fill="#0A0A0A" d="M61.101,41.36v0.131c-3.98,0-3.145,2.856-6.053,2.77h-0.044c-2.9,0.087-2.073-2.77-6.053-2.77V41.36
+ c3.979,0,3.152-2.856,6.053-2.769h0.044C57.956,38.504,57.12,41.36,61.101,41.36z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M48.951,41.36
+ c3.979,0,3.152-2.856,6.053-2.769"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M61.101,41.36
+ c-3.98,0-3.145-2.856-6.053-2.769"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M61.101,41.491
+ c-3.98,0-3.145,2.856-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M48.951,41.491
+ c3.979,0,3.152,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+<g>
+ <g>
+ <g id="XMLID_9_">
+ <g>
+ <path fill="#0A0A0A" d="M57.798,34.466v0.131c-3.98,0-3.144,2.856-6.053,2.77h-0.044c-2.9,0.087-2.072-2.77-6.053-2.77v-0.131
+ c3.98,0,3.152-2.856,6.053-2.77h0.044C54.654,31.61,53.817,34.466,57.798,34.466z"/>
+ </g>
+ <g>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M45.648,34.466
+ c3.98,0,3.152-2.856,6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M57.798,34.466
+ c-3.98,0-3.144-2.856-6.053-2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M57.798,34.597
+ c-3.98,0-3.144,2.856-6.053,2.77"/>
+ <path fill="none" stroke="#666666" stroke-width="0.36" stroke-linecap="square" stroke-linejoin="round" d="M45.648,34.597
+ c3.98,0,3.152,2.856,6.053,2.77"/>
+ </g>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-harmon+.svg b/TamTamSynthLab.activity/icons/sl-harmon+.svg
new file mode 100644
index 0000000..ef4f968
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-harmon+.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.054" y1="54.664" x2="59.055" y2="54.664"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="18.525" y1="44.484" x2="53.525" y2="44.484"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="24.036" y1="35.757" x2="49.979" y2="35.757"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="29.546" y1="26.998" x2="45.122" y2="26.998"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-harmon-menu.svg b/TamTamSynthLab.activity/icons/sl-harmon-menu.svg
new file mode 100644
index 0000000..de11295
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-harmon-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="18.677" y1="53.014" x2="58.621" y2="53.014"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="22.646" y1="43.979" x2="53.713" y2="43.979"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="27.537" y1="36.234" x2="50.564" y2="36.234"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="32.428" y1="28.461" x2="46.254" y2="28.461"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-lfo+.svg b/TamTamSynthLab.activity/icons/sl-lfo+.svg
new file mode 100755
index 0000000..4bdaa74
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-lfo+.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="5.5,9.569 9.615,5.812
+ 69.386,5.812 73.5,9.569 73.5,50.617 57.114,73.812 24.151,73.812 5.5,50.617 "/>
+<circle fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" cx="39.5" cy="73.125" r="5.375"/>
+<line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="18.11" y1="23.482" x2="18.11" y2="52.688"/>
+<line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="18.11" y1="38.122" x2="63.109" y2="38.072"/>
+<line fill="none" stroke="#2D2B2B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="50.443" y1="26.607" x2="62.411" y2="38.607"/>
+<line fill="none" stroke="#2D2B2B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="28.451" y1="48.413" x2="50.337" y2="26.528"/>
+<line fill="none" stroke="#2D2B2B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="18.725" y1="38.688" x2="28.451" y2="48.413"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-lfo-menu.svg b/TamTamSynthLab.activity/icons/sl-lfo-menu.svg
new file mode 100644
index 0000000..e340173
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-lfo-menu.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="9.5,13.127 13.131,9.812
+ 65.871,9.812 69.5,13.127 69.5,49.346 55.041,69.812 25.957,69.812 9.5,49.346 "/>
+
+ <line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="20.626" y1="25.403" x2="20.626" y2="51.173"/>
+
+ <line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="20.626" y1="38.321" x2="60.332" y2="38.276"/>
+
+ <line fill="none" stroke="#2D2B2B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="49.156" y1="28.161" x2="59.716" y2="38.749"/>
+
+ <line fill="none" stroke="#2D2B2B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="29.751" y1="47.401" x2="49.062" y2="28.091"/>
+
+ <line fill="none" stroke="#2D2B2B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="21.169" y1="38.82" x2="29.751" y2="47.401"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-noise+.svg b/TamTamSynthLab.activity/icons/sl-noise+.svg
new file mode 100755
index 0000000..abe48a5
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-noise+.svg
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.869,0,5.209,2.228,5.209,4.985c0,2.745-2.34,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M19.695,36.961c2.058-33.71,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M27.407,34.635c-2.056,33.712-3.978,0-3.978,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M41.56,40.429c2.058-33.737,3.95,0,3.95,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M49.271,38.076c-2.057,33.735-3.979,0-3.979,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M24.836,40.429c2.057-33.737,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M32.548,38.076c-2.056,33.735-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M49.271,38.123c2.056-33.734,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M56.983,35.775c-2.057,33.735-3.978,0-3.978,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M33.847,39.264c2.057-33.711,3.951,0,3.951,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M41.56,36.938c-2.056,33.709-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M26.135,36.499c2.057-20.235,3.952,0,3.952,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M33.847,35.094c-2.056,20.238-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M20.968,39.967c2.083-20.262,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M28.706,38.561c-2.083,20.238-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M40.261,42.27c2.058-20.262,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M47.974,40.863c-2.058,20.236-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M54.412,43.408c2.058-20.238,3.978,0,3.978,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M62.126,42.002c-2.059,20.238-3.979,0-3.979,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M35.12,46.875c2.055-20.237,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M42.832,45.47c-2.057,20.235-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M37.689,29.594c2.058-20.236,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M45.402,28.188c-2.057,20.235-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M53.113,34.199c2.083-20.236,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M60.852,32.793c-2.081,20.235-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M20.968,46.875c2.083-20.237,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M28.706,45.47c-2.083,20.235-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M38.988,48.012c2.057-20.236,3.951,0,3.951,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M46.7,46.605c-2.057,20.238-3.978,0-3.978,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M45.402,36.499c2.057-20.235,3.978,0,3.978,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M53.113,35.094c-2.056,20.238-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M29.978,32.77c2.056-12.142,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M37.689,31.92c-2.056,12.144-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M54.412,32.77c2.058-12.142,3.978,0,3.978,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M62.126,31.92c-2.059,12.144-3.979,0-3.979,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M33.847,39.676c2.057-12.142,3.951,0,3.951,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M41.56,38.828c-2.056,12.142-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M51.842,39.676c2.057-12.142,3.978,0,3.978,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M59.553,38.828c-2.057,12.142-3.977,0-3.977,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M37.689,40.816c2.058-12.144,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M45.402,39.99c-2.057,12.144-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M42.832,47.746c2.055-12.142,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M50.542,46.899c-2.057,12.141-3.949,0-3.949,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M40.261,36.04c2.058-7.271,3.979,0,3.979,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M47.974,35.555c-2.058,7.271-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M38.988,32.599c2.057-7.294,3.951,0,3.951,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M46.7,32.09c-2.057,7.295-3.978,0-3.978,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M47.974,35.943c2.056-4.362,3.977,0,3.977,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M55.686,35.652c-2.059,4.364-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M45.402,40.547c2.057-4.359,3.978,0,3.978,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M53.113,40.258c-2.056,4.362-3.951,0-3.951,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M56.983,35.894c2.057-2.642,3.978,0,3.978,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="
+ M64.695,35.699c-2.057,2.618-3.978,0-3.978,0"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-noise-menu.svg b/TamTamSynthLab.activity/icons/sl-noise-menu.svg
new file mode 100644
index 0000000..3157316
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-noise-menu.svg
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,17.252c0-3.326,4.911-7.418,8.889-7.418h42.222
+ c3.979,0,8.89,4.093,8.89,7.418v27.527c0,13.838-13.424,25.055-30,25.055c-16.577,0-30-11.217-30-25.055V17.252z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.388" x2="21.547" y2="57.058"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.358" x2="62.444" y2="39.358"/>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M22.273,37.378
+ c1.792-28.814,3.465,0,3.465,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M28.99,35.39
+ c-1.791,28.816-3.465,0-3.465,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M41.316,40.343
+ c1.792-28.837,3.439,0,3.439,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M48.032,38.332
+ c-1.792,28.834-3.466,0-3.466,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M26.75,40.343
+ c1.792-28.837,3.465,0,3.465,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M33.467,38.332
+ c-1.791,28.834-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M48.032,38.372
+ c1.79-28.834,3.463,0,3.463,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M54.747,36.364
+ c-1.791,28.835-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M34.598,39.347
+ c1.792-28.814,3.441,0,3.441,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M41.316,37.358
+ c-1.792,28.812-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M27.881,36.983
+ c1.792-17.296,3.442,0,3.442,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M34.598,35.782
+ c-1.791,17.299-3.463,0-3.463,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M23.381,39.947
+ c1.814-17.318,3.464,0,3.464,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M30.121,38.746
+ c-1.814,17.298-3.463,0-3.463,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M40.185,41.916
+ c1.792-17.319,3.466,0,3.466,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M46.902,40.714
+ c-1.793,17.297-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M52.509,42.889
+ c1.793-17.298,3.465,0,3.465,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M59.228,41.688
+ c-1.794,17.298-3.466,0-3.466,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M35.707,45.853
+ c1.79-17.298,3.464,0,3.464,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M42.424,44.652
+ c-1.791,17.295-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M37.944,31.081
+ c1.792-17.296,3.466,0,3.466,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M44.662,29.879
+ c-1.791,17.296-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M51.378,35.018
+ c1.813-17.297,3.465,0,3.465,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M58.117,33.815
+ c-1.812,17.296-3.463,0-3.463,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M23.381,45.853
+ c1.814-17.298,3.464,0,3.464,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M30.121,44.652
+ c-1.814,17.295-3.463,0-3.463,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M39.076,46.824
+ c1.792-17.297,3.442,0,3.442,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M45.792,45.622
+ c-1.792,17.298-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M44.662,36.983
+ c1.791-17.296,3.464,0,3.464,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M51.378,35.782
+ c-1.791,17.299-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M31.229,33.796
+ c1.791-10.378,3.464,0,3.464,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M37.944,33.069
+ c-1.791,10.381-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M52.509,33.796
+ c1.793-10.378,3.465,0,3.465,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M59.228,33.069
+ c-1.794,10.381-3.466,0-3.466,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M34.598,39.699
+ c1.792-10.378,3.441,0,3.441,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M41.316,38.974
+ c-1.792,10.379-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M50.271,39.699
+ c1.791-10.378,3.465,0,3.465,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M56.986,38.974
+ c-1.791,10.379-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M37.944,40.674
+ c1.792-10.381,3.466,0,3.466,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M44.662,39.967
+ c-1.791,10.38-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M42.424,46.597
+ c1.789-10.378,3.463,0,3.463,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M49.139,45.872
+ c-1.792,10.378-3.439,0-3.439,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M40.185,36.591
+ c1.792-6.215,3.466,0,3.466,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M46.902,36.177
+ c-1.793,6.215-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M39.076,33.65
+ c1.792-6.234,3.442,0,3.442,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M45.792,33.215
+ c-1.792,6.235-3.464,0-3.464,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M46.902,36.508
+ c1.789-3.728,3.463,0,3.463,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M53.618,36.259
+ c-1.793,3.73-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M44.662,40.443
+ c1.791-3.726,3.464,0,3.464,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M51.378,40.196
+ c-1.791,3.729-3.441,0-3.441,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M54.747,36.466
+ c1.792-2.258,3.466,0,3.466,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M61.465,36.3
+ c-1.791,2.237-3.465,0-3.465,0"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-pluck+.svg b/TamTamSynthLab.activity/icons/sl-pluck+.svg
new file mode 100755
index 0000000..01bbf3d
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-pluck+.svg
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.869,0,5.209,2.228,5.209,4.985c0,2.745-2.34,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M19.5,40.962c2.063-41.685,3.948,0,3.948,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M27.182,38.037c-2.063,41.688-3.948,0-3.948,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M26.939,40.206c2.062-25.012,3.948,0,3.948,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M34.621,38.465c-2.062,25.012-3.949,0-3.949,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M34.527,39.518c2.062-14.971,3.943,0,3.943,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M42.204,38.492c-2.059,14.979-3.944,0-3.944,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M41.761,39.159c2.063-9.009,3.948,0,3.948,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M49.442,38.527c-2.063,9.009-3.945,0-3.945,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M48.997,39.696c2.063-5.41,3.949,0,3.949,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M56.679,39.302c-2.062,5.414-3.948,0-3.948,0"/>
+ </g>
+</g>
+<g>
+ <g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M56.818,39.488c2.063-3.242,3.945,0,3.945,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="
+ M64.5,39.249c-2.063,3.241-3.948,0-3.948,0"/>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-pluck-menu.svg b/TamTamSynthLab.activity/icons/sl-pluck-menu.svg
new file mode 100644
index 0000000..3131019
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-pluck-menu.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,17.252c0-3.326,4.911-7.418,8.889-7.418h42.222
+ c3.979,0,8.89,4.093,8.89,7.418v27.527c0,13.838-13.424,25.055-30,25.055c-16.577,0-30-11.217-30-25.055V17.252z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.388" x2="21.547" y2="57.058"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.358" x2="62.444" y2="39.358"/>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M22.103,40.798
+ c1.797-35.63,3.438,0,3.438,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M28.793,38.298
+ c-1.796,35.633-3.438,0-3.438,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M28.582,40.152
+ c1.796-21.379,3.438,0,3.438,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M35.272,38.664
+ c-1.796,21.379-3.439,0-3.439,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M35.19,39.564
+ c1.796-12.797,3.434,0,3.434,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M41.877,38.687
+ c-1.793,12.803-3.436,0-3.436,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M41.491,39.257
+ c1.797-7.701,3.438,0,3.438,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M48.18,38.717
+ c-1.796,7.7-3.436,0-3.436,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M47.793,39.716
+ c1.797-4.624,3.438,0,3.438,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M54.483,39.379
+ c-1.796,4.628-3.439,0-3.439,0"/>
+ </g>
+ </g>
+ <g>
+ <g>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M54.604,39.538
+ c1.797-2.771,3.437,0,3.437,0"/>
+ <path fill="none" stroke="#000000" stroke-linecap="square" stroke-linejoin="round" d="M61.295,39.334
+ c-1.797,2.771-3.438,0-3.438,0"/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-rand+.svg b/TamTamSynthLab.activity/icons/sl-rand+.svg
new file mode 100755
index 0000000..62d89d1
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-rand+.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="5.5,8.569 9.615,4.812
+ 69.386,4.812 73.5,8.569 73.5,49.617 57.114,72.812 24.151,72.812 5.5,49.617 "/>
+<circle fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" cx="39.5" cy="73.125" r="5.375"/>
+<line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="18.11" y1="19.482" x2="18.11" y2="48.688"/>
+<line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="18.11" y1="34.122" x2="63.109" y2="34.072"/>
+<polyline fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" points="29.849,22.684
+ 26.539,41.294 19.04,26.295 "/>
+<polyline fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" points="45.152,24.78
+ 39.747,46.977 31.062,22.684 "/>
+<polyline fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" points="64.04,50.893
+ 59.241,20.589 51.16,29.881 45.454,25.083 "/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-rand-menu.svg b/TamTamSynthLab.activity/icons/sl-rand-menu.svg
new file mode 100644
index 0000000..e02bc99
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-rand-menu.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="9.5,12.127 13.131,8.812
+ 65.871,8.812 69.5,12.127 69.5,48.346 55.041,68.812 25.957,68.812 9.5,48.346 "/>
+
+ <line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="20.626" y1="21.756" x2="20.626" y2="47.525"/>
+
+ <line fill="none" stroke="#333333" stroke-width="1.08" stroke-linecap="round" stroke-linejoin="round" x1="20.626" y1="34.674" x2="60.332" y2="34.629"/>
+ <polyline fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" points="30.984,24.582
+ 28.064,41.002 21.447,27.768 "/>
+ <polyline fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" points="44.487,26.431
+ 39.718,46.016 32.055,24.582 "/>
+ <polyline fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" points="61.153,49.472
+ 56.919,22.733 49.788,30.932 44.754,26.698 "/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-reset.svg b/TamTamSynthLab.activity/icons/sl-reset.svg
new file mode 100644
index 0000000..833e85b
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-reset.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="55px" height="55px" viewBox="0 0 55 55" enable-background="new 0 0 55 55" xml:space="preserve">
+<polygon fill="none" stroke="#FFFFFF" stroke-width="2" points="36.668,46.959 17.384,46.671 13.751,19.147 40.626,19.147 "/>
+<path fill="none" stroke="#FFFFFF" stroke-width="2" d="M13.751,17.312c18.998-2.13,21.875-2.374,25.436-3.021
+ c3.561-0.647-8.347-2.808-12.054-2.375c-1.729,0.201-9.713,1.618-13.275,5.396"/>
+<path fill="none" stroke="#FFFFFF" stroke-width="2" d="M22.709,11.557l6.691-1.476c0,0-4.209-3.13-6.691,1.296"/>
+<line fill="none" stroke="#FFFFFF" x1="27.457" y1="24.652" x2="27.457" y2="39.763"/>
+<line fill="none" stroke="#FFFFFF" x1="35.229" y1="25.084" x2="33.502" y2="39.763"/>
+<line fill="none" stroke="#FFFFFF" x1="19.038" y1="25.731" x2="20.55" y2="39.763"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-reverb+.svg b/TamTamSynthLab.activity/icons/sl-reverb+.svg
new file mode 100644
index 0000000..44faefc
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-reverb+.svg
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.054" y1="59.664" x2="59.055" y2="59.664"/>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="300.7227" y1="-327.5078" x2="330.7227" y2="-327.5078" gradientTransform="matrix(1 0 0 -1 -278.5 -288.5)">
+ <stop offset="0" style="stop-color:#FFFFFF"/>
+ <stop offset="0.0799" style="stop-color:#DBDBDB"/>
+ <stop offset="0.2375" style="stop-color:#999999"/>
+ <stop offset="0.3876" style="stop-color:#636363"/>
+ <stop offset="0.526" style="stop-color:#383838"/>
+ <stop offset="0.6501" style="stop-color:#191919"/>
+ <stop offset="0.7555" style="stop-color:#070707"/>
+ <stop offset="0.8297" style="stop-color:#000000"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" stroke="#000000" d="M22.222,38.996c0-8.283,6.707-14.987,14.987-14.987
+ c8.311,0,15.014,6.704,15.014,14.987c0,8.307-6.703,15.011-15.014,15.011C28.928,54.007,22.222,47.303,22.222,38.996z"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-reverb-menu.svg b/TamTamSynthLab.activity/icons/sl-reverb-menu.svg
new file mode 100644
index 0000000..c14a445
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-reverb-menu.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="18.677" y1="57.451" x2="58.621" y2="57.451"/>
+
+ <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="291.9277" y1="-316.1196" x2="318.5566" y2="-316.1196" gradientTransform="matrix(1 0 0 -1 -266 -277)">
+ <stop offset="0" style="stop-color:#FFFFFF"/>
+ <stop offset="0.0799" style="stop-color:#DBDBDB"/>
+ <stop offset="0.2375" style="stop-color:#999999"/>
+ <stop offset="0.3876" style="stop-color:#636363"/>
+ <stop offset="0.526" style="stop-color:#383838"/>
+ <stop offset="0.6501" style="stop-color:#191919"/>
+ <stop offset="0.7555" style="stop-color:#070707"/>
+ <stop offset="0.8297" style="stop-color:#000000"/>
+ </linearGradient>
+ <path fill="url(#SVGID_1_)" stroke="#000000" d="M25.927,39.109c0-7.351,5.953-13.3,13.303-13.3c7.376,0,13.327,5.95,13.327,13.3
+ c0,7.372-5.95,13.322-13.327,13.322C31.88,52.431,25.927,46.48,25.927,39.109z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-ring+.svg b/TamTamSynthLab.activity/icons/sl-ring+.svg
new file mode 100644
index 0000000..7fd5495
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-ring+.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.054" y1="59.664" x2="59.055" y2="59.664"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="37.777" y1="21.95" x2="37.777" y2="55.3"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="50.295" y1="30.297" x2="50.295" y2="50.286"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="25.295" y1="30.297" x2="25.295" y2="50.286"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-ring-menu.svg b/TamTamSynthLab.activity/icons/sl-ring-menu.svg
new file mode 100644
index 0000000..731f2d2
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-ring-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="18.677" y1="57.451" x2="58.621" y2="57.451"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.734" y1="23.981" x2="39.734" y2="53.578"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="50.846" y1="31.389" x2="50.846" y2="49.129"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="28.655" y1="31.389" x2="28.655" y2="49.129"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-sample+.svg b/TamTamSynthLab.activity/icons/sl-sample+.svg
new file mode 100755
index 0000000..fdca11a
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-sample+.svg
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.869,0,5.209,2.228,5.209,4.985c0,2.745-2.34,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#333333" d="M42.689,38.583c-0.818,1.25-3.273,1.25-3.273,5
+ c-0.818,3.75,0,7.5-1.636,11.25c0-5,0-10-0.818-15c-0.818,0-1.636,2.5-2.455,5c-0.818-2.5-2.455-5-4.909-5
+ c-1.636,0-2.455,6.25-3.272,10c-1.636-2.5-2.455-6.25-4.909-10c0.818-1.25,2.455-5,3.273-8.75c4.091,2.5,1.636,7.5,5.727,7.5
+ c2.455,0,3.273-1.25,4.091-3.75c0.818,0,0.818,2.5,2.455,5c1.636-5-1.636-11.25,2.455-13.75
+ C39.417,29.833,36.962,37.333,42.689,38.583z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#333333" d="M45.963,24.833c0,3.75,0,8.75,1.635,12.5
+ c4.092-1.25,0.818-8.75,5.729-12.5c0,3.75-1.637,10,4.908,13.75c0-3.75-1.637-10,3.273-13.75c0,3.75-0.818,7.5,0.818,11.25
+ c0.818,1.25,3.271,2.5,4.09,3.75c-8.182-1.25-3.271,11.25-7.363,13.75c0-3.75-0.818-8.75-0.818-12.5c0,0,0-1.25-1.637-1.25
+ c-4.09,0-4.09,12.5-4.09,15c-1.637-5-2.455-10-3.273-15c-5.727,2.5-1.637,8.75-5.727,13.75c0-2.5-0.818-6.25,0-28.75H45.963z"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-sample-menu.svg b/TamTamSynthLab.activity/icons/sl-sample-menu.svg
new file mode 100644
index 0000000..d1fb3ed
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-sample-menu.svg
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,17.252c0-3.326,4.911-7.418,8.889-7.418h42.222
+ c3.979,0,8.89,4.093,8.89,7.418v27.527c0,13.838-13.424,25.055-30,25.055c-16.577,0-30-11.217-30-25.055V17.252z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.388" x2="21.547" y2="57.058"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.358" x2="62.444" y2="39.358"/>
+ <path fill="#333333" d="M42.3,38.765c-0.713,1.068-2.852,1.068-2.852,4.273c-0.712,3.206,0,6.411-1.425,9.616
+ c0-4.273,0-8.548-0.712-12.821c-0.712,0-1.424,2.137-2.138,4.273c-0.712-2.137-2.138-4.273-4.275-4.273
+ c-1.425,0-2.138,5.343-2.85,8.548c-1.425-2.137-2.138-5.343-4.276-8.548c0.712-1.068,2.138-4.273,2.851-7.479
+ c3.563,2.137,1.425,6.411,4.988,6.411c2.138,0,2.851-1.068,3.563-3.205c0.713,0,0.713,2.137,2.138,4.273
+ c1.425-4.273-1.425-9.616,2.138-11.753C39.449,31.286,37.311,37.696,42.3,38.765z"/>
+ <path fill="#333333" d="M45.15,27.012c0,3.206,0,7.479,1.424,10.685c3.563-1.068,0.713-7.479,4.99-10.685
+ c0,3.206-1.427,8.548,4.273,11.753c0-3.205-1.426-8.547,2.851-11.753c0,3.206-0.713,6.411,0.713,9.616
+ c0.713,1.068,2.85,2.137,3.562,3.205c-7.126-1.068-2.85,9.616-6.413,11.753c0-3.205-0.713-7.479-0.713-10.685
+ c0,0,0-1.068-1.426-1.068c-3.562,0-3.562,10.685-3.562,12.821c-1.426-4.273-2.139-8.548-2.851-12.821
+ c-4.988,2.137-1.426,7.479-4.988,11.753c0-2.137-0.712-5.342,0-24.574H45.15z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-speaker.svg b/TamTamSynthLab.activity/icons/sl-speaker.svg
new file mode 100755
index 0000000..b0d38a5
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-speaker.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FF0000" stroke="#333333" stroke-linecap="square" d="M29.528,20.354h23.383
+ c0,0,15.076,31.692,15.125,31.841c0.906,2.764-2.504,4.239-2.372,4.239c2.787,0-31.64-0.082-49.519-0.109
+ c-4.499-0.007-1.047-5.316-1.12-5.175C13.697,53.729,29.528,20.354,29.528,20.354z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#FF0000" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="
+ M65.648,5.702c3.083,0,5.57,1.493,5.57,3.358v11.194c0,1.866-2.487,3.358-5.57,3.358H16.792c-3.084,0-5.572-1.493-5.572-3.358V9.061
+ c0-1.866,2.488-3.358,5.572-3.358H65.648z"/>
+<circle fill-rule="evenodd" clip-rule="evenodd" fill="#FF0000" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" cx="41.816" cy="5.479" r="4.726"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-trackpadX+.svg b/TamTamSynthLab.activity/icons/sl-trackpadX+.svg
new file mode 100755
index 0000000..8122fed
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-trackpadX+.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="5.5,8.569 9.615,4.812
+ 69.386,4.812 73.5,8.569 73.5,49.617 57.114,72.812 24.151,72.812 5.5,49.617 "/>
+<circle fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" cx="39.5" cy="73.125" r="5.375"/>
+<rect x="19.5" y="14.499" fill="none" stroke="#333333" stroke-width="2" stroke-linecap="square" stroke-linejoin="round" width="40" height="40.002"/>
+<g>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.641" y1="22.411" x2="39.641" y2="49.913"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.363" y1="21.411" x2="31.861" y2="28.91"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.363" y1="49.438" x2="31.861" y2="41.938"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.641" y1="21.16" x2="47.139" y2="28.661"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.641" y1="49.689" x2="47.139" y2="42.188"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-trackpadX-menu.svg b/TamTamSynthLab.activity/icons/sl-trackpadX-menu.svg
new file mode 100644
index 0000000..45e555c
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-trackpadX-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="9.5,12.127 13.131,8.812
+ 65.871,8.812 69.5,12.127 69.5,48.346 55.041,68.812 25.957,68.812 9.5,48.346 "/>
+<rect x="21.853" y="17.359" fill="none" stroke="#333333" stroke-width="2" stroke-linecap="square" stroke-linejoin="round" width="35.294" height="35.296"/>
+<g>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.625" y1="24.341" x2="39.625" y2="48.607"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.379" y1="23.458" x2="32.76" y2="30.075"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.379" y1="48.188" x2="32.76" y2="41.569"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.625" y1="23.237" x2="46.24" y2="29.855"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="39.625" y1="48.41" x2="46.24" y2="41.79"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-trackpadY+.svg b/TamTamSynthLab.activity/icons/sl-trackpadY+.svg
new file mode 100755
index 0000000..51bac2e
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-trackpadY+.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="5.5,8.569 9.615,4.812
+ 69.386,4.812 73.5,8.569 73.5,49.617 57.114,72.812 24.151,72.812 5.5,49.617 "/>
+<circle fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" cx="39.5" cy="73.125" r="5.375"/>
+<rect x="17.001" y="10.8" fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="44.998" height="45"/>
+<g>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="24.734" y1="34.017" x2="55.7" y2="34.017"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="22.734" y1="34.396" x2="31.203" y2="42.831"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="55.859" y1="34.396" x2="47.451" y2="42.831"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="23.327" y1="34.017" x2="31.796" y2="25.549"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="56.266" y1="34.017" x2="47.857" y2="25.549"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-trackpadY-menu.svg b/TamTamSynthLab.activity/icons/sl-trackpadY-menu.svg
new file mode 100644
index 0000000..0d6598b
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-trackpadY-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<polygon fill="#FFFF33" stroke="#333333" stroke-linecap="round" stroke-miterlimit="8" points="9.5,12.127 13.131,8.812
+ 65.871,8.812 69.5,12.127 69.5,48.346 55.041,68.812 25.957,68.812 9.5,48.346 "/>
+<rect x="22" y="19" fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="35" height="35"/>
+<g>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="28.491" y1="36.581" x2="51.578" y2="36.581"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="27" y1="36.916" x2="33.314" y2="44.358"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="51.697" y1="36.916" x2="45.428" y2="44.358"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="27.442" y1="36.581" x2="33.756" y2="29.109"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="52" y1="36.581" x2="45.73" y2="29.109"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-vco+.svg b/TamTamSynthLab.activity/icons/sl-vco+.svg
new file mode 100755
index 0000000..6b20870
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-vco+.svg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679V45.62c0,16.188-15.414,29.312-34.446,29.312c-19.033,0-34.446-13.123-34.446-29.312V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.984"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.207,2.228,5.207,4.985c0,2.745-2.326,4.986-5.207,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.818,5.818
+ c0-2.758,2.328-4.985,5.195-4.985c2.869,0,5.209,2.228,5.209,4.985c0,2.745-2.34,4.986-5.209,4.986
+ C62.146,10.804,59.818,8.563,59.818,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.848
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.985-5.195,4.985
+ C36.638,78.833,34.299,76.604,34.299,73.848z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+<g>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#26282D" stroke-width="3" stroke-linecap="round" d="
+ M22.407,39.34c10.059-38.507,18.869,0,18.869,0"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="none" stroke="#26282D" stroke-width="3" stroke-linecap="round" d="
+ M60.407,40.167c-9.323,34.622-19.21-0.667-19.21-0.667"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-vco-menu.svg b/TamTamSynthLab.activity/icons/sl-vco-menu.svg
new file mode 100644
index 0000000..c73b410
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-vco-menu.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,17.252c0-3.326,4.911-7.418,8.889-7.418h42.222
+ c3.979,0,8.89,4.093,8.89,7.418v27.527c0,13.838-13.424,25.055-30,25.055c-16.577,0-30-11.217-30-25.055V17.252z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.388" x2="21.547" y2="57.058"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.358" x2="62.444" y2="39.358"/>
+ <g>
+ <path fill="none" stroke="#26282D" stroke-width="3" stroke-linecap="round" d="M24.635,39.412c8.76-32.914,16.432,0,16.432,0"/>
+ <path fill="none" stroke="#26282D" stroke-width="3" stroke-linecap="round" d="M57.73,40.119C49.61,69.712,41,39.548,41,39.548"
+ />
+ </g>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-voice+.svg b/TamTamSynthLab.activity/icons/sl-voice+.svg
new file mode 100755
index 0000000..3e19ef1
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-voice+.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M5.221,13.415c0-3.891,5.639-8.679,10.206-8.679h48.479
+ c4.568,0,10.207,4.789,10.207,8.679v32.205c0,16.188-15.414,29.311-34.446,29.311c-19.033,0-34.446-13.122-34.446-29.311V13.415z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="18.862" y1="17.083" x2="18.862" y2="59.985"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M10.417,5.818
+ c0-2.758,2.326-4.985,5.195-4.985c2.88,0,5.207,2.228,5.207,4.985c0,2.745-2.327,4.986-5.207,4.986
+ C12.743,10.804,10.417,8.563,10.417,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M26.015,5.818
+ c0-2.758,2.326-4.985,5.207-4.985c2.868,0,5.195,2.228,5.195,4.985c0,2.745-2.327,4.986-5.195,4.986
+ C28.34,10.804,26.015,8.563,26.015,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M42.917,5.818
+ c0-2.758,2.326-4.985,5.194-4.985c2.881,0,5.208,2.228,5.208,4.985c0,2.745-2.327,4.986-5.208,4.986
+ C45.243,10.804,42.917,8.563,42.917,5.818z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M59.819,5.818
+ c0-2.758,2.327-4.985,5.194-4.985c2.87,0,5.209,2.228,5.209,4.985c0,2.745-2.339,4.986-5.209,4.986
+ C62.146,10.804,59.819,8.563,59.819,5.818z"/>
+<path fill="#DF3800" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M34.299,73.847
+ c0-2.744,2.339-4.984,5.207-4.984c2.869,0,5.195,2.24,5.195,4.984c0,2.758-2.326,4.986-5.195,4.986
+ C36.638,78.833,34.299,76.604,34.299,73.847z"/>
+<path fill-rule="evenodd" clip-rule="evenodd" fill="#333333" d="M25.582,25.87c1,2,2.25,4,3.25,7c3-2,4-5,5-8c2,1,4,6,6,8
+ c2-2,3-5,4-8c3,2,3,5,6,8c2-2,3-5,4-8h3c0,2,2,5,3,8c1,0,2-2,3-3v16c-1-1-1-2-2-3c-2,3-4,7-5,10c-2-2-3-6-6-10c-2,3-3,7-5,10
+ c-2-3-3-7-5-10c-2,3-3,7-5,10c-2-3-3-7-5-10c-2,3-4,7-5,10c-5-5-4-10-4-15v-3c0.25-6.12,3.75-10.12,2.62-11.62L25.582,25.87z"/>
+<line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="19.014" y1="39.278" x2="65.82" y2="39.278"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-voice-menu.svg b/TamTamSynthLab.activity/icons/sl-voice-menu.svg
new file mode 100644
index 0000000..525b290
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-voice-menu.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#51A425" stroke="#333333" stroke-linecap="square" d="M9.667,17.252c0-3.326,4.911-7.418,8.889-7.418h42.222
+ c3.979,0,8.89,4.093,8.89,7.418v27.527c0,13.838-13.424,25.055-30,25.055c-16.577,0-30-11.217-30-25.055V17.252z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.547" y1="20.388" x2="21.547" y2="57.058"/>
+ <path fill="#333333" d="M27.4,27.898c0.871,1.709,1.96,3.419,2.831,5.983c2.613-1.709,3.484-4.273,4.354-6.838
+ c1.742,0.855,3.484,5.128,5.226,6.838c1.742-1.709,2.613-4.273,3.484-6.838c2.612,1.709,2.612,4.274,5.226,6.838
+ c1.741-1.709,2.612-4.273,3.483-6.838h2.612c0,1.709,1.742,4.274,2.613,6.838c0.871,0,1.741-1.709,2.612-2.564v13.676
+ c-0.871-0.854-0.871-1.709-1.741-2.564c-1.742,2.564-3.484,5.983-4.355,8.548c-1.741-1.709-2.612-5.129-5.225-8.548
+ c-1.742,2.564-2.613,5.983-4.355,8.548c-1.741-2.564-2.612-5.983-4.354-8.548c-1.742,2.564-2.613,5.983-4.354,8.548
+ c-1.742-2.564-2.613-5.983-4.354-8.548c-1.742,2.564-3.484,5.983-4.354,8.548c-4.355-4.273-3.484-8.548-3.484-12.821v-2.564
+ c0.218-5.231,3.266-8.65,2.282-9.933L27.4,27.898z"/>
+
+ <line fill="none" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" x1="21.68" y1="39.358" x2="62.444" y2="39.358"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-wguide+.svg b/TamTamSynthLab.activity/icons/sl-wguide+.svg
new file mode 100644
index 0000000..3dcf5a8
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-wguide+.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M3.598,23.098
+ c0-9.332,7.571-16.902,16.902-16.902h33.805c9.332,0,16.889,7.571,16.889,16.902v33.806c0,9.33-7.557,16.9-16.889,16.9H20.5
+ c-9.332,0-16.902-7.57-16.902-16.9V23.098z"/>
+</g>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,20.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,25.695,66,23.369,66,20.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,33.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.327,5.209,5.195s-2.327,5.194-5.209,5.194C68.326,38.695,66,36.368,66,33.5z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,46.499
+ c0-2.867,2.326-5.192,5.193-5.192c2.882,0,5.209,2.325,5.209,5.192c0,2.868-2.327,5.196-5.209,5.196
+ C68.326,51.695,66,49.367,66,46.499z"/>
+<path fill="#F5D04E" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M66,59.5c0-2.869,2.326-5.195,5.193-5.195
+ c2.882,0,5.209,2.326,5.209,5.195c0,2.868-2.327,5.195-5.209,5.195C68.326,64.695,66,62.368,66,59.5z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,6.195
+ C32.299,3.327,34.638,1,37.507,1c2.868,0,5.194,2.327,5.194,5.195c0,2.88-2.326,5.208-5.194,5.208
+ C34.638,11.403,32.299,9.076,32.299,6.195z"/>
+<path fill="#DF0040" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M32.299,73.805
+ c0-2.881,2.339-5.207,5.208-5.207c2.868,0,5.194,2.326,5.194,5.207c0,2.868-2.326,5.194-5.194,5.194
+ C34.638,78.999,32.299,76.673,32.299,73.805z"/>
+<line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="14.054" y1="59.664" x2="59.055" y2="59.664"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="18.729" y1="20.275" x2="18.729" y2="55.5"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="30.693" y1="26.461" x2="30.693" y2="51.094"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="40.771" y1="29.98" x2="40.771" y2="47.575"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="50.88" y1="33.501" x2="50.88" y2="44.057"/>
+<line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="58.729" y1="37.021" x2="58.729" y2="40.539"/>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/sl-wguide-menu.svg b/TamTamSynthLab.activity/icons/sl-wguide-menu.svg
new file mode 100644
index 0000000..6326493
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/sl-wguide-menu.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#3399FF" stroke="#333333" stroke-linecap="round" stroke-linejoin="round" d="M9.396,25c0-8.282,6.72-15,15.003-15
+ h30.006c8.284,0,14.991,6.719,14.991,15v30.001c0,8.28-6.707,14.998-14.991,14.998H24.398c-8.283,0-15.003-6.718-15.003-14.998V25
+ z"/>
+ </g>
+
+ <line fill="none" stroke="#333333" stroke-linecap="square" stroke-linejoin="round" x1="18.677" y1="57.451" x2="58.621" y2="57.451"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="22.827" y1="22.495" x2="22.827" y2="53.756"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="33.446" y1="27.985" x2="33.446" y2="49.846"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="42.393" y1="31.108" x2="42.393" y2="46.723"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="51.365" y1="34.232" x2="51.365" y2="43.601"/>
+
+ <line fill="none" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" x1="58.331" y1="37.356" x2="58.331" y2="40.479"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/icons/tam-help.svg b/TamTamSynthLab.activity/icons/tam-help.svg
new file mode 100644
index 0000000..2923bb3
--- /dev/null
+++ b/TamTamSynthLab.activity/icons/tam-help.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="45.395px" height="45.395px" viewBox="0 0 45.395 45.395" enable-background="new 0 0 45.395 45.395" xml:space="preserve">
+<circle fill="#808284" cx="22.297" cy="23.037" r="22.5"/>
+<circle fill="none" stroke="#4C4D4F" stroke-width="2.25" cx="22.295" cy="23.129" r="21.572"/>
+<circle fill="none" stroke="#4C4D4F" cx="22.628" cy="22.89" r="17.085"/>
+<g>
+ <path fill="#FFFFFF" stroke="#FFFFFF" d="M18.717,15.967c1.383-0.625,2.621-0.938,3.715-0.938c1.477,0,2.617,0.332,3.422,0.996
+ s1.207,1.645,1.207,2.941c0,1.344-0.871,2.738-2.613,4.184c-0.758,0.625-1.221,1.041-1.389,1.248s-0.303,0.459-0.404,0.756
+ s-0.152,0.668-0.152,1.113v0.645h-1.605v-0.668c0-1.359,0.434-2.418,1.301-3.176l1.547-1.359c0.5-0.422,0.867-0.85,1.102-1.283
+ s0.352-0.896,0.352-1.389c0-0.812-0.258-1.436-0.773-1.869s-1.219-0.65-2.109-0.65c-0.805,0-1.82,0.289-3.047,0.867L18.717,15.967z
+ M21.905,29.198c0.414,0,0.762,0.141,1.043,0.422s0.422,0.629,0.422,1.043c0,0.422-0.143,0.783-0.428,1.084
+ s-0.631,0.451-1.037,0.451c-0.398,0-0.738-0.15-1.02-0.451s-0.422-0.662-0.422-1.084s0.139-0.771,0.416-1.049
+ S21.498,29.198,21.905,29.198z"/>
+</g>
+</svg>
diff --git a/TamTamSynthLab.activity/setup.py b/TamTamSynthLab.activity/setup.py
new file mode 100644
index 0000000..5b21f11
--- /dev/null
+++ b/TamTamSynthLab.activity/setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+# Copyright (C) 2006, Red Hat, Inc.
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+from sugar.activity import bundlebuilder
+
+bundlebuilder.start('TamTam')
diff --git a/common/Config.py b/common/Config.py
new file mode 100644
index 0000000..47dd713
--- /dev/null
+++ b/common/Config.py
@@ -0,0 +1,599 @@
+# -*- coding: utf-8 -*-
+import os
+import Util.InstrumentDB as InstrumentDB
+
+QUICKLOAD = os.path.isfile("QUICKLOAD") # skip loading inessential comenents to speed things up
+
+SugarMode = True
+try:
+ from sugar import env
+except ImportError:
+ SugarMode = False
+
+if os.path.isfile("DEBUG"):
+ f = open("DEBUG")
+ l = f.read(10)
+ f.close()
+ if len(l): DEBUG = int( l )
+ else: DEBUG = 99
+else:
+ DEBUG = 0
+print "Debug Level %d" % (DEBUG)
+
+
+TAM_TAM_ROOT = os.path.dirname(os.path.abspath(__file__))
+print 'INFO: loaded TAMTAM_ROOT=%s' % TAM_TAM_ROOT
+
+
+#PATHS
+if os.path.isdir('/usr/share/activities/TamTamEdit.activity/Resources/Sounds'):
+ SOUNDS_DIR = "/usr/share/activities/TamTamEdit.activity/Resources/Sounds"
+else:
+ SOUNDS_DIR = TAM_TAM_ROOT + "/Resources/Sounds"
+FILES_DIR = TAM_TAM_ROOT + "/Resources"
+TUNE_DIR='/'
+SYNTH_DIR='/'
+if SugarMode == True:
+ PREF_DIR = env.get_profile_path() + '/tamtam'
+ TUNE_DIR=env.get_profile_path() + '/tamtam/tunes'
+ SYNTH_DIR=env.get_profile_path() + '/tamtam/synthlab'
+ SNDS_DIR=env.get_profile_path() + '/tamtam/snds'
+ SCRATCH_DIR = PREF_DIR + "/.scratch/"
+else:
+ PREF_DIR = os.getenv('HOME') + '/.tamtam'
+ TUNE_DIR= os.getenv('HOME') + '/.tamtam/tunes'
+ SYNTH_DIR= os.getenv('HOME') + '/.tamtam/synthlab'
+ SNDS_DIR= os.getenv('HOME') + '/.tamtam/snds'
+ SCRATCH_DIR = PREF_DIR + "/.scratch/"
+
+#PLUGIN
+PLUGIN_DEBUG = PREF_DIR + "/clooper.log"
+PLUGIN_VERBOSE = 0
+PLUGIN_UNIVORC = TAM_TAM_ROOT + "/Resources/tamtamorc.csd"
+PLUGIN_KSMPS = 64
+PLUGIN_RATE = 16000
+#PLUGIN_KSMPS = 64
+#PLUGIN_RATE = 22050
+
+## PLUGIN ALSA PARAMETERS:
+
+## for macbook pro
+#PLUGIN_PERIOD = 1024
+#PLUGIN_NPERIODS = 4
+
+## for XO with root
+#PLUGIN_PERIOD = 256
+#PLUGIN_NPERIODS = 2
+
+## for XO as normal user
+PLUGIN_PERIOD = 256 #512
+PLUGIN_NPERIODS = 2
+
+##############
+## SOUNDS
+##############
+KIT_ELEMENT = 24 * [0]
+for i in range(0,13):
+ KIT_ELEMENT += 2 * [i]
+KIT_ELEMENT = tuple(KIT_ELEMENT)
+
+class Instrument:
+ def __init__( self, name, instrumentId, csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit = None ):
+ self.name = name
+ self.instrumentId = instrumentId
+ self.csoundInstrumentId = csoundInstrumentId
+ self.instrumentRegister = instrumentRegister
+ self.soundClass = soundClass
+ self.category = category
+ self.loopStart = loopStart
+ self.loopEnd = loopEnd
+ self.crossDur = crossDur
+ self.kit = kit
+ #print (self.name, self.instrumentId, self.csoundInstrumentId, self.instrumentRegister, self.soundClass, self.category, self.loopStart, self.loopEnd, self.crossDur)
+
+LOW, MID, HIGH, PUNCH = range( 4 )
+
+# Sounds categories: musicInst, animals, drum, people, electronic, concret, mic
+#INSTRUMENTS ( csound table, csound instrument, register, instrumentClass, category )
+INSTRUMENT_TABLE_OFFSET = 5000
+INST_FREE = 5000
+INST_TIED = 5001
+INST_SIMP = 5011
+INST_PERC = 5021
+
+CATEGORIES = ['all','animals','concret','keyboard','people','percussions','strings','winds', 'mysounds']
+
+instrumentDB = InstrumentDB.getRef()
+
+_nextInstrumentId = [0]
+INSTRUMENTS = {}
+def _addInstrument( name, csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit = None ):
+ if not QUICKLOAD or name[0:4] == "drum" or name in ["flute", "kalimba"]: # quick load
+ INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit )
+ instrumentDB.addInstrumentFromArgs( name, name, instrumentRegister, loopStart, loopEnd, crossDur, name, FILES_DIR+"/Images/"+name+".png", [ category ] )
+ _nextInstrumentId[0] += 1
+
+
+_addInstrument( "mic1", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 )
+_addInstrument( "mic2", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 )
+_addInstrument( "mic3", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 )
+_addInstrument( "mic4", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 )
+_addInstrument( "lab1", INST_SIMP, MID, 'melo', 'lab', 0, 0, 0 )
+_addInstrument( "lab2", INST_SIMP, MID, 'melo', 'lab', 0, 0, 0 )
+_addInstrument( "lab3", INST_SIMP, MID, 'melo', 'lab', 0, 0, 0 )
+_addInstrument( "lab4", INST_SIMP, MID, 'melo', 'lab', 0, 0, 0 )
+_addInstrument( "lab5", INST_SIMP, MID, 'melo', 'lab', 0, 0, 0 )
+_addInstrument( "lab6", INST_SIMP, MID, 'melo', 'lab', 0, 0, 0 )
+_addInstrument( "ounk", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "gam", INST_TIED, HIGH, 'melo', 'percussions', .69388, .7536, .02922 )
+_addInstrument( "guit", INST_TIED, MID, 'melo', 'strings', .08592, .75126, .33571 )
+_addInstrument( "koto", INST_TIED, HIGH, 'melo', 'strings', .56523, .70075, .05954 )
+_addInstrument( "clarinette", INST_TIED, MID, 'melo', 'winds', .57905, .73319, .04934 )
+_addInstrument( "flute", INST_TIED, MID, 'melo', 'winds', .47169, .53693, .02481 )
+_addInstrument( "drum1hatpedal", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1hatshoulder", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1hardride", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1ridebell", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1snare", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1snaresidestick", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1crash", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1splash", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1tom", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1floortom", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0)
+_addInstrument( "drum1chine", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum1kick", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "piano", INST_TIED, MID, 'melo', 'keyboard', 0.8883, 1.420524, .13575 )
+_addInstrument( "dog", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "duck", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "drum2darbukadoom", INST_SIMP, LOW, 'drum', 'drum', 0, 0 ,0 )
+_addInstrument( "drum2darbukapied", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2darbukapiedsoft", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2hatflanger", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2darbukatak", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2darbukafinger", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2darbukaroll", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2darbukaslap", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2hatpied", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2tambourinepied", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2hatpied2", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum2tambourinepiedsoft", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3cowbell", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3cowbelltip", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0)
+_addInstrument( "drum3cup", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3djembelow", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3djembemid", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3djembesidestick", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3djembeslap", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3djembestickmid", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3metalstand", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3pedalperc", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3rainstick", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3tambourinehigh", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum3tambourinelow", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "harmonica", INST_TIED, MID, 'melo', 'winds', .1531, .19188, .01792 )
+_addInstrument( "alarm", INST_TIED, MID, 'melo', 'concret', .02, .19133, .01 )
+_addInstrument( "bird", INST_TIED, MID, 'melo', 'animals', .1, 1, .05 )
+_addInstrument( "cat", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "duck2", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "bottle", INST_TIED, MID, 'melo', 'concret', .20532, .41064, .05292 )
+_addInstrument( "clang", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "ow", INST_SIMP, MID, 'melo', 'people', 0, 0, 0 )
+_addInstrument( "sheep", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "water", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "zap", INST_TIED, MID, 'melo', 'keyboard', .299, .7323, .09895 )
+_addInstrument( "trumpet", INST_TIED, MID, 'melo', 'winds', .39934, .45537, .02729)
+_addInstrument( "bubbles", INST_TIED, MID, "melo", 'concret', 0.02, 1.177, 0.02)
+_addInstrument( "marimba", INST_TIED, MID, "melo", 'percussions', .26545, .33098, .03087)
+_addInstrument( "triangle", INST_TIED, MID, "melo", 'percussions', 1.21002, 1.31805, .01268)
+_addInstrument( "laugh", INST_SIMP, MID, 'melo', 'people', 0, 0, 0 )
+_addInstrument( "voix", INST_TIED, MID, 'melo', 'people', .89608, .96092, .02343 )
+_addInstrument( "cling", INST_TIED, MID, 'melo', 'keyboard', .09096, .7878, .18026 )
+_addInstrument( "byke", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "door", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "basse", INST_TIED, MID, 'melo', 'strings', 0.50470875, 0.833315, 0.09375 )
+_addInstrument( "acguit", INST_TIED, MID, 'melo', 'strings', 0.5123225, 0.7491675, 0.08475 )
+_addInstrument( "diceinst", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "didjeridu", INST_TIED, LOW, 'melo', 'winds', .55669, 1.73704, .09178 )
+_addInstrument( "harmonium", INST_TIED, MID, 'melo', 'keyboard', .04674, .41073, .18384 )
+_addInstrument( "horse", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 )
+_addInstrument( "kalimba", INST_TIED, MID, 'melo', 'percussions', .20751, .30161, .04658 )
+_addInstrument( "mando", INST_TIED, MID, 'melo', 'strings', 0.316548, 0.532008, 0.02875 )
+_addInstrument( "ocarina", INST_TIED, MID, 'melo', 'winds', .06612, .19033, .01776 )
+_addInstrument( "rhodes", INST_TIED, MID, 'melo', 'keyboard', 0.58100625, 0.821625, 0.067 )
+_addInstrument( "saxo", INST_TIED, MID, 'melo', 'winds', .53722, .6583, .05264 )
+_addInstrument( "shenai", INST_TIED, MID, 'melo', 'winds', .29003, .33072, .00634 )
+_addInstrument( "sitar", INST_TIED, MID, 'melo', 'strings', .63187, .67882, .01654 )
+_addInstrument( "tuba", INST_TIED, LOW, 'melo', 'winds', .51063, .58384, .035 )
+_addInstrument( "violin", INST_TIED, MID, 'melo', 'strings', .105, .30656, .028 )
+_addInstrument( "guidice1", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice2", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice3", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice4", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice5", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice6", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice7", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice8", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice9", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guidice10", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "drum4afrofeet", INST_SIMP, LOW, 'drum', 'drum', 0, 0 ,0 )
+_addInstrument( "drum4fingersn", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4mutecuic", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4stompbass", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tambouri", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr707clap", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr707open", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr808closed", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr808sn", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr909bass", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr909kick", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum4tr909sn", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5timablesslap", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5congagraveouvert", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5timablesaiguslap", INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5congagraveferme", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5guiroretour", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5vibraslap", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5congaaiguouvert", INST_SIMP, MID, 'drum', 'drum', 0, 0 ,0 )
+_addInstrument( "drum5quicamedium", INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5quicaaigu", INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5agogograve", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5bongoaiguouvert", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5agogoaigu", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "drum5bongograveouvert", INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 )
+_addInstrument( "camera", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "car", INST_TIED, MID, 'melo', 'concret', .67, 1.05761, .01 )
+#_addInstrument( "cello", INST_TIED, MID, 'melo', 'strings', .194, .7211, .017 )
+_addInstrument( "chimes", INST_TIED, MID, 'melo', 'percussions', .09, 2.97633, .01 )
+_addInstrument( "crash", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "guit2", INST_TIED, MID, 'melo', 'strings', .33, 1.1583, .02 )
+_addInstrument( "plane", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+_addInstrument( "slap", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )
+
+try:
+ ifile = open(PREF_DIR + '/sounds_settings', 'r')
+ for line in ifile.readlines():
+ list = line.split()
+ _addInstrument(list[0], int(list[1]), int(list[2]), list[3], list[4], float(list[5]), float(list[6]), float(list[7]))
+except:
+ pass
+
+
+DRUM1KIT = { 24 : INSTRUMENTS["drum1kick"],
+ 26 : INSTRUMENTS["drum1floortom"],
+ 28 : INSTRUMENTS["drum1tom"],
+ 30 : INSTRUMENTS["drum1chine"],
+ 32 : INSTRUMENTS["drum1splash"],
+ 34 : INSTRUMENTS["drum1crash"],
+ 36 : INSTRUMENTS["drum1snaresidestick"],
+ 38 : INSTRUMENTS["drum1snaresidestick"],
+ 40 : INSTRUMENTS["drum1snare"],
+ 42 : INSTRUMENTS["drum1ridebell"],
+ 44 : INSTRUMENTS["drum1hardride"],
+ 46 : INSTRUMENTS["drum1hatshoulder"],
+ 48 : INSTRUMENTS["drum1hatpedal"] }
+
+DRUM2KIT = { 24 : INSTRUMENTS["drum2darbukadoom"],
+ 26 : INSTRUMENTS["drum2darbukapied"],
+ 28 : INSTRUMENTS["drum2darbukapiedsoft"],
+ 30 : INSTRUMENTS["drum2hatflanger"],
+ 32 : INSTRUMENTS["drum2darbukatak"],
+ 34 : INSTRUMENTS["drum2darbukatak"],
+ 36 : INSTRUMENTS["drum2darbukafinger"],
+ 38 : INSTRUMENTS["drum2darbukaroll"],
+ 40 : INSTRUMENTS["drum2darbukaslap"],
+ 42 : INSTRUMENTS["drum2hatpied"],
+ 44 : INSTRUMENTS["drum2tambourinepied"],
+ 46 : INSTRUMENTS["drum2hatpied2"],
+ 48 : INSTRUMENTS["drum2tambourinepiedsoft"] }
+
+DRUM3KIT = { 24 : INSTRUMENTS["drum3djembelow"],
+ 26 : INSTRUMENTS["drum3pedalperc"],
+ 28 : INSTRUMENTS["drum3djembeslap"],
+ 30 : INSTRUMENTS["drum3tambourinehigh"],
+ 32 : INSTRUMENTS["drum3tambourinelow"],
+ 34 : INSTRUMENTS["drum3rainstick"],
+ 36 : INSTRUMENTS["drum3djembemid"],
+ 38 : INSTRUMENTS["drum3djembesidestick"],
+ 40 : INSTRUMENTS["drum3djembestickmid"],
+ 42 : INSTRUMENTS["drum3cowbell"],
+ 44 : INSTRUMENTS["drum3cowbelltip"],
+ 46 : INSTRUMENTS["drum3cup"],
+ 48 : INSTRUMENTS["drum3metalstand"] }
+
+DRUM4KIT = { 24 : INSTRUMENTS["drum4afrofeet"],
+ 26 : INSTRUMENTS["drum4tr909kick"],
+ 28 : INSTRUMENTS["drum4tr909bass"],
+ 30 : INSTRUMENTS["drum4stompbass"],
+ 32 : INSTRUMENTS["drum4tr707open"],
+ 34 : INSTRUMENTS["drum4mutecuic"],
+ 36 : INSTRUMENTS["drum4tr808sn"],
+ 38 : INSTRUMENTS["drum4tr707clap"],
+ 40 : INSTRUMENTS["drum4tr909sn"],
+ 42 : INSTRUMENTS["drum4tambouri"],
+ 44 : INSTRUMENTS["drum4fingersn"],
+ 46 : INSTRUMENTS["drum4fingersn"],
+ 48 : INSTRUMENTS["drum4tr808closed"] }
+
+DRUM5KIT = { 24 : INSTRUMENTS["drum5timablesslap"],
+ 26 : INSTRUMENTS["drum5timablesaiguslap"],
+ 28 : INSTRUMENTS["drum5congagraveouvert"],
+ 30 : INSTRUMENTS["drum5quicamedium"],
+ 32 : INSTRUMENTS["drum5guiroretour"],
+ 34 : INSTRUMENTS["drum5vibraslap"],
+ 36 : INSTRUMENTS["drum5congagraveferme"],
+ 38 : INSTRUMENTS["drum5quicaaigu"],
+ 40 : INSTRUMENTS["drum5congaaiguouvert"],
+ 42 : INSTRUMENTS["drum5agogoaigu"],
+ 44 : INSTRUMENTS["drum5bongograveouvert"],
+ 46 : INSTRUMENTS["drum5agogograve"],
+ 48 : INSTRUMENTS["drum5bongoaiguouvert"] }
+
+_addInstrument( "drum1kit", 0, 0, 0, "kit", 0, 0, 0, DRUM1KIT )
+_addInstrument( "drum2kit", 0, 0, 0, "kit", 0, 0, 0, DRUM2KIT )
+_addInstrument( "drum3kit", 0, 0, 0, "kit", 0, 0, 0, DRUM3KIT )
+_addInstrument( "drum4kit", 0, 0, 0, "kit", 0, 0, 0, DRUM4KIT )
+_addInstrument( "drum5kit", 0, 0, 0, "kit", 0, 0, 0, DRUM5KIT )
+
+INSTRUMENTSID = {}
+for i in INSTRUMENTS:
+ INSTRUMENTSID[INSTRUMENTS[i].instrumentId] = INSTRUMENTS[i]
+
+
+#DRUMKITS = ['drum1kit', 'drum2kit', 'drum3kit', 'drum4kit']
+#DRUMSINSTRUMENTSDICT = [DRUM1KIT, DRUM2KIT, DRUM3KIT, DRUM4KIT]
+
+RECORDABLE_INSTRUMENTS = set( [ "mic1", "mic2", "mic3", "mic4" ] )
+RECORDABLE_INSTRUMENT_CSOUND_IDS = { "mic1" : 7,
+ "mic2" : 8,
+ "mic3" : 9,
+ "mic4" : 10 }
+
+#CSOUND COMMANDS
+CSOUND_LOAD_INSTRUMENT = 'f%d 0 0 -1 "%s" 0 0 0'
+CSOUND_MIC_RECORD = 'i5201 0 5 %d'
+CSOUND_UNLOAD_TABLES = 'i%d 0 0.1 %d' % (INST_FREE, len(INSTRUMENTS))
+CSOUND_NOTE_OFF = 'i %s.%s .2 0.01 1. 0. 0. 0.5 %d 0 0 0 0' %('%d','%d',INSTRUMENT_TABLE_OFFSET)
+CSOUND_LOAD_LS_INSTRUMENT = 'f4999 0 0 -1 \"%s\" 0 0 0'
+CSOUND_PLAY_LS_NOTE = 'i %i 0 -1'
+CSOUND_STOP_LS_NOTE = 'i 5022 0 0.5'
+
+#CSOUND COMMANDS - DEPRECATED
+
+LOAD_INSTRUMENT_COMMAND = \
+ "perf.InputMessage('f%d 0 0 -1 \"%s\" 0 0 0')\n"
+PLAY_NOTE_COMMAND = \
+ "perf.InputMessage('i %d.%d %f %f %f %f %f %f %d %f %f %d %f %f %f %f')\n"
+#TODO: add the extra three params to COMMAND_MINUS_DELAY, and instrument 5777 in univorc.csd
+PLAY_NOTE_COMMAND_MINUS_DELAY = \
+ "perf.InputMessage('i 5777 0.0 0.001 %d.%d %s %f %f %f %f %f %d %f %f %d %f')\n"
+PLAY_NOTE_OFF_COMMAND = \
+ "perf.InputMessage('i %s.%s .2 0.01 1. 0. 0. 0.5 %d 0 0 0 0')\n" \
+ % ('%d', '%d', INSTRUMENT_TABLE_OFFSET )
+MIC_RECORDING_COMMAND = \
+ "perf.InputMessage('i5201 0 5 %d')\n"
+UNLOAD_TABLES_COMMAND = \
+ "perf.InputMessage('i%d 0 0.1 %d')\n" % (INST_FREE, len(INSTRUMENTS))
+
+
+
+
+#################
+## GUI CONSTANTS
+#################
+
+LANGUAGE = 'En'
+IMAGE_ROOT = TAM_TAM_ROOT + '/Resources/Images/'
+
+MAIN_WINDOW_PADDING = 5
+
+BG_COLOR = '#404040'
+FG_COLOR = '#818286'
+
+NOTE_HEIGHT = 9 # pixels
+NOTE_IMAGE_PADDING = 6
+NOTE_IMAGE_PADDING_MUL2 = NOTE_IMAGE_PADDING*2
+NOTE_IMAGE_TAIL = 1059
+NOTE_IMAGE_ENDLENGTH = 12
+HIT_HEIGHT = 13 # pixels
+HIT_IMAGE_PADDING = 6
+HIT_IMAGE_PADDING_MUL2 = HIT_IMAGE_PADDING*2
+TRACK_SPACING = 4
+TRACK_SPACING_DIV2 = TRACK_SPACING//2
+TRACK_COLORS = [ ( "#00290B", "#00E847" ), \
+ ( "#3F0200", "#E72500" ), \
+ ( "#002642", "#0090EA" ), \
+ ( "#313D00", "#F9EF00" ), \
+ ( "#17083B", "#4A00ED" ) ]
+#TRACK_COLORS = [ ( "#00591B", "#00E847" ), \
+# ( "#6F1200", "#E72500" ), \
+# ( "#004682", "#0090EA" ), \
+# ( "#716D00", "#F9EF00" ), \
+# ( "#37187B", "#4A00ED" ) ]
+BEAT_COLOR = "#999999"
+BEAT_LINE_SIZE = 2
+PLAYHEAD_COLOR = "#666666"
+PLAYHEAD_SIZE = 2
+PLAYHEAD_SIZE_DIV2 = PLAYHEAD_SIZE/2.0
+MARQUEE_COLOR = "#FFFFFF"
+MARQUEE_SIZE = 2
+
+PAGE_BORDER_SIZE = 2
+PAGE_SELECTED_BORDER_SIZE = 5
+PAGE_WIDTH = 100
+PAGE_HEIGHT = 25
+
+PAGE_THUMBNAIL_WIDTH = 92
+PAGE_THUMBNAIL_WIDTH_DIV2 = PAGE_THUMBNAIL_WIDTH/2
+PAGE_THUMBNAIL_HEIGHT = 65
+
+THUMBNAIL_TRACK_RECT = [ ( 2, 4, 83, 10 ), \
+ ( 2, 14, 83, 10 ), \
+ ( 2, 24, 83, 10 ), \
+ ( 2, 34, 83, 10 ), \
+ ( 2, 44, 83, 13 ) ]
+THUMBNAIL_DRAG_COLOR = "#000000"
+THUMBNAIL_TRACK_COLOR = "#FF0000"
+THUMBNAIL_SELECTED_COLOR = "#2266FF"
+THUMBNAIL_DISPLAYED_COLOR = "#CC1133"
+
+TOOLBAR_BCK_COLOR = '#404040'
+WHITE_COLOR = '#FFFFFF'
+### miniTamTam/SYNTHLAB SPECIFIC ###
+INST_BCK_COLOR = '#999999'
+PANEL_BCK_COLOR = '#CCCCCC'
+PANEL_COLOR = '#CCCCCC'
+SL_LINE_COLOR = "#666666"
+SL_HIGHLIGHT_COLOR = "#FFFFFF"
+SL_OVER_WIRE_COLOR = "#FFFFFF"
+SL_OVER_GATE_COLOR = "#00FF18"
+SL_OVER_GATE_REJECT_COLOR = "#B30000"
+PANEL_RADIUS = 10
+PANEL_SPACING = 2
+
+###Instrument Panel###
+CATEGORY_BCK_COLOR = '#222222'
+INSTRUMENT_GRID_COLOR = '#CCCCCC'
+
+###Welcome Screen Specific###
+WS_PANEL_COLOR = '#404040'
+WS_BCK_COLOR = '#CCCCCC'
+
+# hardware keycodes for mod keys
+MOD_LSHIFT = 50
+MOD_RSHIFT = 62
+MOD_LCTRL = 37
+MOD_RCTRL = 109
+MOD_LALT = 64
+MOD_RALT = 113
+
+
+
+########
+## Things that don't belong!
+#######
+class _ModKeys:
+ def __init__( self ):
+ self.shiftDown = False
+ self.ctrlDown = False
+ self.altDown = False
+
+ def keyPress( self, code ):
+ if code == MOD_LSHIFT or code == MOD_RSHIFT: self.shiftDown = True
+ elif code == MOD_LCTRL or code == MOD_RCTRL: self.ctrlDown = True
+ elif code == MOD_LALT or code == MOD_RALT: self.altDown = True
+
+ def keyRelease( self, code ):
+ if code == MOD_LSHIFT or code == MOD_RSHIFT: self.shiftDown = False
+ elif code == MOD_LCTRL or code == MOD_RCTRL: self.ctrlDown = False
+ elif code == MOD_LALT or code == MOD_RALT: self.altDown = False
+
+ModKeys = _ModKeys()
+
+
+############
+## EDIT DEFAULTS
+############
+
+#DEFAULTS
+PLAYER_TEMPO = 100
+PLAYER_TEMPO_LOWER = 30
+PLAYER_TEMPO_UPPER = 160
+DEFAULT_VOLUME = 50
+
+#NUMERICAL CONSTANTS
+NUMBER_OF_POSSIBLE_PITCHES = 25
+MINIMUM_PITCH = 24
+MAXIMUM_PITCH = MINIMUM_PITCH + NUMBER_OF_POSSIBLE_PITCHES - 1
+NUMBER_OF_POSSIBLE_PITCHES_DRUM = 13
+PITCH_STEP_DRUM = 2
+MINIMUM_PITCH_DRUM = 24
+MAXIMUM_PITCH_DRUM = MINIMUM_PITCH_DRUM + PITCH_STEP_DRUM*(NUMBER_OF_POSSIBLE_PITCHES_DRUM - 1)
+MINIMUM_NOTE_DURATION = 1 # ticks
+MS_PER_MINUTE = 60000.0
+TICKS_PER_BEAT = 12
+TICKS_PER_BEAT_DIV2 = TICKS_PER_BEAT/2
+MAXIMUM_BEATS = 12 # maximum beats per page
+NUMBER_OF_TRACKS = 5
+NUMBER_OF_PAGES = 2
+
+MINIMUM_AMPLITUDE = 0
+MAXIMUM_AMPLITUDE = 1
+
+DEFAULT_GRID = 3
+DEFAULT_GRID_DIV2 = DEFAULT_GRID / 2.0
+
+
+####################
+## ToolTips
+####################
+LANGUAGE = 'en'
+exec 'from Resources.tooltips_%s import Tooltips' % LANGUAGE
+
+
+####################
+## KeyMapping
+####################
+
+LOOP_KEYS = [17, 18, 19, 20, 21, 32, 33, 34, 35, 45, 46, 47, 48, 51, 60, 61]
+# Key = Hardware Keycode Value = Note
+
+KEY_MAP_PIANO = {24:36, #Q
+ 25:38, #W
+ 26:40, #E
+ 27:41, #R
+ 28:43, #T
+ 29:45, #Y
+ 30:47, #U
+ 31:48, #I
+
+ 11:37, #2
+ 12:39, #3
+ 14:42, #5
+ 15:44, #6
+ 16:46, #7
+
+ 39:25, #S
+ 40:27, #D
+ 42:30, #G
+ 43:32, #H
+ 44:34, #J
+ 46:37, #L
+
+ 52:24, #Z
+ 53:26, #X
+ 54:28, #C
+ 55:29, #V
+ 56:31, #B
+ 57:33, #N
+ 58:35, #M
+ 59:36} #,
+
+KEY_MAP_NOTPIANO = {24:24, #Q
+ 25:25, #W
+ 26:26, #E
+ 27:27, #R
+ 28:28, #T
+ 29:29, #Y
+ 30:30, #U
+ 31:31, #I
+ 32:32, #O
+ 33:33, #P
+
+ 38:34, #A
+ 39:35, #S
+ 40:36, #D
+ 41:37, #F
+ 42:38, #G
+ 43:39, #H
+ 44:40, #J
+ 45:41, #K
+ 46:42, #L
+
+ 52:43, #Z
+ 53:44, #X
+ 54:45, #C
+ 55:46, #V
+ 56:47, #B
+ 57:48} #N
+
+KEY_MAP = KEY_MAP_PIANO
diff --git a/common/Generation/Drunk.py b/common/Generation/Drunk.py
new file mode 100755
index 0000000..1bc3bbb
--- /dev/null
+++ b/common/Generation/Drunk.py
@@ -0,0 +1,162 @@
+# Random:
+# Randomly choose, within a certain range, a new next value
+# arg 1: maxStepSize (negative value not allowed stepSize == 0)
+# arg 2: maximum value allowed
+
+import random
+
+class Drunk:
+ def __init__( self, minValue, maxValue, trackLength=None ):
+ self.minValue = min(minValue, maxValue)
+ self.maxValue = max(minValue, maxValue)
+ self.lastValue = random.randint( self.minValue, self.maxValue )
+
+
+ def getNextValue( self, maxStepSize, maxValue ):
+ if self.lastValue < 0 or self.lastValue > maxValue:
+ return random.randint( self.minValue, maxValue )
+
+ direction = self.getDirection( maxValue )
+ stepSize = self.getStepSize( direction, abs(maxStepSize), maxValue )
+
+ if maxStepSize < 0:
+ minStepSize = 1
+ else:
+ minStepSize = 0
+
+ self.lastValue += direction * random.randint( minStepSize, stepSize )
+
+ if self.lastValue < self.minValue:
+ self.lastValue = self.minValue
+ elif self.lastValue > maxValue: #instead of 14...
+ self.lastValue = maxValue
+ else:
+ self.lastValue = self.lastValue
+
+ return self.lastValue
+
+ def getDirection( self, maxValue ):
+ if self.lastValue == 0:
+ return 1
+ elif self.lastValue == maxValue:
+ return -1
+ else:
+ return random.choice( [ 1, -1 ] )
+
+ def getStepSize( self, direction, maxStepSize, maxValue, ):
+ if direction == -1:
+ return min( maxStepSize, self.lastValue )
+ else:
+ return min( maxStepSize, maxValue - self.lastValue )
+
+class DroneAndJump( Drunk ):
+ def __init__( self, minValue, maxValue, trackLength=None ):
+ Drunk.__init__( self, minValue, maxValue, trackLength=None )
+ self.minValue = min(minValue, maxValue)
+ self.maxValue = max(minValue, maxValue)
+ self.beforeLastValue = random.randint( self.minValue, self.maxValue ) #self.minValue
+ self.lastValue = self.beforeLastValue + 1
+
+ def getNextValue( self, maxStepSize, maxValue ):
+ if self.beforeLastValue != self.lastValue:
+ self.lastValue = self.beforeLastValue
+ return self.beforeLastValue
+
+ self.beforeLastValue = self.lastValue
+ self.lastValue = Drunk.getNextValue( self, abs(maxStepSize), maxValue )
+ return self.lastValue
+
+ def getStepSize( self, direction, maxStepSize, maxValue ):
+ if random.randint( 0, 100 ) < 42:
+ return Drunk.getStepSize( self, direction, maxStepSize, maxValue )
+ else:
+ return Drunk.getStepSize( self, direction, 0, maxValue )
+
+class Repeter( Drunk ):
+ def __init__( self, minValue, maxValue, trackLength=None ):
+ Drunk.__init__( self, minValue, maxValue, trackLength=None)
+ self.minValue = min(minValue, maxValue)
+ self.maxValue = max(minValue, maxValue)
+ self.lastValue = random.randint( self.minValue, self.maxValue)
+
+ def getNextValue( self, maxStepSize, maxValue ):
+ self.lastValue = Drunk.getNextValue( self, abs(maxStepSize), maxValue )
+ return self.lastValue
+
+ def getStepSize( self, direction, maxStepSize, maxValue ):
+ if random.randint( 0, 100 ) < 20:
+ return Drunk.getStepSize( self, direction, maxStepSize, maxValue )
+ else:
+ return Drunk.getStepSize( self, direction, 0, maxValue )
+
+class Loopseg( Drunk ):
+ def __init__( self, minValue, maxValue, trackLength=None ):
+ Drunk.__init__( self, minValue, maxValue, trackLength=None )
+ self.recordedValues = []
+ self.recordState = 2
+ self.recordPlayback = 0
+ self.loopPlayback = 1
+ self.recordLength = random.randint( 3, 6 )
+ self.recordLoopTime = random.randint( 1, 4 )
+
+ def getNextValue( self, maxStepSize, maxValue ):
+ if self.recordState == 2:
+ self.lastValue = Drunk.getNextValue( self, maxStepSize, maxValue )
+ self.recordState = random.choice([2, 2, 2, 1])
+
+ if len(self.recordedValues) != self.recordLength and self.recordState == 1:
+ self.lastValue = Drunk.getNextValue( self, maxStepSize, maxValue )
+ self.recordedValues.append( self.lastValue )
+ elif self.recordState == 1 or self.recordState == 0:
+ self.recordState = 0
+ if self.recordPlayback < self.recordLength:
+ self.loopAround()
+ else:
+ if self.loopPlayback < self.recordLoopTime:
+ self.recordPlayback = 0
+ self.loopPlayback += 1
+ self.loopAround()
+ else:
+ self.recordedValues = []
+ self.recordState = 2
+ self.recordPlayback = 0
+ self.loopPlayback = 1
+ self.recordLength = random.randint( 3, 6 )
+ self.recordLoopTime = random.randint( 1, 4 )
+ self.lastValue = Drunk.getNextValue( self, maxStepSize, maxValue )
+ self.recordedValues = [self.lastValue]
+ return self.lastValue
+
+ def loopAround( self ):
+ self.lastValue = self.recordedValues[self.recordPlayback]
+ self.recordPlayback += 1
+
+class Line:
+ def __init__(self, minValue, maxValue, trackLength=20):
+ maxVal = max(minValue, maxValue)
+ if maxVal == minValue:
+ self.reverse = True
+ minVal = maxValue
+ self.lastValue = maxVal
+ else:
+ self.reverse = False
+ minVal = minValue
+ self.lastValue = minVal
+
+ scale = float(maxVal - minVal)
+ if self.reverse:
+ self.inc = -scale/trackLength
+ else:
+ self.inc = scale/trackLength
+
+ def getNextValue(self, rand, maxValue):
+ self.val = self.lastValue + int(random.randint(0, rand)*random.choice([-0.5,0.5]))
+ if self.val < 0:
+ self.val = 0
+ elif self.val > maxValue:
+ self.val = maxValue
+ else:
+ self.val = self.val
+ self.lastValue = self.val+self.inc
+ return self.val
+
diff --git a/common/Generation/GenerationConstants.py b/common/Generation/GenerationConstants.py
new file mode 100755
index 0000000..29dd28b
--- /dev/null
+++ b/common/Generation/GenerationConstants.py
@@ -0,0 +1,184 @@
+import random
+
+class GenerationConstants:
+
+ TWO_ROOT_TWELVE = pow( 2, 1./12 )
+ MAX_NOTES_PER_BAR = 12
+
+ PHRASE_LENGTH = 4
+ PHRASE_COMPLEXITY = .5
+
+ TABLE_ONSET_VALUES = [ 3, 3, 6, 3, 6, 12, 4, 3, 6, 6, 12, 6, 12, 18, 8, 6, 12, 18, 12, 24, 12, 18, 36, 24, 36, 24, 48 ]
+ LOOP_TABLE_ONSET_VALUES = [ 3, 3, 6, 3, 6, 12, 6, 3, 6, 6, 12, 6, 12, 18, 12, 6, 12, 18, 12, 24, 12, 18, 12, 24, 18, 24, 24 ]
+
+ # scaling constants
+ MAJOR = 0
+ HARMONIC_MINOR = 1
+ NATURAL_MINOR = 2
+ PHRYGIEN = 3
+ DORIEN = 4
+ LYDIEN = 5
+ MYXOLYDIEN = 6
+
+ SCALES = { MAJOR : [ -12, -10, -8, -7, -5, -3, -1, 0, 2, 4, 5, 7, 9, 11, 12 ],
+ HARMONIC_MINOR : [ -12, -10, -9, -7, -5, -4, -1, 0, 2, 3, 5, 7, 8, 11, 12 ],
+ NATURAL_MINOR : [ -12, -10, -9, -7, -5, -4, -2, 0, 2, 3, 5, 7, 8, 10, 12 ],
+ PHRYGIEN : [ -12, -11, -9, -7, -5, -4, -2, 0, 1, 3, 5, 7, 8, 10, 12 ],
+ DORIEN : [ -12, -10, -9, -7, -5, -3, -2, 0, 2, 3, 5, 7, 9, 10, 12 ],
+ LYDIEN : [ -12, -10, -8, -6, -5, -3, -1, 0, 2, 4, 6, 7, 9, 11, 12 ],
+ MYXOLYDIEN : [ -12, -10, -8, -7, -5, -3, -2, 0, 2, 4, 5, 7, 9, 10, 12 ]}
+
+
+ # Default parameters for algorithmic generation
+
+ RYTHM_DENSITY_BANK = [.25, .88, .72, 1, .25]
+ RYTHM_REGU_BANK = [.75, .8, .85, .4, .5]
+ PITCH_REGU_BANK = [.5, .8, 0, .85, .9]
+ PITCH_STEP_BANK = [.5, .3, 1, .22, .85]
+ DURATION_BANK = [.8, 1, .8, 1, 1]
+ SILENCE_BANK = [.2, .5, .25, .55, .12]
+ SCALE_BANK = [MAJOR, NATURAL_MINOR, LYDIEN, HARMONIC_MINOR, MYXOLYDIEN]
+
+ chooseDefault = random.randint(0,4)
+ DEFAULT_DENSITY = RYTHM_DENSITY_BANK[chooseDefault]
+ DEFAULT_RYTHM_REGULARITY = RYTHM_REGU_BANK[chooseDefault]
+ DEFAULT_PITCH_REGULARITY = PITCH_REGU_BANK[chooseDefault]
+ DEFAULT_STEP = PITCH_STEP_BANK[chooseDefault]
+ DEFAULT_DURATION = DURATION_BANK[chooseDefault]
+ DEFAULT_SILENCE = SILENCE_BANK[chooseDefault]
+ DEFAULT_PATTERN = [random.randint(0,3) for x in range(4)]
+ DEFAULT_SCALE = SCALE_BANK[chooseDefault]
+
+ DEFAULT_RYTHM_METHOD = 0
+ DEFAULT_PITCH_METHOD = 0
+ DEFAULT_PAN = 0.5
+
+ DEFAULT_PITCH_VARIATION = 0 # 0 = 'melodic' 1 = 'harmonic'
+ DEFAULT_RYTHM_VARIATION = 0 # 0 = 'Cellule' 1 = 'Xnoise'
+
+ DEFAULT_TONIQUE = 36
+
+ I = [ 0, 2, 4, 7, 9, 11, 14 ]
+ II = [ 1, 3, 5, 8, 10, 12 ]
+ III = [ 2, 4, 6, 9, 11, 13 ]
+ IV = [ 0, 3, 5, 7, 10, 12, 14 ]
+ V = [ 1, 4, 6, 8, 11, 13 ]
+ VI = [ 0, 2, 5, 7, 9, 12, 14 ]
+ VII = [ 1, 3, 6, 8, 10, 13 ]
+
+ CHORDS_TABLE = [ I, V, I, II, V, I, VI, II, V, I, IV, VI, II, V, I, V, VI ]
+# CHORDS_TABLE = [I, V, I, V, I, V, I, V, I, V, I, V, I, V ]
+ # pitch patterns constants
+ # PITCH_PATTERNS = [ 'Drunk', 'DroneAndJump', 'Repeter', 'Loopseg' ]
+
+ # Parameters for probability scaling function
+ REPETITION_SCALE_MIN_MAPPING = 0
+ REPETITION_SCALE_MAX_MAPPING = 25
+ REPETITION_SCALE_STEPS = 25
+ DENSITY_SCALE_MIN_MAPPING = 0
+ DENSITY_SCALE_MAX_MAPPING = 38
+ DENSITY_SCALE_STEPS = 38
+ ARTICULATION_SCALE_MIN_MAPPING = .6
+ ARTICULATION_SCALE_MAX_MAPPING = 1
+ ARTICULATION_SCALE_STEPS = 10
+
+ # Rythmic durations, in ticks, and how many to complete figure (celluleRythmSequence)
+ DOUBLE_TICK_DUR = 3
+ DOUBLE_HOW_MANY = 2
+ HALF_TRIPLET_TICK_DUR = 4
+ HALF_TRIPLET_HOW_MANY = 3
+ HOLE_TRIPLET_TICK_DUR = 8
+ HOLE_TRIPLET_HOW_MANY = 3
+
+ # Random generators default values (xnoiseRythmSequence)
+ RANDOM_BETA_PARAM = 0.004
+ RANDOM_EXPO_PARAM = 5
+ RANDOM_GAUSS_PARAM1 = 0.5
+ RANDOM_GAUSS_PARAM2 = 0.1
+ RANDOM_WEIBULL_PARAM1 = 0.5
+
+ RANDOM_WEIBULL_PARAM2 = 2.5
+
+ # Onsets probability tables (drumRythmSequence)
+
+ PUNCH_ACCENTS = [ [],
+ [ 0 ],
+ [ 0, 1 ],
+ [ 0, 2, 1 ],
+ [ 0, 2, 3, 1 ],
+ [ 0, 3, 2, 4, 1],
+ [ 0, 3, 2, 5, 1, 4 ],
+ [ 0, 2, 4, 6, 5, 3, 1 ],
+ [ 0, 4, 2, 6, 3, 7, 5, 1 ],
+ [ 0, 4, 6, 2, 8, 5, 3, 7, 1],
+ [ 0, 6, 4, 8, 2, 5, 7, 3, 9, 1],
+ [ 0, 4, 6, 10, 8, 2, 5, 7, 9, 3, 1],
+ [0, 6, 4, 2, 8, 10, 7, 5, 3, 9, 11, 1] ]
+
+
+ LOW_ACCENTS = [ [],
+ [ 0 ],
+ [ 0, 1 ],
+ [ 0, 2, 1 ],
+ [ 0, 2, 3, 1 ],
+ [ 0, 3, 2, 4, 1 ],
+ [ 0, 3, 2, 5, 1, 4 ],
+ [ 0, 2, 4, 6, 5, 3, 1 ],
+ [ 0, 4, 2, 6, 3, 7, 5, 1 ],
+ [ 0, 4, 6, 2, 8, 5, 3, 7, 1 ],
+ [ 0, 6, 4, 8, 2, 5, 7, 3, 9, 1 ],
+ [ 0, 4, 6, 10, 8, 2, 5, 7, 9, 3, 1 ],
+ [0, 6, 4, 2, 8, 10, 7, 5, 3, 9, 11, 1 ] ]
+
+ MID_ACCENTS = [ [],
+ [ 0, 1 ],
+ [ 0, 2, 3, 1 ],
+ [ 0, 2, 4, 3, 1, 5 ],
+ [ 0, 4, 6, 2, 7, 1, 3, 5 ],
+ [ 0, 6, 4, 8, 2, 1, 5, 3, 9, 7 ],
+ [ 0, 6, 11, 5, 3, 9, 10, 2, 8, 7, 1, 4 ],
+ [ 0, 4, 8, 12, 10, 13, 11, 9, 3, 2, 6, 5, 7, 1 ],
+ [ 0, 8, 4, 12, 6, 14, 2, 10, 7, 15, 1, 9, 3, 11, 5, 13 ],
+ [ 0, 8, 16, 4, 12, 14, 6, 2, 10, 7, 15, 1, 9, 3, 17, 11, 5, 13],
+ [ 0, 10, 8, 4, 16, 12, 6, 14, 18, 2, 7, 9, 15, 3, 1, 19, 5, 11, 13, 17],
+ [ 0, 8, 10, 16, 4, 20, 6, 12, 18, 14, 2, 9, 7, 3, 15, 21, 19, 1, 5, 11, 17, 13],
+ [ 0, 10, 8, 4, 16, 6, 20, 22, 18, 12, 2, 14, 7, 9, 15, 3, 19, 1, 21, 5, 23, 17, 11, 13] ]
+
+ HIGH_ACCENTS = [ [],
+ [ 1, 0 ],
+ [ 1, 3, 2, 0 ],
+ [ 5, 1, 3, 4, 2, 0 ],
+ [ 5, 3, 1, 7, 2, 6, 4, 0 ],
+ [ 7, 9, 3, 5, 1, 2, 8, 4, 6, 0 ],
+ [ 4, 1, 7, 5, 3, 9, 10, 2, 8, 11, 6, 0 ],
+ [ 1, 7, 8, 5, 10, 13, 11, 9, 3, 2, 6, 12, 4, 0 ],
+ [ 13, 5, 11, 3, 9, 1, 15, 10, 7, 2, 14, 6, 12, 4, 8, 0 ],
+ [ 13, 5, 11, 17, 3, 9, 1, 15, 7, 10, 2, 6, 14, 12, 4, 16, 8, 0 ],
+ [ 17, 13, 11, 5, 19, 1, 3, 15, 9, 7, 2, 18, 14, 6, 12, 16, 4, 8, 10, 0 ],
+ [ 13, 17, 11, 5, 1, 19, 21, 15, 3, 7, 9, 2, 14, 18, 12, 6, 20, 4, 16, 10, 8, 0 ],
+ [ 13, 11, 17, 23, 5, 21, 1, 19, 3, 15, 9, 7, 14, 2, 12, 18, 22, 20, 6, 16, 4, 8, 10, 0 ] ]
+
+ DRUM_PUNCH_ACCENTS = [[], [0], [0, 12], [0, 24, 12], [0, 24, 36, 12], [0, 36, 24, 48, 12], [0, 36, 24, 60, 12, 48], [0, 24, 48, 72, 60, 36, 12], [0, 48, 24, 72, 36, 84, 60, 12], [0, 48, 72, 24, 96, 60, 36, 84, 12], [0, 72, 48, 96, 24, 60, 84, 36, 108, 12], [0, 48, 72, 120, 96, 24, 60, 84, 108, 36, 12], [0, 72, 48, 24, 96, 120, 84, 60, 36, 108, 132, 12]]
+ DRUM_LOW_ACCENTS = [[], [0], [0, 12], [0, 24, 12], [0, 24, 36, 12], [0, 36, 24, 48, 12], [0, 36, 24, 60, 12, 48], [0, 24, 48, 72, 60, 36, 12], [0, 48, 24, 72, 36, 84, 60, 12], [0, 48, 72, 24, 96, 60, 36, 84, 12], [0, 72, 48, 96, 24, 60, 84, 36, 108, 12], [0, 48, 72, 120, 96, 24, 60, 84, 108, 36, 12], [0, 72, 48, 24, 96, 120, 84, 60, 36, 108, 132, 12]]
+ DRUM_MID_ACCENTS = [[], [0, 6], [0, 12, 18, 6], [0, 12, 24, 18, 6, 30], [0, 24, 36, 12, 42, 6, 18, 30], [0, 36, 24, 48, 12, 6, 30, 18, 54, 42], [0, 36, 66, 30, 18, 54, 60, 12, 48, 42, 6, 24], [0, 24, 48, 72, 60, 78, 66, 54, 18, 12, 36, 30, 42, 6], [0, 48, 24, 72, 36, 84, 12, 60, 42, 90, 6, 54, 18, 66, 30, 78], [0, 48, 96, 24, 72, 84, 36, 12, 60, 42, 90, 6, 54, 18, 102, 66, 30, 78], [0, 60, 48, 24, 96, 72, 36, 84, 108, 12, 42, 54, 90, 18, 6, 114, 30, 66, 78, 102], [0, 48, 60, 96, 24, 120, 36, 72, 108, 84, 12, 54, 42, 18, 90, 126, 114, 6, 30, 66, 102, 78], [0, 60, 48, 24, 96, 36, 120, 132, 108, 72, 12, 84, 42, 54, 90, 18, 114, 6, 126, 30, 138, 102, 66, 78]]
+ DRUM_HIGH_ACCENTS = [[], [6, 0], [6, 18, 12, 0], [30, 6, 18, 24, 12, 0], [30, 18, 6, 42, 12, 36, 24, 0], [42, 54, 18, 30, 6, 12, 48, 24, 36, 0], [24, 6, 42, 30, 18, 54, 60, 12, 48, 66, 36, 0], [6, 42, 48, 30, 60, 78, 66, 54, 18, 12, 36, 72, 24, 0], [78, 30, 66, 18, 54, 6, 90, 60, 42, 12, 84, 36, 72, 24, 48, 0], [78, 30, 66, 102, 18, 54, 6, 90, 42, 60, 12, 36, 84, 72, 24, 96, 48, 0], [102, 78, 66, 30, 114, 6, 18, 90, 54, 42, 12, 108, 84, 36, 72, 96, 24, 48, 60, 0], [78, 102, 66, 30, 6, 114, 126, 90, 18, 42, 54, 12, 84, 108, 72, 36, 120, 24, 96, 60, 48, 0], [78, 66, 102, 138, 30, 126, 6, 114, 18, 90, 54, 42, 84, 12, 72, 108, 132, 120, 36, 96, 24, 48, 60, 0]]
+
+ # Gain boundaries
+ GAIN_MAX_BOUNDARY = 1.
+ GAIN_MID_MAX_BOUNDARY = .9
+ GAIN_MID_MIN_BOUNDARY = .75
+ GAIN_MIN_BOUNDARY = .65
+
+ # pitch mapping for drum kit
+ DRUMPITCH = {25: 24, 27: 26, 29: 28, 31: 30, 33: 32, 35: 34, 37: 36, 39: 38, 41: 40, 43: 42, 45: 44, 47: 46 }
+
+ DRUM_COMPLEXITY1 = [ [ 24 ], [30] , [ 40 ], [ 46 ] ]
+ DRUM_COMPLEXITY2 = [ [ 24, 28 ], [ 30, 32 ], [ 36, 40 ], [ 46, 48 ] ]
+ DRUM_COMPLEXITY3 = [ [ 24, 26, 28 ], [ 30, 32, 34 ], [ 36, 38, 40 ], [ 42, 46, 48 ] ]
+ DRUM_COMPLEXITY4 = [ [ 24, 26, 28 ], [ 30, 32, 34 ], [ 36, 38, 40 ], [ 42, 44, 46, 48 ] ]
+
+ TRANSPOSE = [0.5, 0.52973154717964765, 0.56123102415468651, 0.59460355750136051, 0.6299605249474366, 0.66741992708501718, 0.70710678118654757, 0.74915353843834076, 0.79370052598409979, 0.8408964152537145, 0.89089871814033927, 0.94387431268169353, 1.0, 1.0594630943592953, 1.122462048309373, 1.189207115002721, 1.2599210498948732, 1.3348398541700344, 1.4142135623730951, 1.4983070768766815, 1.5874010519681994, 1.681792830507429, 1.7817974362806785, 1.8877486253633868, 2.0]
+
+ CELLULES_MARKERS = [ 8, 16, 21, 24 ]
+ CELLULES = [ [ 3, 3, 3, 3 ], [ 3, 3, 6 ], [ 3, 6, 3 ], [ 6, 3, 3 ], [ 4, 4, 4 ], [ 4, 8 ], [ 8, 4 ], [ 6, 6 ], [ 12 ], [ 6, 12, 6 ], [ 8, 8, 8 ], [ 8, 16 ], [ 16, 8 ], [ 12, 12 ], [ 18, 6 ],
+ [ 6, 18 ], [ 24 ], [ 12, 12, 12 ], [ 18, 18 ], [ 24, 12 ], [ 12, 24 ], [ 36 ], [ 12, 24, 12 ], [ 24, 24 ], [ 48 ] ]
diff --git a/common/Generation/GenerationParametersWindow.py b/common/Generation/GenerationParametersWindow.py
new file mode 100755
index 0000000..bde409d
--- /dev/null
+++ b/common/Generation/GenerationParametersWindow.py
@@ -0,0 +1,383 @@
+import pygtk
+pygtk.require('2.0')
+import gtk
+import shelve
+from Generation.Generator import GenerationParameters
+from Generation.GenerationConstants import GenerationConstants
+from Util.ThemeWidgets import *
+import Config
+
+Tooltips = Config.Tooltips()
+
+class GenerationParametersWindow( gtk.VBox ):
+ def __init__( self, generateFunction, handleCloseWindowCallback ):
+ gtk.VBox.__init__( self )
+ self.handleCloseWindowCallback = handleCloseWindowCallback
+ self.tooltips = gtk.Tooltips()
+
+ self.rythmMethod = GenerationConstants.DEFAULT_RYTHM_METHOD
+ self.pitchMethod = GenerationConstants.DEFAULT_PITCH_METHOD
+ self.pattern = GenerationConstants.DEFAULT_PATTERN
+ self.scale = GenerationConstants.DEFAULT_SCALE
+ self.sourceVariation = 1
+ self.generateFunction = generateFunction
+ self.setupWindow()
+ self.show_all()
+
+ def setupWindow( self ):
+ self.GUI = {}
+ self.rythmDensity = GenerationConstants.DEFAULT_DENSITY
+ self.rythmRegularity = GenerationConstants.DEFAULT_RYTHM_REGULARITY
+ self.pitchRegularity = GenerationConstants.DEFAULT_PITCH_REGULARITY
+ self.pitchStep = GenerationConstants.DEFAULT_STEP
+ self.duration = GenerationConstants.DEFAULT_DURATION
+ self.silence = GenerationConstants.DEFAULT_SILENCE
+
+ # Generation Panel Setup
+ generationBox = RoundVBox(fillcolor=Config.INST_BCK_COLOR, bordercolor=Config.PANEL_BCK_COLOR)
+ generationBox.set_border_width(1)
+ generationBox.set_radius(10)
+ XYSlidersBox = gtk.HBox()
+
+ self.col = gtk.gdk.color_parse(Config.PANEL_COLOR)
+
+ XYSlider1Box = gtk.VBox()
+ XYSlider1UpBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ XYSlider1UpBox.set_border_width(3)
+ XYSlider1UpBox.set_radius(10)
+ self.XYSlider1DownBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ self.XYSlider1DownBox.set_border_width(3)
+ self.XYSlider1DownBox.set_radius(10)
+
+ self.slider1Label = gtk.DrawingArea()
+ self.slider1Label.modify_bg(gtk.STATE_NORMAL, self.col)
+ colormap = self.slider1Label.get_colormap()
+ self.bgColor = colormap.alloc_color( Config.PANEL_COLOR, True, True )
+ self.slider1Label.set_size_request(228, 60)
+ self.slider1Label.connect("expose-event", self.draw )
+ XYSliderBox1 = self.formatRoundBox( RoundFixed(), Config.PANEL_COLOR )
+ XYSliderBox1.set_size_request( 250, 250 )
+ self.GUI["XYButton1"] = ImageToggleButton( Config.IMAGE_ROOT+"XYbut.png", Config.IMAGE_ROOT+"XYbutDown.png", backgroundFill=Config.PANEL_COLOR )
+ self.XAdjustment1 = gtk.Adjustment( self.rythmDensity*100, 0, 100, 1, 1, 1 )
+ self.XAdjustment1.connect("value-changed", self.handleXAdjustment1)
+ self.YAdjustment1 = gtk.Adjustment( self.rythmRegularity*100, 0, 100, 1, 1, 1 )
+ self.YAdjustment1.connect("value-changed", self.handleYAdjustment1)
+ self.GUI["xySlider1"] = XYSlider( XYSliderBox1, self.GUI["XYButton1"], self.XAdjustment1, self.YAdjustment1, False, True )
+ XYSlider1UpBox.pack_start( self.GUI["xySlider1"], False, False )
+
+ self.XYSlider1DownBox.pack_start(self.slider1Label, False, False, 5)
+ XYSlider1Box.pack_start(XYSlider1UpBox)
+ XYSlider1Box.pack_start(self.XYSlider1DownBox)
+ XYSlidersBox.pack_start(XYSlider1Box, False, False, 5)
+
+
+ XYSlider2Box = gtk.VBox()
+ XYSlider2UpBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ XYSlider2UpBox.set_border_width(3)
+ XYSlider2UpBox.set_radius(10)
+ self.XYSlider2DownBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ self.XYSlider2DownBox.set_border_width(3)
+ self.XYSlider2DownBox.set_radius(10)
+
+ self.slider2Label = gtk.DrawingArea()
+ self.slider2Label.modify_bg(gtk.STATE_NORMAL, self.col)
+ self.slider2Label.set_size_request(228, 60)
+ self.slider2Label.connect("expose-event", self.draw2 )
+ XYSliderBox2 = self.formatRoundBox( RoundFixed(), Config.PANEL_COLOR )
+ XYSliderBox2.set_size_request( 250, 250 )
+ self.GUI["XYButton2"] = ImageToggleButton( Config.IMAGE_ROOT+"XYbut.png", Config.IMAGE_ROOT+"XYbutDown.png", backgroundFill=Config.PANEL_COLOR )
+ self.XAdjustment2 = gtk.Adjustment( self.pitchRegularity*100, 0, 100, 1, 1, 1 )
+ self.XAdjustment2.connect("value-changed", self.handleXAdjustment2)
+ self.YAdjustment2 = gtk.Adjustment( self.pitchStep*100, 0, 100, 1, 1, 1 )
+ self.YAdjustment2.connect("value-changed", self.handleYAdjustment2)
+ self.GUI["xySlider2"] = XYSlider( XYSliderBox2, self.GUI["XYButton2"], self.XAdjustment2, self.YAdjustment2, False, True )
+ XYSlider2UpBox.pack_start( self.GUI["xySlider2"], False, False )
+
+ self.XYSlider2DownBox.pack_start(self.slider2Label, False, False, 5)
+ XYSlider2Box.pack_start(XYSlider2UpBox)
+ XYSlider2Box.pack_start(self.XYSlider2DownBox)
+ XYSlidersBox.pack_start(XYSlider2Box, False, False, 5)
+
+
+ XYSlider3Box = gtk.VBox()
+ XYSlider3UpBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ XYSlider3UpBox.set_border_width(3)
+ XYSlider3UpBox.set_radius(10)
+ self.XYSlider3DownBox = RoundHBox(fillcolor=Config.PANEL_COLOR, bordercolor=Config.INST_BCK_COLOR)
+ self.XYSlider3DownBox.set_border_width(3)
+ self.XYSlider3DownBox.set_radius(10)
+
+ self.slider3Label = gtk.DrawingArea()
+ self.slider3Label.modify_bg(gtk.STATE_NORMAL, self.col)
+ self.slider3Label.set_size_request(228, 60)
+ self.slider3Label.connect("expose-event", self.draw3 )
+ XYSliderBox3 = self.formatRoundBox( RoundFixed(), Config.PANEL_COLOR )
+ XYSliderBox3.set_size_request( 250, 250 )
+ self.GUI["XYButton3"] = ImageToggleButton( Config.IMAGE_ROOT+"XYbut.png", Config.IMAGE_ROOT+"XYbutDown.png", backgroundFill=Config.PANEL_COLOR )
+ self.XAdjustment3 = gtk.Adjustment( self.duration*100, 0, 100, 1, 1, 1 )
+ self.XAdjustment3.connect("value-changed", self.handleXAdjustment3)
+ self.YAdjustment3 = gtk.Adjustment( self.silence*100, 0, 100, 1, 1, 1 )
+ self.YAdjustment3.connect("value-changed", self.handleYAdjustment3)
+ self.GUI["xySlider3"] = XYSlider( XYSliderBox3, self.GUI["XYButton3"], self.XAdjustment3, self.YAdjustment3, False, True )
+ XYSlider3UpBox.pack_start( self.GUI["xySlider3"], False, False )
+
+ self.XYSlider3DownBox.pack_start(self.slider3Label, False, False, 5)
+ XYSlider3Box.pack_start(XYSlider3UpBox)
+ XYSlider3Box.pack_start(self.XYSlider3DownBox)
+ XYSlidersBox.pack_start(XYSlider3Box, False, False, 5)
+
+ generationBox.pack_start(XYSlidersBox, False, False, 5)
+
+ self.pack_start(generationBox)
+
+ # Meta Algo panel setup
+ metaAlgoBox = RoundVBox(fillcolor=Config.INST_BCK_COLOR, bordercolor=Config.PANEL_BCK_COLOR)
+ metaAlgoBox.set_border_width(1)
+ metaAlgoBox.set_radius(10)
+
+ methodBox = gtk.HBox()
+ self.firstButton = None
+ methodNames = ['drunk', 'droneJump', 'repeat', 'loopSeg']
+ for meth in methodNames:
+ self.GUI[meth] = ImageRadioButton(self.firstButton, Config.IMAGE_ROOT + meth + '.png', Config.IMAGE_ROOT + meth + 'Down.png', Config.IMAGE_ROOT + meth + 'Over.png', backgroundFill=Config.INST_BCK_COLOR )
+ if self.firstButton == None:
+ self.firstButton = self.GUI[meth]
+ self.GUI[meth].connect('clicked' , self.handleMethod , methodNames.index(meth))
+ if methodNames.index(meth) == self.pattern:
+ self.GUI[meth].set_active(True)
+ methodBox.pack_start(self.GUI[meth], False, False)
+ metaAlgoBox.pack_start(methodBox, False, False, 5)
+
+ scaleBox = gtk.HBox()
+ self.firstButton = None
+ scaleNames = ['majorKey', 'minorHarmKey', 'minorKey', 'phrygienKey', 'dorienKey', 'lydienKey', 'myxoKey']
+ for scale in scaleNames:
+ self.GUI[scale] = ImageRadioButton(self.firstButton, Config.IMAGE_ROOT + scale + '.png', Config.IMAGE_ROOT + scale + 'Down.png', Config.IMAGE_ROOT + scale + 'Over.png', backgroundFill=Config.INST_BCK_COLOR )
+ if self.firstButton == None:
+ self.firstButton = self.GUI[scale]
+ self.GUI[scale].connect('clicked' , self.handleScale , scaleNames.index(scale))
+ if scaleNames.index(scale) == self.scale:
+ self.GUI[scale].set_active(True)
+ scaleBox.pack_start(self.GUI[scale], False, False)
+ metaAlgoBox.pack_start(scaleBox, False, False)
+
+ self.pack_start(metaAlgoBox)
+
+ # Transport Panel Setup
+ transportBox = RoundVBox(fillcolor=Config.INST_BCK_COLOR, bordercolor=Config.PANEL_BCK_COLOR)
+ transportBox.set_border_width(1)
+ transportBox.set_radius(10)
+
+ # Create save/load presets
+ transButtonBox = RoundHBox(fillcolor=Config.INST_BCK_COLOR, bordercolor=Config.PANEL_BCK_COLOR)
+ transButtonBox.set_radius(10)
+
+ self.GUI["saveButton"] = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/save.png', backgroundFill=Config.INST_BCK_COLOR )
+ self.GUI["saveButton"].connect("clicked", self.handleSave, None)
+ #transButtonBox.pack_start(self.GUI["saveButton"], False, False, 2)
+
+ self.GUI["loadButton"] = ImageButton(Config.TAM_TAM_ROOT + '/Resources/Images/load.png', backgroundFill=Config.INST_BCK_COLOR )
+ self.GUI["loadButton"].connect("clicked", self.handleLoad, None)
+ #transButtonBox.pack_start(self.GUI["loadButton"], False, False, 2)
+
+ # create cancel/check button
+ self.GUI["checkButton"] = ImageButton(Config.IMAGE_ROOT + 'check.png', backgroundFill=Config.INST_BCK_COLOR )
+ self.GUI["checkButton"].connect("clicked", self.generate)
+
+ self.GUI["cancelButton"] = ImageButton(Config.IMAGE_ROOT + 'closeA.png', backgroundFill=Config.INST_BCK_COLOR )
+ self.GUI["cancelButton"].connect("clicked", self.cancel)
+
+ # create play/stop buttons
+ playButton = ImageToggleButton(Config.IMAGE_ROOT + 'playTogOff.png', Config.IMAGE_ROOT + 'playTogOn.png', backgroundFill=Config.INST_BCK_COLOR )
+ selButton = ImageToggleButton(Config.IMAGE_ROOT + 'playAll.png', Config.IMAGE_ROOT + 'playSel.png', backgroundFill=Config.INST_BCK_COLOR )
+ transButtonBox.pack_end(self.GUI["checkButton"], False, False, 10)
+ transButtonBox.pack_end(self.GUI["cancelButton"], False, False)
+ #transButtonBox.pack_end(selButton, False, False)
+ #transButtonBox.pack_end(playButton, False, False)
+ transportBox.pack_start(transButtonBox)
+
+ self.pack_start(transportBox)
+ self.loadPixmaps()
+ # set tooltips
+ for key in self.GUI:
+ if Tooltips.ALGO.has_key(key):
+ self.tooltips.set_tip(self.GUI[key],Tooltips.ALGO[key])
+
+ def loadPixmaps( self ):
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ self.gc.foreground = self.bgColor
+
+ self.arrowPixmap = []
+ for i in range(2):
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT + ['arrowSide.png', 'arrowUp.png'][i])
+ map = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ map.draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ map.draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.arrowPixmap.append(map)
+
+ self.rythDensPixmap = []
+ self.rythRegPixmap = []
+ self.pitchRegPixmap = []
+ self.pitchStepPixmap = []
+ self.durPixmap = []
+ self.silencePixmap = []
+ pixmaps = [self.rythDensPixmap, self.rythRegPixmap, self.pitchRegPixmap, self.pitchStepPixmap, self.durPixmap, self.silencePixmap]
+ pixmapNames = ['rythDens', 'rythReg', 'pitReg', 'pitStep', 'durLen', 'durDens']
+
+ for inc in range(6):
+ imgName = pixmapNames[inc]
+ pixmap = pixmaps[inc]
+ for i in range(6):
+ pix = gtk.gdk.pixbuf_new_from_file(Config.IMAGE_ROOT + imgName + str(i+1) + '.png')
+ map = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ map.draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ map.draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ pixmap.append(map)
+
+
+ def draw( self, widget, event ):
+ imgX = 5 - int(self.rythmDensity * 5)
+ imgY = 5 - int(self.rythmRegularity * 5)
+ widget.window.draw_drawable( self.gc, self.arrowPixmap[0], 0, 0, 0, 18, 24, 24 )
+ widget.window.draw_drawable( self.gc, self.rythDensPixmap[imgX], 0, 0, 24, 0, 90, 60 )
+ widget.window.draw_drawable( self.gc, self.arrowPixmap[1], 0, 0, 114, 18, 24, 24 )
+ widget.window.draw_drawable( self.gc, self.rythRegPixmap[imgY], 0, 0, 138, 0, 90, 60 )
+ return True
+
+ def draw2( self, widget, event ):
+ imgX = 5 - int(self.pitchRegularity * 5)
+ imgY = 5 - int(self.pitchStep * 5)
+ widget.window.draw_drawable( self.gc, self.arrowPixmap[0], 0, 0, 0, 18, 24, 24 )
+ widget.window.draw_drawable( self.gc, self.pitchRegPixmap[imgX], 0, 0, 24, 0, 90, 60 )
+ widget.window.draw_drawable( self.gc, self.arrowPixmap[1], 0, 0, 114, 18, 24, 24 )
+ widget.window.draw_drawable( self.gc, self.pitchStepPixmap[imgY], 0, 0, 138, 0, 90, 60 )
+ return True
+
+ def draw3( self, widget, event ):
+ imgX = int(self.duration * 5)
+ imgY = int(self.silence * 5)
+ widget.window.draw_drawable( self.gc, self.arrowPixmap[0], 0, 0, 0, 18, 24, 24 )
+ widget.window.draw_drawable( self.gc, self.durPixmap[imgX], 0, 0, 24, 0, 90, 60 )
+ widget.window.draw_drawable( self.gc, self.arrowPixmap[1], 0, 0, 114, 18, 24, 24 )
+ widget.window.draw_drawable( self.gc, self.silencePixmap[imgY], 0, 0, 138, 0, 90, 60 )
+ return True
+
+
+ def handleXAdjustment1( self, data ):
+ self.rythmDensity = self.XAdjustment1.value * .01
+ self.slider1Label.queue_draw()
+
+ def handleYAdjustment1( self, data ):
+ self.rythmRegularity = self.YAdjustment1.value * .01
+ self.slider1Label.queue_draw()
+
+ def handleXAdjustment2( self, data ):
+ self.pitchRegularity = self.XAdjustment2.value * .01
+ self.slider2Label.queue_draw()
+
+ def handleYAdjustment2( self, data ):
+ self.pitchStep = self.YAdjustment2.value * .01
+ self.slider2Label.queue_draw()
+
+ def handleXAdjustment3( self, data ):
+ self.duration = self.XAdjustment3.value * .01
+ self.slider3Label.queue_draw()
+
+ def handleYAdjustment3( self, data ):
+ self.silence = self.YAdjustment3.value * .01
+ self.slider3Label.queue_draw()
+
+
+ def getGenerationParameters( self ):
+ return GenerationParameters( self.rythmDensity,
+ self.rythmRegularity,
+ self.pitchStep,
+ self.pitchRegularity,
+ self.duration,
+ self.silence,
+ self.rythmMethod,
+ self.pitchMethod,
+ self.pattern,
+ self.scale )
+
+ def cancel( self, widget, data=None ):
+ self.handleCloseWindowCallback()
+
+ def generate(self, widget, data=None):
+ self.generateFunction( self.getGenerationParameters() )
+ self.handleCloseWindowCallback()
+
+ def handleMethod( self, widget, method ):
+ if widget.get_active():
+ self.pattern = method
+
+ def handleScale( self, widget, scale ):
+ if widget.get_active():
+ self.scale = scale
+
+ def formatRoundBox( self, box, fillcolor ):
+ box.set_radius( 10 )
+ box.set_border_width( 1 )
+ box.set_fill_color( fillcolor )
+ box.set_border_color( Config.INST_BCK_COLOR )
+ return box
+
+
+#=========================== PRESETS ================================
+
+ def handleSave(self, widget, data):
+ chooser = gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE,gtk.RESPONSE_OK))
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ try:
+ print 'INFO: save preset file %s' % chooser.get_filename()
+ f = shelve.open( chooser.get_filename(), 'n')
+ self.saveState(f)
+ f.close()
+ except IOError:
+ print 'ERROR: failed to save preset to file %s' % chooser.get_filename()
+
+ chooser.destroy()
+
+ def handleLoad(self, widget, data):
+
+ chooser = gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+
+ if chooser.run() == gtk.RESPONSE_OK:
+ try:
+ print 'INFO: load preset state from file %s' % chooser.get_filename()
+ f = shelve.open( chooser.get_filename(), 'r')
+ self.loadState(f)
+ f.close()
+ except IOError:
+ print 'ERROR: failed to load preset state from file %s' % chooser.get_filename()
+
+ def loadState( self, state ):
+ pass
+ self.rythmDensity = state['rythmDensity']
+ self.rythmRegularity = state['rythmRegularity']
+ self.pitchRegularity = state['pitchRegularity']
+ self.pitchStep = state['pitchStep']
+ self.duration = state['duration']
+ self.silence = state['silence']
+ self.pattern = state['pattern']
+ self.scale = state['scale']
+
+ self.XAdjustment1.set_value(self.rythmDensity*100)
+ self.YAdjustment1.set_value(self.rythmRegularity*100)
+ self.XAdjustment2.set_value(self.pitchRegularity*100)
+ self.YAdjustment2.set_value(self.pitchStep*100)
+ self.XAdjustment3.set_value(self.duration*100)
+ self.YAdjustment3.set_value(self.silence*100)
+
+ def saveState( self, state ):
+ pass
+ state['rythmDensity'] = self.rythmDensity
+ state['rythmRegularity'] = self.rythmRegularity
+ state['pitchRegularity'] = self.pitchRegularity
+ state['pitchStep'] = self.pitchStep
+ state['duration'] = self.duration
+ state['silence'] = self.silence
+ state['pattern'] = self.pattern
+ state['scale'] = self.scale
diff --git a/common/Generation/GenerationPitch.py b/common/Generation/GenerationPitch.py
new file mode 100644
index 0000000..4012589
--- /dev/null
+++ b/common/Generation/GenerationPitch.py
@@ -0,0 +1,40 @@
+import random
+import Drunk
+
+import common.Config as Config
+from Generation.GenerationConstants import GenerationConstants
+
+class GenerationPitch:
+ def __init__( self ):
+ MIN = 0
+ MAX = 14
+ self.drunkMethod = Drunk.Drunk( MIN, MAX )
+ self.droneMethod = Drunk.DroneAndJump( MIN, MAX )
+ self.repeatMethod = Drunk.Repeter( MIN, MAX )
+ self.loopMethod = Drunk.Loopseg( MIN, MAX )
+ self.methodList = [self.drunkMethod, self.droneMethod, self.repeatMethod, self.loopMethod]
+
+ def drunkPitchSequence(self, length, parameters, table_pitch, trackId):
+ pitchSequence = []
+ append = pitchSequence.append
+ numberOfPitch = int( ( 1 - (parameters.pitchRegularity*.8) ) * 10 + 1 )
+ step = -(int(parameters.step * 10))
+ max = len(table_pitch)-1
+ nextValue = self.methodList[parameters.pattern[trackId]].getNextValue
+ tonique = GenerationConstants.DEFAULT_TONIQUE
+ for i in range(numberOfPitch):
+ append((table_pitch[nextValue(step, max)]) + tonique)
+ restOfNotes = range( length - numberOfPitch )
+ for i in restOfNotes:
+ position = i % numberOfPitch
+ append( pitchSequence[ position ] )
+ return pitchSequence
+
+ def drumPitchSequence(self, length, parameters, drumPitch, table_pitch=None):
+ pitchSequence = []
+ append = pitchSequence.append
+ max = len(drumPitch) - 1
+ rand = random.randint
+ for i in range(length):
+ append(drumPitch[ rand( 0, max ) ] )
+ return pitchSequence
diff --git a/common/Generation/GenerationRythm.py b/common/Generation/GenerationRythm.py
new file mode 100644
index 0000000..718c1ec
--- /dev/null
+++ b/common/Generation/GenerationRythm.py
@@ -0,0 +1,213 @@
+import Utils
+import random
+from math import sqrt
+import common.Config as Config
+from Generation.GenerationConstants import GenerationConstants
+
+class GenerationRythm:
+
+ def celluleRythmSequence(self, parameters, barLength, trackInstrument=None ):
+ rythmSequence = [0, ]
+ self.count = 0
+ lastOnsetTime = 0
+ onsetLen = len(GenerationConstants.TABLE_ONSET_VALUES)
+
+ onsetValue = int( ( 1 - (parameters.density*0.98+0.02) ) * onsetLen )
+ onsetDeviation = int( ( 1 - parameters.rythmRegularity ) * 20 )
+ currentOnsetValue = onsetValue + ( random.randint( 0, onsetDeviation ) - ( onsetDeviation / 2 ) )
+ if currentOnsetValue < 0:
+ currentOnsetValue = 0
+ elif currentOnsetValue >= onsetLen:
+ currentOnsetValue = onsetLen - 1
+ else:
+ currentOnsetValue = currentOnsetValue
+
+ onsetDelta = GenerationConstants.TABLE_ONSET_VALUES[ currentOnsetValue ]
+ listLen = range( int( barLength / Config.TICKS_PER_BEAT * 8 ) )
+ randInt = random.randint
+ for i in listLen:
+ if self.count == 0:
+ currentOnsetValue = onsetValue + ( randInt( 0, onsetDeviation ) - ( onsetDeviation / 2 ) )
+ if currentOnsetValue < 0:
+ currentOnsetValue = 0
+ elif currentOnsetValue >= onsetLen:
+ currentOnsetValue = onsetLen - 1
+ else:
+ currentOnsetValue = currentOnsetValue
+ onsetDelta = GenerationConstants.TABLE_ONSET_VALUES[ currentOnsetValue ]
+
+ if onsetDelta == GenerationConstants.DOUBLE_TICK_DUR:
+ if self.count < (GenerationConstants.DOUBLE_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength-2:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
+ elif onsetDelta == GenerationConstants.HALF_TRIPLET_TICK_DUR:
+ if self.count < (GenerationConstants.HALF_TRIPLET_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength-2:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
+ elif onsetDelta == GenerationConstants.HOLE_TRIPLET_TICK_DUR:
+ if self.count < (GenerationConstants.HOLE_TRIPLET_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength-2:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
+
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength-2:
+ rythmSequence.append(onsetTime)
+ else:
+ break
+ return rythmSequence
+
+ def xnoiseRythmSequence(self, parameters, barLength ):
+ rythmSequence = []
+ onsetTime = None
+ randomParamScaler = parameters.rythmRegularity * 2 + 0.5
+# need radioButton with 0 for random choose and each generator independant
+ whichRandomGenerator = random.randint(0, 4)
+ maximumNumberOfNotes = int( (parameters.density) * GenerationConstants.MAX_NOTES_PER_BAR)
+
+ for i in range(maximumNumberOfNotes):
+ while onsetTime in rythmSequence:
+ if whichRandomGenerator == 0:
+ onsetTime = random.expovariate(GenerationConstants.RANDOM_EXPO_PARAM * randomParamScaler)
+ elif whichRandomGenerator == 1:
+ onsetTime = 1 - random.expovariate(GenerationConstants.RANDOM_EXPO_PARAM * randomParamScaler)
+ elif whichRandomGenerator == 2:
+ onsetTime = random.gauss(GenerationConstants.RANDOM_GAUSS_PARAM1,
+ GenerationConstants.RANDOM_GAUSS_PARAM2 * (3 - randomParamScaler))
+ elif whichRandomGenerator == 3:
+ onsetTime = random.betavariate(GenerationConstants.RANDOM_BETA_PARAM * randomParamScaler,
+ GenerationConstants.RANDOM_BETA_PARAM * randomParamScaler)
+ elif whichRandomGenerator == 4:
+ onsetTime = random.weibullvariate(GenerationConstants.RANDOM_WEIBULL_PARAM1,
+ GenerationConstants.RANDOM_WEIBULL_PARAM2 * randomParamScaler)
+
+ onsetTime = int(onsetTime * (int(( barLength - 1) / GenerationConstants.DOUBLE_TICK_DUR))) * GenerationConstants.DOUBLE_TICK_DUR
+
+ if onsetTime < 0:
+ onsetTime = 0
+ elif onsetTime > ( barLength - GenerationConstants.DOUBLE_TICK_DUR):
+ onsetTime = ( barLength - GenerationConstants.DOUBLE_TICK_DUR)
+ else:
+ onsetTime = onsetTime
+
+ rythmSequence.append(onsetTime)
+
+ rythmSequence.sort()
+ return rythmSequence
+
+ def drumRythmSequence(self, parameters, trackInstrument, barLength ):
+ density = sqrt(parameters.density)
+ rythmSequence = []
+ binSelection = []
+ downBeats = []
+ upBeats = []
+ beats = []
+ countDown = 0
+ onsetTime = None
+ beatsPerPage = int( barLength / Config.TICKS_PER_BEAT )
+ randInt = random.randint
+
+ upBeatsAppend = upBeats.append
+
+ if Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.PUNCH:
+ registerDensity = 0.5
+ downBeatRecurence = 4
+ upBeatOffset = Config.TICKS_PER_BEAT / 2
+ downBeats = [x for x in GenerationConstants.DRUM_PUNCH_ACCENTS[ beatsPerPage ]]
+ for downBeat in downBeats:
+ upBeatsAppend( downBeat + upBeatOffset )
+
+ elif Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.LOW:
+ registerDensity = 1.5
+ downBeatRecurence = 4
+ upBeatOffset = Config.TICKS_PER_BEAT / 2
+ downBeats = [x for x in GenerationConstants.DRUM_LOW_ACCENTS[ beatsPerPage ]]
+ for downBeat in downBeats:
+ upBeatsAppend( downBeat + upBeatOffset )
+
+ elif Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.MID:
+ registerDensity = 1
+ downBeatRecurence = 1
+ upBeatOffset = Config.TICKS_PER_BEAT / 4
+ downBeats = [x for x in GenerationConstants.DRUM_MID_ACCENTS[ beatsPerPage ]]
+ for downBeat in downBeats:
+ upBeatsAppend( downBeat + upBeatOffset )
+
+ elif Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.HIGH:
+ registerDensity = 1.5
+ downBeatRecurence = 1
+ upBeatOffset = Config.TICKS_PER_BEAT / 4
+ downBeats = [x for x in GenerationConstants.DRUM_HIGH_ACCENTS[ beatsPerPage ]]
+ for downBeat in downBeats:
+ upBeatsAppend( downBeat + upBeatOffset )
+
+ list = range( int( density * registerDensity * len( downBeats ) ) )
+ rand = random.random
+ binCount = binSelection.count
+ binAppend = binSelection.append
+ for i in list:
+ if rand() < ( parameters.rythmRegularity * downBeatRecurence ) and binCount( 1 ) < len( downBeats ):
+ binAppend( 1 )
+ else:
+ if binCount( 0 ) < len( downBeats ):
+ binAppend( 0 )
+ else:
+ binAppend( 1 )
+
+ countDown = binCount( 1 )
+
+ seqAppend = rythmSequence.append
+ length = len(downBeats) - 1
+ downPop = downBeats.pop
+ for i in range( countDown ):
+ ran1 = randInt(0, length)
+ ran2 = randInt(0, length)
+ randMin = min(ran1, ran2)
+ onsetTime = downPop(randMin)
+ seqAppend( onsetTime )
+ length -= 1
+
+ length = len(upBeats) - 1
+ upPop = upBeats.pop
+ for i in range( len( binSelection ) - countDown ):
+ ran1 = randInt(0, length)
+ ran2 = randInt(0, length)
+ randMin = min(ran1, ran2)
+ onsetTime = upPop(randMin)
+ seqAppend( onsetTime )
+ length -= 1
+
+ rythmSequence.sort()
+ return rythmSequence
+
+ def makeCellule( self, currentDuration, targetDuration, threshold ):
+ threshold = threshold - 1
+ if currentDuration == targetDuration:
+ if self.count < threshold:
+ self.count += 1
+ else:
+ self.count = 0
diff --git a/common/Generation/Generator.py b/common/Generation/Generator.py
new file mode 100755
index 0000000..b5640a6
--- /dev/null
+++ b/common/Generation/Generator.py
@@ -0,0 +1,167 @@
+import random
+import math
+
+import Utils
+import Drunk
+
+import common.Config as Config
+from Util.CSoundNote import CSoundNote
+from Generation.GenerationConstants import GenerationConstants
+from Generation.GenerationRythm import GenerationRythm
+from Generation.GenerationPitch import GenerationPitch
+
+class GenerationParameters:
+ def __init__( self,
+ density = GenerationConstants.DEFAULT_DENSITY,
+ rythmRegularity = GenerationConstants.DEFAULT_RYTHM_REGULARITY,
+ step = GenerationConstants.DEFAULT_STEP,
+ pitchRegularity = GenerationConstants.DEFAULT_PITCH_REGULARITY,
+ articule = GenerationConstants.DEFAULT_DURATION,
+ silence = GenerationConstants.DEFAULT_SILENCE,
+ rythmMethod = GenerationConstants.DEFAULT_RYTHM_METHOD,
+ pitchMethod = GenerationConstants.DEFAULT_PITCH_METHOD,
+ pattern = GenerationConstants.DEFAULT_PATTERN,
+ scale = GenerationConstants.DEFAULT_SCALE ):
+ self.density = density
+ self.rythmRegularity = rythmRegularity
+ self.step = step
+ self.pitchRegularity = pitchRegularity
+ self.articule = articule
+ self.silence = silence
+ self.rythmMethod = rythmMethod
+ self.pitchMethod = pitchMethod
+ self.pattern = pattern
+ self.scale = scale
+
+def generator1(
+ parameters, # algorithm-specific parameters
+ volume, # [trackId: float(volume) ]
+ instrument, # [pageId][trackId: instrument]
+ tempo, # integer bpm
+ nbeats, # map [ pageId : beats ]
+ trackIds, # list of trackIds to generate
+ pageIds, # list of pageIds to generate
+ trackDictionary, # map [ trackId : [ pageId : events ] ]
+ nPagesCycle = 4 # META ALGO number of pages in a section
+ ):
+
+ makeRythm = GenerationRythm()
+ makePitch = GenerationPitch()
+
+ def makeGainSequence( onsetList ):
+ gainSequence = []
+ append = gainSequence.append
+ rand = random.uniform
+ max = GenerationConstants.GAIN_MAX_BOUNDARY
+ midMax = GenerationConstants.GAIN_MID_MAX_BOUNDARY
+ midMin = GenerationConstants.GAIN_MID_MIN_BOUNDARY
+ min = GenerationConstants.GAIN_MIN_BOUNDARY
+ for onset in onsetList:
+ if onset == 0:
+ append(rand(midMax, max))
+ elif ( onset % Config.TICKS_PER_BEAT) == 0:
+ append(rand(midMin, midMax))
+ else:
+ append(rand(min, midMin))
+ return gainSequence
+
+ def makeDurationSequence( onsetList, parameters, table_duration, barLength, currentInstrument ):
+ durationSequence = []
+ if Config.INSTRUMENTS[currentInstrument].soundClass == 'drum':
+ duration = GenerationConstants.DOUBLE_TICK_DUR / 2
+ durationSequence = [duration] * len(onsetList)
+ return durationSequence
+
+ append = durationSequence.append
+ proba = Utils.prob2
+ if len( onsetList ) > 1:
+ for i in range(len(onsetList) - 1):
+ append((onsetList[i+1] - onsetList[i]) * proba( table_duration ))
+ append(( barLength - onsetList[-1]) * proba( table_duration ))
+ elif len( onsetList ) == 1:
+ append( ( barLength - onsetList[0] ) * proba( table_duration ))
+ return durationSequence
+
+ def pageGenerate(parameters, trackId, pageId, trackOfNotes, drumPitch = None):
+
+ trackNotes = trackOfNotes
+
+ if drumPitch:
+ currentInstrument = Config.INSTRUMENTS[instrument[pageId][trackId]].kit[drumPitch[0]].name
+ rythmSequence = makeRythm.drumRythmSequence(parameters, currentInstrument, barLength)
+ pitchSequence = makePitch.drumPitchSequence(len(rythmSequence), parameters, drumPitch, table_pitch )
+ else:
+ currentInstrument = instrument[pageId][trackId]
+ rythmSequence = makeRythm.celluleRythmSequence(parameters, barLength, currentInstrument)
+ pitchSequence = makePitch.drunkPitchSequence(len(rythmSequence),parameters, table_pitch, trackId)
+
+ gainSequence = makeGainSequence(rythmSequence)
+ durationSequence = makeDurationSequence(rythmSequence, parameters, table_duration, barLength, currentInstrument)
+
+ numOfNotes = range(len(rythmSequence))
+ rand = random.random
+ append = trackNotes.append
+ pan = GenerationConstants.DEFAULT_PAN
+ instrument_id = Config.INSTRUMENTS[instrument[pageId][trackId]].instrumentId
+ for i in numOfNotes:
+ if drumPitch:
+ if ( rand() * fillDrum ) > ( parameters.silence * .5 ):
+ if fillDrum != 1:
+ if rythmSequence[i] not in trackOnsets or pitchSequence[i] not in trackPitchs:
+ append( CSoundNote( rythmSequence[i], pitchSequence[i], gainSequence[i], pan, durationSequence[i], trackId, instrument_id, 0.002, 0.098, 0.1, 0, 1000, False, 'edit' ) )
+ else:
+ append( CSoundNote( rythmSequence[i], pitchSequence[i], gainSequence[i], pan, durationSequence[i], trackId, instrument_id, 0.002, 0.098, 0.1, 0, 1000, False, 'edit' ) )
+ else:
+ if rand() > parameters.silence:
+ append( CSoundNote( rythmSequence[i], pitchSequence[i], gainSequence[i], pan, durationSequence[i], trackId, instrument_id, 0.002, 0.1, 0.1, 0, 1000, False, 'edit' ) )
+
+ trackDictionary[ trackId ][ pageId ] = trackNotes
+
+##################################################################################
+ # begin generate()
+
+ table_duration = Utils.scale(parameters.articule, GenerationConstants.ARTICULATION_SCALE_MIN_MAPPING, GenerationConstants.ARTICULATION_SCALE_MAX_MAPPING, GenerationConstants.ARTICULATION_SCALE_STEPS)
+ table_pitch = GenerationConstants.SCALES[parameters.scale]
+
+ for trackId in trackIds:
+ if trackId == 4: # drum index
+ if parameters.rythmRegularity > 0.75:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY1
+ elif parameters.rythmRegularity > 0.5:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY2
+ elif parameters.rythmRegularity > 0.25:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY3
+ else:
+ streamOfPitch = GenerationConstants.DRUM_COMPLEXITY4
+ selectedPageCount = 0
+ lastPageId = 0
+ for pageId in pageIds:
+ barLength = Config.TICKS_PER_BEAT * nbeats[ pageId ]
+ trackOfNotes = []
+ pageCycle = selectedPageCount % nPagesCycle
+
+ if instrument[pageId][trackId][0:4] == 'drum':
+ if pageCycle not in [0,nPagesCycle-1] and nbeats[pageId] == nbeats[lastPageId]:
+ trackDictionary[trackId][pageId] = []
+ for n in trackDictionary[trackId][lastPageId]:
+ trackDictionary[trackId][pageId].append(n.clone())
+ elif pageCycle == (nPagesCycle-1) and nbeats[pageId] == nbeats[lastPageId]:
+ for n in trackDictionary[trackId][lastPageId]:
+ trackOfNotes.append(n.clone())
+ trackOnsets = [n.onset for n in trackOfNotes]
+ trackPitchs = [n.pitch for n in trackOfNotes]
+ fillDrum = .5
+ rythmRegTemp = parameters.rythmRegularity
+ parameters.rythmRegularity = 0.5
+ for drumPitch in GenerationConstants.DRUM_COMPLEXITY4:
+ pageGenerate( parameters, trackId, pageId, trackOfNotes, drumPitch )
+ parameters.rythmRegularity = rythmRegTemp
+ else:
+ fillDrum = 1
+ for drumPitch in streamOfPitch:
+ pageGenerate( parameters, trackId, pageId, trackOfNotes, drumPitch )
+
+ else:
+ pageGenerate( parameters, trackId, pageId, trackOfNotes, drumPitch = None )
+ selectedPageCount += 1
+ lastPageId = pageId
diff --git a/common/Generation/Utils.py b/common/Generation/Utils.py
new file mode 100755
index 0000000..e5ea295
--- /dev/null
+++ b/common/Generation/Utils.py
@@ -0,0 +1,74 @@
+import random
+import time
+import math
+
+#----------------------------------------------------------------------
+# TODO: replace magic numbers with constants
+# http://en.wikipedia.org/wiki/Magic_number_(programming)
+#----------------------------------------------------------------------
+
+def prob(x):
+ sum1 = 0
+ sum2 = 0
+
+ for i in x:
+ sum1 = sum1 + i
+
+ val = sum1 * random.randint(0, 32767) / 32768
+
+ for i in range(len(x)):
+ sum2 = sum2 + x[i]
+ if x[i]:
+ if sum2 >= val:
+ return i
+ break
+
+def prob2(x):
+ sum1 = 0
+ sum2 = 0
+
+ for i in x:
+ sum1 = sum1 + i[1]
+
+ val = sum1 * random.randint(0, 32767) / 32768
+
+ for i in x:
+ sum2 = sum2 + i[1]
+ if i[1]:
+ if sum2 >= val:
+ return i[0]
+ break
+
+def scale(val, mini=0., maxi=1., length=100):
+ slope = []
+
+ up = 1.-val
+ if up <= 0.5:
+ low_val = (pow(1.-(up*2.),4.)*(-50.5)+0.5)
+ else:
+ low_val = up
+
+ if val <= 0.5:
+ high_val = (pow(1.-(val * 2.),4.)*(-50.5)+0.5)
+ else:
+ high_val = val
+
+ step = (maxi - mini) * (1. / length)
+
+ calc = (1. / length) * (high_val - low_val)
+ append = slope.append
+ for i in range(length + 1):
+ temp = i * calc + low_val
+ if temp < 0:
+ temp = 0
+ elif temp > 1:
+ temp = 1
+ else:
+ temp = temp
+
+ append(((step * i) + mini, int(temp * 100)))
+
+ return slope
+
+def midtotrans(x):
+ return pow(1.059463, x - 36)
diff --git a/common/Generation/VariationPitch.py b/common/Generation/VariationPitch.py
new file mode 100644
index 0000000..5a2b151
--- /dev/null
+++ b/common/Generation/VariationPitch.py
@@ -0,0 +1,82 @@
+import random
+
+class PitchReverse:
+ def __init__( self ):
+ self.pitchList = []
+
+ def reorderPitch( self, notesList ):
+ self.extractOneValue(notesList)
+ self.pitchList.reverse()
+ for i in range(len(notesList)):
+ notesList[i].pitch = self.pitchList[i]
+
+ return notesList
+
+ def extractOneValue( self, notesList ):
+ self.pitchList = []
+ for note in notesList:
+ self.pitchList.append(note.pitch)
+
+class PitchSort( PitchReverse ):
+ def __init__( self ):
+ PitchReverse.__init__( self )
+
+ def reorderPitch( self, notesList ):
+ PitchReverse.extractOneValue(self, notesList)
+ self.pitchList.sort()
+ for i in range(len(notesList)):
+ notesList[i].pitch = self.pitchList[i]
+
+ return notesList
+
+class PitchShuffle( PitchReverse ):
+ def __init__( self ):
+ PitchReverse.__init__ ( self )
+
+ def reorderPitch( self, notesList ):
+ PitchReverse.extractOneValue(self, notesList)
+ self.pitchList = random.sample(self.pitchList, len(self.pitchList))
+ for i in range(len(notesList)):
+ notesList[i].pitch = self.pitchList[i]
+
+ return notesList
+
+class PitchMarkov:
+ def __init__( self ):
+ self.originalList = []
+
+ def getNewList( self, notesList, order=1 ):
+ self.playedNotes = []
+ self.extractOneValue( notesList, order )
+ self.playedNotes = self.originalList[:order]
+
+ for i in range(len(self.originalList) - order):
+ self.playedNotes.append(self.pickupNewValue(order))
+
+ for i in range(len(notesList)):
+ notesList[i].pitch = self.playedNotes[i]
+
+ return notesList
+
+ def extractOneValue( self, notesList, order ):
+ self.originalList = []
+ for note in notesList:
+ self.originalList.append(note.pitch)
+ for i in range(order):
+ self.originalList.append(self.originalList[i])
+
+ def pickupNewValue( self, order ):
+ condition = False
+ self.probTable = []
+ for ilist in range(len(self.originalList) - order):
+ for iord in range(order):
+ if self.playedNotes[len(self.playedNotes) - (iord + 1)] != self.originalList[(order - 1) + ilist - iord]:
+ condition = False
+ break
+ else:
+ condition = True
+
+ if condition == True:
+ self.probTable.append(self.originalList[ilist + order])
+
+ return self.probTable[random.randint(0, (len(self.probTable) - 1))]
diff --git a/common/Generation/VariationRythm.py b/common/Generation/VariationRythm.py
new file mode 100644
index 0000000..5fb6111
--- /dev/null
+++ b/common/Generation/VariationRythm.py
@@ -0,0 +1,74 @@
+import random
+
+import common.Config as Config
+
+# remplacer position dans notesList par l'attribut de CSoundNote
+class RythmShuffle:
+
+ def getNewList( self, notesList, nbeats ):
+ self.barLength = Config.TICKS_PER_BEAT * nbeats
+ self.onsetDelta = 0
+ self.newOnsetList = []
+ self.oldDuration = []
+ self.newDuration = []
+ self.extractOnsetValue(notesList)
+
+ self.newOnsetList = random.sample(range(len(self.originalList)), len(self.originalList))
+ self.getOldDuration(notesList)
+ self.getNewDuration(notesList)
+
+ for i in range(len(notesList)):
+ notesList[i].onset = self.onsetDelta
+ notesList[i].duration = self.oldDuration[i] * self.newDuration[i]
+ self.onsetDelta = self.onsetDelta + self.originalList[self.newOnsetList[i]]
+
+ return notesList
+
+ def extractOnsetValue( self, notesList ):
+ self.originalList = []
+ for note in notesList:
+ self.originalList.append(note.onset)
+
+ for i in range(len(self.originalList) -1):
+ self.originalList[i] = self.originalList[i+1] - self.originalList[i]
+
+ self.originalList[-1] = self.barLength - (self.originalList[-1] % self.barLength)
+
+ def getOldDuration( self, notesList ):
+ for i in range(len(notesList)):
+ if (i+1) == len(notesList):
+ self.oldDuration.append(notesList[i].duration / (self.barLength - (notesList[i].onset % self.barLength)))
+ else:
+ self.oldDuration.append(notesList[i].duration / (notesList[i+1].onset - notesList[i].onset))
+
+ def getNewDuration( self, notesList ):
+ for i in self.newOnsetList:
+ if (i+1) == len(notesList):
+ self.newDuration.append(self.barLength - (notesList[i].onset % self.barLength))
+ else:
+ self.newDuration.append(notesList[i+1].onset - notesList[i].onset)
+
+class RythmReverse( RythmShuffle ):
+
+ def getNewList( self, notesList, nbeats ):
+ self.barLength = Config.TICKS_PER_BEAT * nbeats
+ self.onsetDelta = 0
+ self.newOnsetList = []
+ self.oldDuration = []
+ self.newDuration = []
+ RythmShuffle.extractOnsetValue( self, notesList )
+
+ for i in range( len( self.originalList ) ):
+ self.newOnsetList.append( i )
+
+ self.newOnsetList.reverse()
+
+ RythmShuffle.getOldDuration( self, notesList )
+ RythmShuffle.getNewDuration( self, notesList )
+
+ for i in range(len(notesList)):
+ notesList[i].onset = self.onsetDelta
+ notesList[i].duration = self.oldDuration[i] * self.newDuration[i]
+ self.onsetDelta = self.onsetDelta + self.originalList[self.newOnsetList[i]]
+
+ return notesList
diff --git a/common/Generation/__init__.py b/common/Generation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common/Generation/__init__.py
diff --git a/common/Generation/bList.py b/common/Generation/bList.py
new file mode 100644
index 0000000..26aed12
--- /dev/null
+++ b/common/Generation/bList.py
@@ -0,0 +1,97 @@
+import common.Config as Config
+from Generation.GenerationConstants import GenerationConstants
+
+def gen():
+ punch_list = [[], ]
+ low_list = [[], ]
+ mid_list = [[], ]
+ high_list = [[], ]
+
+ f = open('/home/olpc/tamtam/Generation/drumTablesList', 'w')
+ g = open('/home/olpc/tamtam/Generation/drumStraightTables', 'w')
+
+ # gen punch list
+ beatsList = [[], ]
+ for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
+ accents = []
+ for j in GenerationConstants.PUNCH_ACCENTS[beatsPerPage]:
+ accents.append(j * Config.TICKS_PER_BEAT)
+ beatsList.append(accents)
+ beats = []
+ downBeats = []
+ for beat in range( beatsPerPage ):
+ beats.append( beat * Config.TICKS_PER_BEAT )
+ for i in range( len( beats ) ):
+ downBeats.append( ( beats[ GenerationConstants.PUNCH_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
+ punch_list.append(downBeats)
+
+ string = ' DRUM_PUNCH_PROB = ' + str(punch_list) + '\n'
+ f.write(string)
+ string = ' DRUM_PUNCH_ACCENT = ' + str(beatsList) + '\n'
+ g.write(string)
+
+ # gen low list
+ beatsList = [[], ]
+ for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
+ accents = []
+ for j in GenerationConstants.LOW_ACCENTS[beatsPerPage]:
+ accents.append(j * Config.TICKS_PER_BEAT)
+ beatsList.append(accents)
+ beats = []
+ downBeats = []
+ for beat in range( beatsPerPage ):
+ beats.append( beat * Config.TICKS_PER_BEAT )
+ for i in range( len( beats ) ):
+ downBeats.append( ( beats[ GenerationConstants.LOW_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
+ low_list.append(downBeats)
+
+ string = ' DRUM_LOW_PROB = ' + str(low_list) + '\n'
+ f.write(string)
+ string = ' DRUM_LOW_ACCENT = ' + str(beatsList) + '\n'
+ g.write(string)
+
+ # gen mid list
+ beatsList = [[], ]
+ for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
+ accents = []
+ for j in GenerationConstants.MID_ACCENTS[beatsPerPage]:
+ accents.append(j * Config.TICKS_PER_BEAT / 2)
+ beatsList.append(accents)
+ beats = []
+ downBeats = []
+ for beat in range( beatsPerPage ):
+ beats.append( beat * Config.TICKS_PER_BEAT )
+ beats.append( beat * Config.TICKS_PER_BEAT + ( Config.TICKS_PER_BEAT / 2 ) )
+ for i in range( len( beats ) ):
+ downBeats.append( ( beats[ GenerationConstants.MID_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
+ mid_list.append(downBeats)
+
+ string = ' DRUM_MID_PROB = ' + str(mid_list) + '\n'
+ f.write(string)
+ string = ' DRUM_MID_ACCENT = ' + str(beatsList) + '\n'
+ g.write(string)
+
+ # gen high list
+ beatsList = [[], ]
+ for beatsPerPage in [1,2,3,4,5,6,7,8,9,10,11,12]:
+ accents = []
+ for j in GenerationConstants.HIGH_ACCENTS[beatsPerPage]:
+ accents.append(j * Config.TICKS_PER_BEAT / 2)
+ beatsList.append(accents)
+ beats = []
+ downBeats = []
+ for beat in range( beatsPerPage ):
+ beats.append( beat * Config.TICKS_PER_BEAT )
+ beats.append( beat * Config.TICKS_PER_BEAT + ( Config.TICKS_PER_BEAT / 2 ) )
+ for i in range( len( beats ) ):
+ downBeats.append( ( beats[ GenerationConstants.HIGH_ACCENTS[ beatsPerPage ][ i ] ], int( pow( float( len( beats ) - i) / len( beats ), 1.5 ) * 100.) ) )
+ high_list.append(downBeats)
+
+ string = ' DRUM_HIGH_PROB = ' + str(high_list) + '\n'
+ f.write(string)
+ string = ' DRUM_HIGH_ACCENT = ' + str(beatsList) + '\n'
+ g.write(string)
+
+ f.close()
+ g.close()
+
diff --git a/common/Resources/Desktops/desktop0 b/common/Resources/Desktops/desktop0
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop0
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop1 b/common/Resources/Desktops/desktop1
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop1
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop2 b/common/Resources/Desktops/desktop2
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop2
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop3 b/common/Resources/Desktops/desktop3
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop3
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop4 b/common/Resources/Desktops/desktop4
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop4
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop5 b/common/Resources/Desktops/desktop5
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop5
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop6 b/common/Resources/Desktops/desktop6
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop6
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop7 b/common/Resources/Desktops/desktop7
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop7
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop8 b/common/Resources/Desktops/desktop8
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop8
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Desktops/desktop9 b/common/Resources/Desktops/desktop9
new file mode 100644
index 0000000..3da73d9
--- /dev/null
+++ b/common/Resources/Desktops/desktop9
@@ -0,0 +1,206 @@
+page_add 10 11 0 [82, 82, 82, 82, 133]
+note_add 9 10 0 0 34 0.942260596881 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 13 10 0 3 38 0.72175977127 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 26 10 0 3 42 0.694338417824 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 1 10 0 6 26 0.725991648348 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 27 10 0 9 46 0.673789246514 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 10 0 21 40 0.711089872007 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 28 10 0 21 44 0.724189552495 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 10 0 24 34 0.78660445793 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 10 0 33 38 0.689247104327 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 29 10 0 36 44 0.892482541278 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 30 10 0 39 46 0.743841693835 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 31 10 0 45 42 0.675915254637 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 10 0 48 28 0.867874500271 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 10 0 48 32 0.843933612421 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 10 0 48 36 0.882490480554 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 10 0 51 46 0.7260388951 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 10 0 54 26 0.723548457528 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 10 0 54 40 0.688941454565 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 10 0 57 38 0.692369221065 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 10 0 60 30 0.851574151203 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 10 0 63 42 0.725848400909 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 10 0 72 24 0.844375616982 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 10 0 75 36 0.721617793685 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 10 0 75 44 0.733357608142 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 10 0 84 24 0.816385837458 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 10 0 84 42 0.797679015697 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 10 0 87 40 0.736436950535 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 10 0 93 40 0.678395248218 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 10 0 93 46 0.711345361166 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 10 0 96 24 0.852190617798 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 10 0 99 38 0.730783663308 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 10 0 114 26 0.746689002705 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 10 0 117 36 0.696057408747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 10 0 117 44 0.704912091309 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 10 0 120 26 0.89517776125 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 10 0 120 38 0.775461496957 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 25 10 0 123 36 0.671213642754 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 10 0 123 48 0.657357627725 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 9 3 0 [82, 82, 82, 82, 133]
+note_add 1 9 0 0 24 0.939922537979 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 3 9 0 0 32 0.919417513279 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 7 9 0 0 46 0.94323408296 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 4 9 0 3 40 0.698900010891 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 8 9 0 6 46 0.698856456031 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 9 9 0 9 46 0.73534413844 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 2 9 0 12 28 0.777449966123 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 5 9 0 15 36 0.745537315527 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 6 9 0 18 40 0.731967099614 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 10 9 0 18 46 0.659748039959 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 11 9 0 24 48 0.887567039913 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 12 9 0 27 48 0.67596583908 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 8 9 0 [82, 82, 82, 82, 133]
+note_add 31 8 0 0 24 0.925548542596 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 41 8 0 0 40 0.99515399493 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 51 8 0 3 42 0.656600534211 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 42 8 0 12 40 0.781608499687 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 52 8 0 18 42 0.746078356731 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 32 8 0 24 26 0.842788079016 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 38 8 0 24 30 0.858448377744 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 43 8 0 27 38 0.655557996923 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 33 8 0 36 24 0.84416548026 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 53 8 0 42 48 0.708755031747 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 54 8 0 45 46 0.694252886906 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 34 8 0 48 28 0.790745114826 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 44 8 0 51 38 0.693079205578 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 55 8 0 51 48 0.723114366376 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 56 8 0 57 42 0.74000144627 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 45 8 0 60 36 0.844357847996 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 46 8 0 63 36 0.670774638825 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 57 8 0 69 42 0.666807403745 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 35 8 0 72 24 0.802855117652 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 39 8 0 72 32 0.850137481504 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 58 8 0 75 42 0.714082247268 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 36 8 0 84 28 0.854088386031 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 47 8 0 84 38 0.816924020176 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 48 8 0 87 38 0.698932384487 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 59 8 0 87 42 0.674609289728 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 37 8 0 96 26 0.884421425859 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 40 8 0 96 32 0.816095303092 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 49 8 0 96 40 0.85609056018 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 50 8 0 99 36 0.739998407875 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+note_add 60 8 0 99 48 0.735836941454 0.5 1 5 134 0.005 0.095 0.0 0 1000 0 mini
+page_add 5 3 0 [82, 82, 82, 82, 133]
+note_add 13 5 0 0 28 0.948923051548 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 15 5 0 0 32 0.983674976389 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 16 5 0 3 38 0.676515455171 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 19 5 0 3 44 0.748902416777 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 20 5 0 9 42 0.721823750258 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 14 5 0 18 26 0.727501183971 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 21 5 0 18 42 0.692538780737 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 22 5 0 21 42 0.704638060569 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 17 5 0 27 38 0.699231033599 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 23 5 0 27 42 0.710291506584 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 18 5 0 33 38 0.740104587325 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+note_add 24 5 0 33 42 0.712509981931 0.5 1 5 137 0.005 0.095 0.0 0 1000 0 mini
+page_add 11 9 0 [82, 82, 82, 82, 133]
+note_add 1 11 0 0 28 0.940708810641 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 11 0 0 30 0.917125893398 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 11 0 3 38 0.659757355829 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 21 11 0 3 46 0.691197364433 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 11 0 15 36 0.728363093232 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 22 11 0 15 48 0.651730437628 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 13 11 0 21 36 0.748099491714 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 23 11 0 21 42 0.691142328317 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 11 0 24 26 0.799430971651 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 14 11 0 24 36 0.789827858454 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 15 11 0 27 40 0.717847096017 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 24 11 0 27 46 0.68775950814 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 3 11 0 36 28 0.847659428446 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 16 11 0 39 38 0.724596484561 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 17 11 0 42 38 0.672521332617 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 25 11 0 45 42 0.707153905275 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 11 0 48 26 0.768231729212 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 11 0 48 30 0.797498430547 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 18 11 0 51 40 0.662933204402 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 26 11 0 51 46 0.652875237261 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 11 0 60 28 0.870729034797 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 19 11 0 63 38 0.699990604686 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 27 11 0 63 46 0.744299692171 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 28 11 0 69 42 0.674719518782 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 11 0 72 28 0.793569160964 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 20 11 0 75 36 0.743411205808 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 11 0 84 30 0.76896495703 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 29 11 0 87 46 0.739799809332 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 11 0 96 28 0.854769659604 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 30 11 0 96 48 0.88403154664 0.5 1.0 5 134 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 12 2 0 [88, 76, 56, 82, 135]
+note_add 1 12 0 0 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 12 0 3 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 12 0 6 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 12 0 9 41 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 12 0 12 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 12 0 15 24 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 12 0 18 38 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 12 0 21 45 0.75 0.5 3.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 13 5 0 [88, 76, 56, 82, 135]
+note_add 1 13 0 0 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 13 0 1 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 13 0 2 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 5 13 0 3 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 6 13 0 4 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 39 13 0 7 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 40 13 0 8 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 41 13 0 9 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 42 13 0 10 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 43 13 0 11 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 13 0 12 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 7 13 0 13 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 8 13 0 14 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 9 13 0 15 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 10 13 0 16 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 34 13 0 19 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 35 13 0 20 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 36 13 0 21 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 37 13 0 22 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 38 13 0 23 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 11 13 0 24 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 12 13 0 25 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 13 13 0 26 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 14 13 0 27 48 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 29 13 0 31 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 30 13 0 32 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 31 13 0 33 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 32 13 0 34 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 33 13 0 35 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 15 13 0 36 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 16 13 0 37 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 17 13 0 38 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 18 13 0 39 24 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 24 13 0 43 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 25 13 0 44 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 26 13 0 45 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 27 13 0 46 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 28 13 0 47 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 19 13 0 55 35 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 20 13 0 56 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 21 13 0 57 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 22 13 0 58 36 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 23 13 0 59 34 0.75 0.5 1.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+page_add 14 3 0 [82, 82, 82, 82, 133]
+note_add 3 14 0 0 30 0.900689216372 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 4 14 0 0 38 0.92403208165 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 1 14 0 6 24 0.710809973008 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 7 14 0 6 44 0.680687612344 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 8 14 0 9 48 0.689412655788 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 9 14 0 15 44 0.664335685932 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 10 14 0 21 44 0.699249583758 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 2 14 0 24 26 0.826542425289 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 5 14 0 27 38 0.737997319594 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 11 14 0 27 42 0.671027963479 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 6 14 0 33 40 0.727866267806 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+note_add 12 14 0 33 48 0.674593053365 0.5 1.0 5 137 0.005 0.095 0.0 0.0 1000.0 1 mini
+page_add 15 7 0 [88, 77, 67, 85, 137]
+note_add 1 15 0 0 29 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 2 15 0 24 44 0.75 0.5 7.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 3 15 0 36 44 0.75 0.5 6.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+note_add 4 15 0 48 32 0.75 0.5 24.0 0 88 0.005 0.098 0.1 0.0 1000.0 1 edit
+block_add Drum False 236 203 False {'name': 'drum5kit', 'regularity': 0.17265378043653012, 'page': 5, 'volume': 0.5, 'beats': 3, 'seed': 0.61058227696419964, 'reverb': 0.0, 'id': 137}
+block_add Instrument False 437 137 False {'volume': 0.5, 'reverb': 0, 'name': 'duck', 'pan': 0.5, 'id': 30}
+block_add Loop False 567 137 True {'name': 'loop1', 'id': 15}
+block_add Instrument True 431 302 False {'volume': 0.5, 'reverb': 0, 'name': 'rhodes', 'pan': 0.5, 'id': 85}
+block_add Instrument False 443 445 False {'volume': 0.5, 'reverb': 0, 'name': 'ow', 'pan': 0.5, 'id': 63}
+block_add Loop False 550 445 True {'name': 'loop2', 'id': 13}
+block_add Loop False 638 445 True {'name': 'loop3', 'id': 12}
+block_add Drum False 233 354 False {'name': 'drum2kit', 'regularity': 0.32130953701001352, 'id': 134, 'volume': 0.5, 'beats': 9, 'reverb': 0.0, 'page': 8}
diff --git a/common/Resources/Images/TamTam.png b/common/Resources/Images/TamTam.png
new file mode 100644
index 0000000..1e1f6de
--- /dev/null
+++ b/common/Resources/Images/TamTam.png
Binary files differ
diff --git a/common/Resources/Images/acguit.png b/common/Resources/Images/acguit.png
new file mode 100644
index 0000000..ed0e1ff
--- /dev/null
+++ b/common/Resources/Images/acguit.png
Binary files differ
diff --git a/common/Resources/Images/acguitsel.png b/common/Resources/Images/acguitsel.png
new file mode 100644
index 0000000..cc692ef
--- /dev/null
+++ b/common/Resources/Images/acguitsel.png
Binary files differ
diff --git a/common/Resources/Images/alarm.png b/common/Resources/Images/alarm.png
new file mode 100755
index 0000000..817f23c
--- /dev/null
+++ b/common/Resources/Images/alarm.png
Binary files differ
diff --git a/common/Resources/Images/alarmsel.png b/common/Resources/Images/alarmsel.png
new file mode 100755
index 0000000..cbf2f79
--- /dev/null
+++ b/common/Resources/Images/alarmsel.png
Binary files differ
diff --git a/common/Resources/Images/all.png b/common/Resources/Images/all.png
new file mode 100644
index 0000000..ee3534b
--- /dev/null
+++ b/common/Resources/Images/all.png
Binary files differ
diff --git a/common/Resources/Images/allsel.png b/common/Resources/Images/allsel.png
new file mode 100644
index 0000000..98ff02b
--- /dev/null
+++ b/common/Resources/Images/allsel.png
Binary files differ
diff --git a/common/Resources/Images/animals.png b/common/Resources/Images/animals.png
new file mode 100644
index 0000000..95c802f
--- /dev/null
+++ b/common/Resources/Images/animals.png
Binary files differ
diff --git a/common/Resources/Images/animalssel.png b/common/Resources/Images/animalssel.png
new file mode 100644
index 0000000..f2369fb
--- /dev/null
+++ b/common/Resources/Images/animalssel.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditDown.png b/common/Resources/Images/arrowEditDown.png
new file mode 100755
index 0000000..99888f7
--- /dev/null
+++ b/common/Resources/Images/arrowEditDown.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditDownDown.png b/common/Resources/Images/arrowEditDownDown.png
new file mode 100755
index 0000000..20f783f
--- /dev/null
+++ b/common/Resources/Images/arrowEditDownDown.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditDownOver.png b/common/Resources/Images/arrowEditDownOver.png
new file mode 100755
index 0000000..3fb3d28
--- /dev/null
+++ b/common/Resources/Images/arrowEditDownOver.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditLeft.png b/common/Resources/Images/arrowEditLeft.png
new file mode 100644
index 0000000..2850e64
--- /dev/null
+++ b/common/Resources/Images/arrowEditLeft.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditLeftDown.png b/common/Resources/Images/arrowEditLeftDown.png
new file mode 100755
index 0000000..49ccb5f
--- /dev/null
+++ b/common/Resources/Images/arrowEditLeftDown.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditLeftOver.png b/common/Resources/Images/arrowEditLeftOver.png
new file mode 100755
index 0000000..8dcf71d
--- /dev/null
+++ b/common/Resources/Images/arrowEditLeftOver.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditRight.png b/common/Resources/Images/arrowEditRight.png
new file mode 100644
index 0000000..4046205
--- /dev/null
+++ b/common/Resources/Images/arrowEditRight.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditRightDown.png b/common/Resources/Images/arrowEditRightDown.png
new file mode 100755
index 0000000..b38037d
--- /dev/null
+++ b/common/Resources/Images/arrowEditRightDown.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditRightOver.png b/common/Resources/Images/arrowEditRightOver.png
new file mode 100755
index 0000000..3f4502a
--- /dev/null
+++ b/common/Resources/Images/arrowEditRightOver.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditUp.png b/common/Resources/Images/arrowEditUp.png
new file mode 100755
index 0000000..8ad3a2f
--- /dev/null
+++ b/common/Resources/Images/arrowEditUp.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditUpDown.png b/common/Resources/Images/arrowEditUpDown.png
new file mode 100755
index 0000000..5ca1742
--- /dev/null
+++ b/common/Resources/Images/arrowEditUpDown.png
Binary files differ
diff --git a/common/Resources/Images/arrowEditUpOver.png b/common/Resources/Images/arrowEditUpOver.png
new file mode 100755
index 0000000..5b76e31
--- /dev/null
+++ b/common/Resources/Images/arrowEditUpOver.png
Binary files differ
diff --git a/common/Resources/Images/basse.png b/common/Resources/Images/basse.png
new file mode 100644
index 0000000..93d9a13
--- /dev/null
+++ b/common/Resources/Images/basse.png
Binary files differ
diff --git a/common/Resources/Images/bassesel.png b/common/Resources/Images/bassesel.png
new file mode 100644
index 0000000..ea8b65c
--- /dev/null
+++ b/common/Resources/Images/bassesel.png
Binary files differ
diff --git a/common/Resources/Images/beat1.png b/common/Resources/Images/beat1.png
new file mode 100644
index 0000000..104be63
--- /dev/null
+++ b/common/Resources/Images/beat1.png
Binary files differ
diff --git a/common/Resources/Images/beat10.png b/common/Resources/Images/beat10.png
new file mode 100644
index 0000000..f584b30
--- /dev/null
+++ b/common/Resources/Images/beat10.png
Binary files differ
diff --git a/common/Resources/Images/beat11.png b/common/Resources/Images/beat11.png
new file mode 100644
index 0000000..3b977ad
--- /dev/null
+++ b/common/Resources/Images/beat11.png
Binary files differ
diff --git a/common/Resources/Images/beat2.png b/common/Resources/Images/beat2.png
new file mode 100644
index 0000000..b3b19d3
--- /dev/null
+++ b/common/Resources/Images/beat2.png
Binary files differ
diff --git a/common/Resources/Images/beat3.png b/common/Resources/Images/beat3.png
new file mode 100644
index 0000000..4e5c73a
--- /dev/null
+++ b/common/Resources/Images/beat3.png
Binary files differ
diff --git a/common/Resources/Images/beat4.png b/common/Resources/Images/beat4.png
new file mode 100644
index 0000000..e3c3aea
--- /dev/null
+++ b/common/Resources/Images/beat4.png
Binary files differ
diff --git a/common/Resources/Images/beat5.png b/common/Resources/Images/beat5.png
new file mode 100644
index 0000000..54846dd
--- /dev/null
+++ b/common/Resources/Images/beat5.png
Binary files differ
diff --git a/common/Resources/Images/beat6.png b/common/Resources/Images/beat6.png
new file mode 100644
index 0000000..9f9664f
--- /dev/null
+++ b/common/Resources/Images/beat6.png
Binary files differ
diff --git a/common/Resources/Images/beat7.png b/common/Resources/Images/beat7.png
new file mode 100644
index 0000000..cec399d
--- /dev/null
+++ b/common/Resources/Images/beat7.png
Binary files differ
diff --git a/common/Resources/Images/beat8.png b/common/Resources/Images/beat8.png
new file mode 100644
index 0000000..7f4d7e5
--- /dev/null
+++ b/common/Resources/Images/beat8.png
Binary files differ
diff --git a/common/Resources/Images/beat9.png b/common/Resources/Images/beat9.png
new file mode 100644
index 0000000..1b18084
--- /dev/null
+++ b/common/Resources/Images/beat9.png
Binary files differ
diff --git a/common/Resources/Images/bird.png b/common/Resources/Images/bird.png
new file mode 100644
index 0000000..a0c0fb1
--- /dev/null
+++ b/common/Resources/Images/bird.png
Binary files differ
diff --git a/common/Resources/Images/birdsel.png b/common/Resources/Images/birdsel.png
new file mode 100644
index 0000000..60f75b8
--- /dev/null
+++ b/common/Resources/Images/birdsel.png
Binary files differ
diff --git a/common/Resources/Images/bottle.png b/common/Resources/Images/bottle.png
new file mode 100644
index 0000000..634fcca
--- /dev/null
+++ b/common/Resources/Images/bottle.png
Binary files differ
diff --git a/common/Resources/Images/bottlesel.png b/common/Resources/Images/bottlesel.png
new file mode 100644
index 0000000..f93d01b
--- /dev/null
+++ b/common/Resources/Images/bottlesel.png
Binary files differ
diff --git a/common/Resources/Images/bubbles.png b/common/Resources/Images/bubbles.png
new file mode 100755
index 0000000..ba52212
--- /dev/null
+++ b/common/Resources/Images/bubbles.png
Binary files differ
diff --git a/common/Resources/Images/bubblessel.png b/common/Resources/Images/bubblessel.png
new file mode 100755
index 0000000..6aea349
--- /dev/null
+++ b/common/Resources/Images/bubblessel.png
Binary files differ
diff --git a/common/Resources/Images/byke.png b/common/Resources/Images/byke.png
new file mode 100755
index 0000000..5b4796c
--- /dev/null
+++ b/common/Resources/Images/byke.png
Binary files differ
diff --git a/common/Resources/Images/bykesel.png b/common/Resources/Images/bykesel.png
new file mode 100755
index 0000000..a6b0943
--- /dev/null
+++ b/common/Resources/Images/bykesel.png
Binary files differ
diff --git a/common/Resources/Images/camera.png b/common/Resources/Images/camera.png
new file mode 100755
index 0000000..b5c460d
--- /dev/null
+++ b/common/Resources/Images/camera.png
Binary files differ
diff --git a/common/Resources/Images/camerasel.png b/common/Resources/Images/camerasel.png
new file mode 100755
index 0000000..feb84bc
--- /dev/null
+++ b/common/Resources/Images/camerasel.png
Binary files differ
diff --git a/common/Resources/Images/car.png b/common/Resources/Images/car.png
new file mode 100755
index 0000000..1f8ad8d
--- /dev/null
+++ b/common/Resources/Images/car.png
Binary files differ
diff --git a/common/Resources/Images/carsel.png b/common/Resources/Images/carsel.png
new file mode 100755
index 0000000..76287a7
--- /dev/null
+++ b/common/Resources/Images/carsel.png
Binary files differ
diff --git a/common/Resources/Images/cat.png b/common/Resources/Images/cat.png
new file mode 100644
index 0000000..28151c3
--- /dev/null
+++ b/common/Resources/Images/cat.png
Binary files differ
diff --git a/common/Resources/Images/catsel.png b/common/Resources/Images/catsel.png
new file mode 100644
index 0000000..2ca1472
--- /dev/null
+++ b/common/Resources/Images/catsel.png
Binary files differ
diff --git a/common/Resources/Images/cello.png b/common/Resources/Images/cello.png
new file mode 100755
index 0000000..750a0bc
--- /dev/null
+++ b/common/Resources/Images/cello.png
Binary files differ
diff --git a/common/Resources/Images/cellosel.png b/common/Resources/Images/cellosel.png
new file mode 100755
index 0000000..dc3ac53
--- /dev/null
+++ b/common/Resources/Images/cellosel.png
Binary files differ
diff --git a/common/Resources/Images/check.png b/common/Resources/Images/check.png
new file mode 100644
index 0000000..187546b
--- /dev/null
+++ b/common/Resources/Images/check.png
Binary files differ
diff --git a/common/Resources/Images/checkOff.svg b/common/Resources/Images/checkOff.svg
new file mode 100644
index 0000000..9357b87
--- /dev/null
+++ b/common/Resources/Images/checkOff.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="22px" height="22px" viewBox="0 0 22 22" enable-background="new 0 0 22 22" xml:space="preserve">
+<rect x="1" y="1" fill="#FFFFFF" stroke="#000000" stroke-width="2" width="20" height="20"/>
+</svg>
diff --git a/common/Resources/Images/checkOn.svg b/common/Resources/Images/checkOn.svg
new file mode 100644
index 0000000..5b91ddf
--- /dev/null
+++ b/common/Resources/Images/checkOn.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14576) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="22px" height="22px" viewBox="0 0 22 22" enable-background="new 0 0 22 22" xml:space="preserve">
+<rect x="1" y="1" fill="#FFFFFF" stroke="#000000" stroke-width="2" width="20" height="20"/>
+<g>
+ <path d="M17.021,6.637c0.312,0,0.624,0.048,0.96,0.143c0.144,0.048,0.264,0.12,0.264,0.191c0,0.071-0.048,0.119-0.192,0.143
+ c-0.288,0.024-0.695,0.215-0.912,0.358c-1.68,1.002-6.192,4.701-9.264,7.947c-0.288,0.286-0.625,0.215-0.576,0.047
+ c0.168-0.501,0.312-2.911,0.096-4.009c-0.048-0.286-0.216-0.597-0.672-0.549c-0.144,0.024-0.288,0.024-0.288-0.072
+ c0-0.071,0.12-0.143,0.264-0.191c0.312-0.119,0.744-0.167,0.96-0.167c0.528,0,1.056,0.143,1.176,0.668
+ c0.192,0.788-0.024,2.171-1.008,4.033c2.472-3.604,4.896-6.3,6.528-7.469C15.028,7.234,16.156,6.637,17.021,6.637z"/>
+</g>
+</svg>
diff --git a/common/Resources/Images/chimes.png b/common/Resources/Images/chimes.png
new file mode 100755
index 0000000..5c0873a
--- /dev/null
+++ b/common/Resources/Images/chimes.png
Binary files differ
diff --git a/common/Resources/Images/chimessel.png b/common/Resources/Images/chimessel.png
new file mode 100755
index 0000000..a700720
--- /dev/null
+++ b/common/Resources/Images/chimessel.png
Binary files differ
diff --git a/common/Resources/Images/clang.png b/common/Resources/Images/clang.png
new file mode 100644
index 0000000..f6586fb
--- /dev/null
+++ b/common/Resources/Images/clang.png
Binary files differ
diff --git a/common/Resources/Images/clangsel.png b/common/Resources/Images/clangsel.png
new file mode 100644
index 0000000..9f5a289
--- /dev/null
+++ b/common/Resources/Images/clangsel.png
Binary files differ
diff --git a/common/Resources/Images/clarinette.png b/common/Resources/Images/clarinette.png
new file mode 100644
index 0000000..a3729df
--- /dev/null
+++ b/common/Resources/Images/clarinette.png
Binary files differ
diff --git a/common/Resources/Images/clarinettesel.png b/common/Resources/Images/clarinettesel.png
new file mode 100644
index 0000000..119ec6d
--- /dev/null
+++ b/common/Resources/Images/clarinettesel.png
Binary files differ
diff --git a/common/Resources/Images/cling.png b/common/Resources/Images/cling.png
new file mode 100644
index 0000000..ff35a7e
--- /dev/null
+++ b/common/Resources/Images/cling.png
Binary files differ
diff --git a/common/Resources/Images/clingsel.png b/common/Resources/Images/clingsel.png
new file mode 100644
index 0000000..0b69cd2
--- /dev/null
+++ b/common/Resources/Images/clingsel.png
Binary files differ
diff --git a/common/Resources/Images/complex1.png b/common/Resources/Images/complex1.png
new file mode 100644
index 0000000..5e9fd06
--- /dev/null
+++ b/common/Resources/Images/complex1.png
Binary files differ
diff --git a/common/Resources/Images/complex2.png b/common/Resources/Images/complex2.png
new file mode 100644
index 0000000..3a52d54
--- /dev/null
+++ b/common/Resources/Images/complex2.png
Binary files differ
diff --git a/common/Resources/Images/complex3.png b/common/Resources/Images/complex3.png
new file mode 100644
index 0000000..94d2c7e
--- /dev/null
+++ b/common/Resources/Images/complex3.png
Binary files differ
diff --git a/common/Resources/Images/complex4.png b/common/Resources/Images/complex4.png
new file mode 100644
index 0000000..65ccce0
--- /dev/null
+++ b/common/Resources/Images/complex4.png
Binary files differ
diff --git a/common/Resources/Images/complex5.png b/common/Resources/Images/complex5.png
new file mode 100644
index 0000000..598b14d
--- /dev/null
+++ b/common/Resources/Images/complex5.png
Binary files differ
diff --git a/common/Resources/Images/complex6.png b/common/Resources/Images/complex6.png
new file mode 100644
index 0000000..d8a030a
--- /dev/null
+++ b/common/Resources/Images/complex6.png
Binary files differ
diff --git a/common/Resources/Images/complex7.png b/common/Resources/Images/complex7.png
new file mode 100644
index 0000000..f3d50fb
--- /dev/null
+++ b/common/Resources/Images/complex7.png
Binary files differ
diff --git a/common/Resources/Images/complex8.png b/common/Resources/Images/complex8.png
new file mode 100644
index 0000000..5e9a0a4
--- /dev/null
+++ b/common/Resources/Images/complex8.png
Binary files differ
diff --git a/common/Resources/Images/concret.png b/common/Resources/Images/concret.png
new file mode 100644
index 0000000..038dbb4
--- /dev/null
+++ b/common/Resources/Images/concret.png
Binary files differ
diff --git a/common/Resources/Images/concretsel.png b/common/Resources/Images/concretsel.png
new file mode 100644
index 0000000..b78687c
--- /dev/null
+++ b/common/Resources/Images/concretsel.png
Binary files differ
diff --git a/common/Resources/Images/crash.png b/common/Resources/Images/crash.png
new file mode 100755
index 0000000..23db01f
--- /dev/null
+++ b/common/Resources/Images/crash.png
Binary files differ
diff --git a/common/Resources/Images/crashsel.png b/common/Resources/Images/crashsel.png
new file mode 100755
index 0000000..38dba22
--- /dev/null
+++ b/common/Resources/Images/crashsel.png
Binary files differ
diff --git a/common/Resources/Images/dice.png b/common/Resources/Images/dice.png
new file mode 100644
index 0000000..47441b7
--- /dev/null
+++ b/common/Resources/Images/dice.png
Binary files differ
diff --git a/common/Resources/Images/diceProp.png b/common/Resources/Images/diceProp.png
new file mode 100644
index 0000000..887a6fb
--- /dev/null
+++ b/common/Resources/Images/diceProp.png
Binary files differ
diff --git a/common/Resources/Images/dicePropSel.png b/common/Resources/Images/dicePropSel.png
new file mode 100644
index 0000000..13c5779
--- /dev/null
+++ b/common/Resources/Images/dicePropSel.png
Binary files differ
diff --git a/common/Resources/Images/diceblur.png b/common/Resources/Images/diceblur.png
new file mode 100644
index 0000000..f275422
--- /dev/null
+++ b/common/Resources/Images/diceblur.png
Binary files differ
diff --git a/common/Resources/Images/diceinst.png b/common/Resources/Images/diceinst.png
new file mode 100644
index 0000000..9fda10f
--- /dev/null
+++ b/common/Resources/Images/diceinst.png
Binary files differ
diff --git a/common/Resources/Images/diceinstsel.png b/common/Resources/Images/diceinstsel.png
new file mode 100644
index 0000000..782b100
--- /dev/null
+++ b/common/Resources/Images/diceinstsel.png
Binary files differ
diff --git a/common/Resources/Images/didjeridu.png b/common/Resources/Images/didjeridu.png
new file mode 100644
index 0000000..a14b863
--- /dev/null
+++ b/common/Resources/Images/didjeridu.png
Binary files differ
diff --git a/common/Resources/Images/didjeridusel.png b/common/Resources/Images/didjeridusel.png
new file mode 100644
index 0000000..a836b71
--- /dev/null
+++ b/common/Resources/Images/didjeridusel.png
Binary files differ
diff --git a/common/Resources/Images/dog.png b/common/Resources/Images/dog.png
new file mode 100644
index 0000000..942e5aa
--- /dev/null
+++ b/common/Resources/Images/dog.png
Binary files differ
diff --git a/common/Resources/Images/dogsel.png b/common/Resources/Images/dogsel.png
new file mode 100644
index 0000000..f5458a3
--- /dev/null
+++ b/common/Resources/Images/dogsel.png
Binary files differ
diff --git a/common/Resources/Images/door.png b/common/Resources/Images/door.png
new file mode 100644
index 0000000..15c95b2
--- /dev/null
+++ b/common/Resources/Images/door.png
Binary files differ
diff --git a/common/Resources/Images/doorsel.png b/common/Resources/Images/doorsel.png
new file mode 100644
index 0000000..a95f616
--- /dev/null
+++ b/common/Resources/Images/doorsel.png
Binary files differ
diff --git a/common/Resources/Images/dru0.png b/common/Resources/Images/dru0.png
new file mode 100755
index 0000000..eb8227c
--- /dev/null
+++ b/common/Resources/Images/dru0.png
Binary files differ
diff --git a/common/Resources/Images/dru1.png b/common/Resources/Images/dru1.png
new file mode 100755
index 0000000..e5c8698
--- /dev/null
+++ b/common/Resources/Images/dru1.png
Binary files differ
diff --git a/common/Resources/Images/dru2.png b/common/Resources/Images/dru2.png
new file mode 100755
index 0000000..7f5dba0
--- /dev/null
+++ b/common/Resources/Images/dru2.png
Binary files differ
diff --git a/common/Resources/Images/dru3.png b/common/Resources/Images/dru3.png
new file mode 100755
index 0000000..dcfd922
--- /dev/null
+++ b/common/Resources/Images/dru3.png
Binary files differ
diff --git a/common/Resources/Images/dru4.png b/common/Resources/Images/dru4.png
new file mode 100755
index 0000000..7718e36
--- /dev/null
+++ b/common/Resources/Images/dru4.png
Binary files differ
diff --git a/common/Resources/Images/drum1kit.png b/common/Resources/Images/drum1kit.png
new file mode 100644
index 0000000..e98ec33
--- /dev/null
+++ b/common/Resources/Images/drum1kit.png
Binary files differ
diff --git a/common/Resources/Images/drum1kitsel.png b/common/Resources/Images/drum1kitsel.png
new file mode 100644
index 0000000..aa9a1e0
--- /dev/null
+++ b/common/Resources/Images/drum1kitsel.png
Binary files differ
diff --git a/common/Resources/Images/drum1kitselgen.png b/common/Resources/Images/drum1kitselgen.png
new file mode 100644
index 0000000..f78a18e
--- /dev/null
+++ b/common/Resources/Images/drum1kitselgen.png
Binary files differ
diff --git a/common/Resources/Images/drum2kit.png b/common/Resources/Images/drum2kit.png
new file mode 100644
index 0000000..76d12d7
--- /dev/null
+++ b/common/Resources/Images/drum2kit.png
Binary files differ
diff --git a/common/Resources/Images/drum2kitsel.png b/common/Resources/Images/drum2kitsel.png
new file mode 100644
index 0000000..1101b8a
--- /dev/null
+++ b/common/Resources/Images/drum2kitsel.png
Binary files differ
diff --git a/common/Resources/Images/drum2kitselgen.png b/common/Resources/Images/drum2kitselgen.png
new file mode 100644
index 0000000..6027918
--- /dev/null
+++ b/common/Resources/Images/drum2kitselgen.png
Binary files differ
diff --git a/common/Resources/Images/drum3kit.png b/common/Resources/Images/drum3kit.png
new file mode 100644
index 0000000..38975a2
--- /dev/null
+++ b/common/Resources/Images/drum3kit.png
Binary files differ
diff --git a/common/Resources/Images/drum3kitsel.png b/common/Resources/Images/drum3kitsel.png
new file mode 100644
index 0000000..7200e89
--- /dev/null
+++ b/common/Resources/Images/drum3kitsel.png
Binary files differ
diff --git a/common/Resources/Images/drum3kitselgen.png b/common/Resources/Images/drum3kitselgen.png
new file mode 100644
index 0000000..ecfb61b
--- /dev/null
+++ b/common/Resources/Images/drum3kitselgen.png
Binary files differ
diff --git a/common/Resources/Images/drum4kit.png b/common/Resources/Images/drum4kit.png
new file mode 100644
index 0000000..a928080
--- /dev/null
+++ b/common/Resources/Images/drum4kit.png
Binary files differ
diff --git a/common/Resources/Images/drum4kitsel.png b/common/Resources/Images/drum4kitsel.png
new file mode 100644
index 0000000..8d012df
--- /dev/null
+++ b/common/Resources/Images/drum4kitsel.png
Binary files differ
diff --git a/common/Resources/Images/drum4kitselgen.png b/common/Resources/Images/drum4kitselgen.png
new file mode 100644
index 0000000..02a62c6
--- /dev/null
+++ b/common/Resources/Images/drum4kitselgen.png
Binary files differ
diff --git a/common/Resources/Images/drum5kit.png b/common/Resources/Images/drum5kit.png
new file mode 100644
index 0000000..6213770
--- /dev/null
+++ b/common/Resources/Images/drum5kit.png
Binary files differ
diff --git a/common/Resources/Images/drum5kitsel.png b/common/Resources/Images/drum5kitsel.png
new file mode 100644
index 0000000..eec29b5
--- /dev/null
+++ b/common/Resources/Images/drum5kitsel.png
Binary files differ
diff --git a/common/Resources/Images/drum5kitselgen.png b/common/Resources/Images/drum5kitselgen.png
new file mode 100644
index 0000000..2208d55
--- /dev/null
+++ b/common/Resources/Images/drum5kitselgen.png
Binary files differ
diff --git a/common/Resources/Images/duck.png b/common/Resources/Images/duck.png
new file mode 100644
index 0000000..9c75bd8
--- /dev/null
+++ b/common/Resources/Images/duck.png
Binary files differ
diff --git a/common/Resources/Images/duck2.png b/common/Resources/Images/duck2.png
new file mode 100644
index 0000000..4ef2f28
--- /dev/null
+++ b/common/Resources/Images/duck2.png
Binary files differ
diff --git a/common/Resources/Images/duck2sel.png b/common/Resources/Images/duck2sel.png
new file mode 100644
index 0000000..b3f5c5f
--- /dev/null
+++ b/common/Resources/Images/duck2sel.png
Binary files differ
diff --git a/common/Resources/Images/ducksel.png b/common/Resources/Images/ducksel.png
new file mode 100644
index 0000000..0bc3243
--- /dev/null
+++ b/common/Resources/Images/ducksel.png
Binary files differ
diff --git a/common/Resources/Images/editTam.png b/common/Resources/Images/editTam.png
new file mode 100644
index 0000000..b27e33e
--- /dev/null
+++ b/common/Resources/Images/editTam.png
Binary files differ
diff --git a/common/Resources/Images/editTamDown.png b/common/Resources/Images/editTamDown.png
new file mode 100644
index 0000000..b7ad8b3
--- /dev/null
+++ b/common/Resources/Images/editTamDown.png
Binary files differ
diff --git a/common/Resources/Images/editTamOver.png b/common/Resources/Images/editTamOver.png
new file mode 100644
index 0000000..233624d
--- /dev/null
+++ b/common/Resources/Images/editTamOver.png
Binary files differ
diff --git a/common/Resources/Images/electronic.png b/common/Resources/Images/electronic.png
new file mode 100644
index 0000000..37a7e6f
--- /dev/null
+++ b/common/Resources/Images/electronic.png
Binary files differ
diff --git a/common/Resources/Images/electronicsel.png b/common/Resources/Images/electronicsel.png
new file mode 100644
index 0000000..bd6fceb
--- /dev/null
+++ b/common/Resources/Images/electronicsel.png
Binary files differ
diff --git a/common/Resources/Images/flute.png b/common/Resources/Images/flute.png
new file mode 100644
index 0000000..43e128b
--- /dev/null
+++ b/common/Resources/Images/flute.png
Binary files differ
diff --git a/common/Resources/Images/flutesel.png b/common/Resources/Images/flutesel.png
new file mode 100644
index 0000000..9b72cf7
--- /dev/null
+++ b/common/Resources/Images/flutesel.png
Binary files differ
diff --git a/common/Resources/Images/gam.png b/common/Resources/Images/gam.png
new file mode 100644
index 0000000..02f8719
--- /dev/null
+++ b/common/Resources/Images/gam.png
Binary files differ
diff --git a/common/Resources/Images/gamsel.png b/common/Resources/Images/gamsel.png
new file mode 100644
index 0000000..ac6594f
--- /dev/null
+++ b/common/Resources/Images/gamsel.png
Binary files differ
diff --git a/common/Resources/Images/generic.png b/common/Resources/Images/generic.png
new file mode 100755
index 0000000..c42119b
--- /dev/null
+++ b/common/Resources/Images/generic.png
Binary files differ
diff --git a/common/Resources/Images/genericsel.png b/common/Resources/Images/genericsel.png
new file mode 100755
index 0000000..2cbdb81
--- /dev/null
+++ b/common/Resources/Images/genericsel.png
Binary files differ
diff --git a/common/Resources/Images/guit.png b/common/Resources/Images/guit.png
new file mode 100644
index 0000000..0c2f667
--- /dev/null
+++ b/common/Resources/Images/guit.png
Binary files differ
diff --git a/common/Resources/Images/guit2.png b/common/Resources/Images/guit2.png
new file mode 100755
index 0000000..183d754
--- /dev/null
+++ b/common/Resources/Images/guit2.png
Binary files differ
diff --git a/common/Resources/Images/guit2sel.png b/common/Resources/Images/guit2sel.png
new file mode 100755
index 0000000..60641bd
--- /dev/null
+++ b/common/Resources/Images/guit2sel.png
Binary files differ
diff --git a/common/Resources/Images/guitsel.png b/common/Resources/Images/guitsel.png
new file mode 100644
index 0000000..890fcb7
--- /dev/null
+++ b/common/Resources/Images/guitsel.png
Binary files differ
diff --git a/common/Resources/Images/harmonica.png b/common/Resources/Images/harmonica.png
new file mode 100644
index 0000000..d8dd849
--- /dev/null
+++ b/common/Resources/Images/harmonica.png
Binary files differ
diff --git a/common/Resources/Images/harmonicasel.png b/common/Resources/Images/harmonicasel.png
new file mode 100644
index 0000000..0814bd9
--- /dev/null
+++ b/common/Resources/Images/harmonicasel.png
Binary files differ
diff --git a/common/Resources/Images/harmonium.png b/common/Resources/Images/harmonium.png
new file mode 100644
index 0000000..3d4a605
--- /dev/null
+++ b/common/Resources/Images/harmonium.png
Binary files differ
diff --git a/common/Resources/Images/harmoniumsel.png b/common/Resources/Images/harmoniumsel.png
new file mode 100644
index 0000000..80eb2c8
--- /dev/null
+++ b/common/Resources/Images/harmoniumsel.png
Binary files differ
diff --git a/common/Resources/Images/helpShow1.jpg b/common/Resources/Images/helpShow1.jpg
new file mode 100755
index 0000000..885db27
--- /dev/null
+++ b/common/Resources/Images/helpShow1.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow2.jpg b/common/Resources/Images/helpShow2.jpg
new file mode 100755
index 0000000..009e58e
--- /dev/null
+++ b/common/Resources/Images/helpShow2.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow3.jpg b/common/Resources/Images/helpShow3.jpg
new file mode 100755
index 0000000..b3858aa
--- /dev/null
+++ b/common/Resources/Images/helpShow3.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow4.jpg b/common/Resources/Images/helpShow4.jpg
new file mode 100755
index 0000000..f5ef420
--- /dev/null
+++ b/common/Resources/Images/helpShow4.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow5.jpg b/common/Resources/Images/helpShow5.jpg
new file mode 100755
index 0000000..f7d47d6
--- /dev/null
+++ b/common/Resources/Images/helpShow5.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow6.jpg b/common/Resources/Images/helpShow6.jpg
new file mode 100755
index 0000000..8b548e3
--- /dev/null
+++ b/common/Resources/Images/helpShow6.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow7.jpg b/common/Resources/Images/helpShow7.jpg
new file mode 100755
index 0000000..58f6f1a
--- /dev/null
+++ b/common/Resources/Images/helpShow7.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow8.jpg b/common/Resources/Images/helpShow8.jpg
new file mode 100755
index 0000000..c135fa8
--- /dev/null
+++ b/common/Resources/Images/helpShow8.jpg
Binary files differ
diff --git a/common/Resources/Images/helpShow9.jpg b/common/Resources/Images/helpShow9.jpg
new file mode 100755
index 0000000..6a1e01a
--- /dev/null
+++ b/common/Resources/Images/helpShow9.jpg
Binary files differ
diff --git a/common/Resources/Images/helpTam.png b/common/Resources/Images/helpTam.png
new file mode 100644
index 0000000..b7ad8b3
--- /dev/null
+++ b/common/Resources/Images/helpTam.png
Binary files differ
diff --git a/common/Resources/Images/helpTamDown.png b/common/Resources/Images/helpTamDown.png
new file mode 100644
index 0000000..b27e33e
--- /dev/null
+++ b/common/Resources/Images/helpTamDown.png
Binary files differ
diff --git a/common/Resources/Images/helpTamOver.png b/common/Resources/Images/helpTamOver.png
new file mode 100644
index 0000000..233624d
--- /dev/null
+++ b/common/Resources/Images/helpTamOver.png
Binary files differ
diff --git a/common/Resources/Images/hit.png b/common/Resources/Images/hit.png
new file mode 100644
index 0000000..d81489e
--- /dev/null
+++ b/common/Resources/Images/hit.png
Binary files differ
diff --git a/common/Resources/Images/hitSelected.png b/common/Resources/Images/hitSelected.png
new file mode 100644
index 0000000..20473b8
--- /dev/null
+++ b/common/Resources/Images/hitSelected.png
Binary files differ
diff --git a/common/Resources/Images/horse.png b/common/Resources/Images/horse.png
new file mode 100644
index 0000000..2c4c528
--- /dev/null
+++ b/common/Resources/Images/horse.png
Binary files differ
diff --git a/common/Resources/Images/horsesel.png b/common/Resources/Images/horsesel.png
new file mode 100644
index 0000000..c599ebe
--- /dev/null
+++ b/common/Resources/Images/horsesel.png
Binary files differ
diff --git a/common/Resources/Images/instr0.png b/common/Resources/Images/instr0.png
new file mode 100755
index 0000000..8e11498
--- /dev/null
+++ b/common/Resources/Images/instr0.png
Binary files differ
diff --git a/common/Resources/Images/instr1.png b/common/Resources/Images/instr1.png
new file mode 100755
index 0000000..548870d
--- /dev/null
+++ b/common/Resources/Images/instr1.png
Binary files differ
diff --git a/common/Resources/Images/instr2.png b/common/Resources/Images/instr2.png
new file mode 100755
index 0000000..ca720b3
--- /dev/null
+++ b/common/Resources/Images/instr2.png
Binary files differ
diff --git a/common/Resources/Images/instr3.png b/common/Resources/Images/instr3.png
new file mode 100755
index 0000000..8c6dc63
--- /dev/null
+++ b/common/Resources/Images/instr3.png
Binary files differ
diff --git a/common/Resources/Images/instr4.png b/common/Resources/Images/instr4.png
new file mode 100755
index 0000000..05e16ec
--- /dev/null
+++ b/common/Resources/Images/instr4.png
Binary files differ
diff --git a/common/Resources/Images/jam-blockMask.png b/common/Resources/Images/jam-blockMask.png
new file mode 100644
index 0000000..dc3911f
--- /dev/null
+++ b/common/Resources/Images/jam-blockMask.png
Binary files differ
diff --git a/common/Resources/Images/kalimba.png b/common/Resources/Images/kalimba.png
new file mode 100644
index 0000000..b763869
--- /dev/null
+++ b/common/Resources/Images/kalimba.png
Binary files differ
diff --git a/common/Resources/Images/kalimbasel.png b/common/Resources/Images/kalimbasel.png
new file mode 100644
index 0000000..3e55881
--- /dev/null
+++ b/common/Resources/Images/kalimbasel.png
Binary files differ
diff --git a/common/Resources/Images/keyboard.png b/common/Resources/Images/keyboard.png
new file mode 100644
index 0000000..db31de3
--- /dev/null
+++ b/common/Resources/Images/keyboard.png
Binary files differ
diff --git a/common/Resources/Images/keyboardsel.png b/common/Resources/Images/keyboardsel.png
new file mode 100644
index 0000000..c665ef1
--- /dev/null
+++ b/common/Resources/Images/keyboardsel.png
Binary files differ
diff --git a/common/Resources/Images/koto.png b/common/Resources/Images/koto.png
new file mode 100644
index 0000000..716747d
--- /dev/null
+++ b/common/Resources/Images/koto.png
Binary files differ
diff --git a/common/Resources/Images/kotosel.png b/common/Resources/Images/kotosel.png
new file mode 100644
index 0000000..a560ea7
--- /dev/null
+++ b/common/Resources/Images/kotosel.png
Binary files differ
diff --git a/common/Resources/Images/laugh.png b/common/Resources/Images/laugh.png
new file mode 100644
index 0000000..493711e
--- /dev/null
+++ b/common/Resources/Images/laugh.png
Binary files differ
diff --git a/common/Resources/Images/laughsel.png b/common/Resources/Images/laughsel.png
new file mode 100644
index 0000000..28a1980
--- /dev/null
+++ b/common/Resources/Images/laughsel.png
Binary files differ
diff --git a/common/Resources/Images/mando.png b/common/Resources/Images/mando.png
new file mode 100644
index 0000000..d97a2e1
--- /dev/null
+++ b/common/Resources/Images/mando.png
Binary files differ
diff --git a/common/Resources/Images/mandosel.png b/common/Resources/Images/mandosel.png
new file mode 100644
index 0000000..d8d5ad6
--- /dev/null
+++ b/common/Resources/Images/mandosel.png
Binary files differ
diff --git a/common/Resources/Images/marimba.png b/common/Resources/Images/marimba.png
new file mode 100644
index 0000000..f5eb4ac
--- /dev/null
+++ b/common/Resources/Images/marimba.png
Binary files differ
diff --git a/common/Resources/Images/marimbasel.png b/common/Resources/Images/marimbasel.png
new file mode 100644
index 0000000..3231271
--- /dev/null
+++ b/common/Resources/Images/marimbasel.png
Binary files differ
diff --git a/common/Resources/Images/marquis.png b/common/Resources/Images/marquis.png
new file mode 100644
index 0000000..e14917a
--- /dev/null
+++ b/common/Resources/Images/marquis.png
Binary files differ
diff --git a/common/Resources/Images/mic1.png b/common/Resources/Images/mic1.png
new file mode 100644
index 0000000..c6c991b
--- /dev/null
+++ b/common/Resources/Images/mic1.png
Binary files differ
diff --git a/common/Resources/Images/mic1sel.png b/common/Resources/Images/mic1sel.png
new file mode 100644
index 0000000..577ffcf
--- /dev/null
+++ b/common/Resources/Images/mic1sel.png
Binary files differ
diff --git a/common/Resources/Images/mic2.png b/common/Resources/Images/mic2.png
new file mode 100644
index 0000000..c827229
--- /dev/null
+++ b/common/Resources/Images/mic2.png
Binary files differ
diff --git a/common/Resources/Images/mic2sel.png b/common/Resources/Images/mic2sel.png
new file mode 100644
index 0000000..4f2b800
--- /dev/null
+++ b/common/Resources/Images/mic2sel.png
Binary files differ
diff --git a/common/Resources/Images/mic3.png b/common/Resources/Images/mic3.png
new file mode 100644
index 0000000..a3cb9c2
--- /dev/null
+++ b/common/Resources/Images/mic3.png
Binary files differ
diff --git a/common/Resources/Images/mic3sel.png b/common/Resources/Images/mic3sel.png
new file mode 100644
index 0000000..82fcbf9
--- /dev/null
+++ b/common/Resources/Images/mic3sel.png
Binary files differ
diff --git a/common/Resources/Images/mic4.png b/common/Resources/Images/mic4.png
new file mode 100644
index 0000000..2109c6d
--- /dev/null
+++ b/common/Resources/Images/mic4.png
Binary files differ
diff --git a/common/Resources/Images/mic4sel.png b/common/Resources/Images/mic4sel.png
new file mode 100644
index 0000000..4d63e90
--- /dev/null
+++ b/common/Resources/Images/mic4sel.png
Binary files differ
diff --git a/common/Resources/Images/miniTam.png b/common/Resources/Images/miniTam.png
new file mode 100644
index 0000000..0fc0fc3
--- /dev/null
+++ b/common/Resources/Images/miniTam.png
Binary files differ
diff --git a/common/Resources/Images/miniTamDown.png b/common/Resources/Images/miniTamDown.png
new file mode 100644
index 0000000..ea6395f
--- /dev/null
+++ b/common/Resources/Images/miniTamDown.png
Binary files differ
diff --git a/common/Resources/Images/miniTamOver.png b/common/Resources/Images/miniTamOver.png
new file mode 100644
index 0000000..a9d1478
--- /dev/null
+++ b/common/Resources/Images/miniTamOver.png
Binary files differ
diff --git a/common/Resources/Images/miniplay.png b/common/Resources/Images/miniplay.png
new file mode 100644
index 0000000..674303b
--- /dev/null
+++ b/common/Resources/Images/miniplay.png
Binary files differ
diff --git a/common/Resources/Images/mysounds.png b/common/Resources/Images/mysounds.png
new file mode 100644
index 0000000..88791b6
--- /dev/null
+++ b/common/Resources/Images/mysounds.png
Binary files differ
diff --git a/common/Resources/Images/mysoundssel.png b/common/Resources/Images/mysoundssel.png
new file mode 100644
index 0000000..8aa802c
--- /dev/null
+++ b/common/Resources/Images/mysoundssel.png
Binary files differ
diff --git a/common/Resources/Images/note.png b/common/Resources/Images/note.png
new file mode 100644
index 0000000..98731c0
--- /dev/null
+++ b/common/Resources/Images/note.png
Binary files differ
diff --git a/common/Resources/Images/noteSelected.png b/common/Resources/Images/noteSelected.png
new file mode 100644
index 0000000..b887bb9
--- /dev/null
+++ b/common/Resources/Images/noteSelected.png
Binary files differ
diff --git a/common/Resources/Images/ocarina.png b/common/Resources/Images/ocarina.png
new file mode 100644
index 0000000..3c8f794
--- /dev/null
+++ b/common/Resources/Images/ocarina.png
Binary files differ
diff --git a/common/Resources/Images/ocarinasel.png b/common/Resources/Images/ocarinasel.png
new file mode 100644
index 0000000..00d519b
--- /dev/null
+++ b/common/Resources/Images/ocarinasel.png
Binary files differ
diff --git a/common/Resources/Images/ounk.png b/common/Resources/Images/ounk.png
new file mode 100644
index 0000000..4949262
--- /dev/null
+++ b/common/Resources/Images/ounk.png
Binary files differ
diff --git a/common/Resources/Images/ounksel.png b/common/Resources/Images/ounksel.png
new file mode 100644
index 0000000..f70aea7
--- /dev/null
+++ b/common/Resources/Images/ounksel.png
Binary files differ
diff --git a/common/Resources/Images/ow.png b/common/Resources/Images/ow.png
new file mode 100644
index 0000000..0d8d57d
--- /dev/null
+++ b/common/Resources/Images/ow.png
Binary files differ
diff --git a/common/Resources/Images/owsel.png b/common/Resources/Images/owsel.png
new file mode 100644
index 0000000..dd5e814
--- /dev/null
+++ b/common/Resources/Images/owsel.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBG.png b/common/Resources/Images/pageThumbnailBG.png
new file mode 100644
index 0000000..2c11493
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBG.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBG0.png b/common/Resources/Images/pageThumbnailBG0.png
new file mode 100644
index 0000000..db2c684
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBG0.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBG1.png b/common/Resources/Images/pageThumbnailBG1.png
new file mode 100644
index 0000000..f0c14ce
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBG1.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBG2.png b/common/Resources/Images/pageThumbnailBG2.png
new file mode 100644
index 0000000..4969241
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBG2.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBG3.png b/common/Resources/Images/pageThumbnailBG3.png
new file mode 100644
index 0000000..839b741
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBG3.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut0.png b/common/Resources/Images/pageThumbnailBut0.png
new file mode 100755
index 0000000..e70e75c
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut0.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut0Down.png b/common/Resources/Images/pageThumbnailBut0Down.png
new file mode 100755
index 0000000..0266d10
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut0Down.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut1.png b/common/Resources/Images/pageThumbnailBut1.png
new file mode 100755
index 0000000..e74600c
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut1.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut1Down.png b/common/Resources/Images/pageThumbnailBut1Down.png
new file mode 100755
index 0000000..cfa3f69
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut1Down.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut2.png b/common/Resources/Images/pageThumbnailBut2.png
new file mode 100755
index 0000000..7f16f50
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut2.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut2Down.png b/common/Resources/Images/pageThumbnailBut2Down.png
new file mode 100755
index 0000000..9e7d79a
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut2Down.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut3.png b/common/Resources/Images/pageThumbnailBut3.png
new file mode 100755
index 0000000..8f7be4d
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut3.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailBut3Down.png b/common/Resources/Images/pageThumbnailBut3Down.png
new file mode 100755
index 0000000..90b6b92
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailBut3Down.png
Binary files differ
diff --git a/common/Resources/Images/pageThumbnailMask.png b/common/Resources/Images/pageThumbnailMask.png
new file mode 100644
index 0000000..2a1d416
--- /dev/null
+++ b/common/Resources/Images/pageThumbnailMask.png
Binary files differ
diff --git a/common/Resources/Images/people.png b/common/Resources/Images/people.png
new file mode 100644
index 0000000..3bc11b7
--- /dev/null
+++ b/common/Resources/Images/people.png
Binary files differ
diff --git a/common/Resources/Images/peoplesel.png b/common/Resources/Images/peoplesel.png
new file mode 100644
index 0000000..0893c2e
--- /dev/null
+++ b/common/Resources/Images/peoplesel.png
Binary files differ
diff --git a/common/Resources/Images/percussions.png b/common/Resources/Images/percussions.png
new file mode 100644
index 0000000..e39e3ef
--- /dev/null
+++ b/common/Resources/Images/percussions.png
Binary files differ
diff --git a/common/Resources/Images/percussionssel.png b/common/Resources/Images/percussionssel.png
new file mode 100644
index 0000000..9d8fadd
--- /dev/null
+++ b/common/Resources/Images/percussionssel.png
Binary files differ
diff --git a/common/Resources/Images/piano.png b/common/Resources/Images/piano.png
new file mode 100644
index 0000000..dbd8e21
--- /dev/null
+++ b/common/Resources/Images/piano.png
Binary files differ
diff --git a/common/Resources/Images/pianosel.png b/common/Resources/Images/pianosel.png
new file mode 100644
index 0000000..9c1923a
--- /dev/null
+++ b/common/Resources/Images/pianosel.png
Binary files differ
diff --git a/common/Resources/Images/plane.png b/common/Resources/Images/plane.png
new file mode 100755
index 0000000..ccb8607
--- /dev/null
+++ b/common/Resources/Images/plane.png
Binary files differ
diff --git a/common/Resources/Images/planesel.png b/common/Resources/Images/planesel.png
new file mode 100755
index 0000000..1120b67
--- /dev/null
+++ b/common/Resources/Images/planesel.png
Binary files differ
diff --git a/common/Resources/Images/reverb0.png b/common/Resources/Images/reverb0.png
new file mode 100644
index 0000000..234bef6
--- /dev/null
+++ b/common/Resources/Images/reverb0.png
Binary files differ
diff --git a/common/Resources/Images/reverb1.png b/common/Resources/Images/reverb1.png
new file mode 100644
index 0000000..d05da05
--- /dev/null
+++ b/common/Resources/Images/reverb1.png
Binary files differ
diff --git a/common/Resources/Images/reverb2.png b/common/Resources/Images/reverb2.png
new file mode 100644
index 0000000..91942d5
--- /dev/null
+++ b/common/Resources/Images/reverb2.png
Binary files differ
diff --git a/common/Resources/Images/reverb3.png b/common/Resources/Images/reverb3.png
new file mode 100644
index 0000000..f503f7d
--- /dev/null
+++ b/common/Resources/Images/reverb3.png
Binary files differ
diff --git a/common/Resources/Images/reverb4.png b/common/Resources/Images/reverb4.png
new file mode 100644
index 0000000..1588275
--- /dev/null
+++ b/common/Resources/Images/reverb4.png
Binary files differ
diff --git a/common/Resources/Images/reverb5.png b/common/Resources/Images/reverb5.png
new file mode 100644
index 0000000..a67d360
--- /dev/null
+++ b/common/Resources/Images/reverb5.png
Binary files differ
diff --git a/common/Resources/Images/rhodes.png b/common/Resources/Images/rhodes.png
new file mode 100644
index 0000000..658991d
--- /dev/null
+++ b/common/Resources/Images/rhodes.png
Binary files differ
diff --git a/common/Resources/Images/rhodessel.png b/common/Resources/Images/rhodessel.png
new file mode 100644
index 0000000..95a920f
--- /dev/null
+++ b/common/Resources/Images/rhodessel.png
Binary files differ
diff --git a/common/Resources/Images/sampleBG.png b/common/Resources/Images/sampleBG.png
new file mode 100644
index 0000000..359244e
--- /dev/null
+++ b/common/Resources/Images/sampleBG.png
Binary files differ
diff --git a/common/Resources/Images/sampleNoteMask.png b/common/Resources/Images/sampleNoteMask.png
new file mode 100644
index 0000000..cc9448f
--- /dev/null
+++ b/common/Resources/Images/sampleNoteMask.png
Binary files differ
diff --git a/common/Resources/Images/saxo.png b/common/Resources/Images/saxo.png
new file mode 100644
index 0000000..cadf6fe
--- /dev/null
+++ b/common/Resources/Images/saxo.png
Binary files differ
diff --git a/common/Resources/Images/saxosel.png b/common/Resources/Images/saxosel.png
new file mode 100644
index 0000000..838d552
--- /dev/null
+++ b/common/Resources/Images/saxosel.png
Binary files differ
diff --git a/common/Resources/Images/scrollBar.png b/common/Resources/Images/scrollBar.png
new file mode 100644
index 0000000..b8fb3cb
--- /dev/null
+++ b/common/Resources/Images/scrollBar.png
Binary files differ
diff --git a/common/Resources/Images/sheep.png b/common/Resources/Images/sheep.png
new file mode 100644
index 0000000..3c46699
--- /dev/null
+++ b/common/Resources/Images/sheep.png
Binary files differ
diff --git a/common/Resources/Images/sheepsel.png b/common/Resources/Images/sheepsel.png
new file mode 100644
index 0000000..42548a0
--- /dev/null
+++ b/common/Resources/Images/sheepsel.png
Binary files differ
diff --git a/common/Resources/Images/shenai.png b/common/Resources/Images/shenai.png
new file mode 100644
index 0000000..99eb91d
--- /dev/null
+++ b/common/Resources/Images/shenai.png
Binary files differ
diff --git a/common/Resources/Images/shenaisel.png b/common/Resources/Images/shenaisel.png
new file mode 100644
index 0000000..bde3c4f
--- /dev/null
+++ b/common/Resources/Images/shenaisel.png
Binary files differ
diff --git a/common/Resources/Images/sitar.png b/common/Resources/Images/sitar.png
new file mode 100644
index 0000000..0a61628
--- /dev/null
+++ b/common/Resources/Images/sitar.png
Binary files differ
diff --git a/common/Resources/Images/sitarsel.png b/common/Resources/Images/sitarsel.png
new file mode 100644
index 0000000..512726e
--- /dev/null
+++ b/common/Resources/Images/sitarsel.png
Binary files differ
diff --git a/common/Resources/Images/slap.png b/common/Resources/Images/slap.png
new file mode 100755
index 0000000..cafbe5e
--- /dev/null
+++ b/common/Resources/Images/slap.png
Binary files differ
diff --git a/common/Resources/Images/slapsel.png b/common/Resources/Images/slapsel.png
new file mode 100755
index 0000000..85bd6b4
--- /dev/null
+++ b/common/Resources/Images/slapsel.png
Binary files differ
diff --git a/common/Resources/Images/sliderDrum.png b/common/Resources/Images/sliderDrum.png
new file mode 100644
index 0000000..dd65e6d
--- /dev/null
+++ b/common/Resources/Images/sliderDrum.png
Binary files differ
diff --git a/common/Resources/Images/sliderEditTempo.png b/common/Resources/Images/sliderEditTempo.png
new file mode 100644
index 0000000..0ec252d
--- /dev/null
+++ b/common/Resources/Images/sliderEditTempo.png
Binary files differ
diff --git a/common/Resources/Images/sliderEditVolume.png b/common/Resources/Images/sliderEditVolume.png
new file mode 100644
index 0000000..5f4daca
--- /dev/null
+++ b/common/Resources/Images/sliderEditVolume.png
Binary files differ
diff --git a/common/Resources/Images/sliderInst1.png b/common/Resources/Images/sliderInst1.png
new file mode 100644
index 0000000..fc48d15
--- /dev/null
+++ b/common/Resources/Images/sliderInst1.png
Binary files differ
diff --git a/common/Resources/Images/sliderInst2.png b/common/Resources/Images/sliderInst2.png
new file mode 100644
index 0000000..4f256eb
--- /dev/null
+++ b/common/Resources/Images/sliderInst2.png
Binary files differ
diff --git a/common/Resources/Images/sliderInst3.png b/common/Resources/Images/sliderInst3.png
new file mode 100644
index 0000000..e86b71e
--- /dev/null
+++ b/common/Resources/Images/sliderInst3.png
Binary files differ
diff --git a/common/Resources/Images/sliderInst4.png b/common/Resources/Images/sliderInst4.png
new file mode 100644
index 0000000..e812bd4
--- /dev/null
+++ b/common/Resources/Images/sliderInst4.png
Binary files differ
diff --git a/common/Resources/Images/sliderbutbleu.png b/common/Resources/Images/sliderbutbleu.png
new file mode 100644
index 0000000..6c34a77
--- /dev/null
+++ b/common/Resources/Images/sliderbutbleu.png
Binary files differ
diff --git a/common/Resources/Images/sliderbutjaune.png b/common/Resources/Images/sliderbutjaune.png
new file mode 100644
index 0000000..6f0fe9d
--- /dev/null
+++ b/common/Resources/Images/sliderbutjaune.png
Binary files differ
diff --git a/common/Resources/Images/sliderbutred.png b/common/Resources/Images/sliderbutred.png
new file mode 100644
index 0000000..2e44538
--- /dev/null
+++ b/common/Resources/Images/sliderbutred.png
Binary files differ
diff --git a/common/Resources/Images/sliderbutvert.png b/common/Resources/Images/sliderbutvert.png
new file mode 100644
index 0000000..bbe53e8
--- /dev/null
+++ b/common/Resources/Images/sliderbutvert.png
Binary files differ
diff --git a/common/Resources/Images/sliderbutviolet.png b/common/Resources/Images/sliderbutviolet.png
new file mode 100644
index 0000000..a2b2a54
--- /dev/null
+++ b/common/Resources/Images/sliderbutviolet.png
Binary files differ
diff --git a/common/Resources/Images/sliderlong.png b/common/Resources/Images/sliderlong.png
new file mode 100644
index 0000000..f6e05e4
--- /dev/null
+++ b/common/Resources/Images/sliderlong.png
Binary files differ
diff --git a/common/Resources/Images/slidershort.png b/common/Resources/Images/slidershort.png
new file mode 100644
index 0000000..aff8bb1
--- /dev/null
+++ b/common/Resources/Images/slidershort.png
Binary files differ
diff --git a/common/Resources/Images/stop.png b/common/Resources/Images/stop.png
new file mode 100644
index 0000000..cd55af1
--- /dev/null
+++ b/common/Resources/Images/stop.png
Binary files differ
diff --git a/common/Resources/Images/strings.png b/common/Resources/Images/strings.png
new file mode 100644
index 0000000..38de9ca
--- /dev/null
+++ b/common/Resources/Images/strings.png
Binary files differ
diff --git a/common/Resources/Images/stringssel.png b/common/Resources/Images/stringssel.png
new file mode 100644
index 0000000..08f8997
--- /dev/null
+++ b/common/Resources/Images/stringssel.png
Binary files differ
diff --git a/common/Resources/Images/synthTam.png b/common/Resources/Images/synthTam.png
new file mode 100644
index 0000000..e0837d2
--- /dev/null
+++ b/common/Resources/Images/synthTam.png
Binary files differ
diff --git a/common/Resources/Images/synthTamDown.png b/common/Resources/Images/synthTamDown.png
new file mode 100644
index 0000000..eef7fcb
--- /dev/null
+++ b/common/Resources/Images/synthTamDown.png
Binary files differ
diff --git a/common/Resources/Images/synthTamOver.png b/common/Resources/Images/synthTamOver.png
new file mode 100644
index 0000000..6f203e8
--- /dev/null
+++ b/common/Resources/Images/synthTamOver.png
Binary files differ
diff --git a/common/Resources/Images/synthlabMask.png b/common/Resources/Images/synthlabMask.png
new file mode 100644
index 0000000..b41d467
--- /dev/null
+++ b/common/Resources/Images/synthlabMask.png
Binary files differ
diff --git a/common/Resources/Images/tchiwo.png b/common/Resources/Images/tchiwo.png
new file mode 100644
index 0000000..666f004
--- /dev/null
+++ b/common/Resources/Images/tchiwo.png
Binary files differ
diff --git a/common/Resources/Images/tchiwosel.png b/common/Resources/Images/tchiwosel.png
new file mode 100644
index 0000000..9878149
--- /dev/null
+++ b/common/Resources/Images/tchiwosel.png
Binary files differ
diff --git a/common/Resources/Images/tempo1.png b/common/Resources/Images/tempo1.png
new file mode 100644
index 0000000..71f741c
--- /dev/null
+++ b/common/Resources/Images/tempo1.png
Binary files differ
diff --git a/common/Resources/Images/tempo2.png b/common/Resources/Images/tempo2.png
new file mode 100644
index 0000000..2c69512
--- /dev/null
+++ b/common/Resources/Images/tempo2.png
Binary files differ
diff --git a/common/Resources/Images/tempo3.png b/common/Resources/Images/tempo3.png
new file mode 100644
index 0000000..a7905d1
--- /dev/null
+++ b/common/Resources/Images/tempo3.png
Binary files differ
diff --git a/common/Resources/Images/tempo4.png b/common/Resources/Images/tempo4.png
new file mode 100644
index 0000000..c264a47
--- /dev/null
+++ b/common/Resources/Images/tempo4.png
Binary files differ
diff --git a/common/Resources/Images/tempo5.png b/common/Resources/Images/tempo5.png
new file mode 100644
index 0000000..1c89411
--- /dev/null
+++ b/common/Resources/Images/tempo5.png
Binary files differ
diff --git a/common/Resources/Images/tempo6.png b/common/Resources/Images/tempo6.png
new file mode 100644
index 0000000..68deca9
--- /dev/null
+++ b/common/Resources/Images/tempo6.png
Binary files differ
diff --git a/common/Resources/Images/tempo7.png b/common/Resources/Images/tempo7.png
new file mode 100644
index 0000000..81ffb5a
--- /dev/null
+++ b/common/Resources/Images/tempo7.png
Binary files differ
diff --git a/common/Resources/Images/tempo8.png b/common/Resources/Images/tempo8.png
new file mode 100644
index 0000000..751e68a
--- /dev/null
+++ b/common/Resources/Images/tempo8.png
Binary files differ
diff --git a/common/Resources/Images/trackBG.png b/common/Resources/Images/trackBG.png
new file mode 100644
index 0000000..6fdf29c
--- /dev/null
+++ b/common/Resources/Images/trackBG.png
Binary files differ
diff --git a/common/Resources/Images/trackBGDrum.png b/common/Resources/Images/trackBGDrum.png
new file mode 100644
index 0000000..1a53271
--- /dev/null
+++ b/common/Resources/Images/trackBGDrum.png
Binary files differ
diff --git a/common/Resources/Images/trackBGDrumSelected.png b/common/Resources/Images/trackBGDrumSelected.png
new file mode 100644
index 0000000..54f765e
--- /dev/null
+++ b/common/Resources/Images/trackBGDrumSelected.png
Binary files differ
diff --git a/common/Resources/Images/trackBGSelected.png b/common/Resources/Images/trackBGSelected.png
new file mode 100644
index 0000000..c800112
--- /dev/null
+++ b/common/Resources/Images/trackBGSelected.png
Binary files differ
diff --git a/common/Resources/Images/triangle.png b/common/Resources/Images/triangle.png
new file mode 100644
index 0000000..2a74f17
--- /dev/null
+++ b/common/Resources/Images/triangle.png
Binary files differ
diff --git a/common/Resources/Images/trianglesel.png b/common/Resources/Images/trianglesel.png
new file mode 100644
index 0000000..70d6e58
--- /dev/null
+++ b/common/Resources/Images/trianglesel.png
Binary files differ
diff --git a/common/Resources/Images/trumpet.png b/common/Resources/Images/trumpet.png
new file mode 100644
index 0000000..6876a92
--- /dev/null
+++ b/common/Resources/Images/trumpet.png
Binary files differ
diff --git a/common/Resources/Images/trumpetsel.png b/common/Resources/Images/trumpetsel.png
new file mode 100644
index 0000000..d77a8e4
--- /dev/null
+++ b/common/Resources/Images/trumpetsel.png
Binary files differ
diff --git a/common/Resources/Images/tuba.png b/common/Resources/Images/tuba.png
new file mode 100644
index 0000000..5cdf2f1
--- /dev/null
+++ b/common/Resources/Images/tuba.png
Binary files differ
diff --git a/common/Resources/Images/tubasel.png b/common/Resources/Images/tubasel.png
new file mode 100644
index 0000000..d194d91
--- /dev/null
+++ b/common/Resources/Images/tubasel.png
Binary files differ
diff --git a/common/Resources/Images/violin.png b/common/Resources/Images/violin.png
new file mode 100644
index 0000000..f13988f
--- /dev/null
+++ b/common/Resources/Images/violin.png
Binary files differ
diff --git a/common/Resources/Images/violinsel.png b/common/Resources/Images/violinsel.png
new file mode 100644
index 0000000..36f8b02
--- /dev/null
+++ b/common/Resources/Images/violinsel.png
Binary files differ
diff --git a/common/Resources/Images/voix.png b/common/Resources/Images/voix.png
new file mode 100644
index 0000000..0c1fc68
--- /dev/null
+++ b/common/Resources/Images/voix.png
Binary files differ
diff --git a/common/Resources/Images/voixsel.png b/common/Resources/Images/voixsel.png
new file mode 100644
index 0000000..8dc5a37
--- /dev/null
+++ b/common/Resources/Images/voixsel.png
Binary files differ
diff --git a/common/Resources/Images/volume0.png b/common/Resources/Images/volume0.png
new file mode 100644
index 0000000..f2af58b
--- /dev/null
+++ b/common/Resources/Images/volume0.png
Binary files differ
diff --git a/common/Resources/Images/volume1.png b/common/Resources/Images/volume1.png
new file mode 100644
index 0000000..67bd806
--- /dev/null
+++ b/common/Resources/Images/volume1.png
Binary files differ
diff --git a/common/Resources/Images/volume2.png b/common/Resources/Images/volume2.png
new file mode 100644
index 0000000..74511e9
--- /dev/null
+++ b/common/Resources/Images/volume2.png
Binary files differ
diff --git a/common/Resources/Images/volume3.png b/common/Resources/Images/volume3.png
new file mode 100644
index 0000000..fc0f894
--- /dev/null
+++ b/common/Resources/Images/volume3.png
Binary files differ
diff --git a/common/Resources/Images/water.png b/common/Resources/Images/water.png
new file mode 100644
index 0000000..c199fff
--- /dev/null
+++ b/common/Resources/Images/water.png
Binary files differ
diff --git a/common/Resources/Images/watersel.png b/common/Resources/Images/watersel.png
new file mode 100644
index 0000000..c685fe6
--- /dev/null
+++ b/common/Resources/Images/watersel.png
Binary files differ
diff --git a/common/Resources/Images/winds.png b/common/Resources/Images/winds.png
new file mode 100644
index 0000000..bfb9e26
--- /dev/null
+++ b/common/Resources/Images/winds.png
Binary files differ
diff --git a/common/Resources/Images/windssel.png b/common/Resources/Images/windssel.png
new file mode 100644
index 0000000..fee7452
--- /dev/null
+++ b/common/Resources/Images/windssel.png
Binary files differ
diff --git a/common/Resources/Images/zap.png b/common/Resources/Images/zap.png
new file mode 100644
index 0000000..6599e0f
--- /dev/null
+++ b/common/Resources/Images/zap.png
Binary files differ
diff --git a/common/Resources/Images/zapsel.png b/common/Resources/Images/zapsel.png
new file mode 100644
index 0000000..0f2b324
--- /dev/null
+++ b/common/Resources/Images/zapsel.png
Binary files differ
diff --git a/common/Resources/Loops/loop1.ttl b/common/Resources/Loops/loop1.ttl
new file mode 100644
index 0000000..97bb9a6
--- /dev/null
+++ b/common/Resources/Loops/loop1.ttl
@@ -0,0 +1,5 @@
+page_add 2 7 0 [88, 77, 67, 85, 137]
+note_add 92 2 0 0 29 0.75 0.5 24 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 93 2 0 24 44 0.75 0.5 7 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 94 2 0 36 44 0.75 0.5 6 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 95 2 0 48 32 0.75 0.5 24 0 88 0.005 0.098 0.1 0 1000 0 edit
diff --git a/common/Resources/Loops/loop2.ttl b/common/Resources/Loops/loop2.ttl
new file mode 100644
index 0000000..2e5e7ea
--- /dev/null
+++ b/common/Resources/Loops/loop2.ttl
@@ -0,0 +1,44 @@
+page_add 16 5 0 [88, 76, 56, 82, 135]
+note_add 73 16 0 0 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 74 16 0 12 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 75 16 0 1 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 76 16 0 2 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 77 16 0 3 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 78 16 0 4 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 79 16 0 13 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 80 16 0 14 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 81 16 0 15 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 82 16 0 16 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 83 16 0 24 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 84 16 0 25 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 85 16 0 26 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 86 16 0 27 48 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 87 16 0 36 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 88 16 0 37 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 89 16 0 38 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 90 16 0 39 24 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 91 16 0 55 35 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 92 16 0 56 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 93 16 0 57 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 94 16 0 58 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 95 16 0 59 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 96 16 0 43 35 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 97 16 0 44 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 98 16 0 45 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 99 16 0 46 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 100 16 0 47 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 101 16 0 31 35 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 102 16 0 32 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 103 16 0 33 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 104 16 0 34 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 105 16 0 35 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 106 16 0 19 35 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 107 16 0 20 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 108 16 0 21 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 109 16 0 22 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 110 16 0 23 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 111 16 0 7 35 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 112 16 0 8 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 113 16 0 9 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 114 16 0 10 36 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 115 16 0 11 34 0.75 0.5 1 0 88 0.005 0.098 0.1 0 1000 0 edit
diff --git a/common/Resources/Loops/loop3.ttl b/common/Resources/Loops/loop3.ttl
new file mode 100644
index 0000000..4b6bdd6
--- /dev/null
+++ b/common/Resources/Loops/loop3.ttl
@@ -0,0 +1,9 @@
+page_add 16 2 0 [88, 76, 56, 82, 135]
+note_add 116 16 0 0 45 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 117 16 0 3 45 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 118 16 0 6 45 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 119 16 0 9 41 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 120 16 0 12 24 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 121 16 0 15 24 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 122 16 0 18 38 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
+note_add 123 16 0 21 45 0.75 0.5 3 0 88 0.005 0.098 0.1 0 1000 0 edit
diff --git a/common/Resources/Sounds/acguit b/common/Resources/Sounds/acguit
new file mode 100755
index 0000000..ec431e8
--- /dev/null
+++ b/common/Resources/Sounds/acguit
Binary files differ
diff --git a/common/Resources/Sounds/alarm b/common/Resources/Sounds/alarm
new file mode 100755
index 0000000..34eb906
--- /dev/null
+++ b/common/Resources/Sounds/alarm
Binary files differ
diff --git a/common/Resources/Sounds/banjo b/common/Resources/Sounds/banjo
new file mode 100755
index 0000000..ec431e8
--- /dev/null
+++ b/common/Resources/Sounds/banjo
Binary files differ
diff --git a/common/Resources/Sounds/basse b/common/Resources/Sounds/basse
new file mode 100755
index 0000000..2bc1571
--- /dev/null
+++ b/common/Resources/Sounds/basse
Binary files differ
diff --git a/common/Resources/Sounds/bird b/common/Resources/Sounds/bird
new file mode 100755
index 0000000..fbe8a29
--- /dev/null
+++ b/common/Resources/Sounds/bird
Binary files differ
diff --git a/common/Resources/Sounds/bottle b/common/Resources/Sounds/bottle
new file mode 100755
index 0000000..8f3d680
--- /dev/null
+++ b/common/Resources/Sounds/bottle
Binary files differ
diff --git a/common/Resources/Sounds/bubbles b/common/Resources/Sounds/bubbles
new file mode 100755
index 0000000..849ff02
--- /dev/null
+++ b/common/Resources/Sounds/bubbles
Binary files differ
diff --git a/common/Resources/Sounds/byke b/common/Resources/Sounds/byke
new file mode 100755
index 0000000..6f428b8
--- /dev/null
+++ b/common/Resources/Sounds/byke
Binary files differ
diff --git a/common/Resources/Sounds/camera b/common/Resources/Sounds/camera
new file mode 100755
index 0000000..8eaa5b5
--- /dev/null
+++ b/common/Resources/Sounds/camera
Binary files differ
diff --git a/common/Resources/Sounds/car b/common/Resources/Sounds/car
new file mode 100755
index 0000000..66e42ae
--- /dev/null
+++ b/common/Resources/Sounds/car
Binary files differ
diff --git a/common/Resources/Sounds/cat b/common/Resources/Sounds/cat
new file mode 100755
index 0000000..845ee8e
--- /dev/null
+++ b/common/Resources/Sounds/cat
Binary files differ
diff --git a/common/Resources/Sounds/cello b/common/Resources/Sounds/cello
new file mode 100755
index 0000000..4249723
--- /dev/null
+++ b/common/Resources/Sounds/cello
Binary files differ
diff --git a/common/Resources/Sounds/chimes b/common/Resources/Sounds/chimes
new file mode 100755
index 0000000..f83e23c
--- /dev/null
+++ b/common/Resources/Sounds/chimes
Binary files differ
diff --git a/common/Resources/Sounds/clang b/common/Resources/Sounds/clang
new file mode 100755
index 0000000..01476fc
--- /dev/null
+++ b/common/Resources/Sounds/clang
Binary files differ
diff --git a/common/Resources/Sounds/clarinette b/common/Resources/Sounds/clarinette
new file mode 100755
index 0000000..329974e
--- /dev/null
+++ b/common/Resources/Sounds/clarinette
Binary files differ
diff --git a/common/Resources/Sounds/cling b/common/Resources/Sounds/cling
new file mode 100755
index 0000000..db3525f
--- /dev/null
+++ b/common/Resources/Sounds/cling
Binary files differ
diff --git a/common/Resources/Sounds/crash b/common/Resources/Sounds/crash
new file mode 100755
index 0000000..8408175
--- /dev/null
+++ b/common/Resources/Sounds/crash
Binary files differ
diff --git a/common/Resources/Sounds/diceinst b/common/Resources/Sounds/diceinst
new file mode 100755
index 0000000..5a41341
--- /dev/null
+++ b/common/Resources/Sounds/diceinst
Binary files differ
diff --git a/common/Resources/Sounds/didjeridu b/common/Resources/Sounds/didjeridu
new file mode 100755
index 0000000..d7556e7
--- /dev/null
+++ b/common/Resources/Sounds/didjeridu
Binary files differ
diff --git a/common/Resources/Sounds/dog b/common/Resources/Sounds/dog
new file mode 100755
index 0000000..c1e8e22
--- /dev/null
+++ b/common/Resources/Sounds/dog
Binary files differ
diff --git a/common/Resources/Sounds/door b/common/Resources/Sounds/door
new file mode 100755
index 0000000..2b3b21a
--- /dev/null
+++ b/common/Resources/Sounds/door
Binary files differ
diff --git a/common/Resources/Sounds/drum1chine b/common/Resources/Sounds/drum1chine
new file mode 100755
index 0000000..bb29f18
--- /dev/null
+++ b/common/Resources/Sounds/drum1chine
Binary files differ
diff --git a/common/Resources/Sounds/drum1crash b/common/Resources/Sounds/drum1crash
new file mode 100755
index 0000000..5f520c2
--- /dev/null
+++ b/common/Resources/Sounds/drum1crash
Binary files differ
diff --git a/common/Resources/Sounds/drum1floortom b/common/Resources/Sounds/drum1floortom
new file mode 100755
index 0000000..f43cb2b
--- /dev/null
+++ b/common/Resources/Sounds/drum1floortom
Binary files differ
diff --git a/common/Resources/Sounds/drum1hardride b/common/Resources/Sounds/drum1hardride
new file mode 100755
index 0000000..94f052f
--- /dev/null
+++ b/common/Resources/Sounds/drum1hardride
Binary files differ
diff --git a/common/Resources/Sounds/drum1hatpedal b/common/Resources/Sounds/drum1hatpedal
new file mode 100755
index 0000000..0c0afe6
--- /dev/null
+++ b/common/Resources/Sounds/drum1hatpedal
Binary files differ
diff --git a/common/Resources/Sounds/drum1hatshoulder b/common/Resources/Sounds/drum1hatshoulder
new file mode 100755
index 0000000..395ef0b
--- /dev/null
+++ b/common/Resources/Sounds/drum1hatshoulder
Binary files differ
diff --git a/common/Resources/Sounds/drum1kick b/common/Resources/Sounds/drum1kick
new file mode 100755
index 0000000..0acfb56
--- /dev/null
+++ b/common/Resources/Sounds/drum1kick
Binary files differ
diff --git a/common/Resources/Sounds/drum1ridebell b/common/Resources/Sounds/drum1ridebell
new file mode 100755
index 0000000..6f6b6ce
--- /dev/null
+++ b/common/Resources/Sounds/drum1ridebell
Binary files differ
diff --git a/common/Resources/Sounds/drum1snare b/common/Resources/Sounds/drum1snare
new file mode 100755
index 0000000..54a6372
--- /dev/null
+++ b/common/Resources/Sounds/drum1snare
Binary files differ
diff --git a/common/Resources/Sounds/drum1snaresidestick b/common/Resources/Sounds/drum1snaresidestick
new file mode 100755
index 0000000..a99e846
--- /dev/null
+++ b/common/Resources/Sounds/drum1snaresidestick
Binary files differ
diff --git a/common/Resources/Sounds/drum1splash b/common/Resources/Sounds/drum1splash
new file mode 100755
index 0000000..49a334e
--- /dev/null
+++ b/common/Resources/Sounds/drum1splash
Binary files differ
diff --git a/common/Resources/Sounds/drum1tom b/common/Resources/Sounds/drum1tom
new file mode 100755
index 0000000..ed1464c
--- /dev/null
+++ b/common/Resources/Sounds/drum1tom
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukadoom b/common/Resources/Sounds/drum2darbukadoom
new file mode 100755
index 0000000..5a90725
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukadoom
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukafinger b/common/Resources/Sounds/drum2darbukafinger
new file mode 100755
index 0000000..163aa3c
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukafinger
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukapied b/common/Resources/Sounds/drum2darbukapied
new file mode 100755
index 0000000..006586a
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukapied
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukapiedsoft b/common/Resources/Sounds/drum2darbukapiedsoft
new file mode 100755
index 0000000..cf2aaa8
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukapiedsoft
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukaroll b/common/Resources/Sounds/drum2darbukaroll
new file mode 100755
index 0000000..ded7a31
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukaroll
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukaslap b/common/Resources/Sounds/drum2darbukaslap
new file mode 100755
index 0000000..fd70b88
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukaslap
Binary files differ
diff --git a/common/Resources/Sounds/drum2darbukatak b/common/Resources/Sounds/drum2darbukatak
new file mode 100755
index 0000000..329f619
--- /dev/null
+++ b/common/Resources/Sounds/drum2darbukatak
Binary files differ
diff --git a/common/Resources/Sounds/drum2hatflanger b/common/Resources/Sounds/drum2hatflanger
new file mode 100755
index 0000000..9dd9389
--- /dev/null
+++ b/common/Resources/Sounds/drum2hatflanger
Binary files differ
diff --git a/common/Resources/Sounds/drum2hatpied b/common/Resources/Sounds/drum2hatpied
new file mode 100755
index 0000000..84e774e
--- /dev/null
+++ b/common/Resources/Sounds/drum2hatpied
Binary files differ
diff --git a/common/Resources/Sounds/drum2hatpied2 b/common/Resources/Sounds/drum2hatpied2
new file mode 100755
index 0000000..cd21b17
--- /dev/null
+++ b/common/Resources/Sounds/drum2hatpied2
Binary files differ
diff --git a/common/Resources/Sounds/drum2tambourinepied b/common/Resources/Sounds/drum2tambourinepied
new file mode 100755
index 0000000..d6b566a
--- /dev/null
+++ b/common/Resources/Sounds/drum2tambourinepied
Binary files differ
diff --git a/common/Resources/Sounds/drum2tambourinepiedsoft b/common/Resources/Sounds/drum2tambourinepiedsoft
new file mode 100755
index 0000000..4da2ea6
--- /dev/null
+++ b/common/Resources/Sounds/drum2tambourinepiedsoft
Binary files differ
diff --git a/common/Resources/Sounds/drum3cowbell b/common/Resources/Sounds/drum3cowbell
new file mode 100755
index 0000000..3c52687
--- /dev/null
+++ b/common/Resources/Sounds/drum3cowbell
Binary files differ
diff --git a/common/Resources/Sounds/drum3cowbelltip b/common/Resources/Sounds/drum3cowbelltip
new file mode 100755
index 0000000..7b79fe2
--- /dev/null
+++ b/common/Resources/Sounds/drum3cowbelltip
Binary files differ
diff --git a/common/Resources/Sounds/drum3cup b/common/Resources/Sounds/drum3cup
new file mode 100755
index 0000000..6cf6da2
--- /dev/null
+++ b/common/Resources/Sounds/drum3cup
Binary files differ
diff --git a/common/Resources/Sounds/drum3djembelow b/common/Resources/Sounds/drum3djembelow
new file mode 100755
index 0000000..ad5fd0a
--- /dev/null
+++ b/common/Resources/Sounds/drum3djembelow
Binary files differ
diff --git a/common/Resources/Sounds/drum3djembemid b/common/Resources/Sounds/drum3djembemid
new file mode 100755
index 0000000..55b6d9f
--- /dev/null
+++ b/common/Resources/Sounds/drum3djembemid
Binary files differ
diff --git a/common/Resources/Sounds/drum3djembesidestick b/common/Resources/Sounds/drum3djembesidestick
new file mode 100755
index 0000000..94c29e6
--- /dev/null
+++ b/common/Resources/Sounds/drum3djembesidestick
Binary files differ
diff --git a/common/Resources/Sounds/drum3djembeslap b/common/Resources/Sounds/drum3djembeslap
new file mode 100755
index 0000000..d201e52
--- /dev/null
+++ b/common/Resources/Sounds/drum3djembeslap
Binary files differ
diff --git a/common/Resources/Sounds/drum3djembestickmid b/common/Resources/Sounds/drum3djembestickmid
new file mode 100755
index 0000000..9da83ba
--- /dev/null
+++ b/common/Resources/Sounds/drum3djembestickmid
Binary files differ
diff --git a/common/Resources/Sounds/drum3metalstand b/common/Resources/Sounds/drum3metalstand
new file mode 100755
index 0000000..059efcc
--- /dev/null
+++ b/common/Resources/Sounds/drum3metalstand
Binary files differ
diff --git a/common/Resources/Sounds/drum3pedalperc b/common/Resources/Sounds/drum3pedalperc
new file mode 100755
index 0000000..c271d66
--- /dev/null
+++ b/common/Resources/Sounds/drum3pedalperc
Binary files differ
diff --git a/common/Resources/Sounds/drum3rainstick b/common/Resources/Sounds/drum3rainstick
new file mode 100755
index 0000000..561d0d9
--- /dev/null
+++ b/common/Resources/Sounds/drum3rainstick
Binary files differ
diff --git a/common/Resources/Sounds/drum3tambourinehigh b/common/Resources/Sounds/drum3tambourinehigh
new file mode 100755
index 0000000..cf2c61e
--- /dev/null
+++ b/common/Resources/Sounds/drum3tambourinehigh
Binary files differ
diff --git a/common/Resources/Sounds/drum3tambourinelow b/common/Resources/Sounds/drum3tambourinelow
new file mode 100755
index 0000000..ff8e278
--- /dev/null
+++ b/common/Resources/Sounds/drum3tambourinelow
Binary files differ
diff --git a/common/Resources/Sounds/drum4afrofeet b/common/Resources/Sounds/drum4afrofeet
new file mode 100644
index 0000000..b2044da
--- /dev/null
+++ b/common/Resources/Sounds/drum4afrofeet
Binary files differ
diff --git a/common/Resources/Sounds/drum4fingersn b/common/Resources/Sounds/drum4fingersn
new file mode 100644
index 0000000..e6b60a5
--- /dev/null
+++ b/common/Resources/Sounds/drum4fingersn
Binary files differ
diff --git a/common/Resources/Sounds/drum4mutecuic b/common/Resources/Sounds/drum4mutecuic
new file mode 100644
index 0000000..ef0c0c0
--- /dev/null
+++ b/common/Resources/Sounds/drum4mutecuic
Binary files differ
diff --git a/common/Resources/Sounds/drum4stompbass b/common/Resources/Sounds/drum4stompbass
new file mode 100644
index 0000000..68dd316
--- /dev/null
+++ b/common/Resources/Sounds/drum4stompbass
Binary files differ
diff --git a/common/Resources/Sounds/drum4tambouri b/common/Resources/Sounds/drum4tambouri
new file mode 100644
index 0000000..5b32be2
--- /dev/null
+++ b/common/Resources/Sounds/drum4tambouri
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr707clap b/common/Resources/Sounds/drum4tr707clap
new file mode 100644
index 0000000..f9ea03e
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr707clap
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr707open b/common/Resources/Sounds/drum4tr707open
new file mode 100644
index 0000000..f7d54bf
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr707open
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr808closed b/common/Resources/Sounds/drum4tr808closed
new file mode 100644
index 0000000..8995edd
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr808closed
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr808sn b/common/Resources/Sounds/drum4tr808sn
new file mode 100644
index 0000000..adde850
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr808sn
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr909bass b/common/Resources/Sounds/drum4tr909bass
new file mode 100644
index 0000000..6420213
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr909bass
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr909kick b/common/Resources/Sounds/drum4tr909kick
new file mode 100644
index 0000000..6e33dd3
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr909kick
Binary files differ
diff --git a/common/Resources/Sounds/drum4tr909sn b/common/Resources/Sounds/drum4tr909sn
new file mode 100644
index 0000000..486ed42
--- /dev/null
+++ b/common/Resources/Sounds/drum4tr909sn
Binary files differ
diff --git a/common/Resources/Sounds/drum5agogoaigu b/common/Resources/Sounds/drum5agogoaigu
new file mode 100755
index 0000000..3889332
--- /dev/null
+++ b/common/Resources/Sounds/drum5agogoaigu
Binary files differ
diff --git a/common/Resources/Sounds/drum5agogograve b/common/Resources/Sounds/drum5agogograve
new file mode 100755
index 0000000..5717751
--- /dev/null
+++ b/common/Resources/Sounds/drum5agogograve
Binary files differ
diff --git a/common/Resources/Sounds/drum5bongoaiguouvert b/common/Resources/Sounds/drum5bongoaiguouvert
new file mode 100755
index 0000000..95aba33
--- /dev/null
+++ b/common/Resources/Sounds/drum5bongoaiguouvert
Binary files differ
diff --git a/common/Resources/Sounds/drum5bongograveouvert b/common/Resources/Sounds/drum5bongograveouvert
new file mode 100755
index 0000000..d7d1e58
--- /dev/null
+++ b/common/Resources/Sounds/drum5bongograveouvert
Binary files differ
diff --git a/common/Resources/Sounds/drum5congaaiguouvert b/common/Resources/Sounds/drum5congaaiguouvert
new file mode 100755
index 0000000..a59ce75
--- /dev/null
+++ b/common/Resources/Sounds/drum5congaaiguouvert
Binary files differ
diff --git a/common/Resources/Sounds/drum5congagraveferme b/common/Resources/Sounds/drum5congagraveferme
new file mode 100755
index 0000000..a49c459
--- /dev/null
+++ b/common/Resources/Sounds/drum5congagraveferme
Binary files differ
diff --git a/common/Resources/Sounds/drum5congagraveouvert b/common/Resources/Sounds/drum5congagraveouvert
new file mode 100755
index 0000000..3b9503c
--- /dev/null
+++ b/common/Resources/Sounds/drum5congagraveouvert
Binary files differ
diff --git a/common/Resources/Sounds/drum5guiroretour b/common/Resources/Sounds/drum5guiroretour
new file mode 100755
index 0000000..025ebfb
--- /dev/null
+++ b/common/Resources/Sounds/drum5guiroretour
Binary files differ
diff --git a/common/Resources/Sounds/drum5quicaaigu b/common/Resources/Sounds/drum5quicaaigu
new file mode 100755
index 0000000..d952c8c
--- /dev/null
+++ b/common/Resources/Sounds/drum5quicaaigu
Binary files differ
diff --git a/common/Resources/Sounds/drum5quicamedium b/common/Resources/Sounds/drum5quicamedium
new file mode 100755
index 0000000..57e92e6
--- /dev/null
+++ b/common/Resources/Sounds/drum5quicamedium
Binary files differ
diff --git a/common/Resources/Sounds/drum5timablesaiguslap b/common/Resources/Sounds/drum5timablesaiguslap
new file mode 100755
index 0000000..1b531b0
--- /dev/null
+++ b/common/Resources/Sounds/drum5timablesaiguslap
Binary files differ
diff --git a/common/Resources/Sounds/drum5timablesslap b/common/Resources/Sounds/drum5timablesslap
new file mode 100755
index 0000000..1e5ec3e
--- /dev/null
+++ b/common/Resources/Sounds/drum5timablesslap
Binary files differ
diff --git a/common/Resources/Sounds/drum5vibraslap b/common/Resources/Sounds/drum5vibraslap
new file mode 100755
index 0000000..e539891
--- /dev/null
+++ b/common/Resources/Sounds/drum5vibraslap
Binary files differ
diff --git a/common/Resources/Sounds/duck b/common/Resources/Sounds/duck
new file mode 100755
index 0000000..37b5f85
--- /dev/null
+++ b/common/Resources/Sounds/duck
Binary files differ
diff --git a/common/Resources/Sounds/duck2 b/common/Resources/Sounds/duck2
new file mode 100755
index 0000000..1c62622
--- /dev/null
+++ b/common/Resources/Sounds/duck2
Binary files differ
diff --git a/common/Resources/Sounds/flute b/common/Resources/Sounds/flute
new file mode 100755
index 0000000..68a2580
--- /dev/null
+++ b/common/Resources/Sounds/flute
Binary files differ
diff --git a/common/Resources/Sounds/gam b/common/Resources/Sounds/gam
new file mode 100755
index 0000000..dca077b
--- /dev/null
+++ b/common/Resources/Sounds/gam
Binary files differ
diff --git a/common/Resources/Sounds/guidice1 b/common/Resources/Sounds/guidice1
new file mode 100755
index 0000000..9e48310
--- /dev/null
+++ b/common/Resources/Sounds/guidice1
Binary files differ
diff --git a/common/Resources/Sounds/guidice10 b/common/Resources/Sounds/guidice10
new file mode 100755
index 0000000..8da4267
--- /dev/null
+++ b/common/Resources/Sounds/guidice10
Binary files differ
diff --git a/common/Resources/Sounds/guidice2 b/common/Resources/Sounds/guidice2
new file mode 100755
index 0000000..7b12043
--- /dev/null
+++ b/common/Resources/Sounds/guidice2
Binary files differ
diff --git a/common/Resources/Sounds/guidice3 b/common/Resources/Sounds/guidice3
new file mode 100755
index 0000000..68d1f45
--- /dev/null
+++ b/common/Resources/Sounds/guidice3
Binary files differ
diff --git a/common/Resources/Sounds/guidice4 b/common/Resources/Sounds/guidice4
new file mode 100755
index 0000000..3d72119
--- /dev/null
+++ b/common/Resources/Sounds/guidice4
Binary files differ
diff --git a/common/Resources/Sounds/guidice5 b/common/Resources/Sounds/guidice5
new file mode 100755
index 0000000..79cc786
--- /dev/null
+++ b/common/Resources/Sounds/guidice5
Binary files differ
diff --git a/common/Resources/Sounds/guidice6 b/common/Resources/Sounds/guidice6
new file mode 100755
index 0000000..dc2f756
--- /dev/null
+++ b/common/Resources/Sounds/guidice6
Binary files differ
diff --git a/common/Resources/Sounds/guidice7 b/common/Resources/Sounds/guidice7
new file mode 100755
index 0000000..af341b7
--- /dev/null
+++ b/common/Resources/Sounds/guidice7
Binary files differ
diff --git a/common/Resources/Sounds/guidice8 b/common/Resources/Sounds/guidice8
new file mode 100755
index 0000000..9901020
--- /dev/null
+++ b/common/Resources/Sounds/guidice8
Binary files differ
diff --git a/common/Resources/Sounds/guidice9 b/common/Resources/Sounds/guidice9
new file mode 100755
index 0000000..8798781
--- /dev/null
+++ b/common/Resources/Sounds/guidice9
Binary files differ
diff --git a/common/Resources/Sounds/guit b/common/Resources/Sounds/guit
new file mode 100755
index 0000000..dfb1866
--- /dev/null
+++ b/common/Resources/Sounds/guit
Binary files differ
diff --git a/common/Resources/Sounds/guit2 b/common/Resources/Sounds/guit2
new file mode 100755
index 0000000..1495832
--- /dev/null
+++ b/common/Resources/Sounds/guit2
Binary files differ
diff --git a/common/Resources/Sounds/harmonica b/common/Resources/Sounds/harmonica
new file mode 100755
index 0000000..7b0af9f
--- /dev/null
+++ b/common/Resources/Sounds/harmonica
Binary files differ
diff --git a/common/Resources/Sounds/harmonium b/common/Resources/Sounds/harmonium
new file mode 100755
index 0000000..90a5630
--- /dev/null
+++ b/common/Resources/Sounds/harmonium
Binary files differ
diff --git a/common/Resources/Sounds/horse b/common/Resources/Sounds/horse
new file mode 100755
index 0000000..b7756a3
--- /dev/null
+++ b/common/Resources/Sounds/horse
Binary files differ
diff --git a/common/Resources/Sounds/kalimba b/common/Resources/Sounds/kalimba
new file mode 100755
index 0000000..2e02b48
--- /dev/null
+++ b/common/Resources/Sounds/kalimba
Binary files differ
diff --git a/common/Resources/Sounds/koto b/common/Resources/Sounds/koto
new file mode 100755
index 0000000..9279a7f
--- /dev/null
+++ b/common/Resources/Sounds/koto
Binary files differ
diff --git a/common/Resources/Sounds/lab1 b/common/Resources/Sounds/lab1
new file mode 100644
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/lab1
Binary files differ
diff --git a/common/Resources/Sounds/lab2 b/common/Resources/Sounds/lab2
new file mode 100644
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/lab2
Binary files differ
diff --git a/common/Resources/Sounds/lab3 b/common/Resources/Sounds/lab3
new file mode 100644
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/lab3
Binary files differ
diff --git a/common/Resources/Sounds/lab4 b/common/Resources/Sounds/lab4
new file mode 100644
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/lab4
Binary files differ
diff --git a/common/Resources/Sounds/lab5 b/common/Resources/Sounds/lab5
new file mode 100644
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/lab5
Binary files differ
diff --git a/common/Resources/Sounds/lab6 b/common/Resources/Sounds/lab6
new file mode 100644
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/lab6
Binary files differ
diff --git a/common/Resources/Sounds/laugh b/common/Resources/Sounds/laugh
new file mode 100755
index 0000000..05483ce
--- /dev/null
+++ b/common/Resources/Sounds/laugh
Binary files differ
diff --git a/common/Resources/Sounds/mando b/common/Resources/Sounds/mando
new file mode 100755
index 0000000..88c8484
--- /dev/null
+++ b/common/Resources/Sounds/mando
Binary files differ
diff --git a/common/Resources/Sounds/marimba b/common/Resources/Sounds/marimba
new file mode 100755
index 0000000..331b1db
--- /dev/null
+++ b/common/Resources/Sounds/marimba
Binary files differ
diff --git a/common/Resources/Sounds/mic1 b/common/Resources/Sounds/mic1
new file mode 100755
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/mic1
Binary files differ
diff --git a/common/Resources/Sounds/mic2 b/common/Resources/Sounds/mic2
new file mode 100755
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/mic2
Binary files differ
diff --git a/common/Resources/Sounds/mic3 b/common/Resources/Sounds/mic3
new file mode 100755
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/mic3
Binary files differ
diff --git a/common/Resources/Sounds/mic4 b/common/Resources/Sounds/mic4
new file mode 100755
index 0000000..d26b87b
--- /dev/null
+++ b/common/Resources/Sounds/mic4
Binary files differ
diff --git a/common/Resources/Sounds/ocarina b/common/Resources/Sounds/ocarina
new file mode 100755
index 0000000..d3a8c06
--- /dev/null
+++ b/common/Resources/Sounds/ocarina
Binary files differ
diff --git a/common/Resources/Sounds/ounk b/common/Resources/Sounds/ounk
new file mode 100755
index 0000000..1272c5f
--- /dev/null
+++ b/common/Resources/Sounds/ounk
Binary files differ
diff --git a/common/Resources/Sounds/ow b/common/Resources/Sounds/ow
new file mode 100755
index 0000000..8270199
--- /dev/null
+++ b/common/Resources/Sounds/ow
Binary files differ
diff --git a/common/Resources/Sounds/piano b/common/Resources/Sounds/piano
new file mode 100755
index 0000000..f98a513
--- /dev/null
+++ b/common/Resources/Sounds/piano
Binary files differ
diff --git a/common/Resources/Sounds/plane b/common/Resources/Sounds/plane
new file mode 100755
index 0000000..d20142a
--- /dev/null
+++ b/common/Resources/Sounds/plane
Binary files differ
diff --git a/common/Resources/Sounds/rhodes b/common/Resources/Sounds/rhodes
new file mode 100755
index 0000000..16cd8ec
--- /dev/null
+++ b/common/Resources/Sounds/rhodes
Binary files differ
diff --git a/common/Resources/Sounds/saxo b/common/Resources/Sounds/saxo
new file mode 100755
index 0000000..f422c74
--- /dev/null
+++ b/common/Resources/Sounds/saxo
Binary files differ
diff --git a/common/Resources/Sounds/sheep b/common/Resources/Sounds/sheep
new file mode 100755
index 0000000..178bb43
--- /dev/null
+++ b/common/Resources/Sounds/sheep
Binary files differ
diff --git a/common/Resources/Sounds/shenai b/common/Resources/Sounds/shenai
new file mode 100755
index 0000000..115f125
--- /dev/null
+++ b/common/Resources/Sounds/shenai
Binary files differ
diff --git a/common/Resources/Sounds/sitar b/common/Resources/Sounds/sitar
new file mode 100755
index 0000000..9ba4df5
--- /dev/null
+++ b/common/Resources/Sounds/sitar
Binary files differ
diff --git a/common/Resources/Sounds/slap b/common/Resources/Sounds/slap
new file mode 100755
index 0000000..6e1f375
--- /dev/null
+++ b/common/Resources/Sounds/slap
Binary files differ
diff --git a/common/Resources/Sounds/triangle b/common/Resources/Sounds/triangle
new file mode 100755
index 0000000..d916fd0
--- /dev/null
+++ b/common/Resources/Sounds/triangle
Binary files differ
diff --git a/common/Resources/Sounds/trumpet b/common/Resources/Sounds/trumpet
new file mode 100755
index 0000000..a858a96
--- /dev/null
+++ b/common/Resources/Sounds/trumpet
Binary files differ
diff --git a/common/Resources/Sounds/tuba b/common/Resources/Sounds/tuba
new file mode 100755
index 0000000..9e47196
--- /dev/null
+++ b/common/Resources/Sounds/tuba
Binary files differ
diff --git a/common/Resources/Sounds/violin b/common/Resources/Sounds/violin
new file mode 100755
index 0000000..f89733c
--- /dev/null
+++ b/common/Resources/Sounds/violin
Binary files differ
diff --git a/common/Resources/Sounds/voix b/common/Resources/Sounds/voix
new file mode 100755
index 0000000..87f6ca6
--- /dev/null
+++ b/common/Resources/Sounds/voix
Binary files differ
diff --git a/common/Resources/Sounds/water b/common/Resources/Sounds/water
new file mode 100755
index 0000000..c6cee2e
--- /dev/null
+++ b/common/Resources/Sounds/water
Binary files differ
diff --git a/common/Resources/Sounds/zap b/common/Resources/Sounds/zap
new file mode 100755
index 0000000..e401f6b
--- /dev/null
+++ b/common/Resources/Sounds/zap
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile1 b/common/Resources/SynthFiles/synthFile1
new file mode 100644
index 0000000..adf8bda
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile1
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile10 b/common/Resources/SynthFiles/synthFile10
new file mode 100644
index 0000000..ee1d300
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile10
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile2 b/common/Resources/SynthFiles/synthFile2
new file mode 100644
index 0000000..58ec8aa
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile2
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile3 b/common/Resources/SynthFiles/synthFile3
new file mode 100644
index 0000000..9608200
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile3
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile4 b/common/Resources/SynthFiles/synthFile4
new file mode 100644
index 0000000..ef6586a
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile4
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile5 b/common/Resources/SynthFiles/synthFile5
new file mode 100644
index 0000000..c0f4f29
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile5
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile6 b/common/Resources/SynthFiles/synthFile6
new file mode 100644
index 0000000..5008f47
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile6
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile7 b/common/Resources/SynthFiles/synthFile7
new file mode 100644
index 0000000..333cba1
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile7
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile8 b/common/Resources/SynthFiles/synthFile8
new file mode 100644
index 0000000..8f30e89
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile8
Binary files differ
diff --git a/common/Resources/SynthFiles/synthFile9 b/common/Resources/SynthFiles/synthFile9
new file mode 100644
index 0000000..c68bffb
--- /dev/null
+++ b/common/Resources/SynthFiles/synthFile9
Binary files differ
diff --git a/common/Resources/__init__.py b/common/Resources/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common/Resources/__init__.py
diff --git a/common/Resources/crop.csd b/common/Resources/crop.csd
new file mode 100644
index 0000000..03b10a5
--- /dev/null
+++ b/common/Resources/crop.csd
@@ -0,0 +1,72 @@
+<CsoundSynthesizer>
+
+<CsOptions>
+-W -d -n
+</CsOptions>
+
+<CsInstruments>
+
+sr=16000
+ksmps=64
+nchnls=1
+
+/****************************************************************
+Playing temp file
+****************************************************************/
+instr 1
+
+asig diskin "/home/olpc/.sugar/default/tamtam/snds/tempMic.wav", 1
+gasig dcblock asig
+
+endin
+
+/****************************************************************
+Crop silence at the beginning
+****************************************************************/
+instr 2
+ktimer timeinstk
+ain = gasig
+krms rms ain
+if ktimer > 40 then
+ ktrig trigger krms, 1500, 0
+ if ktrig == 1 then
+ event "i", 3, 0, 2
+ event "i", 4, 2, 0.01
+ turnoff
+ endif
+endif
+endin
+
+/****************************************************************
+recording
+****************************************************************/
+instr 3
+kenv adsr 0.01, 0.05, .9, 0.01
+
+adel delay gasig, .005
+
+ihandle fiopen "/home/olpc/.sugar/default/tamtam/snds/micTemp", 2
+
+fout "/home/olpc/.sugar/default/tamtam/snds/micTemp", 2, adel*kenv
+
+;out adel*kenv
+adel = 0
+endin
+
+/****************************************************************
+Audio input recording ( closing file )
+****************************************************************/
+instr 4
+ficlose "/home/olpc/.sugar/default/tamtam/snds/micTemp"
+endin
+
+
+</CsInstruments>
+
+<CsScore>
+f1 0 8192 10 1
+i1 0 4
+i2 0 4
+</CsScore>
+
+</CsoundSynthesizer>
diff --git a/common/Resources/tamtamorc.csd b/common/Resources/tamtamorc.csd
new file mode 100644
index 0000000..de2f24a
--- /dev/null
+++ b/common/Resources/tamtamorc.csd
@@ -0,0 +1,1096 @@
+<CsoundSynthesizer>
+<CsOptions>
+-n -m0 -W -s -d
+</CsOptions>
+<CsInstruments>
+sr=16000
+ksmps=64
+nchnls=2
+giScale = 1/sr
+giAliasSr = sr/2.1
+
+gainrev init 0
+gaoutL init 0
+gaoutR init 0
+gasynth init 0
+gkTrackpadX init 0
+gkTrackpadY init 0
+
+/*****************************
+matrix for TamTam's SynthLab
+*****************************/
+zakinit 8, 32
+
+/*****************************
+opcodes needed by TamTam's SynthLab
+*****************************/
+
+opcode homeSine, a, kki
+kpitch, kspread, iTable xin
+
+kspread = kspread + 1
+
+kr1 randomi 0.99, 1.01, 3.45
+kr2 randomi 0.9901, 1.0101, 4.43
+kr3 randomi 0.9899, 1.0091, 5.25
+kr4 randomi 0.9889, 1.00921, 6.15
+
+kpit1 = kpitch
+kpit2 = kpit1*kspread
+kpit3 = kpit2*kspread
+kpit4 = kpit3*kspread
+kpit5 = kpit4*kspread
+kpit6 = kpit5*kspread
+kpit7 = kpit6*kspread
+kpit8 = kpit7*kspread
+
+a1 oscil 1000, kpit1*kr1, iTable
+a2 oscil 1000, kpit2*kr2, iTable
+a3 oscil 1000, kpit3*kr3, iTable
+a4 oscil 1000, kpit4*kr4, iTable
+a5 oscil 1000, kpit5*kr1, iTable
+a6 oscil 1000, kpit6*kr2, iTable
+a7 oscil 1000, kpit7*kr3, iTable
+a8 oscil 1000, kpit8*kr4, iTable
+
+aout = a1+a2+a3+a4+a5+a6+a7+a8
+xout aout
+endop
+
+opcode synthGrain, a, aaiiii
+aindex, atrans, ifreq, iphase itable, itabdur xin
+apha phasor ifreq, iphase
+aenv tab apha, 42, 1
+atrig = int(1-aenv)
+apos samphold aindex, atrig
+adur samphold atrans, atrig
+
+aline = apha * adur * sr + apos
+aline limit aline, 0 , itabdur
+ag tablei aline, itable, 0
+aout = ag * aenv
+
+xout aout
+endop
+
+
+opcode ControlMatrice, i, iikkkk
+iTable, iIndex, kc1, kc2, kc3, kc4 xin
+
+iSomme table iIndex, iTable+3
+
+if iSomme == 0 then
+goto noparams
+endif
+
+iPar table iIndex, iTable
+
+if iSomme == 1 then
+kp = iPar
+elseif iSomme == 3 then
+kp = iPar * kc1
+elseif iSomme == 5 then
+kp = iPar * kc2
+elseif iSomme == 7 then
+kp = iPar * ((kc1 + kc2)*.5)
+elseif iSomme == 9 then
+kp = iPar * kc3
+elseif iSomme == 11 then
+kp = iPar * ((kc1 + kc3)*.5)
+elseif iSomme == 13 then
+kp = iPar * ((kc2 + kc3)*.5)
+elseif iSomme == 15 then
+kp = iPar * ((kc1 + kc2 + kc3)*.33)
+elseif iSomme == 17 then
+kp = iPar * kc4
+elseif iSomme == 19 then
+kp = iPar * ((kc1 + kc4)*.5)
+elseif iSomme == 21 then
+kp = iPar * ((kc2 + kc4)*.5)
+elseif iSomme == 23 then
+kp = iPar * ((kc1 + kc2 + kc4)*.33)
+elseif iSomme == 25 then
+kp = iPar * ((kc3 + kc4)*.5)
+elseif iSomme == 27 then
+kp = iPar * ((kc1 + kc3 + kc4)*.5)
+elseif iSomme == 29 then
+kp = iPar * ((kc2 + kc3 + kc4)*.33)
+elseif iSomme == 31 then
+kp = iPar * ((kc1 + kc2 + kc3 + kc4)*.25)
+endif
+
+if iTable == 5201 then
+zkw kp, iIndex+1
+elseif iTable == 5202 then
+zkw kp, iIndex+17
+endif
+
+xout iIndex
+
+noparams:
+endop
+
+opcode SourceMatrice, i, iaaaa
+iIndex, as1, as2, as3, as4 xin
+
+iSomme table iIndex-1, 5206
+
+if iSomme == 0 then
+goto noparams
+endif
+
+if iSomme == 1 then
+as = as1
+elseif iSomme == 2 then
+as = as2
+elseif iSomme == 3 then
+as = as1 + as2
+elseif iSomme == 4 then
+as = as3
+elseif iSomme == 5 then
+as = as1 + as3
+elseif iSomme == 6 then
+as = as2 + as3
+elseif iSomme == 7 then
+as = as1 + as2 + as3
+elseif iSomme == 8 then
+as = as4
+elseif iSomme == 9 then
+as = as1 + as4
+elseif iSomme == 10 then
+as = as2 + as4
+elseif iSomme == 11 then
+as = as1 + as2 + as4
+elseif iSomme == 12 then
+as = as3 + as4
+elseif iSomme == 13 then
+as = as1 + as3 + as4
+elseif iSomme == 14 then
+as = as2 + as3 + as4
+elseif iSomme == 15 then
+as = as1 + as2 + as3 + as4
+endif
+
+zaw as, iIndex
+xout iIndex
+
+noparams:
+endop
+
+opcode FxMatrice, i, iaaaa
+iIndex, as1, as2, as3, as4 xin
+
+iSomme table iIndex-1, 5206
+
+if iSomme == 0 then
+goto noparams
+endif
+
+if iSomme == 1 then
+as = as1
+elseif iSomme == 2 then
+as = as2
+elseif iSomme == 3 then
+as = as1 + as2
+elseif iSomme == 4 then
+as = as3
+elseif iSomme == 5 then
+as = as1 + as3
+elseif iSomme == 6 then
+as = as2 + as3
+elseif iSomme == 7 then
+as = as1 + as2 + as3
+elseif iSomme == 8 then
+as = as4
+elseif iSomme == 9 then
+as = as1 + as4
+elseif iSomme == 10 then
+as = as2 + as4
+elseif iSomme == 11 then
+as = as1 + as2 + as4
+elseif iSomme == 12 then
+as = as3 + as4
+elseif iSomme == 13 then
+as = as1 + as3 + as4
+elseif iSomme == 14 then
+as = as2 + as3 + as4
+endif
+
+zaw as, iIndex
+xout iIndex
+
+noparams:
+endop
+
+opcode controller, k, ii
+iControlNum, idur xin
+
+iControlType table iControlNum-1, 5203
+
+if iControlType == 0 then
+goto nocontrol
+endif
+
+ioffset = (iControlNum-1)*4
+iPar1 table ioffset, 5200
+iPar2 table ioffset+1, 5200
+iPar3 table ioffset+2, 5200
+iPar4 table ioffset+3, 5200
+
+if iControlType == 1 then
+ kControl lfo iPar1, iPar2, int(iPar3)
+ kControl = kControl+iPar4
+elseif iControlType == 2 then
+ irange = (iPar2-iPar1)*.5
+ kControl randi irange, iPar3, iPar4-.001, 0, irange+iPar1
+elseif iControlType == 3 then
+ kControl adsr iPar1*idur+.0001, iPar2*idur, iPar3, iPar4*idur
+elseif iControlType == 4 then
+ if iPar3 == 0 then
+ kControl1 = ((gkTrackpadX+1)*.5)*(iPar2-iPar1)+iPar1
+ elseif iPar3 == 1 then
+ kval = (gkTrackpadX+1)*.5
+ kControl1 pow kval, 2
+ kControl1 = kControl1 * (iPar2-iPar1) + iPar1
+ endif
+ if iPar4 == 0 then
+ kControl = kControl1
+ else
+ ktrig oscil 1, 1/iPar4, 45
+ kControl samphold kControl1, ktrig, i(kControl1), 0
+ endif
+elseif iControlType == 5 then
+ if iPar3 == 0 then
+ kControl1 = ((gkTrackpadY+1)*.5)*(iPar2-iPar1)+iPar1
+ elseif iPar3 == 1 then
+ kval = (gkTrackpadY+1)*.5
+ kControl1 pow kval, 2
+ kControl1 = kControl1 * (iPar2-iPar1) + iPar1
+ endif
+ if iPar4 == 0 then
+ kControl = kControl1
+ else
+ ktrig oscil 1, 1/iPar4, 45
+ kControl samphold kControl1, ktrig, i(kControl1), 0
+ endif
+endif
+
+xout kControl
+
+nocontrol:
+endop
+
+opcode source, a, ii
+iSourceNum, ipitch xin
+
+iSourceType table iSourceNum+3, 5203
+
+if iSourceType == 0 then
+goto nosource
+endif
+
+ioffset = (iSourceNum-1)*4
+kpara1 zkr ioffset+1
+kpara2 zkr ioffset+2
+kpara3 zkr ioffset+3
+kpara4 zkr ioffset+4
+
+iPar1 table ioffset, 5201
+iPar2 table ioffset+1, 5201
+iPar3 table ioffset+2, 5201
+iPar4 table ioffset+3, 5201
+
+if iSourceType == 1 then
+ aSource foscil 2000*kpara4, ipitch, kpara1, kpara2, kpara3, 1
+elseif iSourceType == 2 then
+ aSource gbuzz 5000*kpara4, ipitch*kpara1, int(abs(kpara2))+5, 0, kpara3+0.01, 2
+elseif iSourceType == 3 then
+ iPar2 = int(iPar2)
+ if iPar2 == 0 then
+ imode = 0
+ elseif iPar2 == 1 then
+ imode = 10
+ elseif iPar2 == 2 then
+ imode = 12
+ endif
+ aSource vco2 2000*kpara4, ipitch*kpara1, imode, 0.1, 0, iPar3
+elseif iSourceType == 4 then
+ if iPar3 == 0 then
+ kvib = 0
+ goto novib
+ else
+ kvibenv linseg 0, .3, 1, p3-.3, 1
+ kvib oscil ipitch*.015, kpara3, 1
+ endif
+ novib:
+ aSource pluck 5000*kpara4, ipitch*(abs(kpara1))+.001+kvib, 40, 0, 6
+ aSource butterlp aSource, kpara2
+elseif iSourceType == 5 then
+ if int(iPar1) == 0 then
+ ar rand 5000*kpara4
+ elseif int(iPar1) == 1 then
+ ar pinkish 5000*kpara4
+ elseif int(iPar1) == 2 then
+ ar gauss 5000*kpara4
+ endif
+ knoisebandwith limit abs(kpara3), 1, sr/2
+ aSource butterbp ar, kpara2, knoisebandwith
+ aSource balance aSource, ar
+elseif iSourceType == 6 then
+ iSndpitch = p4/261.626
+ iLoopIndex = iPar2 * 3
+ ils table iLoopIndex, 5755
+ ile table iLoopIndex+1, 5755
+ icd table iLoopIndex+2, 5755
+ if ile == 0 then
+ ile = nsamp(5000+iPar2) * giScale - .01
+ endif
+ if icd == 0 then
+ icd = .01
+ endif
+ aSource flooper2 kpara4*.4, iSndpitch*abs(kpara1), ils, ile, icd, 5000+iPar2
+ aSource butterlp aSource, abs(kpara3)
+elseif iSourceType == 7 then
+ kvoy = int(kpara2*3)
+ kform1 table kvoy, 4
+ kform2 table kvoy+1, 4
+ kform3 table kvoy+2, 4
+ kform1 port kform1, .1, 500
+ kform2 port kform2, .1, 1500
+ kform3 port kform3, .1, 2500
+ kvibadev randomi -.0852, .0152, .5
+ kvibfdev randomi -.032, .032, .5
+ kvibfreqrand randomi kpara3-.75, kpara3+.75, .2
+ kvibfatt linseg 0, .3, 1, p3-.3, 1
+ kvib oscili (1+kvibadev)*kvibfatt, (kvibfreqrand+kvibfdev), 1
+ kharm randomi 40, 50, 1.34
+ kmul randomi .80, .84, 1.45
+ kbam randomi 480., 510., 2.07
+ kfunddev randomi -.0053, .0052, 1.05
+ ar gbuzz kbam, (p4*kpara1*(1+kfunddev)+kvib), int(kharm), 0, kmul, 2
+ a1 resonx ar, kform1, 140, 2, 1
+ a2 resonx ar, kform2, 180, 2, 1
+ a3 resonx ar, kform3, 220, 2 , 1
+ aSource = ((a1*80)+(a2*55)+(a3*40))*kpara4
+elseif iSourceType == 8 then
+ iSndPitch = p4/261.626
+ igrdur = .1
+ itable = 5000+iPar2
+ irealTable = 5500 + iSourceNum
+ itabdur = nsamp(itable)
+ ifreq = 1 / igrdur
+ kamp = kpara4 * .2
+ aindex upsamp abs(kpara3) * itabdur
+ atrans upsamp kpara1 * igrdur * iSndPitch
+
+ as1 synthGrain aindex, atrans, ifreq, 0.82, irealTable, itabdur
+ as2 synthGrain aindex, atrans, ifreq, .58, irealTable, itabdur
+ as3 synthGrain aindex, atrans, ifreq, .41, irealTable, itabdur
+ as4 synthGrain aindex, atrans, ifreq, 0.19, irealTable, itabdur
+ as5 synthGrain aindex, atrans, ifreq, 0, irealTable, itabdur
+ aSource = (as1+as2+as3+as4+as5)*kamp
+ aSource butterlp aSource, 7500
+elseif iSourceType == 9 then
+ aSource homeSine p4*kpara1, kpara2*0.1, iPar3+30
+ aSource = aSource*kpara4
+
+endif
+
+aSource dcblock aSource
+xout aSource
+
+nosource:
+endop
+
+opcode effects, a, ii
+iFxNum, ipitch xin
+
+iFxType table iFxNum+7, 5203
+
+if iFxType == 0 then
+goto nofx
+endif
+
+as1 zar iFxNum
+as2 zar iFxNum+4
+as = as1+as2
+
+ioffset = (iFxNum+3)*4
+kpara1 zkr ioffset+1
+kpara2 zkr ioffset+2
+kpara3 zkr ioffset+3
+kpara4 zkr ioffset+4
+
+ioffset2 = (iFxNum-1)*4
+iPar1 table ioffset2, 5202
+iPar2 table ioffset2+1, 5202
+iPar3 table ioffset2+2, 5202
+iPar4 table ioffset2+3, 5202
+
+if iFxType == 1 then
+ kwgfeed limit kpara3, 0, 1
+ aFx wguide1 as, abs(kpara1)+1, kpara2, kwgfeed
+ aFx = aFx*kpara4
+elseif iFxType == 2 then
+ aFx lpf18 as*.0005, abs(kpara1)+20, kpara2, kpara3
+ aFx = aFx*5000*kpara4
+elseif iFxType == 3 then
+ aFx bqrez as*kpara4, abs(kpara1)+20, abs(kpara2)+1, int(iPar3)
+ aFx balance aFx, as*kpara4
+elseif iFxType == 4 then
+ amod lfo 1, kpara1, int(iPar3)
+ aFx = ((as*amod*kpara2)+(as*(1-kpara2)))*kpara4
+elseif iFxType == 5 then
+ ain = as*kpara4
+ krevLength limit kpara1, 0.01, 10
+ arev reverb ain, krevLength
+ arev butterlp arev, kpara2
+ aFx = (arev*kpara3)+(as*(1-kpara3))
+elseif iFxType == 6 then
+ fsig pvsanal as, 1024, 256, 1024, 1
+ ftps1 pvscale fsig, kpara1
+ aFx pvsynth ftps1
+ adry delay as, iPar2
+ aFx = ((aFx*kpara3)+(adry*(1-kpara3)))*kpara4
+elseif iFxType == 7 then
+ aeq1 butterbp as, 700, 400
+ aeq2 butterbp as, 1500, 600
+ aeq3 butterbp as, 3000, 1000
+ aeq4 butterbp as, 5000, 2000
+ aFx = (aeq1*kpara1)+(aeq2*kpara2)+(aeq3*kpara3)+(aeq4*kpara4)
+elseif iFxType == 8 then
+ afeed init 0
+ adel oscil kpara1, kpara2, 1
+ adel = adel + kpara1 + kpara3
+ adel limit adel, 0, 50
+ aFx vdelay as+afeed, adel, 50
+ afeed = aFx * kpara4
+endif
+
+xout aFx
+
+nofx:
+endop
+
+
+/****************************************************************
+Reverb + master out
+*****************************************************************/
+instr 200
+
+gktime timek
+
+kTrackpadX chnget "trackpadX"
+gkTrackpadX = kTrackpadX / 600.
+gkTrackpadX limit gkTrackpadX, -1, 1
+
+kTrackpadY chnget "trackpadY"
+gkTrackpadY = kTrackpadY / 450.
+gkTrackpadY limit -gkTrackpadY, -1, 1
+
+koutGain chnget "masterVolume"
+koutGain = koutGain * 0.02
+gkduck init 1
+gkduck port gkduck, .03, 1.
+
+ain dcblock gainrev*0.05
+arev reverb ain, 2.5
+arev butterlp arev, 5000
+
+aLeft butterlp gaoutL, 7500
+aRight butterlp gaoutR, 7500
+
+aOutLeft dcblock (arev + aLeft) * koutGain * gkduck
+aOutRight dcblock (arev + aRight) * koutGain * gkduck
+gaRecL = aOutLeft
+gaRecR = aOutRight
+ outs aOutLeft, aOutRight
+
+ gaoutL = 0
+ gaoutR = 0
+ gainrev = 0
+
+endin
+
+/****************************************************************
+ducking
+****************************************************************/
+instr 5600
+gkduck linseg 1., 0.005, 0.05, 3.9, 0.05, 0.095, 1
+endin
+
+/****************************************************************
+Performance recording start
+*****************************************************************/
+instr 5400
+Sname strcpy "/home/olpc/.sugar/default/tamtam/perf.wav"
+ihandle fiopen Sname, 2
+fout Sname, 2, gaRecL, gaRecR
+clear gaRecL, gaRecR
+endin
+
+/****************************************************************
+Performance recording stop ( closing file )
+*****************************************************************/
+instr 5401
+Sname strcpy "/home/olpc/.sugar/default/tamtam/perf.wav"
+turnoff2 5400, 8, 0
+ficlose Sname
+endin
+
+/****************************************************************
+Handler audio input recording
+****************************************************************/
+instr 5201
+
+ktim timeinsts
+
+gkduck = .05
+itab = p4
+ain inch 1
+krms rms ain
+ktrig trigger krms, 1500, 0
+
+if ktrig == 1 then
+event "i", 5202, 0 , 1, itab
+turnoff
+endif
+
+ithresh = p3 - 1
+
+if ktim > ithresh then
+gkduck linseg .05, .8, .05, .2, 1
+endif
+
+endin
+
+/****************************************************************
+Audio input recording
+****************************************************************/
+instr 5202
+kenv adsr 0.005, 0.05, .9, 0.01
+gkduck linseg .05, .8, .05, .2, 1
+ain inch 1
+
+adel delay ain, .01
+
+Sname sprintf "/home/olpc/.sugar/default/tamtam/snds/mic%d", int(p4)-6
+ihandle fiopen Sname, 2
+event "i", 5212, 1 , .01, p4
+
+fout Sname, 2, adel*kenv
+adel = 0
+endin
+
+/****************************************************************
+Audio input recording ( closing file )
+****************************************************************/
+instr 5212
+Sname sprintf "/home/olpc/.sugar/default/tamtam/snds/mic%d", int(p4)-6
+ficlose Sname
+endin
+
+/****************************************************************
+SynthLab input recording
+****************************************************************/
+instr 5204
+
+Sname2 sprintf "/home/olpc/.sugar/default/tamtam/snds/lab%d", int(p4)-85
+fout Sname2, 2, gasynth * 0.707
+clear gasynth
+endin
+
+/************************
+TamTam's SynthLab instrument
+************************/
+instr 5203
+
+if p5 != 0 then
+event_i "i", 5204, 0, p3, p5
+endif
+
+aSource1 init 0
+aSource2 init 0
+aSource3 init 0
+aSource4 init 0
+aFx1 init 0
+aFx2 init 0
+aFx3 init 0
+aFx4 init 0
+aout init 0
+
+ipitch = p4
+
+kc1 controller 1,p3
+kc2 controller 2,p3
+kc3 controller 3,p3
+kc4 controller 4,p3
+
+is1p1 ControlMatrice 5201, 0, kc1, kc2, kc3, kc4
+is1p2 ControlMatrice 5201, 1, kc1, kc2, kc3, kc4
+is1p3 ControlMatrice 5201, 2, kc1, kc2, kc3, kc4
+is1p4 ControlMatrice 5201, 3, kc1, kc2, kc3, kc4
+is2p1 ControlMatrice 5201, 4, kc1, kc2, kc3, kc4
+is2p2 ControlMatrice 5201, 5, kc1, kc2, kc3, kc4
+is2p3 ControlMatrice 5201, 6, kc1, kc2, kc3, kc4
+is2p4 ControlMatrice 5201, 7, kc1, kc2, kc3, kc4
+is3p1 ControlMatrice 5201, 8, kc1, kc2, kc3, kc4
+is3p2 ControlMatrice 5201, 9, kc1, kc2, kc3, kc4
+is3p3 ControlMatrice 5201, 10, kc1, kc2, kc3, kc4
+is3p4 ControlMatrice 5201, 11, kc1, kc2, kc3, kc4
+is4p1 ControlMatrice 5201, 12, kc1, kc2, kc3, kc4
+is4p2 ControlMatrice 5201, 13, kc1, kc2, kc3, kc4
+is4p3 ControlMatrice 5201, 14, kc1, kc2, kc3, kc4
+is4p4 ControlMatrice 5201, 15, kc1, kc2, kc3, kc4
+
+aSource1 source 1, ipitch*2
+aSource2 source 2, ipitch*2
+aSource3 source 3, ipitch*2
+aSource4 source 4, ipitch*2
+
+ifx1p1 ControlMatrice 5202, 0, kc1, kc2, kc3, kc4
+ifx1p2 ControlMatrice 5202, 1, kc1, kc2, kc3, kc4
+ifx1p3 ControlMatrice 5202, 2, kc1, kc2, kc3, kc4
+ifx1p4 ControlMatrice 5202, 3, kc1, kc2, kc3, kc4
+ifx2p1 ControlMatrice 5202, 4, kc1, kc2, kc3, kc4
+ifx2p2 ControlMatrice 5202, 5, kc1, kc2, kc3, kc4
+ifx2p3 ControlMatrice 5202, 6, kc1, kc2, kc3, kc4
+ifx2p4 ControlMatrice 5202, 7, kc1, kc2, kc3, kc4
+ifx3p1 ControlMatrice 5202, 8, kc1, kc2, kc3, kc4
+ifx3p2 ControlMatrice 5202, 9, kc1, kc2, kc3, kc4
+ifx3p3 ControlMatrice 5202, 10, kc1, kc2, kc3, kc4
+ifx3p4 ControlMatrice 5202, 11, kc1, kc2, kc3, kc4
+ifx4p1 ControlMatrice 5202, 12, kc1, kc2, kc3, kc4
+ifx4p2 ControlMatrice 5202, 13, kc1, kc2, kc3, kc4
+ifx4p3 ControlMatrice 5202, 14, kc1, kc2, kc3, kc4
+ifx4p4 ControlMatrice 5202, 15, kc1, kc2, kc3, kc4
+
+ifx1in SourceMatrice 1, aSource1, aSource2, aSource3, aSource4
+ifx2in SourceMatrice 2, aSource1, aSource2, aSource3, aSource4
+ifx3in SourceMatrice 3, aSource1, aSource2, aSource3, aSource4
+ifx4in SourceMatrice 4, aSource1, aSource2, aSource3, aSource4
+
+ifx1in1 FxMatrice 5, aFx1, aFx2, aFx3, aFx4
+ifx2in1 FxMatrice 6, aFx1, aFx2, aFx3, aFx4
+ifx3in1 FxMatrice 7, aFx1, aFx2, aFx3, aFx4
+ifx4in1 FxMatrice 8, aFx1, aFx2, aFx3, aFx4
+
+aFx1 effects 1, ipitch
+aFx2 effects 2, ipitch
+aFx3 effects 3, ipitch
+aFx4 effects 4, ipitch
+
+iSourceOut1 table 8, 5206
+iSourceOut2 table 9, 5206
+iSourceOut3 table 10, 5206
+iSourceOut4 table 11, 5206
+iFxOut1 table 12, 5206
+iFxOut2 table 13, 5206
+iFxOut3 table 14, 5206
+iFxOut4 table 15, 5206
+
+aout = (aSource1*iSourceOut1)+(aSource2*iSourceOut2)+(aSource3*iSourceOut3)+(aSource4*iSourceOut4)+(aFx1*iFxOut1)+(aFx2*iFxOut2)+(aFx3*iFxOut3)+(aFx4*iFxOut4)
+
+kenv adsr p3*p6+0.001, p3*p7, p8, p3*p9
+aout = aout*kenv
+
+vincr gasynth, aout
+
+ outs aout, aout
+
+zacl 0, 8
+
+endin
+
+/***********************
+DELETE RESOURCES
+************************/
+
+instr 5000
+
+icount init 0
+
+again:
+ftfree 5000+icount, 0
+icount = icount+1
+
+if icount < p4 goto again
+
+turnoff
+
+endin
+
+/*************************
+Loop points editor
+*************************/
+instr 5022
+
+kstart chnget "lstart"
+kend chnget "lend"
+kdur chnget "ldur"
+
+idurfadein init 0.005
+idurfadeout init 0.095
+iampe0 init 1
+iampe1 init 1
+iampe2 init 1
+
+itie tival
+if itie == 1 igoto nofadein
+
+iampe0 init 0
+iskip = 1
+
+nofadein:
+iskip = 0
+igliss = 0.005
+
+if p3 < 0 igoto nofadeout
+
+iampe2 init 0
+
+nofadeout:
+
+idelta = idurfadein+idurfadeout
+if idelta > abs(p3) then
+idelta = abs(p3)
+endif
+
+iampe0 = iampe0
+iampe2 = iampe2
+kenv linseg iampe0, idurfadein, iampe1, abs(p3)-idelta, iampe1, idurfadeout, iampe2
+
+
+ivibRand random 4.1, 5.7
+
+kvibrato oscil .006, ivibRand, 1
+
+ tigoto tieskip
+
+a1 flooper2 1, 1+kvibrato, kstart, kend, kdur, 4999, 0, 0, 0, iskip
+
+a1 = a1*kenv
+
+gaoutL = a1*0.5+gaoutL
+gaoutR = a1*0.5+gaoutR
+
+gainrev = a1*0.1+gainrev
+
+ tieskip:
+endin
+
+/*************************
+Loop points editor, simple player
+*************************/
+instr 5023
+
+p3 = nsamp(4999) * giScale
+
+a1 loscil 1, 1, 4999, 1
+
+kenv adsr 0.005, 0.05, .8, 0.1
+
+a1 = a1*kenv
+
+gaoutL = a1*0.5+gaoutL
+gaoutR = a1*0.5+gaoutR
+
+gainrev = a1*0.1+gainrev
+
+endin
+
+/****************************************************************
+Soundfile player with miniTamTam's tied notes
+****************************************************************/
+/*************************
+pitch, reverbGain, amp, pan, table, att, dec, filtType, cutoff, loopstart, loopend, crossdur
+*************************/
+instr 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010
+
+idump = p16
+idump2 = p17
+idump3 = p18
+idump4 = p19
+
+iTrackId = int(p1-5001)
+SvolTrackName sprintf "trackVolume%0d", iTrackId
+kvol chnget SvolTrackName
+kvol = kvol * 0.01
+kvol port kvol, .01, i(kvol)
+
+idurfadein init 0.005
+idurfadeout init 0.095
+iampe0 init 1
+iampe1 = p6
+iampe2 init 1
+
+itie tival
+if itie == 1 igoto nofadein
+
+idurfadein init p9
+iampe0 init 0
+iskip = 1
+kpitch init p4
+kamp init p6
+kpan init p7
+krg init p5
+
+nofadein:
+iskip = 0
+igliss = 0.005
+
+if p3 < 0 igoto nofadeout
+
+idurfadeout init p10
+iampe2 init 0
+
+nofadeout:
+
+idelta = idurfadein+idurfadeout
+if idelta > abs(p3) then
+idelta = abs(p3)
+endif
+
+iampe0 = iampe0 * p6
+iampe2 = iampe2 * p6
+kenv linseg iampe0, idurfadein, iampe1, abs(p3)-idelta, iampe1, idurfadeout, iampe2
+
+kpitchBend port gkTrackpadX, .03, i(gkTrackpadX)
+kpitchBend pow kpitchBend + 1, 5
+kampBend port gkTrackpadY, .03, i(gkTrackpadY)
+kampBend pow kampBend + 1, 5
+
+ivibRand random 4.1, 5.7
+
+kvibrato oscil .006*kampBend, ivibRand*kpitchBend, 1
+
+ tigoto tieskip
+
+kpitch portk p4, igliss, p4
+kpan portk p7, igliss, p7
+krg portk p5, igliss, p5
+kcutoff portk p12, igliss, p12
+kls portk p13, igliss, p13
+kle portk p14, igliss, p14
+kcd portk p15, igliss, p15
+
+a1 flooper2 1, kpitch+kvibrato, kls, kle, kcd, p8, 0, 0, 0, iskip
+
+if (p11-1) != -1 then
+acomp = a1
+a1 bqrez a1, kcutoff, 6, p11-1
+a1 balance a1, acomp
+endif
+
+if kpitch < 1 then
+kalias = giAliasSr*kpitch
+else
+kalias = giAliasSr
+endif
+
+a1 tone a1, kalias
+
+a1 = a1*kenv*kvol
+
+gaoutL = a1*(1-kpan)+gaoutL
+gaoutR = a1*kpan+gaoutR
+
+gainrev = a1*krg+gainrev
+
+ tieskip:
+endin
+
+
+/*************************
+Soundfile player with edit's looped notes
+*************************/
+instr 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110
+
+if p16 != -1 then
+ inum = frac(p16) * 10000
+ itable2 = int(p16)
+ event_i "i", inum, 0, p3, p4, p5, p6, p7, itable2, p9, p10, p11, p12, p17, p18, p19, -1
+endif
+
+ipitch random p4*.995, p4*1.005
+
+iTrackId = int(p1-5101)
+SvolTrackName2 sprintf "trackVolume%0d", iTrackId
+kvol chnget SvolTrackName2
+kvol = kvol * 0.01
+kvol port kvol, .01, 0 ;i(kvol)
+
+ivibRand random 4.1, 5.7
+
+kvibrato oscil .006, ivibRand, 1
+
+a1 flooper2 1, ipitch+kvibrato, p13, p14, p15, p8, 0, 0, 0
+
+if (p11-1) != -1 then
+acomp = a1
+a1 bqrez a1, p12, 6, p11-1
+a1 balance a1, acomp
+endif
+
+;if p4 < 1 then
+;ialias = giAliasSr*p4
+;else
+;ialias = giAliasSr
+;endif
+
+;a1 tone a1, ialias
+
+aenv adsr p9, 0.005, p6, p10
+a1 = a1*aenv*kvol
+
+gaoutL = a1*(1-p7)+gaoutL
+gaoutR = a1*p7+gaoutR
+
+gainrev = a1*p5+gainrev
+
+endin
+
+/**************************************************************
+Simple soundfile player (miniTamTam)
+**************************************************************/
+
+instr 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020
+
+idump = p16
+idump2 = p17
+idump3 = p18
+idump4 = p19
+
+iTrackId = int(p1-5011)
+SvolTrackName3 sprintf "trackVolume%0d", iTrackId
+kvol chnget SvolTrackName3
+kvol = kvol * 0.01
+kvol port kvol, .01
+
+p3 = nsamp(p8) * giScale / p4
+
+a1 loscil p6, p4, p8, 1
+
+if (p11-1) != -1 then
+acomp = a1
+a1 bqrez a1, p12, 6, p11-1
+a1 balance a1, acomp
+endif
+
+if p4 < 1 then
+ialias = giAliasSr*p4
+else
+ialias = giAliasSr
+endif
+
+a1 tone a1, ialias
+
+kenv adsr p9, 0.05, .8, p10
+a1 = a1*kenv*kvol
+
+gaoutL = a1*(1-p7)+gaoutL
+gaoutR = a1*p7+gaoutR
+
+gainrev = a1*p5+gainrev
+
+endin
+
+/**************************************************************
+Simple soundfile player (Edit)
+**************************************************************/
+
+instr 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120
+
+if p16 != -1 then
+ inum = frac(p16) * 10000
+ itable2 = int(p16)
+ event_i "i", inum, 0, p3, p4, p5, p6, p7, itable2, p9, p10, p11, p12, p17, p18, p19, -1
+endif
+
+iTrackId = int(p1-5111)
+SvolTrackName4 sprintf "trackVolume%0d", iTrackId
+kvol chnget SvolTrackName4
+kvol = kvol * 0.01
+kvol port kvol, .01
+
+a1 loscil p6, p4, p8, 1
+
+if (p11-1) != -1 then
+acomp = a1
+a1 bqrez a1, p12, 6, p11-1
+a1 balance a1, acomp
+endif
+
+;if p4 < 1 then
+;ialias = giAliasSr*p4
+;else
+;ialias = giAliasSr
+;endif
+
+;a1 tone a1, ialias
+
+kenv adsr p9, 0.05, .8, p10
+
+a1 = a1*kenv*kvol
+
+gaoutL = a1*(1-p7)+gaoutL
+gaoutR = a1*p7+gaoutR
+
+gainrev = a1*p5+gainrev
+
+endin
+
+
+
+/********************************************************************
+soundfile player for percussion - resonance notes
+********************************************************************/
+instr 5021
+
+a1 flooper2 1, p4, .25, .750, .2, p8
+
+if (p11-1) != -1 then
+acomp = a1
+a1 bqrez a1, p12, 6, p11-1
+a1 balance a1, acomp
+endif
+
+kenv expseg 0.001, .003, .6, p3 - .003, 0.001
+klocalenv adsr p8, 0.05, .8, p10
+
+a1 = a1*kenv*klocalenv
+
+gaoutL = a1*(1-p7)+gaoutL
+gaoutR = a1*p7+gaoutR
+
+gainrev = a1*p5+gainrev
+
+endin
+
+
+
+</CsInstruments>
+<CsScore>
+f1 0 8192 10 1
+f2 0 8192 11 1 1
+
+f4 0 32 -2 250 2250 2980 420 2050 2630 590 1770 2580
+ 750 1450 2590 290 750 2300 360 770 2530 520 900 2510 710 1230 2700 570 1560 2560 0 0 0 0 0
+f30 0 1024 10 1 0 .3 0 .1
+f31 0 1024 10 1 .5 .3 .25 .1
+f32 0 1024 10 1 0 .1 0 .3 .2 0 0 .1
+f33 0 1024 10 1 0 0 0 .1 0 0 .2 .1 0 0 .1
+f34 0 1024 10 1 .6 0 0 .4 .2 .1 0 0 .1
+f35 0 1024 10 1 .5 .3 0 .1 0 0 0 .1 .1
+f36 0 1024 10 1 0 .6 .4 .1 0 0 .2 .1 0 0 ,1
+f37 0 1024 10 1 0 0 0 .1 .2 .1 0 0 0 .1 0 0 .1
+f38 0 1024 10 1 .4 .3 0 .1 .2 .1 .1 .1 0 0 0 0 .1 .05
+f39 0 1024 10 1 0 .5 0 0 .3 0 0 .2 0 .1 0 0 0 0 .2 0 0 0 .05 0 0 0 0 .03 ; ADDITIVE SYNTHESIS WAVE
+f41 0 8193 19 .5 .5 270 .5 ; SIGMOID FUNCTION
+f42 0 8192 -20 2 1
+f44 0 8192 5 1 8192 0.001 ; EXPONENTIAL FUNCTION
+f45 0 512 7 0 500 0 2 1 10 1
+f5150 0 32768 7 0 32768 0
+i200 0 600000
+</CsScore>
+</CsoundSynthesizer>
diff --git a/common/Resources/tooltips_en.py b/common/Resources/tooltips_en.py
new file mode 100644
index 0000000..e59e88d
--- /dev/null
+++ b/common/Resources/tooltips_en.py
@@ -0,0 +1,128 @@
+from gettext import gettext as _
+
+class Tooltips:
+ def __init__(self):
+ # Edit
+ self.Edit = {}
+ # tools
+ self.Edit["2toolPointerButton"] = _('Select tool')
+ self.Edit["2toolPencilButton"] = _('Draw tool')
+ self.Edit["2toolBrushButton"] = _('Paint tool')
+ # create tune
+ self.Edit["2generateBtn"] = _('Generate new tune')
+ # page
+ self.Edit["2pageGenerateButton"] = _('Generate page')
+ self.Edit["2pagePropertiesButton"] = _('Page properties')
+ self.Edit["2pageDeleteButton"] = _('Delete page(s)')
+ self.Edit["2pageDuplicateButton"] = _('Duplicate page(s)')
+ self.Edit["2pageNewButton"] = _('Add page')
+ self.Edit["2pageBeatsButton"] = _('Beats per page')
+ self.Edit["2saveButton"] = _('Save tune')
+ self.Edit["2loadButton"] = _('Load tune')
+ # track
+ self.Edit["2trackGenerateButton"] = _('Generate track')
+ self.Edit["2trackPropertiesButton"] = _('Track properties')
+ self.Edit["2trackDeleteButton"] = _('Clear track')
+ self.Edit["2trackDuplicateButton"] = _('Duplicate track')
+ # note
+ self.Edit["2notePropertiesButton"] = _('Note(s) properties')
+ self.Edit["2noteDeleteButton"] = _('Delete note(s)')
+ self.Edit["2noteDuplicateButton"] = _('Duplicate note(s)')
+ self.Edit["2noteOnsetMinusButton"] = _('Move note in time')
+ self.Edit["2noteOnsetPlusButton"] = _('Move note in time')
+ self.Edit["2notePitchMinusButton"] = _('Lower pitch')
+ self.Edit["2notePitchPlusButton"] = _('Raise pitch')
+ self.Edit["2noteDurationMinusButton"] = _('Modify duration')
+ self.Edit["2noteDurationPlusButton"] = _('Modify duration')
+ self.Edit["2noteVolumeMinusButton"] = _('Lower volume')
+ self.Edit["2noteVolumePlusButton"] = _('Raise volume')
+ # transport
+ self.Edit["2playButton"] = _('Play')
+ self.Edit["2pauseButton"] = _('Pause')
+ self.Edit["2stopButton"] = _('Stop')
+ self.Edit["2keyRecordButton"] = _('Keyboard recording')
+ self.Edit["2recordButton"] = _('Save as .ogg')
+ self.Edit["2rewindButton"] = _('Rewind')
+ self.Edit["2closeButton"] = _('Save to journal and quit')
+ # volume and tempo
+ self.Edit["2volumeSlider"] = _('Master volume')
+ self.Edit["2tempoSlider"] = _('Tempo')
+ #InstrumentBox
+ self.Edit["2instrument1muteButton"] = _("Left click to mute, right click to solo")
+ self.Edit["2instrument2muteButton"] = _("Left click to mute, right click to solo")
+ self.Edit["2instrument3muteButton"] = _("Left click to mute, right click to solo")
+ self.Edit["2instrument4muteButton"] = _("Left click to mute, right click to solo")
+ self.Edit["2drumMuteButton"] = _("Left click to mute, right click to solo")
+
+ self.ALGO = {}
+ self.ALGO["XYButton1"] = _('-- Rythm density, | Rythm regularity' )
+ self.ALGO["XYButton2"] = _('-- Pitch regularity, | Pitch maximum step' )
+ self.ALGO["XYButton3"] = _('-- Average duration, | Silence probability')
+ self.ALGO["drunk"] = _('Drunk')
+ self.ALGO["droneJump"] = _('Drone and Jump')
+ self.ALGO["repeat"] = _('Repeater')
+ self.ALGO["loopSeg"] = _('Loop segments')
+ self.ALGO["majorKey"] = _('Major scale')
+ self.ALGO["minorHarmKey"] = _('Harmonic minor scale')
+ self.ALGO["minorKey"] = _('Natural minor scale')
+ self.ALGO["phrygienKey"] = _('Phrygian scale')
+ self.ALGO["dorienKey"] = _('Dorian scale')
+ self.ALGO["lydienKey"] = _('Lydian scale')
+ self.ALGO["myxoKey"] = _('Myxolydian scale')
+ self.ALGO["saveButton"] = _('Save preset')
+ self.ALGO["loadButton"] = _('Load preset')
+ self.ALGO["checkButton"] = _('Generate')
+ self.ALGO["cancelButton"] = _('Close')
+
+ self.PROP = {}
+ self.PROP['pitchUp'] = _('Transpose up')
+ self.PROP['pitchDown'] = _('Transpose down')
+ self.PROP['volumeUp'] = _('Volume up')
+ self.PROP['volumeDown'] = _('Volume down')
+ self.PROP['panSlider'] = _('Panoramisation')
+ self.PROP['reverbSlider'] = _('Reverb')
+ self.PROP['attackSlider'] = _('Attack duration')
+ self.PROP['decaySlider'] = _('Decay duration')
+ self.PROP['filterTypeLowButton'] = _('Lowpass filter')
+ self.PROP['filterTypeHighButton'] = _('Highpass filter')
+ self.PROP['filterTypeBandButton'] = _('Bandpass filter')
+ self.PROP['cutoffSlider'] = _('Filter cutoff')
+ self.PROP['pitchGen'] = _('Open algorithmic generator')
+ self.PROP['volumeGen'] = _('Open algorithmic generator')
+ self.PROP['panGen'] = _('Open algorithmic generator')
+ self.PROP['reverbGen'] = _('Open algorithmic generator')
+ self.PROP['attackGen'] = _('Open algorithmic generator')
+ self.PROP['decayGen'] = _('Open algorithmic generator')
+ self.PROP['cutoffGen'] = _('Open algorithmic generator')
+ self.PROP['line'] = _('Line')
+ self.PROP['drunk'] = _('Drunk')
+ self.PROP['droneJump'] = _('Drone and jump')
+ self.PROP['repeater'] = _('Repeater')
+ self.PROP['loopseg'] = _('Loop segments')
+ self.PROP['minSlider'] = _('Minimum value')
+ self.PROP['maxSlider'] = _('Maximum value')
+ self.PROP['paraSlider'] = _('Specific parameter')
+ self.PROP['checkButton'] = _('Apply generator')
+ self.PROP['cancelButton'] = _('Cancel')
+
+
+
+ #miniTamTam
+ VOL = _('Volume')
+ BAL = _('Balance')
+ REV = _('Reverb')
+ PLAY = _('Play / Stop')
+ STOP = _('Stop')
+ SEQ = _('Left click to record, right click to record on top')
+ GEN = _('Generate')
+ COMPL = _('Complexity of beat')
+ BEAT = _('Beats per bar')
+ TEMPO = _('Tempo')
+ JAZZ = _('Jazz / Rock Kit')
+ AFRI = _('African Kit')
+ ARAB = _('Arabic Kit')
+ BRES = _('South American Kit')
+ ELEC = _('Electronic Kit')
+ RECMIC = _('Record with the microphone')
+ RECLAB = _('Open SynthLab to create noise')
+ MT_RECORDBUTTONS = [_('Record mic into slot 1'), _('Record mic into slot 2'), _('Record mic into slot 3'), _('Record mic into slot 4')]
diff --git a/common/Resources/tooltips_fr.py b/common/Resources/tooltips_fr.py
new file mode 100644
index 0000000..e16ea53
--- /dev/null
+++ b/common/Resources/tooltips_fr.py
@@ -0,0 +1,153 @@
+class Tooltips:
+ #miniTamTam
+ VOL = 'Volume'
+ REV = 'Reverb'
+ PLAY = 'Play / Stop'
+ STOP = 'Stop'
+ SEQ = 'Sequencer'
+ GEN = 'Generate'
+ COMPL = 'Complexity du beat'
+ BEAT = 'Beats per bar'
+ TEMPO = 'Tempo'
+ JAZZ = 'Jazz / Rock Kit'
+ AFRI = 'African Kit'
+ ARAB = 'Arabic Kit'
+ RECMIC = 'Record avec le microphone'
+ RECLAB = 'Open SynthLab to create bruits'
+
+ #Synthlab
+ SOURCE = 'Source'
+ EFFECT = 'Effect'
+ CONTROL = 'Control'
+ SOUNDOUT = 'Sound Output'
+ SOUNDDUR = 'Sound Duration'
+ SAVE = 'Save'
+ LOAD = 'Load'
+ SAVEMINI = 'Save to miniTamTam'
+ CLOSE = 'Close'
+ RESET = 'Reset'
+
+ #Controls
+ LFO = 'LFO'
+ AMP = 'Amplitude'
+ FREQ = 'Frequency'
+ WAVEFORM = 'Waveform'
+ LFO_WAVEFORMS = ['Sine', 'Triangle', 'Bi-Square', 'Uni-Square', 'Sawtooth', 'Sawtooth-down']
+ OFFSET = 'Offset'
+
+ RANDOM = 'Random'
+ MIN = 'Minimum'
+ MAX = 'Maximum'
+ FREQ = FREQ
+ SEED = 'Seed'
+
+ ADSR = 'Envelope'
+ ATTACK = 'Attack'
+ DECAY = 'Decay'
+ SUSTAIN = 'Sustain'
+ RELEASE = 'Release'
+
+ #Source
+ FM = 'Fequency Modulator'
+ CAR = 'Carrier Frequency'
+ MOD = 'Modulator Frequency'
+ INDEX = 'Index'
+ GAIN = 'Gain'
+
+ BUZZ = 'Buzz'
+ FREQ = FREQ
+ NHARM = 'Number of harmonics'
+ FSLOPE = 'Filter Slope'
+ GAIN = GAIN
+
+ VCO = 'Voltage Controlled Oscillator'
+ FREQ = FREQ
+ WAVEFORM = WAVEFORM
+ VCO_WAVEFORMS = ['Sawtooth', 'Square', 'Triangle']
+ FSLOPE = FSLOPE
+ GAIN = GAIN
+
+ PLUCK = 'Pluck'
+ FREQ = FREQ
+ LFILTER = 'Lowpass Filter'
+ VIBRATO = 'Vibrato'
+ GAIN = GAIN
+
+ NOISE = 'Noise'
+ NOISETYPE = 'Type'
+ NOISE_TYPES = ['White', 'Pink', 'Gauss']
+ FREQ = FREQ
+ BANDWITH = 'Bandwith'
+ GAIN = GAIN
+
+ SAMPLE = 'Sound Sample'
+ FREQ = FREQ
+ SAMPLEN = 'Sample Number'
+ SAMPLE_NAMES = ['some inst'] * 100
+ LFILTER = LFILTER
+ GAIN = GAIN
+
+ VOICE = 'Voice'
+ FREQ = FREQ
+ VOWEL = 'Vowel'
+ VOWEL_TYPES = ['i', 'e', 'ee', 'a', 'u', 'o1', 'o2', 'oa', 'oe']
+ VIBRATO = VIBRATO
+ GAIN = GAIN
+
+ #Effects
+ DELAY = 'Delay'
+ FREQ = FREQ
+ LFILTER = LFILTER
+ FEEDBACK = 'Feedback'
+ GAIN = GAIN
+
+ DIST = 'Distortion'
+ FREQ = FREQ
+ RESON = 'Resonance'
+ DISTL = 'Distotion Level'
+ GAIN = GAIN
+
+ FILTER = 'Filter'
+ FREQ = FREQ
+ FSLOPE = FSLOPE
+ FTYPE = 'Type'
+ FILTER_TYPES = ['Lowpass', 'Highpass', 'Bandpass']
+ GAIN = GAIN
+
+ RINGMOD = 'Ring Modulator'
+ FREQ = FREQ
+ AMP = 'Amplitude'
+ WAVEFORM = WAVEFORM
+ LFO_WAVEFORMS = LFO_WAVEFORMS
+ GAIN = GAIN
+
+ REVERB = 'Reverb'
+ REVERBD = 'Length'
+ REVERBF = 'Lowpass Filter'
+ REVERBL = 'Reverb Level'
+ GAIN = GAIN
+
+ HARMON = 'Harmonizer'
+ FREQ = FREQ
+ DRYDELAY = 'Dry delay'
+ MIX = 'Mix'
+ GAIN = GAIN
+
+ SYNTHTYPES = [[LFO, RANDOM, ADSR], [FM, BUZZ, VCO, PLUCK, NOISE, SAMPLE, VOICE], [DELAY, DIST, FILTER, RINGMOD, REVERB, HARMON], [ADSR]]
+ SYNTHPARA = { 'lfo': [AMP, FREQ, WAVEFORM, OFFSET],
+ 'rand': [MIN, MAX, FREQ, SEED],
+ 'adsr': [ATTACK, DECAY, SUSTAIN, RELEASE],
+ 'fm': [CAR, MOD, INDEX, GAIN],
+ 'buzz': [FREQ, NHARM, FSLOPE, GAIN],
+ 'vco': [FREQ, WAVEFORM, FSLOPE, GAIN],
+ 'pluck': [FREQ, LFILTER, VIBRATO, GAIN],
+ 'noise': [NOISETYPE, FREQ, BANDWITH, GAIN],
+ 'sample': [FREQ, SAMPLEN, LFILTER, GAIN],
+ 'voice': [FREQ, VOWEL, VIBRATO, GAIN],
+ 'wguide': [FREQ, LFILTER, FEEDBACK, GAIN],
+ 'distort': [FREQ, RESON, DISTL, GAIN],
+ 'filter': [FREQ, FSLOPE, FTYPE, GAIN],
+ 'ring': [FREQ, AMP, WAVEFORM, GAIN],
+ 'reverb': [REVERBD, REVERBF, REVERBL, GAIN],
+ 'harmon': [FREQ, DRYDELAY, MIX, GAIN]}
+
diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py
new file mode 100644
index 0000000..af1124d
--- /dev/null
+++ b/common/Util/CSoundClient.py
@@ -0,0 +1,356 @@
+import os
+import socket
+import select
+import sys
+import threading
+import time
+import array
+
+import common.Config as Config
+
+from common.Generation.GenerationConstants import GenerationConstants
+from common.Util.Clooper.aclient import *
+from common.Util import NoteDB
+
+
+_note_template = array.array('f', [0] * 19 )
+def _new_note_array():
+ return _note_template.__copy__()
+
+def _noteid(dbnote):
+ return (dbnote.page << 16) + dbnote.id
+
+_loop_default=0
+
+class _CSoundClientPlugin:
+
+ #array index constants for csound
+ (INSTR_TRACK, \
+ ONSET, \
+ DURATION, \
+ PITCH,
+ REVERBSEND, \
+ AMPLITUDE, \
+ PAN, \
+ INST_ID, \
+ ATTACK, \
+ DECAY, \
+ FILTERTYPE, \
+ FILTERCUTOFF, \
+ INSTRUMENT2 ) = range(13)
+
+ def __init__(self):
+ sc_initialize( Config.PLUGIN_UNIVORC, Config.PLUGIN_DEBUG,
+ Config.PLUGIN_PERIOD, Config.PLUGIN_NPERIODS,
+ Config.PLUGIN_VERBOSE,
+ Config.PLUGIN_KSMPS, Config.PLUGIN_RATE)
+ self.on = False
+ #self.masterVolume = 80.0
+ self.periods_per_buffer = 2
+ global _loop_default
+ _loop_default = self.loopCreate()
+
+ def __del__(self):
+ self.connect(False)
+ sc_destroy()
+
+ def setChannel(self, name, val):
+ sc_setChannel(name, val)
+
+ def setMasterVolume(self, volume):
+ sc_setChannel( 'masterVolume', volume)
+
+ def setTrackVolume( self, volume, trackId ):
+ sc_setChannel( 'trackVolume' + str(trackId + 1), volume )
+
+ def setTrackpadX( self, value ):
+ sc_setChannel( 'trackpadX', value)
+
+ def setTrackpadY( self, value ):
+ sc_setChannel( 'trackpadY', value)
+
+ def micRecording( self, table ):
+ sc_inputMessage( Config.CSOUND_MIC_RECORD % table )
+
+ def load_mic_instrument( self, inst ):
+ fileName = Config.SNDS_DIR + '/' + inst
+ instrumentId = Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[inst].instrumentId
+ sc_inputMessage(Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName))
+
+ def load_synth_instrument( self, inst ):
+ fileName = Config.SNDS_DIR + '/' + inst
+ instrumentId = Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[inst].instrumentId
+ sc_inputMessage(Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName))
+
+ def load_ls_instrument( self, inst ):
+ fileName = Config.SNDS_DIR + '/' + inst
+ sc_inputMessage(Config.CSOUND_LOAD_LS_INSTRUMENT % fileName)
+
+ def load_instruments( self ):
+ for instrumentSoundFile in Config.INSTRUMENTS.keys():
+ if instrumentSoundFile[0:3] == 'mic' or instrumentSoundFile[0:3] == 'lab' or Config.INSTRUMENTS[instrumentSoundFile].category == 'mysounds':
+ fileName = Config.SNDS_DIR + '/' + instrumentSoundFile
+ else:
+ fileName = Config.SOUNDS_DIR + "/" + instrumentSoundFile
+ instrumentId = Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ instrumentSoundFile ].instrumentId
+ sc_inputMessage( Config.CSOUND_LOAD_INSTRUMENT % (instrumentId, fileName) )
+
+ def connect( self, init = True ):
+ def reconnect():
+ if sc_start(self.periods_per_buffer) :
+ if (Config.DEBUG > 0) : print 'ERROR connecting'
+ else:
+ self.on = True
+ def disconnect():
+ if sc_stop() :
+ if (Config.DEBUG > 0) : print 'ERROR connecting'
+ else:
+ self.on = False
+
+ if init and not self.on :
+ reconnect()
+ if not init and self.on :
+ disconnect()
+
+ def destroy( self ):
+ self.connect(False)
+ sc_destroy()
+
+ def inputMessage(self,msg):
+ sc_inputMessage(msg)
+
+ def getTick( self ):
+ return sc_getTickf()
+
+ def adjustTick( self, amt ):
+ sc_adjustTick(amt)
+
+ def setTempo(self,t):
+ if (Config.DEBUG > 3) : print 'INFO: loop tempo: %f -> %f' % (t, 60.0 / (Config.TICKS_PER_BEAT * t))
+ sc_setTickDuration( 60.0 / (Config.TICKS_PER_BEAT * t))
+
+
+ def loopCreate(self):
+ return sc_loop_new()
+
+ def loopDestroy(self, loopId):
+ sc_loop_delete(loopId)
+
+ def loopClear(self):
+ global _loop_default
+ sc_loop_delete(_loop_default)
+ _loop_default = sc_loop_new()
+
+ # this is function deletes an Event from a loop
+ # TODO: rename this function
+ def loopDelete(self, dbnote, loopId=_loop_default):
+ sc_loop_delScoreEvent( loopId, _noteid(dbnote))
+
+ def loopDelete1(self, page, id, loopId=_loop_default):
+ sc_loop_delScoreEvent( loopId, (page << 16) + id)
+
+ def loopStart(self, loopId=_loop_default):
+ sc_loop_playing(loopId, 1)
+
+ def loopPause(self, loopId=_loop_default):
+ sc_loop_playing(loopId, 0)
+
+ def loopSetTick(self,t, loopId=_loop_default):
+ sc_loop_setTickf(loopId, t)
+
+ def loopGetTick(self, loopId=_loop_default):
+ return sc_loop_getTickf(loopId)
+
+ def loopSetNumTicks(self,n, loopId=_loop_default):
+ sc_loop_setNumTicks(loopId, n)
+
+ def loopSetTickDuration(self,d, loopId=_loop_default):
+ sc_loop_setTickDuration(loopId, d)
+
+ def loopDeactivate(self, note = 'all', loopId=_loop_default):
+ if note == 'all':
+ sc_loop_deactivate_all(loopId)
+ else:
+ if (Config.DEBUG > 0) : print 'ERROR: deactivating a single note is not implemented'
+
+ def loopUpdate(self, note, parameter, value,cmd, loopId=_loop_default):
+ page = note.page
+ track = note.track
+ id = note.id
+ if note.cs.mode == 'mini':
+ instrument_id_offset = 0
+ elif note.cs.mode == 'edit':
+ if Config.INSTRUMENTSID[note.cs.instrumentId].kit != None:
+ instrument_id_offset = 0
+ else:
+ instrument_id_offset = 100
+ if (parameter == NoteDB.PARAMETER.ONSET):
+ if (Config.DEBUG > 2): print 'INFO: updating onset', (page<<16)+id, value
+ sc_loop_updateEvent( loopId, (page<<16)+id, 1, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.PITCH):
+ if (Config.DEBUG > 2): print 'INFO: updating pitch', (page<<16)+id, value
+ pitch = value
+ if Config.INSTRUMENTSID[note.cs.instrumentId].kit != None:
+ instrument = Config.INSTRUMENTSID[note.cs.instrumentId].kit[pitch]
+ csoundInstId = instrument.csoundInstrumentId
+ csoundTable = Config.INSTRUMENT_TABLE_OFFSET + instrument.instrumentId
+ if (Config.DEBUG > 2): print 'INFO: updating drum instrument (pitch)', (page<<16)+id, instrument.name, csoundInstId
+ sc_loop_updateEvent( loopId, (page<<16)+id, 0, (csoundInstId + instrument_id_offset) + note.track * 0.01, -1 )
+ sc_loop_updateEvent( loopId, (page<<16)+id, 7, csoundTable , -1 )
+ pitch = 1
+ else:
+ pitch = GenerationConstants.TRANSPOSE[ pitch - 24 ]
+ sc_loop_updateEvent( loopId, (page<<16)+id, 3, pitch, cmd)
+ elif (parameter == NoteDB.PARAMETER.AMPLITUDE):
+ if (Config.DEBUG > 2): print 'INFO: updating amp', (page<<16)+id, value
+ sc_loop_updateEvent( loopId, (page<<16)+id, 5, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.DURATION):
+ if (Config.DEBUG > 2): print 'INFO: updating duration', (page<<16)+id, value
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.DURATION, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.INSTRUMENT):
+ pitch = note.cs.pitch
+ instrument = Config.INSTRUMENTSID[value]
+ if instrument.kit != None:
+ instrument = instrument.kit[pitch]
+ csoundInstId = instrument.csoundInstrumentId
+ csoundTable = Config.INSTRUMENT_TABLE_OFFSET + instrument.instrumentId
+ loopStart = instrument.loopStart
+ loopEnd = instrument.loopEnd
+ crossDur = instrument.crossDur
+ if (Config.DEBUG > 2): print 'INFO: updating instrument', (page<<16)+id, instrument.name, csoundInstId
+ sc_loop_updateEvent( loopId, (page<<16)+id, 0, (csoundInstId + (track+1) + instrument_id_offset) + note.track * 0.01, cmd )
+ sc_loop_updateEvent( loopId, (page<<16)+id, 7, csoundTable, -1 )
+ sc_loop_updateEvent( loopId, (page<<16)+id, 12, loopStart, -1 )
+ sc_loop_updateEvent( loopId, (page<<16)+id, 13, loopEnd, -1 )
+ sc_loop_updateEvent( loopId, (page<<16)+id, 14, crossDur , -1 )
+ elif (parameter == NoteDB.PARAMETER.PAN):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.PAN, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.REVERB):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.REVERBSEND, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.ATTACK):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.ATTACK, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.DECAY):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.DECAY, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.FILTERTYPE):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.FILTERTYPE, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.FILTERCUTOFF):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.FILTERCUTOFF, value, cmd)
+ elif (parameter == NoteDB.PARAMETER.INSTRUMENT2):
+ sc_loop_updateEvent( loopId, (page<<16)+id, self.INSTRUMENT2, value, cmd)
+ else:
+ if (Config.DEBUG > 0): print 'ERROR: loopUpdate(): unsupported parameter change'
+
+ def loopPlay(self, dbnote, active, storage=_new_note_array(),
+ loopId=_loop_default ):
+ qid = (dbnote.page << 16) + dbnote.id
+ sc_loop_addScoreEvent( loopId, qid, 1, active, 'i',
+ self.csnote_to_array( dbnote.cs, storage))
+
+ def play(self, csnote, secs_per_tick, storage=_new_note_array()):
+ a = self.csnote_to_array(csnote, storage)
+ a[self.DURATION] = a[self.DURATION] * secs_per_tick
+ a[self.ATTACK] = max(a[self.ATTACK]*a[self.DURATION], 0.002)
+ a[self.DECAY] = max(a[self.DECAY]*a[self.DURATION], 0.002)
+ sc_scoreEvent( 'i', a)
+
+ def csnote_to_array(self, csnote, storage):
+ return self._csnote_to_array1(storage,
+ csnote.onset,
+ csnote.pitch,
+ csnote.amplitude,
+ csnote.pan,
+ csnote.duration,
+ csnote.trackId,
+ csnote.attack,
+ csnote.decay,
+ csnote.reverbSend,
+ csnote.filterType,
+ csnote.filterCutoff,
+ csnote.tied,
+ csnote.instrumentId,
+ csnote.mode,
+ csnote.instrumentId2 )
+
+ def _csnote_to_array1( self, storage, onset, pitch, amplitude, pan, duration,
+ trackId, attack, decay, reverbSend, filterType, filterCutoff,
+ tied, instrumentId, mode, instrumentId2 = -1):
+
+ rval=storage
+ instrument = Config.INSTRUMENTSID[instrumentId]
+ if instrument.kit != None:
+ instrument = instrument.kit[pitch]
+ pitch = 1
+ time_in_ticks = 0
+ else:
+ pitch = GenerationConstants.TRANSPOSE[ pitch - 24 ]
+ time_in_ticks = 1
+
+ instrument_id_offset = 0
+ # condition for tied notes
+ if instrument.csoundInstrumentId == Config.INST_TIED:
+ if tied:
+ if mode == 'mini':
+ duration = -1
+ instrument_id_offset = 0
+ elif mode == 'edit':
+ instrument_id_offset = 0
+ if duration < 0:
+ duration = -1
+ else:
+ if mode == 'mini':
+ instrument_id_offset = 0
+ elif mode == 'edit':
+ instrument_id_offset = 100
+
+ if instrument.csoundInstrumentId == Config.INST_SIMP:
+ if mode == 'mini':
+ instrument_id_offset = 0
+ elif mode == 'edit':
+ if instrument.soundClass == 'drum':
+ instrument_id_offset = 0
+ else:
+ instrument_id_offset = 100
+
+ rval[0] = (instrument.csoundInstrumentId + \
+ (trackId+1) + instrument_id_offset) + trackId * 0.01
+ rval[1] = onset
+ rval[2] = duration
+ rval[3] = pitch
+ rval[4] = reverbSend
+ rval[5] = amplitude
+ rval[6] = pan
+ rval[7] = Config.INSTRUMENT_TABLE_OFFSET + instrument.instrumentId
+ rval[8] = attack
+ rval[9] = decay
+ rval[10]= filterType
+ rval[11]= filterCutoff
+ rval[12]= instrument.loopStart
+ rval[13]= instrument.loopEnd
+ rval[14]= instrument.crossDur
+
+ if instrumentId2 != -1:
+ instrument2 = Config.INSTRUMENTSID[instrumentId2]
+ csInstrumentId2 = (instrument2.csoundInstrumentId + 100) * 0.0001
+ rval[15] = Config.INSTRUMENT_TABLE_OFFSET + instrumentId2 + csInstrumentId2
+ rval[16] = instrument2.loopStart
+ rval[17] = instrument2.loopEnd
+ rval[18] = instrument2.crossDur
+ else:
+ rval[15] = -1
+ rval[16] = 0
+ rval[17] = 0
+ rval[18] = 0
+
+ return rval
+
+_Client = None
+
+def new_csound_client():
+ global _Client
+ if _Client == None:
+ _Client = _CSoundClientPlugin()
+ _Client.connect(True)
+ _Client.setMasterVolume(100.0)
+ _Client.load_instruments()
+ time.sleep(0.2)
+ return _Client
diff --git a/common/Util/CSoundNote.py b/common/Util/CSoundNote.py
new file mode 100644
index 0000000..535084d
--- /dev/null
+++ b/common/Util/CSoundNote.py
@@ -0,0 +1,77 @@
+import common.Config as Config
+
+class CSoundNote :
+ def __init__( self,
+ onset,
+ pitch,
+ amplitude,
+ pan,
+ duration,
+ trackId,
+ instrumentId = Config.INSTRUMENTS["flute"].instrumentId,
+ attack = 0.005,
+ decay = 0.098,
+ reverbSend = 0.1,
+ filterType = 0,
+ filterCutoff = 1000,
+ tied = False,
+ mode = 'edit',
+ instrumentId2 = -1 ):
+
+ self.onset = onset
+ self.pitch = pitch
+ self.amplitude = amplitude
+ self.pan = pan
+ self.duration = duration
+ self.trackId = trackId
+ self.instrumentId = instrumentId
+ #temp: catch old code trying to pass in instrument names here
+ int(instrumentId)
+ self.attack = attack
+ self.decay = decay
+ self.reverbSend = reverbSend
+ self.filterType = filterType
+ self.filterCutoff = filterCutoff
+ self.tied = tied
+ self.mode = mode
+ self.instrumentId2 = instrumentId2
+
+ def clone( self ):
+ return CSoundNote( self.onset, self.pitch, self.amplitude, self.pan,
+ self.duration, self.trackId, self.instrumentId,
+ self.attack, self.decay, self.reverbSend,
+ self.filterType, self.filterCutoff, self.tied,
+ self.mode, self.instrumentId2 )
+
+ def __getstate__unused(self):
+ return {'onset': self.onset,
+ 'pitch': self.pitch,
+ 'amplitude': self.amplitude,
+ 'pan': self.pan,
+ 'duration': self.duration,
+ 'trackId': self.trackId,
+ 'instrumentId': self.instrumentId,
+ 'attack': self.attack,
+ 'decay': self.decay,
+ 'reverbSend': self.reverbSend,
+ 'filterType': self.filterType,
+ 'filterCutoff': self.filterCutoff,
+ 'tied': self.tied,
+ 'mode': self.mode }
+
+ def __setstate__unused(self,dict):
+ self.onset = dict['onset']
+ self.pitch = dict['pitch']
+ self.amplitude = dict['amplitude']
+ self.pan = dict['pan']
+ self.duration = dict['duration']
+ self.trackId = dict['trackId']
+ self.instrumentId = dict['instrumentId']
+ self.attack = dict['attack']
+ self.decay = dict['decay']
+ self.reverbSend = dict['reverbSend']
+ self.filterType = dict['filterType']
+ self.filterCutoff = dict['filterCutoff']
+ self.tied = dict['tied']
+ self.mode = dict['mode']
+ self.nchanges = 0
diff --git a/common/Util/Clooper/Makefile b/common/Util/Clooper/Makefile
new file mode 100644
index 0000000..6ea2e2c
--- /dev/null
+++ b/common/Util/Clooper/Makefile
@@ -0,0 +1,21 @@
+CC=gcc
+
+CXXFLAGS+= -Wall -Werror -fPIC -O2 -finline
+LDFLAGS+= -lasound
+
+LDFLAGS+= -L/usr/local/lib -lcsound
+
+CPPFLAGS+=-I/home/james/cvs/sugar-jhbuild/build/include/python2.5
+LDFLAGS+=-L/home/james/cvs/sugar-jhbuild/build/lib
+
+CPPFLAGS+=-I/usr/include/python2.5
+LDFLAGS+=-lpython2.5
+
+all : aclient.so
+
+aclient.so : aclient.cpp audio.cpp
+ g++ $(CPPFLAGS) $(CXXFLAGS) -shared -o $@ $< $(LDFLAGS)
+
+clean :
+ rm aclient.so
+
diff --git a/common/Util/Clooper/SoundClient.i b/common/Util/Clooper/SoundClient.i
new file mode 100644
index 0000000..80d77df
--- /dev/null
+++ b/common/Util/Clooper/SoundClient.i
@@ -0,0 +1,14 @@
+
+%module SClient
+
+%{
+#define SWIG_FILE_WITH_INIT
+#include "SoundClient.h"
+%}
+
+%pythoncode
+%{
+
+%}
+
+%include "SoundClient.h"
diff --git a/common/Util/Clooper/__init__.py b/common/Util/Clooper/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common/Util/Clooper/__init__.py
diff --git a/common/Util/Clooper/aclient.cpp b/common/Util/Clooper/aclient.cpp
new file mode 100644
index 0000000..1146c3b
--- /dev/null
+++ b/common/Util/Clooper/aclient.cpp
@@ -0,0 +1,1090 @@
+#include <Python.h>
+
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sched.h>
+
+#include <vector>
+#include <map>
+#include <cmath>
+
+#include <csound/csound.h>
+#include <alsa/asoundlib.h>
+
+static double pytime(const struct timeval * tv)
+{
+ struct timeval t;
+ if (!tv)
+ {
+ tv = &t;
+ gettimeofday(&t, NULL);
+ }
+ return (double) tv->tv_sec + (double) tv->tv_usec / 1000000.0;
+}
+#include "log.cpp"
+#include "audio.cpp"
+
+#define FLOAT_TO_SHORT(in,out) __asm__ __volatile__ ("fistps %0" : "=m" (out) : "t" (in) : "st") ;
+
+int VERBOSE = 3;
+FILE * _debug = NULL;
+struct TamTamSound;
+struct Music;
+TamTamSound * g_tt = NULL;
+Music * g_music = NULL;
+log_t * g_log = NULL;
+const int STEP_eventMax = 16; //this is the most events that will be queued by a loop per step()
+
+/**
+ * Event is the type of event that Clooper puts in the loop buffer.
+ * It corresponds to a line of csound that starts with an 'i'
+ */
+struct Event
+{
+ char type; ///< if this event were listed in a csound file, the line would begin with this letter
+ int onset; ///< the onset time of this event (its temporal position)
+ bool time_in_ticks; ///< if true, then some parameters will be updated according to the tempo
+ bool active; ///< if true, then event() will actually do something
+ MYFLT prev_secs_per_tick; ///< normally used for ____, sometimes set to -1 to force recalculation of param[] entries
+ MYFLT duration, attack, decay;///< canonical values of some tempo-dependent parameters
+ std::vector<MYFLT> param; ///< parameter buffer for csound
+
+ Event(char type, MYFLT * p, int param_count, bool in_ticks, bool active)
+ : type(type), onset(0), time_in_ticks(in_ticks), active(active), param(param_count)
+ {
+ assert(param_count >= 4);
+ onset = (int) p[1];
+ duration = p[2];
+ attack = param_count > 8 ? p[8]: 0.0; //attack
+ decay = param_count > 9 ? p[9]: 0.0; //decay
+ prev_secs_per_tick = -1.0;
+ for (int i = 0; i < param_count; ++i) param[i] = p[i];
+
+ param[1] = 0.0; //onset
+ }
+ /*
+ bool operator<(const Event &e) const
+ {
+ return onset < e.onset;
+ }
+ */
+ void ev_print(FILE *f)
+ {
+ fprintf(f, "INFO: scoreEvent %c ", type);
+ for (size_t i = 0; i < param.size(); ++i) fprintf(f, "%lf ", param[i]);
+ fprintf(f, "[%s]\n", active ? "active": "inactive");
+ }
+ /**
+ * Update the idx'th param value to have a certain value.
+ *
+ * Certain of the parameters are linked in strange hack-y ways, as defined by
+ * the constructor, and update() (which should be consistent with one another!)
+ *
+ * These events are for use with the file: TamTam/Resources/univorc.csd.
+ * So that file defines how the parameters will be interpreted by csound.
+ */
+ void update(int idx, MYFLT val)
+ {
+ if ( (unsigned)idx >= param.size())
+ {
+ if (_debug && (VERBOSE > 0)) fprintf(_debug, "ERROR: updateEvent request for too-high parameter %i\n", idx);
+ return;
+ }
+ if (time_in_ticks)
+ {
+ switch(idx)
+ {
+ case 1: onset = (int) val; break;
+ case 2: duration = val; break;
+ case 8: attack = val; break;
+ case 9: decay = val; break;
+ default: param[idx] = val; break;
+ }
+ prev_secs_per_tick = -1.0; //force recalculation
+ }
+ else
+ {
+ param[idx] = val;
+ }
+ }
+ /**
+ * An Event instance can be in an active or inactive state. If an Event instance
+ * is active, then event() will call a corresponding csoundScoreEvent(). If an
+ * Event instance is inactive, then event() is a noop.
+ */
+ void activate_cmd(int cmd)
+ {
+ switch(cmd)
+ {
+ case 0: active = false; break;
+ case 1: active = true; break;
+ case 2: active = !active; break;
+ }
+ }
+
+ /**
+ * Iff this instance is active, this call generates a csound event.
+ * Parameters are passed directly as a buffer of floats. If secs_per_tick
+ * != prev_secs_per_tick (possibly because prev_secs_per_tick was set to -1
+ * by update() ) then this call will do some floating point ops to
+ * recalculate the parameter buffer.
+ */
+ void event(CSOUND * csound, MYFLT secs_per_tick)
+ {
+ if (!active) return;
+
+ if (time_in_ticks && (secs_per_tick != prev_secs_per_tick))
+ {
+ param[2] = duration * secs_per_tick;
+ if (param.size() > 8) param[8] = std::max(0.002f, attack * param[2]);
+ if (param.size() > 9) param[9] = std::max(0.002f, decay * param[2]);
+ prev_secs_per_tick = secs_per_tick;
+ if (_debug && (VERBOSE > 2)) fprintf(_debug, "setting duration to %f\n", param[5]);
+ }
+ csoundScoreEvent(csound, type, &param[0], param.size());
+ }
+};
+
+/**
+ *
+ * Loop is a repeat-able loop of Event instances.
+ * */
+struct Loop
+{
+ typedef int onset_t;
+ typedef int id_t;
+ typedef std::pair<onset_t, Event *> pair_t;
+ typedef std::multimap<onset_t, Event *>::iterator iter_t;
+ typedef std::map<id_t, iter_t>::iterator idmap_t;
+
+ int tick_prev;
+ int tickMax;
+ MYFLT rtick;
+
+ // a container of all events, sorted by onset time
+ // used for efficient playback
+ std::multimap<onset_t, Event *> ev;
+ // the playback head
+ std::multimap<onset_t, Event *>::iterator ev_pos;
+ // a container of pointers into ev, indexed by note id
+ // used for deleting, updating notes
+ std::map<id_t, iter_t> idmap;
+ int steps;
+ int playing; //true means that step() works, else step() is no-op
+
+ Loop() : tick_prev(0), tickMax(1), rtick(0.0), ev(), ev_pos(ev.end()), steps(0), playing(0)
+ {
+ }
+ ~Loop()
+ {
+ //TODO: send these events to a recycling queue, don't erase them
+ for (iter_t i = ev.begin(); i != ev.end(); ++i)
+ {
+ delete i->second;
+ }
+ }
+ void deactivateAll()
+ {
+ for (iter_t i = ev.begin(); i != ev.end(); ++i)
+ {
+ i->second->activate_cmd(0);
+ }
+ }
+ MYFLT getTickf()
+ {
+ return fmod(rtick, (MYFLT)tickMax);
+ }
+ void setNumTicks(int nticks)
+ {
+ tickMax = nticks;
+ MYFLT fnticks = nticks;
+ if (rtick > fnticks)
+ {
+ rtick = fmodf(rtick, fnticks);
+ }
+ }
+ void setTickf(float t)
+ {
+ rtick = fmodf(t, (MYFLT) tickMax);
+ ev_pos = ev.lower_bound( (int) rtick );
+ }
+ /** advance in play loop by rtick_inc ticks, possibly generate some
+ * csoundScoreEvent calls.
+ */
+ void step(MYFLT rtick_inc, MYFLT secs_per_tick , CSOUND * csound)
+ {
+ if (!playing) return;
+ rtick += rtick_inc;
+ int tick = (int)rtick % tickMax;
+ if (tick == tick_prev) return;
+
+ int events = 0;
+ int loop0 = 0;
+ int loop1 = 0;
+ if (!ev.empty())
+ {
+ if (steps && (tick < tick_prev)) // should be true only after the loop wraps (not after insert)
+ {
+ while (ev_pos != ev.end())
+ {
+ if (_debug && (VERBOSE > 3)) ev_pos->second->ev_print(_debug);
+ if (events < STEP_eventMax) ev_pos->second->event(csound, secs_per_tick);
+ ++ev_pos;
+ ++events;
+ ++loop0;
+ }
+ ev_pos = ev.begin();
+ }
+ while ((ev_pos != ev.end()) && (tick >= ev_pos->first))
+ {
+ if (_debug && (VERBOSE > 3)) ev_pos->second->ev_print(_debug);
+ if (events < STEP_eventMax) ev_pos->second->event(csound, secs_per_tick);
+ ++ev_pos;
+ ++events;
+ ++loop1;
+ }
+ }
+ tick_prev = tick;
+ if (_debug && (VERBOSE>1) && (events >= STEP_eventMax)) fprintf(_debug, "WARNING: %i/%i events at once (%i, %i)\n", events,ev.size(),loop0,loop1);
+ ++steps;
+ }
+ void addEvent(int id, char type, MYFLT * p, int np, bool in_ticks, bool active)
+ {
+ Event * e = new Event(type, p, np, in_ticks, active);
+
+ idmap_t id_iter = idmap.find(id);
+ if (id_iter == idmap.end())
+ {
+ //this is a new id
+ iter_t e_iter = ev.insert(pair_t(e->onset, e));
+
+ //TODO: optimize by thinking about whether to do ev_pos = e_iter
+ ev_pos = ev.upper_bound( tick_prev );
+ idmap[id] = e_iter;
+ }
+ else
+ {
+ g_log->printf(1, "%s duplicate note %i\n", __FUNCTION__, id);
+ }
+ }
+ void delEvent(int id)
+ {
+ idmap_t id_iter = idmap.find(id);
+ if (id_iter != idmap.end())
+ {
+ iter_t e_iter = id_iter->second;//idmap[id];
+ if (e_iter == ev_pos) ++ev_pos;
+
+ delete e_iter->second;
+ ev.erase(e_iter);
+ idmap.erase(id_iter);
+ }
+ else
+ {
+ g_log->printf( 1, "%s unknown note %i\n", __FUNCTION__, id);
+ }
+ }
+ void updateEvent(int id, int idx, float val, int activate_cmd)
+ {
+ idmap_t id_iter = idmap.find(id);
+ if (id_iter != idmap.end())
+ {
+ //this is a new id
+ iter_t e_iter = id_iter->second;
+ Event * e = e_iter->second;
+ int onset = e->onset;
+ e->update(idx, val);
+ e->activate_cmd(activate_cmd);
+ if (onset != e->onset)
+ {
+ ev.erase(e_iter);
+
+ e_iter = ev.insert(pair_t(e->onset, e));
+
+ //TODO: optimize by thinking about whether to do ev_pos = e_iter
+ ev_pos = ev.upper_bound( tick_prev );
+ idmap[id] = e_iter;
+ }
+ }
+ else
+ {
+ g_log->printf(1, "%s unknown note %i\n", __FUNCTION__, id);
+ }
+ }
+ void reset()
+ {
+ steps = 0;
+ }
+ void setPlaying(int tf)
+ {
+ playing = tf;
+ }
+};
+
+/** management of loops */
+struct Music
+{
+ typedef int loopIdx_t;
+ typedef std::map<int, Loop * > eventMap_t;
+
+ eventMap_t loop;
+ int loop_nextIdx;
+ void * mutex; //modification and playing of loops cannot be interwoven
+
+ Music() :
+ loop(),
+ loop_nextIdx(0),
+ mutex(csoundCreateMutex(0))
+ {
+ }
+ ~Music()
+ {
+ for (eventMap_t::iterator i = loop.begin(); i != loop.end(); ++i)
+ {
+ delete i->second;
+ }
+ csoundDestroyMutex(mutex);
+ }
+
+ void step(MYFLT amt, MYFLT secs_per_tick, CSOUND * csound)
+ {
+ csoundLockMutex(mutex);
+ for (eventMap_t::iterator i = loop.begin(); i != loop.end(); ++i)
+ {
+ i->second->step(amt, secs_per_tick, csound);
+ }
+ csoundUnlockMutex(mutex);
+ }
+
+ /** allocate a new loop, and return its index */
+ loopIdx_t alloc()
+ {
+ csoundLockMutex(mutex);
+ //find a loop_nextIdx that isn't in loop map already
+ while ( loop.find( loop_nextIdx) != loop.end()) ++loop_nextIdx;
+ loop[loop_nextIdx] = new Loop();
+ csoundUnlockMutex(mutex);
+ return loop_nextIdx;
+ }
+ /** de-allocate a loop */
+ void destroy(loopIdx_t loopIdx)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ csoundLockMutex(mutex);
+ //TODO: save the note events to a cache for recycling
+ delete loop[loopIdx];
+ loop.erase(loopIdx);
+ csoundUnlockMutex(mutex);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ /** set the playing flag of the given loop */
+ void playing(loopIdx_t loopIdx, int tf)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ csoundLockMutex(mutex);
+ loop[loopIdx]->setPlaying(tf);
+ csoundUnlockMutex(mutex);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ /** set the playing flag of the given loop */
+ void addEvent(loopIdx_t loopIdx, int eventId, char type, MYFLT * p, int np, bool in_ticks, bool active)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ csoundLockMutex(mutex);
+ loop[loopIdx]->addEvent(eventId, type, p, np, in_ticks, active);
+ csoundUnlockMutex(mutex);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ void delEvent(loopIdx_t loopIdx, int eventId)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ csoundLockMutex(mutex);
+ loop[loopIdx]->delEvent(eventId);
+ csoundUnlockMutex(mutex);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ void updateEvent(loopIdx_t loopIdx, int eventId, int pIdx, float pVal, int activate_cmd)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ csoundLockMutex(mutex);
+ loop[loopIdx]->updateEvent(eventId, pIdx, pVal, activate_cmd);
+ csoundUnlockMutex(mutex);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ MYFLT getTickf(loopIdx_t loopIdx)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ return loop[loopIdx]->getTickf();
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ return 0.0;
+ }
+ }
+ void setTickf(loopIdx_t loopIdx, MYFLT tickf)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ loop[loopIdx]->setTickf(tickf);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ void setNumTicks(loopIdx_t loopIdx, int numTicks)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ loop[loopIdx]->setNumTicks(numTicks);
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+ void deactivateAll(loopIdx_t loopIdx)
+ {
+ if (loop.find(loopIdx) != loop.end())
+ {
+ loop[loopIdx]->deactivateAll();
+ }
+ else
+ {
+ g_log->printf(1, "%s() called on non-existant loop %i\n", __FUNCTION__ , loopIdx);
+ }
+ }
+
+};
+
+/**
+ * The main object of control in the Clooper plugin.
+ *
+ * This guy controls the sound rendering thread, loads and unloads ALSA,
+ * maintains a csound instance, and maintains a subset of notes from the
+ * currently-loaded TamTam.
+ */
+struct TamTamSound
+{
+ /** the id of an running sound-rendering thread, or NULL */
+ void * ThreadID;
+ /** a flag to tell the thread to continue, or break */
+ enum {CONTINUE, STOP} PERF_STATUS;
+ /** our csound object, NULL iff there was a problem creating it */
+ CSOUND * csound;
+ /** our note sources */
+ Music music;
+
+ MYFLT secs_per_tick;
+ MYFLT ticks_per_period;
+ MYFLT tick_adjustment; //the default time increment in thread_fn
+ MYFLT tick_total;
+
+ /** the upsampling ratio from csound */
+ unsigned int csound_ksmps;
+ snd_pcm_uframes_t csound_frame_rate;
+ snd_pcm_uframes_t csound_period_size;
+ snd_pcm_uframes_t period0;
+ unsigned int period_per_buffer; //should be 2
+ int up_ratio; //if the hardware only supports a small integer multiple of our effective samplerate, do a real-time conversion
+
+ log_t * ll;
+ SystemStuff * sys_stuff;
+
+ TamTamSound(log_t * ll, char * orc, snd_pcm_uframes_t period0, unsigned int ppb, int ksmps, int framerate )
+ : ThreadID(NULL), PERF_STATUS(STOP), csound(NULL),
+ music(),
+ ticks_per_period(0.0),
+ tick_adjustment(0.0),
+ tick_total(0.0),
+ csound_ksmps(ksmps), //must agree with the orchestra file
+ csound_frame_rate(framerate), //must agree with the orchestra file
+ period0(period0),
+ period_per_buffer(ppb),
+ up_ratio(1),
+ ll( ll ),
+ sys_stuff(NULL)
+ {
+ sys_stuff = new SystemStuff(ll);
+ if (0 > sys_stuff->open(csound_frame_rate, 4, period0, period_per_buffer))
+ {
+ return;
+ }
+ sys_stuff->close(0);
+ up_ratio = sys_stuff->rate / csound_frame_rate;
+ csound_period_size = (sys_stuff->period_size % up_ratio == 0)
+ ? sys_stuff->period_size / up_ratio
+ : csound_ksmps * 4;
+
+ csound = csoundCreate(NULL);
+ int argc=3;
+ char **argv = (char**)malloc(argc*sizeof(char*));
+ argv[0] = "csound";
+ argv[1] = "-m0";
+ argv[2] = orc;
+
+ ll->printf(1, "loading csound orchestra file %s\n", orc);
+ //csoundInitialize(&argc, &argv, 0);
+ csoundPreCompile(csound);
+ csoundSetHostImplementedAudioIO(csound, 1, csound_period_size);
+ int result = csoundCompile(csound, argc, &(argv[0]));
+ if (result)
+ {
+ csound = NULL;
+ ll->printf( "ERROR: csoundCompile of orchestra %s failed with code %i\n", orc, result);
+ }
+ free(argv);
+ setTickDuration(0.05);
+ }
+ ~TamTamSound()
+ {
+ if (csound)
+ {
+ stop();
+ ll->printf(2, "Going for csoundDestroy\n");
+ csoundDestroy(csound);
+ }
+ ll->printf(2, "TamTamSound destroyed\n");
+ if (sys_stuff) delete sys_stuff;
+ delete ll;
+ }
+ bool good()
+ {
+ return csound != NULL;
+ }
+
+ uintptr_t thread_fn()
+ {
+ assert(csound);
+
+ const int nchannels = 2;
+ int nloops = 0;
+ long int csound_nsamples = csoundGetOutputBufferSize(csound);
+ long int csound_nframes = csound_nsamples / nchannels;
+
+ ll->printf(2, "INFO: nsamples = %li nframes = %li\n", csound_nsamples, csound_nframes);
+
+ if (0 > sys_stuff->open(csound_frame_rate, 4, period0, period_per_buffer))
+ {
+ ll->printf( "ERROR: failed to open alsa device, thread abort\n");
+ return 1;
+ }
+
+ assert(up_ratio == (signed)(sys_stuff->rate / csound_frame_rate));
+
+ bool do_upsample = (signed)sys_stuff->period_size != csound_nframes;
+ short *upbuf = new short[ sys_stuff->period_size * nchannels ];
+ int cbuf_pos = csound_nframes; // trigger a call to csoundPerformBuffer immediately
+ float *cbuf = NULL;
+ int up_pos = 0;
+ int ratio_pos = 0;
+
+ tick_total = 0.0f;
+
+ while (PERF_STATUS == CONTINUE)
+ {
+ if ( do_upsample ) //fill one period of audio buffer data by 0 or more calls to csound
+ {
+ up_pos = 0;
+ int messed = 0;
+ short cursample[2]={0,0};
+ while(!messed)
+ {
+ if (cbuf_pos == csound_nframes)
+ {
+ cbuf_pos = 0;
+ if (csoundPerformBuffer(csound)) { messed = 1;break;}
+ cbuf = csoundGetOutputBuffer(csound);
+ }
+ upbuf[2*up_pos+0] = cursample[0];
+ upbuf[2*up_pos+1] = cursample[1];
+
+ if (++ratio_pos == up_ratio)
+ {
+ ratio_pos = 0;
+ ++cbuf_pos;
+ cbuf[cbuf_pos*2+0] *= (float) ((1<<15)-100.0f);
+ cbuf[cbuf_pos*2+1] *= (float) ((1<<15)-100.0f);
+ FLOAT_TO_SHORT( cbuf[cbuf_pos*2+0], cursample[0]);
+ FLOAT_TO_SHORT( cbuf[cbuf_pos*2+1], cursample[1]);
+ }
+
+ if (++up_pos == (signed)sys_stuff->period_size) break;
+ }
+ if (messed || (up_pos != (signed)sys_stuff->period_size)) break;
+
+ if (0 > sys_stuff->writebuf(sys_stuff->period_size, upbuf)) break;
+ }
+ else //fill one period of audio directly from csound
+ {
+ if (csoundPerformBuffer(csound)) break;
+ cbuf = csoundGetOutputBuffer(csound);
+ for (int i = 0; i < csound_nframes * nchannels; ++i)
+ {
+ cbuf[i] *= (float) ((1<<15)-100.0f);
+ FLOAT_TO_SHORT( cbuf[i], upbuf[i]);
+ }
+ if (0 > sys_stuff->writebuf(csound_nframes,upbuf)) break;
+ }
+
+ if (tick_adjustment > - ticks_per_period)
+ {
+ MYFLT tick_inc = ticks_per_period + tick_adjustment;
+ music.step( tick_inc, secs_per_tick, csound);
+ tick_adjustment = 0.0;
+ tick_total += tick_inc;
+ }
+ else
+ {
+ tick_adjustment += ticks_per_period;
+ }
+ ++nloops;
+ }
+
+ sys_stuff->close(1);
+ delete [] upbuf;
+ ll->printf(2, "INFO: performance thread returning 0\n");
+ return 0;
+ }
+ static uintptr_t csThread(void *clientData)
+ {
+ return ((TamTamSound*)clientData)->thread_fn();
+ }
+ int start(int )
+ {
+ if (!csound) {
+ ll->printf(1, "skipping %s, csound==NULL\n", __FUNCTION__);
+ return 1;
+ }
+ if (!ThreadID)
+ {
+ PERF_STATUS = CONTINUE;
+ ThreadID = csoundCreateThread(csThread, (void*)this);
+ ll->printf( "INFO(%s:%i) aclient launching performance thread (%p)\n", __FILE__, __LINE__, ThreadID );
+ return 0;
+ }
+ ll->printf( "INFO(%s:%i) skipping duplicate request to launch a thread\n", __FILE__, __LINE__ );
+ return 1;
+ }
+ int stop()
+ {
+ if (!csound) {
+ ll->printf(1, "skipping %s, csound==NULL\n", __FUNCTION__);
+ return 1;
+ }
+ if (ThreadID)
+ {
+ PERF_STATUS = STOP;
+ ll->printf( "INFO(%s:%i) aclient joining performance thread\n", __FILE__, __LINE__ );
+ uintptr_t rval = csoundJoinThread(ThreadID);
+ ll->printf( "INFO(%s:%i) ... joined\n", __FILE__, __LINE__ );
+ if (rval) ll->printf( "WARNING: thread returned %zu\n", rval);
+ ThreadID = NULL;
+ return 0;
+ }
+ return 1;
+ }
+
+ /** pass an array event straight through to csound. only works if perf. thread is running */
+ void scoreEvent(char type, MYFLT * p, int np)
+ {
+ if (!csound) {
+ ll->printf(1, "skipping %s, csound==NULL\n", __FUNCTION__);
+ return;
+ }
+ if (!ThreadID)
+ {
+ if (_debug && (VERBOSE > 1)) fprintf(_debug, "skipping %s, ThreadID==NULL\n", __FUNCTION__);
+ return ;
+ }
+ if (_debug && (VERBOSE > 2))
+ {
+ fprintf(_debug, "INFO: scoreEvent %c ", type);
+ for (int i = 0; i < np; ++i) fprintf(_debug, "%lf ", p[i]);
+ fprintf(_debug, "\n");
+ }
+ csoundScoreEvent(csound, type, p, np);
+ }
+ /** pass a string event straight through to csound. only works if perf. thread is running */
+ void inputMessage(const char * msg)
+ {
+ if (!csound) {
+ ll->printf(1, "skipping %s, csound==NULL\n", __FUNCTION__);
+ return;
+ }
+ if (!ThreadID)
+ {
+ if (_debug && (VERBOSE > 1)) fprintf(_debug, "skipping %s, ThreadID==NULL\n", __FUNCTION__);
+ return ;
+ }
+ if (_debug &&(VERBOSE > 3)) fprintf(_debug, "%s\n", msg);
+ csoundInputMessage(csound, msg);
+ }
+ /** pass a setChannel command through to csound. only works if perf. thread is running */
+ void setChannel(const char * name, MYFLT vol)
+ {
+ if (!csound) {
+ ll->printf(1, "skipping %s, csound==NULL\n", __FUNCTION__);
+ return;
+ }
+ if (!ThreadID)
+ {
+ if (_debug && (VERBOSE > 1)) fprintf(_debug, "skipping %s, ThreadID==NULL\n", __FUNCTION__);
+ return ;
+ }
+ MYFLT *p;
+ if (!(csoundGetChannelPtr(csound, &p, name, CSOUND_CONTROL_CHANNEL | CSOUND_INPUT_CHANNEL)))
+ *p = (MYFLT) vol;
+ else
+ {
+ if (_debug && (VERBOSE >0)) fprintf(_debug, "ERROR: failed to set channel: %s\n", name);
+ }
+ }
+
+ /** adjust the global tick value by this much */
+ void adjustTick(MYFLT dtick)
+ {
+ tick_adjustment += dtick;
+ }
+ void setTickDuration(MYFLT d )
+ {
+ secs_per_tick = d;
+ ticks_per_period = csound_period_size / ( secs_per_tick * csound_frame_rate);
+ ll->printf( 3, "INFO: duration %lf := ticks_per_period %lf\n", secs_per_tick , ticks_per_period);
+ }
+ MYFLT getTickf()
+ {
+ return tick_total + tick_adjustment;
+ }
+};
+
+
+static void cleanup(void)
+{
+ if (g_tt)
+ {
+ delete g_tt;
+ g_tt = NULL;
+ }
+}
+
+#define DECL(s) static PyObject * s(PyObject * self, PyObject *args)
+#define RetNone Py_INCREF(Py_None); return Py_None;
+
+//call once at end
+DECL(sc_destroy)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ {
+ return NULL;
+ }
+ if (g_tt)
+ {
+ delete g_tt;
+ g_tt = NULL;
+ if (_debug) fclose(_debug);
+ }
+ RetNone;
+}
+//call once at startup, should return 0
+DECL(sc_initialize) //(char * csd)
+{
+ char * str;
+ char * log_file;
+ int period, ppb, ksmps, framerate;
+ if (!PyArg_ParseTuple(args, "ssiiiii", &str, &log_file, &period, &ppb, &VERBOSE, &ksmps, &framerate ))
+ {
+ return NULL;
+ }
+ if ( log_file[0] )
+ {
+ _debug = fopen(log_file,"w");
+ if (_debug==NULL)
+ {
+ fprintf(stderr, "WARNING: fopen(%s) failed, logging to stderr\n", log_file);
+ _debug = stderr;
+ }
+ }
+ else
+ {
+ _debug = NULL;
+ fprintf(stderr, "Logging disabled on purpose\n");
+ }
+ g_log = new log_t(_debug, VERBOSE);
+ g_tt = new TamTamSound(g_log, str, period, ppb, ksmps, framerate);
+ g_music = & g_tt->music;
+ atexit(&cleanup);
+ if (g_tt->good())
+ return Py_BuildValue("i", 0);
+ else
+ return Py_BuildValue("i", -1);
+}
+//compile the score, connect to device, start a sound rendering thread
+DECL(sc_start)
+{
+ int ppb;
+ if (!PyArg_ParseTuple(args, "i", &ppb ))
+ {
+ return NULL;
+ }
+ return Py_BuildValue("i", g_tt->start(ppb));
+}
+//stop csound rendering thread, disconnect from sound device, clear tables.
+DECL(sc_stop)
+{
+ if (!PyArg_ParseTuple(args, "" ))
+ {
+ return NULL;
+ }
+ return Py_BuildValue("i", g_tt->stop());
+}
+DECL(sc_scoreEvent) //(char type, farray param)
+{
+ char ev_type;
+ PyObject *o;
+ if (!PyArg_ParseTuple(args, "cO", &ev_type, &o ))
+ {
+ return NULL;
+ }
+ if (o->ob_type
+ && o->ob_type->tp_as_buffer
+ && (1 == o->ob_type->tp_as_buffer->bf_getsegcount(o, NULL)))
+ {
+ if (o->ob_type->tp_as_buffer->bf_getreadbuffer)
+ {
+ void * ptr;
+ size_t len;
+ len = o->ob_type->tp_as_buffer->bf_getreadbuffer(o, 0, &ptr);
+ float * fptr = (float*)ptr;
+ size_t flen = len / sizeof(float);
+ g_tt->scoreEvent(ev_type, fptr, flen);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ else
+ {
+ assert(!"asdf");
+ }
+ }
+ assert(!"not reached");
+ return NULL;
+}
+DECL (sc_inputMessage) //(const char *msg)
+{
+ char * msg;
+ if (!PyArg_ParseTuple(args, "s", &msg ))
+ {
+ return NULL;
+ }
+ g_tt->inputMessage(msg);
+ RetNone;
+}
+DECL(sc_setChannel) //(string name, float value)
+{
+ const char * str;
+ float v;
+ if (!PyArg_ParseTuple(args, "sf", &str,&v))
+ {
+ return NULL;
+ }
+ g_tt->setChannel(str,v);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+DECL(sc_getTickf) // () -> float
+{
+ if (!PyArg_ParseTuple(args, ""))
+ {
+ return NULL;
+ }
+ return Py_BuildValue("f", g_tt->getTickf());
+}
+DECL(sc_adjustTick) // (MYFLT ntick)
+{
+ float spt;
+ if (!PyArg_ParseTuple(args, "f", &spt ))
+ {
+ return NULL;
+ }
+ g_tt->adjustTick(spt);
+ RetNone;
+}
+DECL(sc_setTickDuration) // (MYFLT secs_per_tick)
+{
+ float spt;
+ if (!PyArg_ParseTuple(args, "f", &spt ))
+ {
+ return NULL;
+ }
+ g_tt->setTickDuration(spt);
+ RetNone;
+}
+DECL(sc_loop_new) // () -> int
+{
+ if (!PyArg_ParseTuple(args, "" )) return NULL;
+ return Py_BuildValue("i", g_music->alloc());
+}
+DECL(sc_loop_delete) // (int loopIdx)
+{
+ int loopIdx;
+ if (!PyArg_ParseTuple(args, "i", &loopIdx )) return NULL;
+ g_music->destroy(loopIdx);
+ RetNone;
+}
+DECL(sc_loop_getTickf) // (int loopIdx) -> float
+{
+ int idx;
+ if (!PyArg_ParseTuple(args, "i", &idx ))
+ {
+ return NULL;
+ }
+ return Py_BuildValue("f", g_music->getTickf(idx));
+}
+DECL(sc_loop_setNumTicks) //(int loopIdx, int nticks)
+{
+ int loopIdx;
+ int nticks;
+ if (!PyArg_ParseTuple(args, "ii", &loopIdx, &nticks )) return NULL;
+ g_music->setNumTicks(loopIdx, nticks);
+ RetNone;
+}
+DECL(sc_loop_setTickf) // (int loopIdx, float pos)
+{
+ int loopIdx;
+ MYFLT pos;
+ if (!PyArg_ParseTuple(args, "if", &loopIdx, &pos )) return NULL;
+ g_music->setTickf(loopIdx, pos);
+ RetNone;
+}
+DECL(sc_loop_addScoreEvent) // (int loopIdx, int id, int duration_in_ticks, char type, farray param)
+{
+ int loopIdx, qid, inticks, active;
+ char ev_type;
+ PyObject *o;
+ if (!PyArg_ParseTuple(args, "iiiicO", &loopIdx, &qid, &inticks, &active, &ev_type, &o )) return NULL;
+
+ if (o->ob_type
+ && o->ob_type->tp_as_buffer
+ && (1 == o->ob_type->tp_as_buffer->bf_getsegcount(o, NULL)))
+ {
+ if (o->ob_type->tp_as_buffer->bf_getreadbuffer)
+ {
+ void * ptr;
+ size_t len;
+ len = o->ob_type->tp_as_buffer->bf_getreadbuffer(o, 0, &ptr);
+ float * fptr = (float*)ptr;
+ size_t flen = len / sizeof(float);
+
+ g_music->addEvent(loopIdx, qid, ev_type, fptr, flen, inticks, active);
+
+ RetNone;
+ }
+ else
+ {
+ assert(!"asdf");
+ }
+ }
+ assert(!"not reached");
+ return NULL;
+}
+DECL(sc_loop_delScoreEvent) // (int loopIdx, int id)
+{
+ int loopIdx, id;
+ if (!PyArg_ParseTuple(args, "ii", &loopIdx, &id ))
+ {
+ return NULL;
+ }
+ g_music->delEvent(loopIdx, id);
+ RetNone;
+}
+DECL(sc_loop_updateEvent) // (int loopIdx, int id, int paramIdx, float paramVal, int activate_cmd))
+{
+ int loopIdx, eventId;
+ int idx;
+ float val;
+ int cmd;
+ if (!PyArg_ParseTuple(args, "iiifi", &loopIdx, &eventId, &idx, &val, &cmd)) return NULL;
+ g_music->updateEvent(loopIdx, eventId, idx, val, cmd);
+ RetNone;
+}
+DECL(sc_loop_deactivate_all) // (int id)
+{
+ int loopIdx;
+ if (!PyArg_ParseTuple(args, "i", &loopIdx)) return NULL;
+ g_music->deactivateAll(loopIdx);
+ RetNone;
+}
+DECL(sc_loop_playing) // (int loopIdx, int tf)
+{
+ int loopIdx, tf;
+ if (!PyArg_ParseTuple(args, "ii", &loopIdx, &tf )) return NULL;
+ g_music->playing(loopIdx, tf);
+ RetNone;
+}
+
+#define MDECL(s) {""#s, s, METH_VARARGS, "documentation of "#s"... nothing!"}
+static PyMethodDef SpamMethods[] = {
+ MDECL(sc_destroy),
+ MDECL(sc_initialize),
+ MDECL(sc_start),
+ MDECL(sc_stop),
+
+ MDECL(sc_setChannel),
+ MDECL(sc_inputMessage),
+ MDECL(sc_scoreEvent),
+
+ MDECL(sc_getTickf),
+ MDECL(sc_adjustTick),
+ MDECL(sc_setTickDuration),
+
+ MDECL(sc_loop_new),
+ MDECL(sc_loop_delete),
+ MDECL(sc_loop_getTickf),
+ MDECL(sc_loop_setTickf),
+ MDECL(sc_loop_setNumTicks),
+ MDECL(sc_loop_delScoreEvent),
+ MDECL(sc_loop_addScoreEvent),
+ MDECL(sc_loop_updateEvent),
+ MDECL(sc_loop_deactivate_all),
+ MDECL(sc_loop_playing),
+ {NULL, NULL, 0, NULL} /*end of list */
+};
+
+PyMODINIT_FUNC
+initaclient(void)
+{
+ (void) Py_InitModule("aclient", SpamMethods);
+}
+
+
diff --git a/common/Util/Clooper/aclient.so b/common/Util/Clooper/aclient.so
new file mode 100755
index 0000000..996e9e3
--- /dev/null
+++ b/common/Util/Clooper/aclient.so
Binary files differ
diff --git a/common/Util/Clooper/audio.cpp b/common/Util/Clooper/audio.cpp
new file mode 100644
index 0000000..343bc99
--- /dev/null
+++ b/common/Util/Clooper/audio.cpp
@@ -0,0 +1,223 @@
+#ifndef AUDIO_HXX
+#define AUDIO_HXX
+
+/*
+ * Latency test program
+ *
+ * Author: Jaroslav Kysela <perex@suse.cz>
+ *
+ * This small demo program can be used for measuring latency between
+ * capture and playback. This latency is measured from driver (diff when
+ * playback and capture was started). Scheduler is set to SCHED_RR.
+ *
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sched.h>
+#include <errno.h>
+#include <getopt.h>
+#include <sys/time.h>
+#include <math.h>
+
+#include <string>
+#include <alsa/asoundlib.h>
+
+#define ERROR_HERE ll->printf("ERROR_HERE: %s %i\n", __FILE__, __LINE__)
+
+struct SystemStuff
+{
+ log_t * ll;
+
+ snd_pcm_t *phandle;
+ snd_pcm_uframes_t period_size;
+ unsigned int rate;
+ const snd_pcm_format_t sample_format;
+ SystemStuff(log_t * ll) : ll(ll), phandle(NULL), period_size(0), rate(0), sample_format(SND_PCM_FORMAT_S16)
+ {
+ }
+ ~SystemStuff()
+ {
+ if (phandle) close(0);
+ }
+
+ void setscheduler(void)
+ {
+ struct sched_param sched_param;
+
+ if (sched_getparam(0, &sched_param) < 0) {
+ ll->printf( "Scheduler getparam failed...\n");
+ return;
+ }
+ sched_param.sched_priority = sched_get_priority_max(SCHED_RR);
+ if (!sched_setscheduler(0, SCHED_RR, &sched_param)) {
+ ll->printf( "Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority);
+ return;
+ }
+ ll->printf( "!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority);
+ }
+
+ int open(unsigned int rate0, int upsample_max, snd_pcm_uframes_t period0, unsigned int p_per_buff)
+ {
+ snd_pcm_hw_params_t *hw;
+
+ if (phandle)
+ {
+ ll->printf( "ERROR: open called twice! First close the sound device\n");
+ return -1;
+ }
+
+ if ( 0 > snd_pcm_open(&phandle, "default", SND_PCM_STREAM_PLAYBACK, 0)) { ERROR_HERE; return -1; }
+ if ( 0 > snd_pcm_hw_params_malloc(&hw)) { ERROR_HERE; snd_pcm_close(phandle); phandle = NULL; return -1; }
+
+ //now we can be a bit flexible with the buffer size and the sample-rate...
+
+ int upsample;
+ for (upsample = 1; upsample < upsample_max; ++upsample)
+ {
+ rate = rate0 * upsample;
+
+ if ( 0 > snd_pcm_hw_params_any(phandle, hw)) { ERROR_HERE; goto open_error;}
+
+ //first do the compulsory steps... interleaved float, 2 channel
+ if ( 0 > snd_pcm_hw_params_set_rate_resample(phandle, hw, 0)) { ERROR_HERE; goto open_error;}
+ if ( 0 > snd_pcm_hw_params_test_access(phandle, hw, SND_PCM_ACCESS_RW_INTERLEAVED)){ ERROR_HERE; goto open_error;}
+ if ( 0 > snd_pcm_hw_params_set_access(phandle, hw, SND_PCM_ACCESS_RW_INTERLEAVED)){ ERROR_HERE; goto open_error;}
+ if ( 0 > snd_pcm_hw_params_test_format(phandle, hw, sample_format)) { ERROR_HERE; goto open_error;}
+ if ( 0 > snd_pcm_hw_params_set_format(phandle, hw, sample_format)) { ERROR_HERE; goto open_error;}
+ if ( 0 > snd_pcm_hw_params_set_channels(phandle, hw, 2)) { ERROR_HERE; goto open_error;}
+
+ if ( snd_pcm_hw_params_test_rate(phandle, hw, rate, 0))
+ {
+ ll->printf("test_rate failed( %i\n", rate);
+ continue;
+ }
+ else
+ {
+ ll->printf(1, "success! setting rate : %i\n", rate);
+ if (0 > snd_pcm_hw_params_set_rate(phandle, hw, rate, 0)) { ERROR_HERE; goto open_error;}
+
+ snd_pcm_uframes_t minb=0, maxb= 0;
+ int mind=0, maxd=0;
+ snd_pcm_hw_params_get_period_size_min(hw, &minb,&mind);
+ snd_pcm_hw_params_get_period_size_max(hw, &maxb,&maxd);
+ ll->printf(2, "FYI: period size range is [%li/%i,%li/%i]\n", minb,mind, maxb, maxd);
+
+ assert(mind == 0); //rate_resample 0 makes this true right?
+ assert(maxd == 0); //rate_resample 0 makes this true right?
+
+ if (period0 < minb)
+ {
+ ll->printf(1, "requested period size (%li) < min (%li), adjusting to min\n", period_size, minb);
+ period_size = minb;
+ }
+ else if (period0 > maxb)
+ {
+ ll->printf(2, "requested period size (%li) < max (%li), adjusting to min\n", period_size, maxb);
+ period_size = maxb;
+ }
+ else
+ {
+ period_size = period0;
+ }
+
+ ll->printf(1, "testing period size : %li\n", period_size);
+ if ( 0 > snd_pcm_hw_params_test_period_size(phandle, hw, period_size, 0)){ ERROR_HERE; goto open_error;}
+
+
+ ll->printf(1, "setting period size : %li\n", period_size);
+ if ( 0 > snd_pcm_hw_params_set_period_size(phandle, hw, period_size, 0)){ ERROR_HERE; goto open_error;}
+
+ ll->printf(1, "setting buffer size : %i * %li = %li\n", p_per_buff, period_size, p_per_buff * period_size);
+ if ( 0 > snd_pcm_hw_params_set_buffer_size(phandle, hw, p_per_buff*period_size)) { ERROR_HERE; goto open_error;}
+
+ break;
+ }
+ }
+
+ if (upsample_max == upsample) { ERROR_HERE; goto open_error; }
+
+ if (0 > snd_pcm_hw_params(phandle, hw)) { ERROR_HERE; goto open_error; }
+
+ snd_pcm_hw_params_free (hw);
+ return 0;
+
+open_error:
+ snd_pcm_hw_params_free (hw);
+ snd_pcm_close(phandle);
+ phandle = NULL;
+ return -1;
+ }
+ void close(int drain = 0)
+ {
+ if (!phandle)
+ {
+ ll->printf(0, "WARNING: attempt to close already-closed pcm\n");
+ return;
+ }
+ ll->printf(1, "INFO: closing phandle device\n");
+ if (drain) snd_pcm_drain(phandle);
+ snd_pcm_close(phandle);
+ phandle = NULL;
+ }
+ void prepare()
+ {
+ if (!phandle)
+ {
+ ll->printf(0, "ERROR: attempt to prepare a closed pcm\n");
+ return;
+ }
+ if (0 > snd_pcm_prepare(phandle)) { ERROR_HERE; }
+ }
+ int writebuf(snd_pcm_uframes_t frame_count, short int * frame_data)
+ {
+ if (!phandle)
+ {
+ ll->printf(0, "ERROR: attempt to write a closed phandle\n");
+ return -1;
+ }
+ int err;
+ err = snd_pcm_writei (phandle, frame_data, frame_count );
+ if (err == (signed)frame_count) return 0; //success
+
+ assert(err < 0);
+
+ const char * msg = NULL;
+ snd_pcm_state_t state = snd_pcm_state(phandle);
+ switch (state)
+ {
+ case SND_PCM_STATE_OPEN: msg = "open"; break;
+ case SND_PCM_STATE_SETUP: msg = "setup"; break;
+ case SND_PCM_STATE_PREPARED:msg = "prepared"; break;
+ case SND_PCM_STATE_RUNNING: msg = "running"; break;
+ case SND_PCM_STATE_XRUN: msg = "xrun"; break;
+ case SND_PCM_STATE_DRAINING: msg = "draining"; break;
+ case SND_PCM_STATE_PAUSED: msg = "paused"; break;
+ case SND_PCM_STATE_SUSPENDED: msg = "suspended"; break;
+ case SND_PCM_STATE_DISCONNECTED: msg = "disconnected"; break;
+ }
+ ll->printf(1, "WARNING: write failed (%s)\tstate = %s\ttime=%lf\n", snd_strerror (err), msg, pytime(NULL));
+ if (0 > snd_pcm_recover(phandle, err, 0)) { ERROR_HERE; return err;}
+ if (0 > snd_pcm_prepare(phandle)) { ERROR_HERE; return err;}
+ return 1; //warning
+ }
+};
+#undef ERROR_HERE
+
+#endif
diff --git a/common/Util/Clooper/cmd_csound.cpp b/common/Util/Clooper/cmd_csound.cpp
new file mode 100644
index 0000000..ef94f84
--- /dev/null
+++ b/common/Util/Clooper/cmd_csound.cpp
@@ -0,0 +1,22 @@
+
+#include <stdio.h>
+#include <csound/csound.hpp>
+
+#include "SoundClient.h"
+
+int main( int argc, char ** argv)
+{
+ int userInput = 200;
+ int rval = sc_initialize(argv[1]);
+ sc_setMasterVolume(30.0);
+
+ while ((userInput != 0) && (rval == 0))
+ {
+ fprintf(stderr, "Enter a pitch\n");
+ scanf("%i", &userInput);
+ //sc_instrumentLoad(5083, "/home/olpc/tamtam/Resources/Sounds/sitar");
+ scanf("%i", &userInput);
+ }
+
+ return 0;
+}
diff --git a/common/Util/Clooper/log.cpp b/common/Util/Clooper/log.cpp
new file mode 100644
index 0000000..d4a8c72
--- /dev/null
+++ b/common/Util/Clooper/log.cpp
@@ -0,0 +1,52 @@
+#ifndef LOG_HXX
+#define LOG_HXX
+
+#include <stdarg.h>
+#include <stdio.h>
+
+struct log_t
+{
+ FILE * _file;
+ int _level;
+ int _close;
+
+ log_t(const char * logpath, int level = 0) : _file(NULL), _level(level), _close(1)
+ {
+ _file = fopen(logpath, "w");
+ if (!_file)
+ {
+ fprintf(stderr, "Failed to open log file for writing: %s\n", logpath);
+ }
+ }
+ log_t(FILE * file, int level = 0): _file(file), _level(level), _close(0)
+ {
+ }
+ ~log_t()
+ {
+ if (_close && _file) fclose(_file);
+ }
+ void printf( const char * fmt, ... ) __attribute__(( format (printf, 2,3)))
+ {
+ if (!_file) return;
+ va_list ap;
+ va_start(ap,fmt);
+ ::vfprintf(_file, fmt, ap);
+ va_end(ap);
+ fflush(_file);
+ }
+ void printf( int level, const char * fmt, ... ) __attribute__(( format (printf, 3,4)))
+ {
+ if (level <= _level)
+ {
+ if (!_file) return;
+ fprintf(_file, "L%i:", level);
+ va_list ap;
+ va_start(ap,fmt);
+ ::vfprintf(_file, fmt, ap);
+ va_end(ap);
+ fflush(_file);
+ }
+ }
+};
+
+#endif
diff --git a/common/Util/Clooper/ttest.c b/common/Util/Clooper/ttest.c
new file mode 100644
index 0000000..9ff3d85
--- /dev/null
+++ b/common/Util/Clooper/ttest.c
@@ -0,0 +1,53 @@
+
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+double sleeptime = 0.0;
+int usleep(int);
+static void * threadfn(void * _arg)
+{
+ double pytime(const struct timeval * tv)
+ {
+ return (double) tv->tv_sec + (double) tv->tv_usec / 1000000.0;
+ }
+ struct timeval tv0, tv1;
+ double m = 0.0;
+
+ int loops = 0;
+
+ while (1)
+ {
+ gettimeofday(&tv0, 0);
+ usleep( (int) (sleeptime * 1000000) );
+ gettimeofday(&tv1, 0);
+ double t0 = pytime(&tv0);
+ double t1 = pytime(&tv1);
+ if (t1 - t0 > 1.2 * sleeptime)
+ {
+ fprintf(stderr, "critical lagginess %lf\n", t1 - t0);
+ }
+ if (m < t1 - t0)
+ {
+ m = t1 - t0;
+ fprintf(stderr, "maximum lag %lf\n", m);
+ }
+
+ if ( ( loops % 100 ) == 0 )
+ {
+ fprintf(stderr, "loop (%lf)\n", t0);
+ }
+ ++loops;
+ }
+ return NULL;
+}
+void testtimer(double st)
+{
+ pthread_t pth;
+ sleeptime = st;
+
+ pthread_create( &pth, NULL, &threadfn, NULL );
+}
+
diff --git a/common/Util/Clooper/ttest.h b/common/Util/Clooper/ttest.h
new file mode 100644
index 0000000..111f10c
--- /dev/null
+++ b/common/Util/Clooper/ttest.h
@@ -0,0 +1,15 @@
+#ifndef _MSL_MATH_H
+#define _MSL_MATH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void testtimer(double);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/common/Util/Clooper/ttest.i b/common/Util/Clooper/ttest.i
new file mode 100644
index 0000000..0c88add
--- /dev/null
+++ b/common/Util/Clooper/ttest.i
@@ -0,0 +1,15 @@
+
+%module ttest
+
+%{
+#define SWIG_FILE_WITH_INIT
+#include "ttest.h"
+%}
+
+%pythoncode
+%{
+def somefn(seed, mat):
+
+%}
+
+%include "ttest.h"
diff --git a/common/Util/Clooper/ttest.py b/common/Util/Clooper/ttest.py
new file mode 100644
index 0000000..302c8f3
--- /dev/null
+++ b/common/Util/Clooper/ttest.py
@@ -0,0 +1,54 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.31
+#
+# Don't modify this file, modify the SWIG interface instead.
+# This file is compatible with both classic and new-style classes.
+
+import _ttest
+import new
+new_instancemethod = new.instancemethod
+try:
+ _swig_property = property
+except NameError:
+ pass # Python < 2.2 doesn't have 'property'.
+def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
+ if (name == "thisown"): return self.this.own(value)
+ if (name == "this"):
+ if type(value).__name__ == 'PySwigObject':
+ self.__dict__[name] = value
+ return
+ method = class_type.__swig_setmethods__.get(name,None)
+ if method: return method(self,value)
+ if (not static) or hasattr(self,name):
+ self.__dict__[name] = value
+ else:
+ raise AttributeError("You cannot add attributes to %s" % self)
+
+def _swig_setattr(self,class_type,name,value):
+ return _swig_setattr_nondynamic(self,class_type,name,value,0)
+
+def _swig_getattr(self,class_type,name):
+ if (name == "thisown"): return self.this.own()
+ method = class_type.__swig_getmethods__.get(name,None)
+ if method: return method(self)
+ raise AttributeError,name
+
+def _swig_repr(self):
+ try: strthis = "proxy of " + self.this.__repr__()
+ except: strthis = ""
+ return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
+import types
+try:
+ _object = types.ObjectType
+ _newclass = 1
+except AttributeError:
+ class _object : pass
+ _newclass = 0
+del types
+
+
+
+testtimer = _ttest.testtimer
+
+
diff --git a/common/Util/Clooper/ttest_wrap.c b/common/Util/Clooper/ttest_wrap.c
new file mode 100644
index 0000000..a073e99
--- /dev/null
+++ b/common/Util/Clooper/ttest_wrap.c
@@ -0,0 +1,3042 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.31
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPYTHON
+#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
+/* -----------------------------------------------------------------------------
+ * This section contains generic SWIG labels for method/variable
+ * declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC)
+# if (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+# define SWIGINLINE inline
+# else
+# define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+# elif defined(__ICC)
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+# define SWIGUNUSEDPARM(p)
+# else
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# ifndef GCC_HASCLASSVISIBILITY
+# define GCC_HASCLASSVISIBILITY
+# endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT
+# else
+# define SWIGEXPORT __declspec(dllexport)
+# endif
+# else
+# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+# define SWIGEXPORT __attribute__ ((visibility("default")))
+# else
+# define SWIGEXPORT
+# endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# define SWIGSTDCALL __stdcall
+# else
+# define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+
+/* Python.h has to appear first */
+#include <Python.h>
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+ or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "3"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+ creating a static or dynamic library from the swig runtime code.
+ In 99.9% of the cases, swig just needs to declare them as 'static'.
+
+ But only do this if is strictly necessary, ie, if you have problems
+ with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/* Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN 0x1
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN 0x1
+
+
+/*
+ Flags/methods for returning states.
+
+ The swig conversion methods, as ConvertPtr, return and integer
+ that tells if the conversion was successful or not. And if not,
+ an error code can be returned (see swigerrors.swg for the codes).
+
+ Use the following macros/flags to set or process the returning
+ states.
+
+ In old swig versions, you usually write code as:
+
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+ // success code
+ } else {
+ //fail code
+ }
+
+ Now you can be more explicit as:
+
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ } else {
+ // fail code
+ }
+
+ that seems to be the same, but now you can also do
+
+ Type *ptr;
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+ if (SWIG_IsOK(res)) {
+ // success code
+ if (SWIG_IsNewObj(res) {
+ ...
+ delete *ptr;
+ } else {
+ ...
+ }
+ } else {
+ // fail code
+ }
+
+ I.e., now SWIG_ConvertPtr can return new objects and you can
+ identify the case and take care of the deallocation. Of course that
+ requires also to SWIG_ConvertPtr to return new result values, as
+
+ int SWIG_ConvertPtr(obj, ptr,...) {
+ if (<obj is ok>) {
+ if (<need new object>) {
+ *ptr = <ptr to new allocated object>;
+ return SWIG_NEWOBJ;
+ } else {
+ *ptr = <ptr to old object>;
+ return SWIG_OLDOBJ;
+ }
+ } else {
+ return SWIG_BADOBJ;
+ }
+ }
+
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+ swig errors code.
+
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+ allows to return the 'cast rank', for example, if you have this
+
+ int food(double)
+ int fooi(int);
+
+ and you call
+
+ food(1) // cast rank '1' (1 -> 1.0)
+ fooi(1) // cast rank '0'
+
+ just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK (0)
+#define SWIG_ERROR (-1)
+#define SWIG_IsOK(r) (r >= 0)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ (SWIG_ERROR)
+#define SWIG_OLDOBJ (SWIG_OK)
+#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+# ifndef SWIG_TypeRank
+# define SWIG_TypeRank unsigned long
+# endif
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# define SWIG_MAXCASTRANK (2)
+# endif
+# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
+# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+# define SWIG_AddCast
+# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store inforomation on one type */
+typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+} swig_module_info;
+
+/*
+ Compare two type names skipping the space characters, therefore
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+ Return 0 when the two name types are equivalent, as in
+ strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+ const char *f2, const char *l2) {
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+ }
+ return (l1 - f1) - (l2 - f2);
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne) ++ne;
+ }
+ return equiv;
+}
+
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne) ++ne;
+ }
+ return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty) \
+ if (ty) { \
+ swig_cast_info *iter = ty->cast; \
+ while (iter) { \
+ if (comparison) { \
+ if (iter == ty->cast) return iter; \
+ /* Move iter to the top of the linked list */ \
+ iter->prev->next = iter->next; \
+ if (iter->next) \
+ iter->next->prev = iter->prev; \
+ iter->next = ty->cast; \
+ iter->prev = 0; \
+ if (ty->cast) ty->cast->prev = iter; \
+ ty->cast = iter; \
+ return iter; \
+ } \
+ iter = iter->next; \
+ } \
+ } \
+ return 0
+
+/*
+ Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+ SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+ Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+}
+
+/*
+ Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast) return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast)(ptr);
+ if (ty) lastty = ty;
+ }
+ return lastty;
+}
+
+/*
+ Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
+
+/*
+ Return the pretty name associated with this type,
+ that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type) return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|') last_name = s+1;
+ return last_name;
+ }
+ else
+ return type->name;
+}
+
+/*
+ Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+}
+
+/*
+ Search for a swig_type_info structure only by mangled name
+ Search is a O(log #types)
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ register size_t l = 0;
+ register size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ register size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ register int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
+}
+
+/*
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
+ It first searches the mangled names of the types, which is a O(log #types)
+ If a type is not found it then searches the human readable names, which is O(#types).
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ register size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+}
+
+/*
+ Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ register const unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
+
+/*
+ Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ register unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register char d = *(c++);
+ register unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+}
+
+/*
+ Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+ strcpy(r,name);
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2*sz + 2 + lname) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ if (lname) {
+ strncpy(r,name,lname+1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ memset(ptr,0,sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Errors in SWIG */
+#define SWIG_UnknownError -1
+#define SWIG_IOError -2
+#define SWIG_RuntimeError -3
+#define SWIG_IndexError -4
+#define SWIG_TypeError -5
+#define SWIG_DivisionByZero -6
+#define SWIG_OverflowError -7
+#define SWIG_SyntaxError -8
+#define SWIG_ValueError -9
+#define SWIG_SystemError -10
+#define SWIG_AttributeError -11
+#define SWIG_MemoryError -12
+#define SWIG_NullReferenceError -13
+
+
+
+
+/* Add PyOS_snprintf for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
+# define PyOS_snprintf _snprintf
+# else
+# define PyOS_snprintf snprintf
+# endif
+#endif
+
+/* A crude PyString_FromFormat implementation for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+
+#ifndef SWIG_PYBUFFER_SIZE
+# define SWIG_PYBUFFER_SIZE 1024
+#endif
+
+static PyObject *
+PyString_FromFormat(const char *fmt, ...) {
+ va_list ap;
+ char buf[SWIG_PYBUFFER_SIZE * 2];
+ int res;
+ va_start(ap, fmt);
+ res = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
+}
+#endif
+
+/* Add PyObject_Del for old Pythons */
+#if PY_VERSION_HEX < 0x01060000
+# define PyObject_Del(op) PyMem_DEL((op))
+#endif
+#ifndef PyObject_DEL
+# define PyObject_DEL PyObject_Del
+#endif
+
+/* A crude PyExc_StopIteration exception for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+# ifndef PyExc_StopIteration
+# define PyExc_StopIteration PyExc_RuntimeError
+# endif
+# ifndef PyObject_GenericGetAttr
+# define PyObject_GenericGetAttr 0
+# endif
+#endif
+/* Py_NotImplemented is defined in 2.1 and up. */
+#if PY_VERSION_HEX < 0x02010000
+# ifndef Py_NotImplemented
+# define Py_NotImplemented PyExc_RuntimeError
+# endif
+#endif
+
+
+/* A crude PyString_AsStringAndSize implementation for old Pythons */
+#if PY_VERSION_HEX < 0x02010000
+# ifndef PyString_AsStringAndSize
+# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
+# endif
+#endif
+
+/* PySequence_Size for old Pythons */
+#if PY_VERSION_HEX < 0x02000000
+# ifndef PySequence_Size
+# define PySequence_Size PySequence_Length
+# endif
+#endif
+
+
+/* PyBool_FromLong for old Pythons */
+#if PY_VERSION_HEX < 0x02030000
+static
+PyObject *PyBool_FromLong(long ok)
+{
+ PyObject *result = ok ? Py_True : Py_False;
+ Py_INCREF(result);
+ return result;
+}
+#endif
+
+/* Py_ssize_t for old Pythons */
+/* This code is as recommended by: */
+/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGRUNTIME PyObject*
+SWIG_Python_ErrorType(int code) {
+ PyObject* type = 0;
+ switch(code) {
+ case SWIG_MemoryError:
+ type = PyExc_MemoryError;
+ break;
+ case SWIG_IOError:
+ type = PyExc_IOError;
+ break;
+ case SWIG_RuntimeError:
+ type = PyExc_RuntimeError;
+ break;
+ case SWIG_IndexError:
+ type = PyExc_IndexError;
+ break;
+ case SWIG_TypeError:
+ type = PyExc_TypeError;
+ break;
+ case SWIG_DivisionByZero:
+ type = PyExc_ZeroDivisionError;
+ break;
+ case SWIG_OverflowError:
+ type = PyExc_OverflowError;
+ break;
+ case SWIG_SyntaxError:
+ type = PyExc_SyntaxError;
+ break;
+ case SWIG_ValueError:
+ type = PyExc_ValueError;
+ break;
+ case SWIG_SystemError:
+ type = PyExc_SystemError;
+ break;
+ case SWIG_AttributeError:
+ type = PyExc_AttributeError;
+ break;
+ default:
+ type = PyExc_RuntimeError;
+ }
+ return type;
+}
+
+
+SWIGRUNTIME void
+SWIG_Python_AddErrorMsg(const char* mesg)
+{
+ PyObject *type = 0;
+ PyObject *value = 0;
+ PyObject *traceback = 0;
+
+ if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
+ if (value) {
+ PyObject *old_str = PyObject_Str(value);
+ PyErr_Clear();
+ Py_XINCREF(type);
+ PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+ Py_DECREF(old_str);
+ Py_DECREF(value);
+ } else {
+ PyErr_Format(PyExc_RuntimeError, mesg);
+ }
+}
+
+
+
+#if defined(SWIG_PYTHON_NO_THREADS)
+# if defined(SWIG_PYTHON_THREADS)
+# undef SWIG_PYTHON_THREADS
+# endif
+#endif
+#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
+# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
+# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
+# define SWIG_PYTHON_USE_GIL
+# endif
+# endif
+# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
+# ifndef SWIG_PYTHON_INITIALIZE_THREADS
+# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
+# endif
+# ifdef __cplusplus /* C++ code */
+ class SWIG_Python_Thread_Block {
+ bool status;
+ PyGILState_STATE state;
+ public:
+ void end() { if (status) { PyGILState_Release(state); status = false;} }
+ SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
+ ~SWIG_Python_Thread_Block() { end(); }
+ };
+ class SWIG_Python_Thread_Allow {
+ bool status;
+ PyThreadState *save;
+ public:
+ void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
+ SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
+ ~SWIG_Python_Thread_Allow() { end(); }
+ };
+# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
+# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
+# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
+# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
+# else /* C code */
+# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
+# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
+# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
+# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
+# endif
+# else /* Old thread way, not implemented, user must provide it */
+# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
+# define SWIG_PYTHON_INITIALIZE_THREADS
+# endif
+# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
+# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
+# endif
+# if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
+# define SWIG_PYTHON_THREAD_END_BLOCK
+# endif
+# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
+# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
+# endif
+# if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
+# define SWIG_PYTHON_THREAD_END_ALLOW
+# endif
+# endif
+#else /* No thread support */
+# define SWIG_PYTHON_INITIALIZE_THREADS
+# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
+# define SWIG_PYTHON_THREAD_END_BLOCK
+# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
+# define SWIG_PYTHON_THREAD_END_ALLOW
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Python API portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* cc-mode */
+#endif
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Constant declarations
+ * ----------------------------------------------------------------------------- */
+
+/* Constant Types */
+#define SWIG_PY_POINTER 4
+#define SWIG_PY_BINARY 5
+
+/* Constant information structure */
+typedef struct swig_const_info {
+ int type;
+ char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+} swig_const_info;
+
+#ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
+}
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * pyrun.swg
+ *
+ * This file contains the runtime support for Python modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ *
+ * ----------------------------------------------------------------------------- */
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
+#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
+#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
+#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
+#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
+#define swig_owntype int
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
+#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
+#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
+#define SWIG_NewClientData(obj) PySwigClientData_New(obj)
+
+#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
+#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
+#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
+#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
+#define SWIG_fail goto fail
+
+
+/* Runtime API implementation */
+
+/* Error manipulation */
+
+SWIGINTERN void
+SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+ PyErr_SetObject(errtype, obj);
+ Py_DECREF(obj);
+ SWIG_PYTHON_THREAD_END_BLOCK;
+}
+
+SWIGINTERN void
+SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+ PyErr_SetString(errtype, (char *) msg);
+ SWIG_PYTHON_THREAD_END_BLOCK;
+}
+
+#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
+
+/* Set a constant value */
+
+SWIGINTERN void
+SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
+ PyDict_SetItemString(d, (char*) name, obj);
+ Py_DECREF(obj);
+}
+
+/* Append a value to the result obj */
+
+SWIGINTERN PyObject*
+SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
+#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
+ if (!result) {
+ result = obj;
+ } else if (result == Py_None) {
+ Py_DECREF(result);
+ result = obj;
+ } else {
+ if (!PyList_Check(result)) {
+ PyObject *o2 = result;
+ result = PyList_New(1);
+ PyList_SetItem(result, 0, o2);
+ }
+ PyList_Append(result,obj);
+ Py_DECREF(obj);
+ }
+ return result;
+#else
+ PyObject* o2;
+ PyObject* o3;
+ if (!result) {
+ result = obj;
+ } else if (result == Py_None) {
+ Py_DECREF(result);
+ result = obj;
+ } else {
+ if (!PyTuple_Check(result)) {
+ o2 = result;
+ result = PyTuple_New(1);
+ PyTuple_SET_ITEM(result, 0, o2);
+ }
+ o3 = PyTuple_New(1);
+ PyTuple_SET_ITEM(o3, 0, obj);
+ o2 = result;
+ result = PySequence_Concat(o2, o3);
+ Py_DECREF(o2);
+ Py_DECREF(o3);
+ }
+ return result;
+#endif
+}
+
+/* Unpack the argument tuple */
+
+SWIGINTERN int
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
+{
+ if (!args) {
+ if (!min && !max) {
+ return 1;
+ } else {
+ PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
+ name, (min == max ? "" : "at least "), min);
+ return 0;
+ }
+ }
+ if (!PyTuple_Check(args)) {
+ PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
+ return 0;
+ } else {
+ register int l = PyTuple_GET_SIZE(args);
+ if (l < min) {
+ PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
+ name, (min == max ? "" : "at least "), min, l);
+ return 0;
+ } else if (l > max) {
+ PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
+ name, (min == max ? "" : "at most "), max, l);
+ return 0;
+ } else {
+ register int i;
+ for (i = 0; i < l; ++i) {
+ objs[i] = PyTuple_GET_ITEM(args, i);
+ }
+ for (; l < max; ++l) {
+ objs[l] = 0;
+ }
+ return i + 1;
+ }
+ }
+}
+
+/* A functor is a function object with one single object argument */
+#if PY_VERSION_HEX >= 0x02020000
+#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
+#else
+#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
+#endif
+
+/*
+ Helper for static pointer initialization for both C and C++ code, for example
+ static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
+*/
+#ifdef __cplusplus
+#define SWIG_STATIC_POINTER(var) var
+#else
+#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Pointer declarations
+ * ----------------------------------------------------------------------------- */
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
+#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
+
+#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* cc-mode */
+#endif
+#endif
+
+/* How to access Py_None */
+#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# ifndef SWIG_PYTHON_NO_BUILD_NONE
+# ifndef SWIG_PYTHON_BUILD_NONE
+# define SWIG_PYTHON_BUILD_NONE
+# endif
+# endif
+#endif
+
+#ifdef SWIG_PYTHON_BUILD_NONE
+# ifdef Py_None
+# undef Py_None
+# define Py_None SWIG_Py_None()
+# endif
+SWIGRUNTIMEINLINE PyObject *
+_SWIG_Py_None(void)
+{
+ PyObject *none = Py_BuildValue((char*)"");
+ Py_DECREF(none);
+ return none;
+}
+SWIGRUNTIME PyObject *
+SWIG_Py_None(void)
+{
+ static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
+ return none;
+}
+#endif
+
+/* The python void return value */
+
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Py_Void(void)
+{
+ PyObject *none = Py_None;
+ Py_INCREF(none);
+ return none;
+}
+
+/* PySwigClientData */
+
+typedef struct {
+ PyObject *klass;
+ PyObject *newraw;
+ PyObject *newargs;
+ PyObject *destroy;
+ int delargs;
+ int implicitconv;
+} PySwigClientData;
+
+SWIGRUNTIMEINLINE int
+SWIG_Python_CheckImplicit(swig_type_info *ty)
+{
+ PySwigClientData *data = (PySwigClientData *)ty->clientdata;
+ return data ? data->implicitconv : 0;
+}
+
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Python_ExceptionType(swig_type_info *desc) {
+ PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
+ PyObject *klass = data ? data->klass : 0;
+ return (klass ? klass : PyExc_RuntimeError);
+}
+
+
+SWIGRUNTIME PySwigClientData *
+PySwigClientData_New(PyObject* obj)
+{
+ if (!obj) {
+ return 0;
+ } else {
+ PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
+ /* the klass element */
+ data->klass = obj;
+ Py_INCREF(data->klass);
+ /* the newraw method and newargs arguments used to create a new raw instance */
+ if (PyClass_Check(obj)) {
+ data->newraw = 0;
+ data->newargs = obj;
+ Py_INCREF(obj);
+ } else {
+#if (PY_VERSION_HEX < 0x02020000)
+ data->newraw = 0;
+#else
+ data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
+#endif
+ if (data->newraw) {
+ Py_INCREF(data->newraw);
+ data->newargs = PyTuple_New(1);
+ PyTuple_SetItem(data->newargs, 0, obj);
+ } else {
+ data->newargs = obj;
+ }
+ Py_INCREF(data->newargs);
+ }
+ /* the destroy method, aka as the C++ delete method */
+ data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ data->destroy = 0;
+ }
+ if (data->destroy) {
+ int flags;
+ Py_INCREF(data->destroy);
+ flags = PyCFunction_GET_FLAGS(data->destroy);
+#ifdef METH_O
+ data->delargs = !(flags & (METH_O));
+#else
+ data->delargs = 0;
+#endif
+ } else {
+ data->delargs = 0;
+ }
+ data->implicitconv = 0;
+ return data;
+ }
+}
+
+SWIGRUNTIME void
+PySwigClientData_Del(PySwigClientData* data)
+{
+ Py_XDECREF(data->newraw);
+ Py_XDECREF(data->newargs);
+ Py_XDECREF(data->destroy);
+}
+
+/* =============== PySwigObject =====================*/
+
+typedef struct {
+ PyObject_HEAD
+ void *ptr;
+ swig_type_info *ty;
+ int own;
+ PyObject *next;
+} PySwigObject;
+
+SWIGRUNTIME PyObject *
+PySwigObject_long(PySwigObject *v)
+{
+ return PyLong_FromVoidPtr(v->ptr);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_format(const char* fmt, PySwigObject *v)
+{
+ PyObject *res = NULL;
+ PyObject *args = PyTuple_New(1);
+ if (args) {
+ if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
+ PyObject *ofmt = PyString_FromString(fmt);
+ if (ofmt) {
+ res = PyString_Format(ofmt,args);
+ Py_DECREF(ofmt);
+ }
+ Py_DECREF(args);
+ }
+ }
+ return res;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_oct(PySwigObject *v)
+{
+ return PySwigObject_format("%o",v);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_hex(PySwigObject *v)
+{
+ return PySwigObject_format("%x",v);
+}
+
+SWIGRUNTIME PyObject *
+#ifdef METH_NOARGS
+PySwigObject_repr(PySwigObject *v)
+#else
+PySwigObject_repr(PySwigObject *v, PyObject *args)
+#endif
+{
+ const char *name = SWIG_TypePrettyName(v->ty);
+ PyObject *hex = PySwigObject_hex(v);
+ PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
+ Py_DECREF(hex);
+ if (v->next) {
+#ifdef METH_NOARGS
+ PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
+#else
+ PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
+#endif
+ PyString_ConcatAndDel(&repr,nrep);
+ }
+ return repr;
+}
+
+SWIGRUNTIME int
+PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+{
+#ifdef METH_NOARGS
+ PyObject *repr = PySwigObject_repr(v);
+#else
+ PyObject *repr = PySwigObject_repr(v, NULL);
+#endif
+ if (repr) {
+ fputs(PyString_AsString(repr), fp);
+ Py_DECREF(repr);
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_str(PySwigObject *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
+ PyString_FromString(result) : 0;
+}
+
+SWIGRUNTIME int
+PySwigObject_compare(PySwigObject *v, PySwigObject *w)
+{
+ void *i = v->ptr;
+ void *j = w->ptr;
+ return (i < j) ? -1 : ((i > j) ? 1 : 0);
+}
+
+SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
+
+SWIGRUNTIME PyTypeObject*
+PySwigObject_type(void) {
+ static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
+ return type;
+}
+
+SWIGRUNTIMEINLINE int
+PySwigObject_Check(PyObject *op) {
+ return ((op)->ob_type == PySwigObject_type())
+ || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_New(void *ptr, swig_type_info *ty, int own);
+
+SWIGRUNTIME void
+PySwigObject_dealloc(PyObject *v)
+{
+ PySwigObject *sobj = (PySwigObject *) v;
+ PyObject *next = sobj->next;
+ if (sobj->own) {
+ swig_type_info *ty = sobj->ty;
+ PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+ PyObject *destroy = data ? data->destroy : 0;
+ if (destroy) {
+ /* destroy is always a VARARGS method */
+ PyObject *res;
+ if (data->delargs) {
+ /* we need to create a temporal object to carry the destroy operation */
+ PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
+ res = SWIG_Python_CallFunctor(destroy, tmp);
+ Py_DECREF(tmp);
+ } else {
+ PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
+ PyObject *mself = PyCFunction_GET_SELF(destroy);
+ res = ((*meth)(mself, v));
+ }
+ Py_XDECREF(res);
+ } else {
+ const char *name = SWIG_TypePrettyName(ty);
+#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
+#endif
+ }
+ }
+ Py_XDECREF(next);
+ PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyObject*
+PySwigObject_append(PyObject* v, PyObject* next)
+{
+ PySwigObject *sobj = (PySwigObject *) v;
+#ifndef METH_O
+ PyObject *tmp = 0;
+ if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
+ next = tmp;
+#endif
+ if (!PySwigObject_Check(next)) {
+ return NULL;
+ }
+ sobj->next = next;
+ Py_INCREF(next);
+ return SWIG_Py_Void();
+}
+
+SWIGRUNTIME PyObject*
+#ifdef METH_NOARGS
+PySwigObject_next(PyObject* v)
+#else
+PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+#endif
+{
+ PySwigObject *sobj = (PySwigObject *) v;
+ if (sobj->next) {
+ Py_INCREF(sobj->next);
+ return sobj->next;
+ } else {
+ return SWIG_Py_Void();
+ }
+}
+
+SWIGINTERN PyObject*
+#ifdef METH_NOARGS
+PySwigObject_disown(PyObject *v)
+#else
+PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+#endif
+{
+ PySwigObject *sobj = (PySwigObject *)v;
+ sobj->own = 0;
+ return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject*
+#ifdef METH_NOARGS
+PySwigObject_acquire(PyObject *v)
+#else
+PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+#endif
+{
+ PySwigObject *sobj = (PySwigObject *)v;
+ sobj->own = SWIG_POINTER_OWN;
+ return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject*
+PySwigObject_own(PyObject *v, PyObject *args)
+{
+ PyObject *val = 0;
+#if (PY_VERSION_HEX < 0x02020000)
+ if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
+#else
+ if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
+#endif
+ {
+ return NULL;
+ }
+ else
+ {
+ PySwigObject *sobj = (PySwigObject *)v;
+ PyObject *obj = PyBool_FromLong(sobj->own);
+ if (val) {
+#ifdef METH_NOARGS
+ if (PyObject_IsTrue(val)) {
+ PySwigObject_acquire(v);
+ } else {
+ PySwigObject_disown(v);
+ }
+#else
+ if (PyObject_IsTrue(val)) {
+ PySwigObject_acquire(v,args);
+ } else {
+ PySwigObject_disown(v,args);
+ }
+#endif
+ }
+ return obj;
+ }
+}
+
+#ifdef METH_O
+static PyMethodDef
+swigobject_methods[] = {
+ {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
+ {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
+ {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
+ {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
+ {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
+ {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
+ {0, 0, 0, 0}
+};
+#else
+static PyMethodDef
+swigobject_methods[] = {
+ {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
+ {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
+ {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
+ {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
+ {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
+ {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
+ {0, 0, 0, 0}
+};
+#endif
+
+#if PY_VERSION_HEX < 0x02020000
+SWIGINTERN PyObject *
+PySwigObject_getattr(PySwigObject *sobj,char *name)
+{
+ return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
+}
+#endif
+
+SWIGRUNTIME PyTypeObject*
+_PySwigObject_type(void) {
+ static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
+
+ static PyNumberMethods PySwigObject_as_number = {
+ (binaryfunc)0, /*nb_add*/
+ (binaryfunc)0, /*nb_subtract*/
+ (binaryfunc)0, /*nb_multiply*/
+ (binaryfunc)0, /*nb_divide*/
+ (binaryfunc)0, /*nb_remainder*/
+ (binaryfunc)0, /*nb_divmod*/
+ (ternaryfunc)0,/*nb_power*/
+ (unaryfunc)0, /*nb_negative*/
+ (unaryfunc)0, /*nb_positive*/
+ (unaryfunc)0, /*nb_absolute*/
+ (inquiry)0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ (coercion)0, /*nb_coerce*/
+ (unaryfunc)PySwigObject_long, /*nb_int*/
+ (unaryfunc)PySwigObject_long, /*nb_long*/
+ (unaryfunc)0, /*nb_float*/
+ (unaryfunc)PySwigObject_oct, /*nb_oct*/
+ (unaryfunc)PySwigObject_hex, /*nb_hex*/
+#if PY_VERSION_HEX >= 0x02020000
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000
+ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
+#endif
+ };
+
+ static PyTypeObject pyswigobject_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp
+ = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ (char *)"PySwigObject", /* tp_name */
+ sizeof(PySwigObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor)PySwigObject_dealloc, /* tp_dealloc */
+ (printfunc)PySwigObject_print, /* tp_print */
+#if PY_VERSION_HEX < 0x02020000
+ (getattrfunc)PySwigObject_getattr, /* tp_getattr */
+#else
+ (getattrfunc)0, /* tp_getattr */
+#endif
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)PySwigObject_compare, /* tp_compare */
+ (reprfunc)PySwigObject_repr, /* tp_repr */
+ &PySwigObject_as_number, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)PySwigObject_str, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ swigobject_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+#if PY_VERSION_HEX >= 0x02020000
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ swigobject_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+ 0, /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+ 0,0,0,0 /* tp_alloc -> tp_next */
+#endif
+ };
+ pyswigobject_type = tmp;
+ pyswigobject_type.ob_type = &PyType_Type;
+ type_init = 1;
+ }
+ return &pyswigobject_type;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_New(void *ptr, swig_type_info *ty, int own)
+{
+ PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
+ if (sobj) {
+ sobj->ptr = ptr;
+ sobj->ty = ty;
+ sobj->own = own;
+ sobj->next = 0;
+ }
+ return (PyObject *)sobj;
+}
+
+/* -----------------------------------------------------------------------------
+ * Implements a simple Swig Packed type, and use it instead of string
+ * ----------------------------------------------------------------------------- */
+
+typedef struct {
+ PyObject_HEAD
+ void *pack;
+ swig_type_info *ty;
+ size_t size;
+} PySwigPacked;
+
+SWIGRUNTIME int
+PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+{
+ char result[SWIG_BUFFER_SIZE];
+ fputs("<Swig Packed ", fp);
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ fputs("at ", fp);
+ fputs(result, fp);
+ }
+ fputs(v->ty->name,fp);
+ fputs(">", fp);
+ return 0;
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_repr(PySwigPacked *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
+ } else {
+ return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
+ }
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_str(PySwigPacked *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
+ return PyString_FromFormat("%s%s", result, v->ty->name);
+ } else {
+ return PyString_FromString(v->ty->name);
+ }
+}
+
+SWIGRUNTIME int
+PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
+{
+ size_t i = v->size;
+ size_t j = w->size;
+ int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
+ return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
+}
+
+SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
+
+SWIGRUNTIME PyTypeObject*
+PySwigPacked_type(void) {
+ static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
+ return type;
+}
+
+SWIGRUNTIMEINLINE int
+PySwigPacked_Check(PyObject *op) {
+ return ((op)->ob_type == _PySwigPacked_type())
+ || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
+}
+
+SWIGRUNTIME void
+PySwigPacked_dealloc(PyObject *v)
+{
+ if (PySwigPacked_Check(v)) {
+ PySwigPacked *sobj = (PySwigPacked *) v;
+ free(sobj->pack);
+ }
+ PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyTypeObject*
+_PySwigPacked_type(void) {
+ static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
+ static PyTypeObject pyswigpacked_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp
+ = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ (char *)"PySwigPacked", /* tp_name */
+ sizeof(PySwigPacked), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor)PySwigPacked_dealloc, /* tp_dealloc */
+ (printfunc)PySwigPacked_print, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)PySwigPacked_compare, /* tp_compare */
+ (reprfunc)PySwigPacked_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)PySwigPacked_str, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ swigpacked_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+#if PY_VERSION_HEX >= 0x02020000
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+ 0, /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+ 0,0,0,0 /* tp_alloc -> tp_next */
+#endif
+ };
+ pyswigpacked_type = tmp;
+ pyswigpacked_type.ob_type = &PyType_Type;
+ type_init = 1;
+ }
+ return &pyswigpacked_type;
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
+{
+ PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
+ if (sobj) {
+ void *pack = malloc(size);
+ if (pack) {
+ memcpy(pack, ptr, size);
+ sobj->pack = pack;
+ sobj->ty = ty;
+ sobj->size = size;
+ } else {
+ PyObject_DEL((PyObject *) sobj);
+ sobj = 0;
+ }
+ }
+ return (PyObject *) sobj;
+}
+
+SWIGRUNTIME swig_type_info *
+PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
+{
+ if (PySwigPacked_Check(obj)) {
+ PySwigPacked *sobj = (PySwigPacked *)obj;
+ if (sobj->size != size) return 0;
+ memcpy(ptr, sobj->pack, size);
+ return sobj->ty;
+ } else {
+ return 0;
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGRUNTIMEINLINE PyObject *
+_SWIG_This(void)
+{
+ return PyString_FromString("this");
+}
+
+SWIGRUNTIME PyObject *
+SWIG_This(void)
+{
+ static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
+ return swig_this;
+}
+
+/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
+
+SWIGRUNTIME PySwigObject *
+SWIG_Python_GetSwigThis(PyObject *pyobj)
+{
+ if (PySwigObject_Check(pyobj)) {
+ return (PySwigObject *) pyobj;
+ } else {
+ PyObject *obj = 0;
+#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
+ if (PyInstance_Check(pyobj)) {
+ obj = _PyInstance_Lookup(pyobj, SWIG_This());
+ } else {
+ PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
+ if (dictptr != NULL) {
+ PyObject *dict = *dictptr;
+ obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+ } else {
+#ifdef PyWeakref_CheckProxy
+ if (PyWeakref_CheckProxy(pyobj)) {
+ PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
+ return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
+ }
+#endif
+ obj = PyObject_GetAttr(pyobj,SWIG_This());
+ if (obj) {
+ Py_DECREF(obj);
+ } else {
+ if (PyErr_Occurred()) PyErr_Clear();
+ return 0;
+ }
+ }
+ }
+#else
+ obj = PyObject_GetAttr(pyobj,SWIG_This());
+ if (obj) {
+ Py_DECREF(obj);
+ } else {
+ if (PyErr_Occurred()) PyErr_Clear();
+ return 0;
+ }
+#endif
+ if (obj && !PySwigObject_Check(obj)) {
+ /* a PyObject is called 'this', try to get the 'real this'
+ PySwigObject from it */
+ return SWIG_Python_GetSwigThis(obj);
+ }
+ return (PySwigObject *)obj;
+ }
+}
+
+/* Acquire a pointer value */
+
+SWIGRUNTIME int
+SWIG_Python_AcquirePtr(PyObject *obj, int own) {
+ if (own) {
+ PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (sobj) {
+ int oldown = sobj->own;
+ sobj->own = own;
+ return oldown;
+ }
+ }
+ return 0;
+}
+
+/* Convert a pointer value */
+
+SWIGRUNTIME int
+SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
+ if (!obj) return SWIG_ERROR;
+ if (obj == Py_None) {
+ if (ptr) *ptr = 0;
+ return SWIG_OK;
+ } else {
+ PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ while (sobj) {
+ void *vptr = sobj->ptr;
+ if (ty) {
+ swig_type_info *to = sobj->ty;
+ if (to == ty) {
+ /* no type cast needed */
+ if (ptr) *ptr = vptr;
+ break;
+ } else {
+ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+ if (!tc) {
+ sobj = (PySwigObject *)sobj->next;
+ } else {
+ if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ break;
+ }
+ }
+ } else {
+ if (ptr) *ptr = vptr;
+ break;
+ }
+ }
+ if (sobj) {
+ if (own) *own = sobj->own;
+ if (flags & SWIG_POINTER_DISOWN) {
+ sobj->own = 0;
+ }
+ return SWIG_OK;
+ } else {
+ int res = SWIG_ERROR;
+ if (flags & SWIG_POINTER_IMPLICIT_CONV) {
+ PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+ if (data && !data->implicitconv) {
+ PyObject *klass = data->klass;
+ if (klass) {
+ PyObject *impconv;
+ data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
+ impconv = SWIG_Python_CallFunctor(klass, obj);
+ data->implicitconv = 0;
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ impconv = 0;
+ }
+ if (impconv) {
+ PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
+ if (iobj) {
+ void *vptr;
+ res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
+ if (SWIG_IsOK(res)) {
+ if (ptr) {
+ *ptr = vptr;
+ /* transfer the ownership to 'ptr' */
+ iobj->own = 0;
+ res = SWIG_AddCast(res);
+ res = SWIG_AddNewMask(res);
+ } else {
+ res = SWIG_AddCast(res);
+ }
+ }
+ }
+ Py_DECREF(impconv);
+ }
+ }
+ }
+ }
+ return res;
+ }
+ }
+}
+
+/* Convert a function ptr value */
+
+SWIGRUNTIME int
+SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
+ if (!PyCFunction_Check(obj)) {
+ return SWIG_ConvertPtr(obj, ptr, ty, 0);
+ } else {
+ void *vptr = 0;
+
+ /* here we get the method pointer for callbacks */
+ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+ const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
+ if (desc) {
+ desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
+ if (!desc) return SWIG_ERROR;
+ }
+ if (ty) {
+ swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
+ if (!tc) return SWIG_ERROR;
+ *ptr = SWIG_TypeCast(tc,vptr);
+ } else {
+ *ptr = vptr;
+ }
+ return SWIG_OK;
+ }
+}
+
+/* Convert a packed value value */
+
+SWIGRUNTIME int
+SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
+ swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
+ if (!to) return SWIG_ERROR;
+ if (ty) {
+ if (to != ty) {
+ /* check type cast? */
+ swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+ if (!tc) return SWIG_ERROR;
+ }
+ }
+ return SWIG_OK;
+}
+
+/* -----------------------------------------------------------------------------
+ * Create a new pointer object
+ * ----------------------------------------------------------------------------- */
+
+/*
+ Create a new instance object, whitout calling __init__, and set the
+ 'this' attribute.
+*/
+
+SWIGRUNTIME PyObject*
+SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
+{
+#if (PY_VERSION_HEX >= 0x02020000)
+ PyObject *inst = 0;
+ PyObject *newraw = data->newraw;
+ if (newraw) {
+ inst = PyObject_Call(newraw, data->newargs, NULL);
+ if (inst) {
+#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+ PyObject *dict = *dictptr;
+ if (dict == NULL) {
+ dict = PyDict_New();
+ *dictptr = dict;
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ }
+ }
+#else
+ PyObject *key = SWIG_This();
+ PyObject_SetAttr(inst, key, swig_this);
+#endif
+ }
+ } else {
+ PyObject *dict = PyDict_New();
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ inst = PyInstance_NewRaw(data->newargs, dict);
+ Py_DECREF(dict);
+ }
+ return inst;
+#else
+#if (PY_VERSION_HEX >= 0x02010000)
+ PyObject *inst;
+ PyObject *dict = PyDict_New();
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ inst = PyInstance_NewRaw(data->newargs, dict);
+ Py_DECREF(dict);
+ return (PyObject *) inst;
+#else
+ PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
+ if (inst == NULL) {
+ return NULL;
+ }
+ inst->in_class = (PyClassObject *)data->newargs;
+ Py_INCREF(inst->in_class);
+ inst->in_dict = PyDict_New();
+ if (inst->in_dict == NULL) {
+ Py_DECREF(inst);
+ return NULL;
+ }
+#ifdef Py_TPFLAGS_HAVE_WEAKREFS
+ inst->in_weakreflist = NULL;
+#endif
+#ifdef Py_TPFLAGS_GC
+ PyObject_GC_Init(inst);
+#endif
+ PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
+ return (PyObject *) inst;
+#endif
+#endif
+}
+
+SWIGRUNTIME void
+SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
+{
+ PyObject *dict;
+#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+ dict = *dictptr;
+ if (dict == NULL) {
+ dict = PyDict_New();
+ *dictptr = dict;
+ }
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ return;
+ }
+#endif
+ dict = PyObject_GetAttrString(inst, (char*)"__dict__");
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ Py_DECREF(dict);
+}
+
+
+SWIGINTERN PyObject *
+SWIG_Python_InitShadowInstance(PyObject *args) {
+ PyObject *obj[2];
+ if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
+ return NULL;
+ } else {
+ PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
+ if (sthis) {
+ PySwigObject_append((PyObject*) sthis, obj[1]);
+ } else {
+ SWIG_Python_SetSwigThis(obj[0], obj[1]);
+ }
+ return SWIG_Py_Void();
+ }
+}
+
+/* Create a new pointer object */
+
+SWIGRUNTIME PyObject *
+SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
+ if (!ptr) {
+ return SWIG_Py_Void();
+ } else {
+ int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+ PyObject *robj = PySwigObject_New(ptr, type, own);
+ PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
+ if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+ PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
+ if (inst) {
+ Py_DECREF(robj);
+ robj = inst;
+ }
+ }
+ return robj;
+ }
+}
+
+/* Create a new packed object */
+
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
+ return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
+}
+
+/* -----------------------------------------------------------------------------*
+ * Get type list
+ * -----------------------------------------------------------------------------*/
+
+#ifdef SWIG_LINK_RUNTIME
+void *SWIG_ReturnGlobalTypeList(void *);
+#endif
+
+SWIGRUNTIME swig_module_info *
+SWIG_Python_GetModule(void) {
+ static void *type_pointer = (void *)0;
+ /* first check if module already created */
+ if (!type_pointer) {
+#ifdef SWIG_LINK_RUNTIME
+ type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+#else
+ type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+ (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ type_pointer = (void *)0;
+ }
+#endif
+ }
+ return (swig_module_info *) type_pointer;
+}
+
+#if PY_MAJOR_VERSION < 2
+/* PyModule_AddObject function was introduced in Python 2.0. The following function
+ is copied out of Python/modsupport.c in python version 2.3.4 */
+SWIGINTERN int
+PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+{
+ PyObject *dict;
+ if (!PyModule_Check(m)) {
+ PyErr_SetString(PyExc_TypeError,
+ "PyModule_AddObject() needs module as first arg");
+ return SWIG_ERROR;
+ }
+ if (!o) {
+ PyErr_SetString(PyExc_TypeError,
+ "PyModule_AddObject() needs non-NULL value");
+ return SWIG_ERROR;
+ }
+
+ dict = PyModule_GetDict(m);
+ if (dict == NULL) {
+ /* Internal error -- modules must have a dict! */
+ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
+ PyModule_GetName(m));
+ return SWIG_ERROR;
+ }
+ if (PyDict_SetItemString(dict, name, o))
+ return SWIG_ERROR;
+ Py_DECREF(o);
+ return SWIG_OK;
+}
+#endif
+
+SWIGRUNTIME void
+SWIG_Python_DestroyModule(void *vptr)
+{
+ swig_module_info *swig_module = (swig_module_info *) vptr;
+ swig_type_info **types = swig_module->types;
+ size_t i;
+ for (i =0; i < swig_module->size; ++i) {
+ swig_type_info *ty = types[i];
+ if (ty->owndata) {
+ PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+ if (data) PySwigClientData_Del(data);
+ }
+ }
+ Py_DECREF(SWIG_This());
+}
+
+SWIGRUNTIME void
+SWIG_Python_SetModule(swig_module_info *swig_module) {
+ static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
+
+ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+ swig_empty_runtime_method_table);
+ PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
+ if (pointer && module) {
+ PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+ } else {
+ Py_XDECREF(pointer);
+ }
+}
+
+/* The python cached type query */
+SWIGRUNTIME PyObject *
+SWIG_Python_TypeCache(void) {
+ static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
+ return cache;
+}
+
+SWIGRUNTIME swig_type_info *
+SWIG_Python_TypeQuery(const char *type)
+{
+ PyObject *cache = SWIG_Python_TypeCache();
+ PyObject *key = PyString_FromString(type);
+ PyObject *obj = PyDict_GetItem(cache, key);
+ swig_type_info *descriptor;
+ if (obj) {
+ descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
+ } else {
+ swig_module_info *swig_module = SWIG_Python_GetModule();
+ descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
+ if (descriptor) {
+ obj = PyCObject_FromVoidPtr(descriptor, NULL);
+ PyDict_SetItem(cache, key, obj);
+ Py_DECREF(obj);
+ }
+ }
+ Py_DECREF(key);
+ return descriptor;
+}
+
+/*
+ For backward compatibility only
+*/
+#define SWIG_POINTER_EXCEPTION 0
+#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
+#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
+
+SWIGRUNTIME int
+SWIG_Python_AddErrMesg(const char* mesg, int infront)
+{
+ if (PyErr_Occurred()) {
+ PyObject *type = 0;
+ PyObject *value = 0;
+ PyObject *traceback = 0;
+ PyErr_Fetch(&type, &value, &traceback);
+ if (value) {
+ PyObject *old_str = PyObject_Str(value);
+ Py_XINCREF(type);
+ PyErr_Clear();
+ if (infront) {
+ PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
+ } else {
+ PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+ }
+ Py_DECREF(old_str);
+ }
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+SWIGRUNTIME int
+SWIG_Python_ArgFail(int argnum)
+{
+ if (PyErr_Occurred()) {
+ /* add information about failing argument */
+ char mesg[256];
+ PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
+ return SWIG_Python_AddErrMesg(mesg, 1);
+ } else {
+ return 0;
+ }
+}
+
+SWIGRUNTIMEINLINE const char *
+PySwigObject_GetDesc(PyObject *self)
+{
+ PySwigObject *v = (PySwigObject *)self;
+ swig_type_info *ty = v ? v->ty : 0;
+ return ty ? ty->str : (char*)"";
+}
+
+SWIGRUNTIME void
+SWIG_Python_TypeError(const char *type, PyObject *obj)
+{
+ if (type) {
+#if defined(SWIG_COBJECT_TYPES)
+ if (obj && PySwigObject_Check(obj)) {
+ const char *otype = (const char *) PySwigObject_GetDesc(obj);
+ if (otype) {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
+ type, otype);
+ return;
+ }
+ } else
+#endif
+ {
+ const char *otype = (obj ? obj->ob_type->tp_name : 0);
+ if (otype) {
+ PyObject *str = PyObject_Str(obj);
+ const char *cstr = str ? PyString_AsString(str) : 0;
+ if (cstr) {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
+ type, otype, cstr);
+ } else {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
+ type, otype);
+ }
+ Py_XDECREF(str);
+ return;
+ }
+ }
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
+ } else {
+ PyErr_Format(PyExc_TypeError, "unexpected type is received");
+ }
+}
+
+
+/* Convert a pointer value, signal an exception on a type mismatch */
+SWIGRUNTIME void *
+SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
+ void *result;
+ if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
+ PyErr_Clear();
+ if (flags & SWIG_POINTER_EXCEPTION) {
+ SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
+ SWIG_Python_ArgFail(argnum);
+ }
+ }
+ return result;
+}
+
+
+#ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
+}
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_char swig_types[0]
+#define SWIGTYPE_p_gsl_complex swig_types[1]
+static swig_type_info *swig_types[3];
+static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#if (PY_VERSION_HEX <= 0x02000000)
+# if !defined(SWIG_PYTHON_CLASSIC)
+# error "This python version requires swig to be run with the '-classic' option"
+# endif
+#endif
+
+/*-----------------------------------------------
+ @(target):= _ttest.so
+ ------------------------------------------------*/
+#define SWIG_init init_ttest
+
+#define SWIG_name "_ttest"
+
+#define SWIGVERSION 0x010331
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
+
+
+#define SWIG_FILE_WITH_INIT
+#include "ttest.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+SWIGINTERN PyObject *_wrap_testtimer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+
+ if (!PyArg_ParseTuple(args,(char *)":testtimer")) SWIG_fail;
+ testtimer();
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+static PyMethodDef SwigMethods[] = {
+ { (char *)"testtimer", _wrap_testtimer, METH_VARARGS, NULL},
+ { NULL, NULL, 0, NULL }
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gsl_complex = {"_p_gsl_complex", "gsl_complex *|msl_complex_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_char,
+ &_swigt__p_gsl_complex,
+};
+
+static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gsl_complex[] = { {&_swigt__p_gsl_complex, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_char,
+ _swigc__p_gsl_complex,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_const_info swig_const_table[] = {
+{0, 0, 0, 0.0, 0, 0}};
+
+#ifdef __cplusplus
+}
+#endif
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ * 1) If the cast->type has already been loaded AND the type we are adding
+ * casting info to has not been loaded (it is in this module), THEN we
+ * replace the cast->type pointer with the type pointer that has already
+ * been loaded.
+ * 2) If BOTH types (the one we are adding casting info to, and the
+ * cast->type) are loaded, THEN the cast info has already been loaded by
+ * the previous module so we just ignore it.
+ * 3) Finally, if cast->type has not already been loaded, then we add that
+ * swig_cast_info to the linked list (because the cast->type) pointer will
+ * be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int found;
+
+ clientdata = clientdata;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ }
+
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found=0;
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ found=1;
+ break;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found) return;
+ /* otherwise we must add out module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
+
+ /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+ /* Don't need to add information already in the list */
+ ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+ if (!ocast) ret = 0;
+ }
+ }
+
+ if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+
+#ifdef SWIGRUNTIME_DEBUG
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n",j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types. It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run) return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+ /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Python-specific SWIG API */
+#define SWIG_newvarlink() SWIG_Python_newvarlink()
+#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
+#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
+
+ /* -----------------------------------------------------------------------------
+ * global variable support code.
+ * ----------------------------------------------------------------------------- */
+
+ typedef struct swig_globalvar {
+ char *name; /* Name of global variable */
+ PyObject *(*get_attr)(void); /* Return the current value */
+ int (*set_attr)(PyObject *); /* Set the value */
+ struct swig_globalvar *next;
+ } swig_globalvar;
+
+ typedef struct swig_varlinkobject {
+ PyObject_HEAD
+ swig_globalvar *vars;
+ } swig_varlinkobject;
+
+ SWIGINTERN PyObject *
+ swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
+ return PyString_FromString("<Swig global variables>");
+ }
+
+ SWIGINTERN PyObject *
+ swig_varlink_str(swig_varlinkobject *v) {
+ PyObject *str = PyString_FromString("(");
+ swig_globalvar *var;
+ for (var = v->vars; var; var=var->next) {
+ PyString_ConcatAndDel(&str,PyString_FromString(var->name));
+ if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
+ }
+ PyString_ConcatAndDel(&str,PyString_FromString(")"));
+ return str;
+ }
+
+ SWIGINTERN int
+ swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
+ PyObject *str = swig_varlink_str(v);
+ fprintf(fp,"Swig global variables ");
+ fprintf(fp,"%s\n", PyString_AsString(str));
+ Py_DECREF(str);
+ return 0;
+ }
+
+ SWIGINTERN void
+ swig_varlink_dealloc(swig_varlinkobject *v) {
+ swig_globalvar *var = v->vars;
+ while (var) {
+ swig_globalvar *n = var->next;
+ free(var->name);
+ free(var);
+ var = n;
+ }
+ }
+
+ SWIGINTERN PyObject *
+ swig_varlink_getattr(swig_varlinkobject *v, char *n) {
+ PyObject *res = NULL;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ res = (*var->get_attr)();
+ break;
+ }
+ var = var->next;
+ }
+ if (res == NULL && !PyErr_Occurred()) {
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ }
+ return res;
+ }
+
+ SWIGINTERN int
+ swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
+ int res = 1;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ res = (*var->set_attr)(p);
+ break;
+ }
+ var = var->next;
+ }
+ if (res == 1 && !PyErr_Occurred()) {
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ }
+ return res;
+ }
+
+ SWIGINTERN PyTypeObject*
+ swig_varlink_type(void) {
+ static char varlink__doc__[] = "Swig var link object";
+ static PyTypeObject varlink_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp
+ = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* Number of items in variable part (ob_size) */
+ (char *)"swigvarlink", /* Type name (tp_name) */
+ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
+ 0, /* Itemsize (tp_itemsize) */
+ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
+ (printfunc) swig_varlink_print, /* Print (tp_print) */
+ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
+ 0, /* tp_compare */
+ (reprfunc) swig_varlink_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ (reprfunc)swig_varlink_str, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ 0, /* tp_flags */
+ varlink__doc__, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+#if PY_VERSION_HEX >= 0x02020000
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+ 0, /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+ 0,0,0,0 /* tp_alloc -> tp_next */
+#endif
+ };
+ varlink_type = tmp;
+ varlink_type.ob_type = &PyType_Type;
+ type_init = 1;
+ }
+ return &varlink_type;
+ }
+
+ /* Create a variable linking object for use later */
+ SWIGINTERN PyObject *
+ SWIG_Python_newvarlink(void) {
+ swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
+ if (result) {
+ result->vars = 0;
+ }
+ return ((PyObject*) result);
+ }
+
+ SWIGINTERN void
+ SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
+ swig_varlinkobject *v = (swig_varlinkobject *) p;
+ swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+ if (gv) {
+ size_t size = strlen(name)+1;
+ gv->name = (char *)malloc(size);
+ if (gv->name) {
+ strncpy(gv->name,name,size);
+ gv->get_attr = get_attr;
+ gv->set_attr = set_attr;
+ gv->next = v->vars;
+ }
+ }
+ v->vars = gv;
+ }
+
+ SWIGINTERN PyObject *
+ SWIG_globals(void) {
+ static PyObject *_SWIG_globals = 0;
+ if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
+ return _SWIG_globals;
+ }
+
+ /* -----------------------------------------------------------------------------
+ * constants/methods manipulation
+ * ----------------------------------------------------------------------------- */
+
+ /* Install Constants */
+ SWIGINTERN void
+ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
+ PyObject *obj = 0;
+ size_t i;
+ for (i = 0; constants[i].type; ++i) {
+ switch(constants[i].type) {
+ case SWIG_PY_POINTER:
+ obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+ break;
+ case SWIG_PY_BINARY:
+ obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+ break;
+ default:
+ obj = 0;
+ break;
+ }
+ if (obj) {
+ PyDict_SetItemString(d, constants[i].name, obj);
+ Py_DECREF(obj);
+ }
+ }
+ }
+
+ /* -----------------------------------------------------------------------------*/
+ /* Fix SwigMethods to carry the callback ptrs when needed */
+ /* -----------------------------------------------------------------------------*/
+
+ SWIGINTERN void
+ SWIG_Python_FixMethods(PyMethodDef *methods,
+ swig_const_info *const_table,
+ swig_type_info **types,
+ swig_type_info **types_initial) {
+ size_t i;
+ for (i = 0; methods[i].ml_name; ++i) {
+ const char *c = methods[i].ml_doc;
+ if (c && (c = strstr(c, "swig_ptr: "))) {
+ int j;
+ swig_const_info *ci = 0;
+ const char *name = c + 10;
+ for (j = 0; const_table[j].type; ++j) {
+ if (strncmp(const_table[j].name, name,
+ strlen(const_table[j].name)) == 0) {
+ ci = &(const_table[j]);
+ break;
+ }
+ }
+ if (ci) {
+ size_t shift = (ci->ptype) - types;
+ swig_type_info *ty = types_initial[shift];
+ size_t ldoc = (c - methods[i].ml_doc);
+ size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
+ char *ndoc = (char*)malloc(ldoc + lptr + 10);
+ if (ndoc) {
+ char *buff = ndoc;
+ void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+ if (ptr) {
+ strncpy(buff, methods[i].ml_doc, ldoc);
+ buff += ldoc;
+ strncpy(buff, "swig_ptr: ", 10);
+ buff += 10;
+ SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
+ methods[i].ml_doc = ndoc;
+ }
+ }
+ }
+ }
+ }
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------*
+ * Partial Init method
+ * -----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C"
+#endif
+SWIGEXPORT void SWIG_init(void) {
+ PyObject *m, *d;
+
+ /* Fix SwigMethods to carry the callback ptrs when needed */
+ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+
+ m = Py_InitModule((char *) SWIG_name, SwigMethods);
+ d = PyModule_GetDict(m);
+
+ SWIG_InitializeModule(0);
+ SWIG_InstallConstants(d,swig_const_table);
+
+
+}
+
diff --git a/common/Util/ControlStream.py b/common/Util/ControlStream.py
new file mode 100644
index 0000000..ac7035f
--- /dev/null
+++ b/common/Util/ControlStream.py
@@ -0,0 +1,225 @@
+import sys
+import types
+import time
+
+import common.Config as Config
+
+import os
+
+from common.Util import NoteDB
+from common.Util.CSoundNote import CSoundNote
+from common.Util.CSoundClient import new_csound_client
+
+from Jam import Block
+
+class TamTamOStream:
+ def __init__(self, file):
+ self.file = file
+
+ def note_add(self, note):
+ l = ['note_add', note.id, note.page, note.track,
+ note.cs.onset,
+ note.cs.pitch,
+ note.cs.amplitude,
+ note.cs.pan,
+ note.cs.duration,
+ note.cs.trackId,
+ note.cs.instrumentId,
+ note.cs.attack,
+ note.cs.decay,
+ note.cs.reverbSend,
+ note.cs.filterType,
+ note.cs.filterCutoff,
+ int(note.cs.tied),
+ note.cs.mode]
+
+ self.file.write( " ".join([str(i) for i in l]))
+ self.file.write('\n')
+
+ def page_add(self, pid, page):
+ l = [ 'page_add', str(pid), str(page.beats), str(page.color), str(page.instruments) ]
+ self.file.write( " ".join([str(i) for i in l]))
+ self.file.write('\n')
+
+ def track_vol(self, vols):
+ self.file.write('track_vol ')
+ self.file.write(" ".join([str(t) for t in vols]))
+ self.file.write('\n')
+
+ def master_vol(self, volume):
+ self.file.write('master_vol ')
+ self.file.write(str(volume))
+ self.file.write('\n')
+
+ def tempo(self, tempo):
+ self.file.write('tempo ')
+ self.file.write(str(tempo))
+ self.file.write('\n')
+
+ def block_add( self, typeStr, active, centerX, centerY, child, data ):
+ l = [ "block_add", typeStr, str(active), str(centerX), str(centerY), str(child), str(data) ]
+ self.file.write( " ".join([str(i) for i in l]))
+ self.file.write('\n')
+
+ def desktop_store( self, filename, id ):
+ self.file.write( "desktop_store %d\n" % id )
+ try:
+ file = open( filename, "r" )
+ for line in file:
+ self.file.write( line )
+ file.close()
+ except:
+ if Config.DEBUG > 3: print "ERROR:: desktop_store could not open file: " + filename
+ self.file.write( "desktop_store END\n" )
+
+ def desktop_set( self, id ):
+ self.file.write( "desktop_set %d\n" % id )
+
+class TamTamTable:
+
+ def __init__(self, noteDB = None, jam = None ):
+ self.noteDB = noteDB
+ self.jam = jam
+ self.csnd = new_csound_client()
+ self.pid = {} #stream_pid : local_pid
+
+ def parseTable(self):
+ return {
+ 'note_set':self.note_set,
+ 'note_add':self.note_add,
+ 'page_add':self.page_add,
+ 'page_set':self.page_set,
+ 'track_vol':self.track_vol,
+ 'master_vol':self.master_vol,
+ 'tempo':self.tempo,
+ 'block_add':self.block_add,
+ 'desktop_store':self.desktop_store,
+ 'desktop_set':self.desktop_set,
+ 'sleep':self.sleep,
+ 'quit':self.quit}
+
+ def parseFile(self, ifile):
+ table = self.parseTable()
+ self.file = ifile
+ for l in self.file:
+ #print "---", l
+ cmdlist = l.split()
+ if len(cmdlist) > 0:
+ if cmdlist[0] not in table:
+ print 'ERROR: skipping command %s not found in parse table' % cmdlist[0]
+ else:
+ table[cmdlist[0]](cmdlist[1:])
+
+ def note_add(self, argv):
+ if Config.DEBUG > 3: print 'note_add', argv
+
+ nid = int(argv[0])
+ page = self.pid[int(argv[1])]
+ track = int(argv[2])
+ cs = CSoundNote(
+ int(argv[3]),
+ int(argv[4]),
+ float(argv[5]),
+ float(argv[6]),
+ float(argv[7]),
+ int(argv[8]),
+ int(argv[9]),
+ float(argv[10]),
+ float(argv[11]),
+ float(argv[12]),
+ float(argv[13]),
+ float(argv[14]),
+ bool(argv[15]),
+ argv[16])
+
+ self.noteDB.addNote( -1, page, track, cs )
+
+ def note_set(self, argv):
+ print 'note_set', argv
+
+ def page_add(self, argv):
+ if Config.DEBUG > 3: print 'page_add', argv
+ pid = int (argv[0])
+ beats = int (argv[1])
+ color = int( argv[2] )
+ insts = ""
+ for str in argv[3:]:
+ insts += str
+ print pid, insts
+ instruments = eval( insts )
+ if len( self.noteDB.tune ):
+ after = self.noteDB.tune[-1]
+ else:
+ after = False
+ self.pid[pid] = self.noteDB.addPage(-1, NoteDB.Page(beats,color,instruments), after)
+
+ def page_set(self, argv):
+ print 'page_set', argv
+
+ def track_vol(self, argv):
+ self.tracks_volume = []
+ for i in range(len(argv)):
+ self.tracks_volume.append(float(argv[i]))
+
+ def master_vol(self, argv):
+ self.masterVolume = eval( argv[0] )
+
+ def tempo(self, argv):
+ self.tempo = eval( argv[0] )
+
+ def block_add( self, argv ):
+ blockClass = Block.StrToClass[argv[0]]
+ active = eval( argv[1] )
+ x = int( argv[2] )
+ y = int( argv[3] )
+ child = eval( argv[4] )
+ data = ""
+ for str in argv[5:]:
+ data += str
+ data = eval( data )
+
+ if blockClass == Block.Drum:
+ data["page"] = self.pid[ data["page"] ]
+ elif blockClass == Block.Loop:
+ data["id"] = self.pid[ data["id"] ]
+ self.jam.updateLoopImage( data["id"] )
+
+ if child:
+ block = blockClass( self.jam.getDesktop(), data )
+ self.lastBlock.addChild( block )
+ else:
+ block = self.jam.getDesktop().addBlock( blockClass, data, ( x, y ) )
+
+ block.setPlaced( True )
+
+ if blockClass == Block.Instrument and active:
+ self.jam.getDesktop().activateInstrument( block )
+
+ self.lastBlock = block
+
+ def desktop_store( self, argv ):
+ filename = self.jam.getDesktopScratchFile( int( argv[0] ) )
+ #try:
+ if os.path.isfile( filename ):
+ os.remove( filename )
+
+ file = open( filename, "w" )
+ for line in self.file:
+ if line == "desktop_store END\n":
+ break
+ file.write( line )
+ file.close
+ #except:
+ # if Config.DEBUG > 3: print "ERROR:: desktop_store could not open file: " + filename
+
+ def desktop_set( self, argv ):
+ self.jam.setDesktop( int( argv[0] ), True )
+
+ def sleep(self, argv):
+ t = float(argv[0])
+ print 'sleeping for %i seconds' % t
+ time.sleep(t)
+ def quit(self, argv):
+ print 'quitting...'
+ sys.exit(0)
+
diff --git a/common/Util/Credits.py b/common/Util/Credits.py
new file mode 100644
index 0000000..c8d2644
--- /dev/null
+++ b/common/Util/Credits.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+class Credits( gtk.Window ):
+ def __init__(self , handleCreditsCloseCallback , pos):
+ gtk.Window.__init__( self, gtk.WINDOW_TOPLEVEL )
+ self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
+ self.connect('destroy' , self.destroy)
+ #self.set_decorated(False)
+ self.handleCreditsCloseCallback = handleCreditsCloseCallback
+ self.move(pos[0] , pos[1])
+
+ self.vbox = gtk.VBox()
+ self.tb = gtk.TextBuffer()
+ self.tb.set_text('miniTamTam\n\nby\n\nOlivier Bélanger\nJames Bergstra\nEric Lamothe\nNathanaël Lécaudé\nAdrian Martin\nJean Piché\nSean Wood\n\nThanks to\n\nBarry Vercoe\nVictor Lazzarini\nMarco Pesenti Gritti\nSimon Schampijer\nPeter Kirn\n\nUniversité de Montréal 2006')
+ self.tw = gtk.TextView(buffer = self.tb)
+ self.tw.set_editable(False)
+ self.tw.set_cursor_visible(False)
+ #self.tw.set_right_margin(10)
+ #self.tw.set_left_margin(10)
+ self.tw.set_justification(gtk.JUSTIFY_CENTER)
+ self.vbox.add(self.tw)
+
+ self.closeButton = gtk.Button(label='X')
+ self.closeButton.connect('clicked' , self.destroy)
+ self.vbox.add(self.closeButton)
+ self.add(self.vbox)
+ self.show_all()
+
+ def destroy(self, widget):
+ self.handleCreditsCloseCallback(False)
+ self.hide_all()
+
+
+if __name__ == '__main__':
+ credits = Credits()
+ gtk.main() \ No newline at end of file
diff --git a/common/Util/InstrumentDB.py b/common/Util/InstrumentDB.py
new file mode 100644
index 0000000..ca1e0ef
--- /dev/null
+++ b/common/Util/InstrumentDB.py
@@ -0,0 +1,143 @@
+#!/bin/env python
+import os
+
+##############
+## SOUNDS
+##############
+
+class Instrument:
+ def __init__(self, id):
+ self.id = id
+
+ # build an Instrument instance from argument list
+ def loadFromArgs( self, name, csoundInstrumentName, register, loopStart,
+ loopEnd, crossDur, wav, img, labels ):
+ self.name = name
+ self.csoundInstrumentName = csoundInstrumentName
+ self.register = register
+ self.loopStart = loopStart
+ self.loopEnd = loopEnd
+ self.crossDur = crossDur
+ self.wav = wav
+ self.img = img
+ self.labels = labels
+
+ # build an Instrument instance by parsing a file
+ def loadFromPath(self, path ):
+ f = file(path, 'r')
+ magic = f.readline()[:-1]
+ if (magic != 'TamTam idf v1'):
+ raise 'given file has wrong header'
+ self.name = f.readline()
+ self.csoundInstrumentName = f.readline()
+ self.register = f.readline()
+ self.loopStart = float( f.readline())
+ self.loopEnd = float( f.readline())
+ self.crossDur = float( f.readline())
+ self.wav = f.readline()
+ self.img = f.readline()
+ self.labels = f.readline().split()
+ f.close()
+
+class InstrumentDB:
+
+ # initialize an empty InstrumentDB instance
+ def __init__(self):
+ self.labelSet = {'All':set([])} # <key> -> all instruments labelled by <key>
+ self.inst = [] # all instruments
+ self.instNamed = {} # <name> -> instrument with that name
+ self.kit = [] # all kits. kits are lists of 13 instruments
+ self.kitNamed = {} # <name> -> kit with that name
+
+ # TEMP? add instrument from args
+ def addInstrumentFromArgs( self, name, csoundInstrumentName, register, loopStart,
+ loopEnd, crossDur, wav, img, labels ):
+ i = Instrument(len(self.inst))
+ self.inst += [ i ]
+ i.loadFromArgs( name, csoundInstrumentName, register, loopStart, loopEnd, crossDur, wav, img, labels )
+ #print 'labelSet... ', self.labelSet
+ self.labelSet['All'].add(i)
+ for l in i.labels:
+ if l not in self.labelSet:
+ self.labelSet[l] = set([])
+ self.labelSet[l].add( i )
+
+
+ # add an instrument to the DB by reading from an instrument definition file
+ def addInstrument( self, path ):
+ i = Instrument(len(self.inst))
+ self.inst += [ i ]
+ i.loadFromPath( path )
+ self.instNamed[ i.name ] = i
+ #print 'labelSet... ', self.labelSet
+ self.labelSet['All'].add(i)
+ for l in i.labels:
+ if l not in self.labelSet:
+ self.labelSet[l] = set([])
+ self.labelSet[l].add( i )
+
+ # add a kit by reading from a kit definition file
+ def addKit( self, path ):
+ strlist = file(path, 'r').readline().split()
+ if len(strlist) != 14:
+ raise 'kit length != 13'
+ for str in strlist[1:]:
+ if str not in self.inst_named:
+ raise 'invalid instrument'
+ kit = [ self.instNamed[name] for name in strlist ]
+ self.kit += [ kit ]
+
+ # try to load each file in a given folder as an instrument def. file
+ def scanInstrumentDir( self, path ):
+ dirlist = os.listdir( path )
+ for fpath in dirlist:
+ try :
+ self.addInstrument( path + fpath )
+ except :
+ print 'ERROR: scanning instrument path %s: file %s invalid' % (path, fpath)
+
+ # try to load each file in a given folder as a kit def. file
+ def scanKitDir( self, path ):
+ dirlist = os.listdir( path )
+ for fpath in dirlist:
+ try :
+ self.addKit( fpath )
+ except :
+ print 'ERROR: scanning kit path %s: file %s invalid' % (path, fpath)
+
+ def getLabels( self ):
+ return self.labelSet.keys()
+
+ def getSet( self, label ):
+ return self.labelSet[label]
+
+ def getInstrument( self, id ):
+ return self.inst[id]
+
+ def debug_summarize(self):
+ for i in self.inst:
+ print i.id, i.name
+
+ for l in self.labelSet:
+ print l, [ i.name for i in self.labelSet[l]]
+
+
+db_instance = None
+def getRef():
+ global db_instance
+ if (None == db_instance):
+ db_instance = InstrumentDB()
+ return db_instance
+
+
+if __name__ == "__main__":
+ i1 = getRef()
+ i2 = getRef()
+
+ print i1, i2
+
+ import sys
+ i1.scanInstrumentDir( sys.argv[1] )
+
+ i1.debug_summarize()
+
diff --git a/common/Util/InstrumentPanel.py b/common/Util/InstrumentPanel.py
new file mode 100644
index 0000000..8cac210
--- /dev/null
+++ b/common/Util/InstrumentPanel.py
@@ -0,0 +1,379 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+import time
+
+import common.Config as Config
+from common.Util.ThemeWidgets import *
+Tooltips = Config.Tooltips
+
+class InstrumentPanel( gtk.EventBox ):
+ def __init__(self,setInstrument = None, playInstrument = None, enterMode = False, micRec = None, synthRec = None, rowLen = 8, _instDic = None, force_load = True ):
+ gtk.EventBox.__init__(self)
+
+ self.setInstrument = setInstrument
+ self.playInstrument = playInstrument
+ self.micRec = micRec
+ self.synthRec = synthRec
+ self.rowLen = rowLen
+ self.enterMode = enterMode
+
+ self.instDic = _instDic
+
+ self.loaded = False
+ self.loadData = {}
+ self.loadStage = [0,0,0]
+ if force_load: self.load()
+
+ def configure( self, setInstrument = None, playInstrument = None, enterMode = False, micRec = None, synthRec = None, rowLen = 8 ):
+
+ self.setInstrument = setInstrument
+ self.playInstrument = playInstrument
+ self.enterMode = enterMode
+ self.micRec = micRec
+
+ if self.rowLen != rowLen:
+ self.rowLen = rowLen
+ self.prepareInstrumentTable( self.category )
+ else:
+ self.rowLen = rowLen
+
+ def load( self, timeout = -1 ):
+ if self.loaded: return True
+ if Config.DEBUG > 4: print "InstrumentPanel load", self.loadStage
+
+ if self.loadStage[0] == 0:
+ color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+ self.loadStage[0] = 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 1:
+ self.tooltips = gtk.Tooltips()
+ self.loadStage[0] = 2
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 2:
+ self.instTable = None
+ self.recstate = False
+ self.lastInstrumentWidget = None
+
+ self.mainVBox = gtk.VBox()
+ self.loadStage[0] = 3
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 3:
+ if not self.loadInstrumentList( timeout, self.loadStage ):
+ return False
+ self.loadStage[0] = 4
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 4:
+ if not self.loadToolbar( timeout, self.loadStage ):
+ return False
+ self.loadStage[0] = 5
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 5:
+ if self.instDic == None:
+ self.instDic = {}
+ self.loadStage[0] = 5.1
+ else:
+ self.loadStage[0] = 6
+
+ if self.loadStage[0] == 5.1:
+ if not self.loadInstDic( self.instDic, timeout, self.loadStage ):
+ return False
+ self.loadStage[0] = 6
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 6:
+ self.loadInstrumentViewport()
+ self.loadStage[0] = 7
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.loadStage[0] == 7:
+ self.prepareInstrumentTable()
+ self.loadStage[0] = 8
+ if timeout >= 0 and time.time() > timeout: return False
+
+ self.add(self.mainVBox)
+ self.show_all()
+
+ self.loaded = True
+ return True
+
+ def loadInstrumentList( self, timeout = -1, loadStage = [0,0,0] ):
+
+ if loadStage[1] == 0:
+ self.instrumentList = { "all": [], "all.enterMode": [], "percussions.enterMode": [], "lab": [], "mic": [], "kit": [] }
+ for category in Config.CATEGORIES:
+ self.instrumentList[category] = []
+ loadStage[1] = 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if loadStage[1] == 1:
+ keys = Config.INSTRUMENTS.keys()
+ for i in range(loadStage[2], len(keys)):
+ key = keys[i]
+ instrument = Config.INSTRUMENTS[key]
+ if key[0:4] != 'drum' and key[0:4] != 'guid' and key[0:3] != 'mic' and key[0:3] != 'lab':
+ self.instrumentList["all"].append( key )
+ if key[0:4] != 'drum' and key[0:4] != 'guid' and key[0:3] != 'mic' and key[0:3] != 'lab':
+ self.instrumentList["all.enterMode"].append( key )
+ if key[0:4] != 'drum' and key[0:4] != 'guid':
+ self.instrumentList[instrument.category].append( key )
+ if instrument.category == "percussions":
+ self.instrumentList["percussions.enterMode"].append( key )
+ if instrument.category == "kit":
+ self.instrumentList["kit"].append( key )
+ loadStage[2] += 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ loadStage[1] = 2
+ loadStage[2] = 0
+
+ self.instrumentList["mic"].sort()
+ self.instrumentList["lab"].sort()
+
+ self.instrumentList["all"] += self.instrumentList["kit"] + self.instrumentList["mic"] + self.instrumentList["lab"]
+ self.instrumentList["all.enterMode"] += self.instrumentList["mic"] + self.instrumentList["lab"]
+ self.instrumentList["percussions"] += self.instrumentList["kit"]
+ self.instrumentList["people"] += self.instrumentList["mic"]
+ self.instrumentList["keyboard"] += self.instrumentList["lab"]
+
+ loadStage[1] = 0
+ return True
+
+ def loadToolbar( self, timeout = -1, loadStage = [0,0,0] ):
+ if loadStage[1] == 0:
+ self.loadData["toolbarBox"] = gtk.HBox()
+ self.firstTbBtn = None
+ self.loadStage[1] = 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ for i in range(loadStage[1]-1, len(Config.CATEGORIES)):
+ category = Config.CATEGORIES[i]
+ if loadStage[2] == 0:
+ self.loadData["btnBox"] = RoundVBox(fillcolor = Config.CATEGORY_BCK_COLOR, bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
+ self.loadData["btnBox"].set_border_width(Config.PANEL_SPACING)
+ loadStage[2] = 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if loadStage[2] == 1:
+ self.loadData["btn"] = ImageRadioButton(self.firstTbBtn,Config.IMAGE_ROOT + category + '.png', Config.IMAGE_ROOT + category + 'sel.png', Config.IMAGE_ROOT + category + 'sel.png')
+ loadStage[2] = 2
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if self.firstTbBtn == None:
+ self.firstTbBtn = self.loadData["btn"]
+ self.loadData["btn"].connect('clicked',self.handleToolbarBtnPress,category)
+ self.loadData["btnBox"].add(self.loadData["btn"])
+ self.loadData["toolbarBox"].pack_start(self.loadData["btnBox"],True,True)
+
+ loadStage[2] = 0
+ loadStage[1] += 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ self.mainVBox.pack_start(self.loadData["toolbarBox"],False,False)
+
+ self.loadData.pop("btn")
+ self.loadData.pop("btnBox")
+ self.loadData.pop("toolbarBox")
+ loadStage[1] = 0
+ return True
+
+ def loadInstDic( self, instDic, timeout = -1, loadStage = [0,0,0] ):
+
+ if loadStage[1] == 0:
+ self.firstInstButton = None
+ self.loadData["len"] = len(self.instrumentList['all'])
+ loadStage[1] = 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+
+ for i in range( loadStage[1]-1, self.loadData["len"] ):
+ instrument = self.instrumentList["all"][i]
+ if loadStage[2] == 0:
+ self.loadData["instBox"] = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.INSTRUMENT_GRID_COLOR, radius = Config.PANEL_RADIUS)
+ self.loadData["instBox"].set_border_width(Config.PANEL_SPACING)
+ loadStage[2] = 1
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if loadStage[2] == 1:
+ try:
+ self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png')
+ except:
+ self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + 'generic.png' , Config.IMAGE_ROOT + 'genericsel.png', Config.IMAGE_ROOT + 'genericsel.png')
+ loadStage[2] = 2
+ if timeout >= 0 and time.time() > timeout: return False
+
+ if loadStage[2] == 2:
+ self.loadData["instButton"].clickedHandler = self.loadData["instButton"].connect('clicked',self.handleInstrumentButtonClick, instrument)
+ self.loadData["instButton"].connect('enter',self.handleInstrumentButtonEnter, instrument)
+ loadStage[2] = 3
+ if timeout >= 0 and time.time() > timeout: return False
+
+ self.loadData["instBox"].pack_start(self.loadData["instButton"],False,False)
+ instDic[instrument] = self.loadData["instBox"]
+ if self.firstInstButton == None:
+ self.firstInstButton = self.loadData["instButton"]
+ loadStage[2] = 0
+ if timeout >= 0 and time.time() > timeout: return False
+
+ loadStage[1] += 1
+
+ self.loadData.pop("instBox")
+ self.loadData.pop("instButton")
+ self.loadData.pop("len")
+ loadStage[1] = 0
+ return True
+
+ def loadInstrumentViewport( self ):
+ self.instrumentBox = RoundHBox(fillcolor = Config.INSTRUMENT_GRID_COLOR, bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
+
+ self.scrollWin = gtk.ScrolledWindow()
+ self.scrollWin.set_policy(gtk.POLICY_NEVER,gtk.POLICY_AUTOMATIC)
+
+ self.tableEventBox = gtk.EventBox()
+ color = gtk.gdk.color_parse(Config.INSTRUMENT_GRID_COLOR)
+ self.tableEventBox.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.scrollWin.add_with_viewport(self.tableEventBox)
+ self.tableEventBox.get_parent().set_shadow_type( gtk.SHADOW_NONE )
+ self.instrumentBox.pack_start(self.scrollWin,True,True,0)
+ self.mainVBox.pack_start(self.instrumentBox)
+ self.show_all()
+
+ def prepareInstrumentTable(self,category = 'all'):
+
+ self.category = category
+
+ if self.enterMode:
+ if category == "all": category = "all.enterMode"
+ elif category == "percussions": category = "percussions.enterMode"
+
+ if self.instTable != None:
+ for child in self.instTable.get_children()[:]:
+ self.instTable.remove(child)
+ self.tableEventBox.remove(self.instTable)
+ self.instTable.destroy()
+
+ instrumentNum = len(self.instrumentList[category])
+ instruments = self.instrumentList[category]
+
+ cols = self.rowLen
+ if instrumentNum < cols:
+ cols = instrumentNum
+ rows = (instrumentNum // cols)
+ if instrumentNum % cols is not 0: #S'il y a un reste
+ rows = rows + 1
+
+ self.instTable = gtk.Table(rows,cols,True)
+ self.instTable.set_row_spacings(0)
+ self.instTable.set_col_spacings(0)
+
+ for row in range(rows):
+ for col in range(cols):
+ if row*cols+col >= instrumentNum:
+ break
+ instBox = self.instDic[instruments[row*cols+col]]
+ self.instTable.attach(instBox, col, col+1, row, row+1, gtk.SHRINK, gtk.SHRINK, 0, 0)
+
+ self.tableEventBox.add(self.instTable)
+ self.instTable.show_all()
+
+ def selectFirstCat(self):
+ self.firstTbBtn.set_active(True)
+
+ def handleToolbarBtnPress(self, widget, category):
+ if widget.get_active():
+ self.prepareInstrumentTable(category)
+
+ def handleInstrumentButtonClick(self,widget,instrument):
+ if widget.get_active() is True and self.recstate == False:
+ if self.setInstrument:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+ self.setInstrument(instrument)
+ if self.playInstrument: self.playInstrument(instrument)
+ if self.enterMode:
+ pass #Close the window
+
+ def handleInstrumentButtonEnter(self,widget,instrument):
+ if self.enterMode and self.playInstrument:
+ self.playInstrument(instrument)
+
+ def handleMicRecButtonClick(self,widget,mic):
+ self.recstate = False
+ self.setInstrument(mic)
+ if self.micRec: self.micRec(mic)
+
+ def handleRecButtonPress(self,widget,btn):
+ self.recstate = True
+ btn.set_active(True)
+
+ def set_activeInstrument(self,instrument, state):
+ if len(self.instDic) > 0:
+ for key in self.instDic:
+ if key == instrument:
+ btn = self.instDic[key].get_children()[0]
+ btn.handler_block(btn.clickedHandler)
+ btn.set_active(state)
+ btn.handler_unblock(btn.clickedHandler)
+
+
+class DrumPanel( gtk.EventBox ):
+ def __init__(self, setDrum = None):
+ gtk.EventBox.__init__(self)
+ color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.setDrum = setDrum
+ self.instrumentList = []
+ keys = Config.INSTRUMENTS.keys()
+ for key in Config.INSTRUMENTS.keys():
+ if Config.INSTRUMENTS[key].category == "kit":
+ self.instrumentList.append( key )
+ self.instrumentList.sort()
+ self.drawDrums()
+
+ def drawDrums(self):
+ firstBtn = None
+ btnBox = RoundHBox(fillcolor = '#6F947B', bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
+ btnBox.set_border_width(Config.PANEL_SPACING)
+ self.drums = {}
+ for drumkit in self.instrumentList:
+ instBox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
+ instBox.set_border_width(Config.PANEL_SPACING)
+ self.drums[drumkit] = ImageRadioButton(firstBtn, Config.IMAGE_ROOT + drumkit + '.png' , Config.IMAGE_ROOT + drumkit + 'sel.png', Config.IMAGE_ROOT + drumkit + 'sel.png')
+ self.drums[drumkit].clickedHandler = self.drums[drumkit].connect('clicked',self.setDrums,drumkit)
+ if firstBtn == None:
+ firstBtn = self.drums[drumkit]
+ instBox.pack_start(self.drums[drumkit], False, False, 0)
+ btnBox.pack_start(instBox, False, False, 0)
+ self.add(btnBox)
+ self.show_all()
+
+ def setDrums(self,widget,data):
+ if widget.get_active():
+ if self.setDrum:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+ self.setDrum(data)
+
+ def set_activeInstrument( self, instrument, state ):
+ if instrument in self.instrumentList:
+ btn = self.drums[instrument]
+ btn.handler_block(btn.clickedHandler)
+ btn.set_active(state)
+ btn.handler_unblock(btn.clickedHandler)
+
+if __name__ == "__main__":
+ win = gtk.Window()
+ wc = DrumPanel(None)
+ win.add(wc)
+ win.show()
+ #start the gtk event loop
+ gtk.main()
diff --git a/common/Util/Instrument_.py b/common/Util/Instrument_.py
new file mode 100644
index 0000000..5bc74b3
--- /dev/null
+++ b/common/Util/Instrument_.py
@@ -0,0 +1,392 @@
+#!/bin/env python
+import os
+
+##############
+## SOUNDS
+##############
+
+#INSTRUMENTS ( csound table, csound instrument, register, instrumentClass, category )
+CSOUND_INSTRUMENT = {'inst_free' : 5000, 'inst_tied' : 5001, 'inst_simp': 5011, 'inst_perc': 5021}
+
+SOUND_ROOT = os.getenv("HOME") + '/cvs/tamtam/snd'
+KIT_ROOT = SOUND_ROOT + "/drum"
+INST_ROOT = SOUND_ROOT + "/inst"
+
+INST = {}
+inst_load_dynamic = 0
+class Instrument:
+ REGISTER = {'low': 0, 'mid':1, 'high':2, 'punch':3}
+ def __init__( self, name, csoundInstrumentName, registerName, category, loopStart, loopEnd, crossDur, wav, img ):
+ self.name = name
+ self.instrumentId = len(INST)
+ self.csoundInstrumentName = csoundInstrumentName
+ self.csoundInstrumentId = CSOUND_INSTRUMENT[csoundInstrumentName]
+ self.register = registerName
+ self.category = category
+ self.loopStart = loopStart
+ self.loopEnd = loopEnd
+ self.crossDur = crossDur
+ self.wav = wav
+ self.img = img
+
+ if None == self.wav: self.wav = os.getenv('HOME') + 'cvs/tamtam/Resources/Sounds/' + name
+ if None == self.img: self.wav = os.getenv('HOME') + 'cvs/tamtam/Resources/Images/' + name
+
+ INST[name] = self
+
+if inst_load_dynamic:
+ for I in os.listdir(INST_ROOT):
+ print 'inst:', I
+else:
+ Instrument( 'mic1', 'inst_tied', 'mid', 'mic', .01, .99, .01, None, None)
+ Instrument( 'mic2', 'inst_tied', 'mid', 'mic', .01, .99, .01, None, None)
+ Instrument( "mic3", 'inst_tied', 'mid', 'mic', .01, .99, .01, None, None)
+ Instrument( "mic4", 'inst_tied', 'mid', 'mic', .01, .99, .01, None, None)
+ Instrument( "lab1", 'inst_simp', 'mid', 'lab', 0, 0, 0, None, None)
+ Instrument( "lab2", 'inst_simp', 'mid', 'lab', 0, 0, 0, None, None)
+ Instrument( "lab3", 'inst_simp', 'mid', 'lab', 0, 0, 0, None, None)
+ Instrument( "lab4", 'inst_simp', 'mid', 'lab', 0, 0, 0, None, None)
+ Instrument( "lab5", 'inst_simp', 'mid', 'lab', 0, 0, 0, None, None)
+ Instrument( "lab6", 'inst_simp', 'mid', 'lab', 0, 0, 0, None, None)
+ Instrument( "ounk", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "gam", 'inst_tied', 'high', 'percussions', .69388, .7536, .02922 , None, None)
+ Instrument( "guit", 'inst_tied', 'mid', 'strings', .08592, .75126, .33571 , None, None)
+ Instrument( "koto", 'inst_tied', 'high', 'strings', .56523, .70075, .05954 , None, None)
+ Instrument( "clarinette", 'inst_tied', 'mid', 'winds', .57905, .73319, .04934 , None, None)
+ Instrument( "flute", 'inst_tied', 'mid', 'winds', .47169, .53693, .02481 , None, None)
+ Instrument( "drum1hatpedal", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1hatshoulder", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1hardride", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1ridebell", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1snare", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1snaresidestick", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1crash", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1splash", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1tom", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1floortom", 'inst_simp', 'low', 'drum', 0, 0, 0, None, None)
+ Instrument( "drum1chine", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum1kick", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "piano", 'inst_tied', 'mid', 'keyboard', 2.39418, 2.53339, .01323 , None, None)
+ Instrument( "dog", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "duck", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "drum2darbukadoom", 'inst_simp', 'low', 'drum', 0, 0 ,0 , None, None)
+ Instrument( "drum2darbukapied", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2darbukapiedsoft", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2hatflanger", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2darbukatak", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2darbukafinger", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2darbukaroll", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2darbukaslap", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2hatpied", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2tambourinepied", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2hatpied2", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum2tambourinepiedsoft", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3cowbell", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3cowbelltip", 'inst_simp', 'mid', 'drum', 0, 0, 0, None, None)
+ Instrument( "drum3cup", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3djembelow", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3djembemid", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3djembesidestick", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3djembeslap", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3djembestickmid", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3metalstand", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3pedalperc", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3rainstick", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3tambourinehigh", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum3tambourinelow", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "harmonica", 'inst_tied', 'mid', 'winds', .1531, .19188, .01792 , None, None)
+ Instrument( "alarm", 'inst_tied', 'mid', 'concret', .02, .19133, .01 , None, None)
+ Instrument( "bird", 'inst_tied', 'mid', 'animals', .1, 1, .05 , None, None)
+ Instrument( "cat", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "duck2", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "bottle", 'inst_tied', 'mid', 'concret', .20532, .41064, .05292 , None, None)
+ Instrument( "clang", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "ow", 'inst_simp', 'mid', 'people', 0, 0, 0 , None, None)
+ Instrument( "sheep", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "water", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "zap", 'inst_tied', 'mid', 'electronic', .299, .7323, .09895 , None, None)
+ Instrument( "trumpet", 'inst_tied', 'mid', 'winds', .39934, .45537, .02729, None, None)
+ Instrument( "bubbles", 'inst_tied', 'mid', 'concret', 0.02, 1.177, 0.02, None, None)
+ Instrument( "marimba", 'inst_tied', 'mid', 'percussions', .26545, .33098, .03087, None, None)
+ Instrument( "triangle", 'inst_tied', 'mid', 'percussions', 1.21002, 1.31805, .01268, None, None)
+ Instrument( "laugh", 'inst_simp', 'mid', 'people', 0, 0, 0 , None, None)
+ Instrument( "voix", 'inst_tied', 'mid', 'people', .89608, .96092, .02343 , None, None)
+ Instrument( "cling", 'inst_tied', 'mid', 'electronic', .09096, .7878, .18026 , None, None)
+ Instrument( "byke", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "door", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "basse", 'inst_tied', 'mid', 'strings', .58455, .67433, .03638 , None, None)
+ Instrument( "acguit", 'inst_tied', 'mid', 'strings', .58503, .8667, .13699 , None, None)
+ Instrument( "diceinst", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "didjeridu", 'inst_tied', 'low', 'winds', .55669, 1.73704, .09178 , None, None)
+ Instrument( "harmonium", 'inst_tied', 'mid', 'keyboard', .04674, .41073, .18384 , None, None)
+ Instrument( "horse", 'inst_simp', 'mid', 'animals', 0, 0, 0 , None, None)
+ Instrument( "kalimba", 'inst_tied', 'mid', 'percussions', .20751, .30161, .04658 , None, None)
+ Instrument( "mando", 'inst_tied', 'mid', 'strings', .50167, .54401, .01984 , None, None)
+ Instrument( "ocarina", 'inst_tied', 'mid', 'winds', .06612, .19033, .01776 , None, None)
+ Instrument( "rhodes", 'inst_tied', 'mid', 'keyboard', .65013, .71429, .02205 , None, None)
+ Instrument( "saxo", 'inst_tied', 'mid', 'winds', .53722, .6583, .05264 , None, None)
+ Instrument( "shenai", 'inst_tied', 'mid', 'winds', .29003, .33072, .00634 , None, None)
+ Instrument( "sitar", 'inst_tied', 'mid', 'strings', .63187, .67882, .01654 , None, None)
+ Instrument( "tuba", 'inst_tied', 'low', 'winds', .51063, .58384, .035 , None, None)
+ Instrument( "violin", 'inst_tied', 'mid', 'strings', .105, .30656, .028 , None, None)
+ Instrument( "guidice1", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice2", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice3", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice4", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice5", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice6", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice7", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice8", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice9", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guidice10", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "drum4afrofeet", 'inst_simp', 'low', 'drum', 0, 0 ,0 , None, None)
+ Instrument( "drum4fingersn", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4mutecuic", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4stompbass", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tambouri", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr707clap", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr707open", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr808closed", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr808sn", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr909bass", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr909kick", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum4tr909sn", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5timablesslap", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5congagraveouvert", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5timablesaiguslap", 'inst_simp', 'low', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5congagraveferme", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5guiroretour", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5vibraslap", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5congaaiguouvert", 'inst_simp', 'mid', 'drum', 0, 0 ,0 , None, None)
+ Instrument( "drum5quicamedium", 'inst_simp', 'punch', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5quicaaigu", 'inst_simp', 'mid', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5agogograve", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5bongoaiguouvert", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5agogoaigu", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "drum5bongograveouvert", 'inst_simp', 'high', 'drum', 0, 0, 0 , None, None)
+ Instrument( "camera", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "car", 'inst_tied', 'mid', 'concret', .67, 1.05761, .01 , None, None)
+ Instrument( "chimes", 'inst_tied', 'mid', 'percussions', .09, 2.97633, .01 , None, None)
+ Instrument( "crash", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "guit2", 'inst_tied', 'mid', 'strings', .33, 1.1583, .02 , None, None)
+ Instrument( "plane", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+ Instrument( "slap", 'inst_simp', 'mid', 'concret', 0, 0, 0 , None, None)
+INST_byId = {}
+for i in INST:
+ INST_byId[ INST[i].instrumentId] = INST[i]
+
+KIT_ELEMENT = 24 * [0]
+for i in range(0,13):
+ KIT_ELEMENT += 2 * [i]
+
+KIT = {}
+drum_load_dynamic = 0
+if drum_load_dynamic:
+ for D in os.listdir(KIT_ROOT):
+ print 'drum:',D
+else:
+ KIT = {
+ 'drum1kit' : [ 'drum1kick', 'drum1floortom', 'drum1tom',
+ 'drum1chine', 'drum1splash', 'drum1crash',
+ 'drum1snaresidestick', 'drum1snaresidestick', 'drum1snare',
+ 'drum1ridebell', 'drum1hardride', 'drum1hatshoulder',
+ 'drum1hatpedal'],
+ 'drum2kit' : [ "drum2darbukadoom", "drum2darbukapied", "drum2darbukapiedsoft",
+ "drum2hatflanger", "drum2darbukatak", "drum2darbukatak",
+ "drum2darbukafinger", "drum2darbukaroll", "drum2darbukaslap",
+ "drum2hatpied", "drum2tambourinepied", "drum2hatpied2",
+ "drum2tambourinepiedsoft"],
+ 'drum3kit' : [ "drum3djembelow", "drum3pedalperc", "drum3djembeslap",
+ "drum3tambourinehigh", "drum3tambourinelow", "drum3rainstick",
+ "drum3djembemid", "drum3djembesidestick", "drum3djembestickmid",
+ "drum3cowbell", "drum3cowbelltip", "drum3cup",
+ "drum3metalstand"],
+ 'drum4kit' : [ "drum4afrofeet", "drum4tr909kick", "drum4tr909bass",
+ "drum4stompbass", "drum4tr707open", "drum4mutecuic",
+ "drum4tr808sn", "drum4tr707clap", "drum4tr909sn",
+ "drum4tambouri", "drum4fingersn", "drum4fingersn",
+ "drum4tr808closed" ],
+ 'drum5kit' : [ "drum5timablesslap", "drum5timablesaiguslap", "drum5congagraveouvert",
+ "drum5quicamedium", "drum5guiroretour", "drum5vibraslap",
+ "drum5congagraveferme", "drum5quicaaigu", "drum5congaaiguouvert",
+ "drum5agogoaigu", "drum5bongograveouvert", "drum5agogograve",
+ "drum5bongoaiguouvert" ]
+ }
+
+for name in KIT:
+ KIT[name] = [ INST[e] for e in KIT[name] ]
+
+if 0:
+ _nextInstrumentId = [0]
+ INSTRUMENTS = {}
+ write_instrument_config = 0
+ hard_coded_instruments = 0
+ if hard_coded_instruments:
+ def _addInstrument( name, csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit = None ):
+ if write_instrument_config:
+ if (kit == None):
+ blah = file('snd/'+name+'.snd', 'w')
+ print >>blah, (csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur)
+ blah.close()
+ else:
+ sys.exit(1)
+
+ INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit )
+ _nextInstrumentId[0] += 1
+
+ DRUM1KIT = { 24 : INSTRUMENTS["drum1kick"],
+ 26 : INSTRUMENTS["drum1floortom"],
+ 28 : INSTRUMENTS["drum1tom"],
+ 30 : INSTRUMENTS["drum1chine"],
+ 32 : INSTRUMENTS["drum1splash"],
+ 34 : INSTRUMENTS["drum1crash"],
+ 36 : INSTRUMENTS["drum1snaresidestick"],
+ 38 : INSTRUMENTS["drum1snaresidestick"],
+ 40 : INSTRUMENTS["drum1snare"],
+ 42 : INSTRUMENTS["drum1ridebell"],
+ 44 : INSTRUMENTS["drum1hardride"],
+ 46 : INSTRUMENTS["drum1hatshoulder"],
+ 48 : INSTRUMENTS["drum1hatpedal"] }
+
+ DRUM2KIT = { 24 : INSTRUMENTS["drum2darbukadoom"],
+ 26 : INSTRUMENTS["drum2darbukapied"],
+ 28 : INSTRUMENTS["drum2darbukapiedsoft"],
+ 30 : INSTRUMENTS["drum2hatflanger"],
+ 32 : INSTRUMENTS["drum2darbukatak"],
+ 34 : INSTRUMENTS["drum2darbukatak"],
+ 36 : INSTRUMENTS["drum2darbukafinger"],
+ 38 : INSTRUMENTS["drum2darbukaroll"],
+ 40 : INSTRUMENTS["drum2darbukaslap"],
+ 42 : INSTRUMENTS["drum2hatpied"],
+ 44 : INSTRUMENTS["drum2tambourinepied"],
+ 46 : INSTRUMENTS["drum2hatpied2"],
+ 48 : INSTRUMENTS["drum2tambourinepiedsoft"] }
+
+ DRUM3KIT = { 24 : INSTRUMENTS["drum3djembelow"],
+ 26 : INSTRUMENTS["drum3pedalperc"],
+ 28 : INSTRUMENTS["drum3djembeslap"],
+ 30 : INSTRUMENTS["drum3tambourinehigh"],
+ 32 : INSTRUMENTS["drum3tambourinelow"],
+ 34 : INSTRUMENTS["drum3rainstick"],
+ 36 : INSTRUMENTS["drum3djembemid"],
+ 38 : INSTRUMENTS["drum3djembesidestick"],
+ 40 : INSTRUMENTS["drum3djembestickmid"],
+ 42 : INSTRUMENTS["drum3cowbell"],
+ 44 : INSTRUMENTS["drum3cowbelltip"],
+ 46 : INSTRUMENTS["drum3cup"],
+ 48 : INSTRUMENTS["drum3metalstand"] }
+
+ DRUM4KIT = { 24 : INSTRUMENTS["drum4afrofeet"],
+ 26 : INSTRUMENTS["drum4tr909kick"],
+ 28 : INSTRUMENTS["drum4tr909bass"],
+ 30 : INSTRUMENTS["drum4stompbass"],
+ 32 : INSTRUMENTS["drum4tr707open"],
+ 34 : INSTRUMENTS["drum4mutecuic"],
+ 36 : INSTRUMENTS["drum4tr808sn"],
+ 38 : INSTRUMENTS["drum4tr707clap"],
+ 40 : INSTRUMENTS["drum4tr909sn"],
+ 42 : INSTRUMENTS["drum4tambouri"],
+ 44 : INSTRUMENTS["drum4fingersn"],
+ 46 : INSTRUMENTS["drum4fingersn"],
+ 48 : INSTRUMENTS["drum4tr808closed"] }
+
+ DRUM5KIT = { 24 : INSTRUMENTS["drum5timablesslap"],
+ 26 : INSTRUMENTS["drum5timablesaiguslap"],
+ 28 : INSTRUMENTS["drum5congagraveouvert"],
+ 30 : INSTRUMENTS["drum5quicamedium"],
+ 32 : INSTRUMENTS["drum5guiroretour"],
+ 34 : INSTRUMENTS["drum5vibraslap"],
+ 36 : INSTRUMENTS["drum5congagraveferme"],
+ 38 : INSTRUMENTS["drum5quicaaigu"],
+ 40 : INSTRUMENTS["drum5congaaiguouvert"],
+ 42 : INSTRUMENTS["drum5agogoaigu"],
+ 44 : INSTRUMENTS["drum5bongograveouvert"],
+ 46 : INSTRUMENTS["drum5agogograve"],
+ 48 : INSTRUMENTS["drum5bongoaiguouvert"] }
+
+ _addInstrument( "drum1kit", 0, 0, 0, "kit", 0, 0, 0, DRUM1KIT )
+ _addInstrument( "drum2kit", 0, 0, 0, "kit", 0, 0, 0, DRUM2KIT )
+ _addInstrument( "drum3kit", 0, 0, 0, "kit", 0, 0, 0, DRUM3KIT )
+ _addInstrument( "drum4kit", 0, 0, 0, "kit", 0, 0, 0, DRUM4KIT )
+ _addInstrument( "drum5kit", 0, 0, 0, "kit", 0, 0, 0, DRUM5KIT )
+
+ else:
+
+ sndlist = os.listdir('snd/')
+ #print sndlist
+ sndpaths = [p for p in sndlist if p[-4:] == '.snd']
+
+ #load the normal instruments
+ for sndpath in sndpaths:
+ name = sndpath[0:-4]
+ sndfile = file('snd/'+sndpath, 'r')
+ line = sndfile.readline()
+ #print sndpath, line
+ tup = eval(line)
+ if len(tup) == 7:
+ csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur = tup
+ INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0],
+ csoundInstrumentId, instrumentRegister, soundClass,
+ category, loopStart, loopEnd, crossDur, None, None, None )
+ else:
+ print 'loading a gooddmammn img and wav thing!'
+ csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, wav, img = tup
+ INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0],
+ csoundInstrumentId, instrumentRegister, soundClass,
+ category, loopStart, loopEnd, crossDur, None , wav, img)
+ _nextInstrumentId[0] += 1
+ sndfile.close()
+
+ #load the kits
+ if 0:
+ kitpaths = [p for p in sndlist if p[-4:] == '.kit'] #don't use these for now..
+ for kitpath in kitpaths:
+ kitidx = int( kitpath[4] )
+ print kitpath, kitidx
+ exec "DRUM%iKIT = {} ; curkit = DRUM%iKIT" % (kitidx,kitidx)
+ name = kitpath[0:-4]
+ kitfile = file('snd/'+ kitpath, 'r')
+ line = kitfile.readline()
+ print kitpath, line
+
+ keyval = eval(line)
+ for kv in keyval:
+ curkit[kv[0]] = INSTRUMENTS[kv[1]]
+
+ #csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur = eval( line )
+ INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], 0, 0, 0, "kit", 0, 0, 0, curkit)
+ _nextInstrumentId[0] += 1
+ kitfile.close()
+
+ else:
+ def _addInstrument( name, csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit = None ):
+ blah = file('snd/' + name + '.kit', 'w')
+ print >>blah, [(k, kit[k].name) for k in kit.keys()]
+ blah.close()
+ INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit )
+ _nextInstrumentId[0] += 1
+ print INSTRUMENTS[name]
+
+
+ _addInstrument( "drum1kit", 0, 0, 0, "kit", 0, 0, 0, DRUM1KIT )
+ _addInstrument( "drum2kit", 0, 0, 0, "kit", 0, 0, 0, DRUM2KIT )
+ _addInstrument( "drum3kit", 0, 0, 0, "kit", 0, 0, 0, DRUM3KIT )
+ _addInstrument( "drum4kit", 0, 0, 0, "kit", 0, 0, 0, DRUM4KIT )
+ _addInstrument( "drum5kit", 0, 0, 0, "kit", 0, 0, 0, DRUM5KIT )
+
+ #import sys
+ #sys.exit(0)
+
+ INSTRUMENTSID = {}
+ for i in INSTRUMENTS:
+ INSTRUMENTSID[INSTRUMENTS[i].instrumentId] = INSTRUMENTS[i]
+
+
+ #DRUMKITS = ['drum1kit', 'drum2kit', 'drum3kit', 'drum4kit']
+ #DRUMSINSTRUMENTSDICT = [DRUM1KIT, DRUM2KIT, DRUM3KIT, DRUM4KIT]
+
+ RECORDABLE_INSTRUMENTS = set( [ "mic1", "mic2", "mic3", "mic4" ] )
+ RECORDABLE_INSTRUMENT_CSOUND_IDS = { "mic1" : 7,
+ "mic2" : 8,
+ "mic3" : 9,
+ "mic4" : 10 }
diff --git a/common/Util/KeyboardWindow.py b/common/Util/KeyboardWindow.py
new file mode 100644
index 0000000..507276b
--- /dev/null
+++ b/common/Util/KeyboardWindow.py
@@ -0,0 +1,181 @@
+#!/usr/bin/env python
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import random
+from common.Util.ThemeWidgets import keyButton
+import common.Config as Config
+KEY_MAP_PIANO = Config.KEY_MAP_PIANO
+
+class KeyboardWindow(gtk.Window):
+ def __init__(self, size = None, pos = 0, popup = False):
+ if popup is False:
+ gtk.Window.__init__(self , gtk.WINDOW_TOPLEVEL)
+ else:
+ gtk.Window.__init__(self , gtk.WINDOW_POPUP)
+ color = gtk.gdk.color_parse("#000000")
+ self.modify_bg(gtk.STATE_NORMAL, color)
+ self.set_decorated(False)
+
+ self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.KEY_PRESS_MASK)
+ self.connect("key-press-event",self.handle_keypress)
+ self.connect("key-release-event",self.handle_keyrelease)
+ self.connect("button-press-event",self.handle_mousePress)
+ self.connect("button-release-event",self.handle_mouseRelease)
+ self.connect("enter-notify-event",self.handle_enter)
+
+ self.size = size
+ self.pos = pos
+ self.popup = popup
+ self.set_pos(self.pos)
+
+ if self.size == None:
+ self.pixel_space = 15
+ self.height = 45
+ else:
+ self.pixel_space = size
+ self.height = 3 * size
+
+ self.draw()
+
+ def draw(self):
+ self.rows = {}
+ self.rows[1] = [(49,1), (10,3), (11,3), (12,3), (13,3), (14,3), (15,3), (16,3), (17,3), (18,3), (19,3), (20,3), (21,5)]
+ self.rows[2] = [(23,3), (24,3), (25,3), (26,3), (27,3), (28,3), (29,3), (30,3), (31,3), (32,3), (33,3), (34,3), (35,4)]
+ self.rows[3] = [(37,4), (38,3), (39,3), (40,3), (41,3), (42,3), (43,3), (44,3), (45,3), (46,3), (47,3), (48,3), (51,3)]
+ self.rows[4] = [(50,6), (52,3), (53,3), (54,3), (55,3), (56,3), (57,3), (58,3), (59,3), (60,3), (61,3), (62,5)]
+ self.rows[5] = [(216,1),(133,4),(64,4), (65,25), (108,4), (134,4,), (113,3)]
+
+ self.right_section = [(22,7),(36,(7,7)),(111,3),(219,3),(116,3),(114,3)]
+
+ self.btn_dic = {}
+
+ mainvbox = gtk.VBox()
+ mainhbox = gtk.HBox()
+
+ #Main keyboard section
+ vbox = gtk.VBox()
+ for row in [1,2,3,4,5]:
+ hbox = gtk.HBox()
+ for key in self.rows[row]:
+ self.btn_dic[key[0]] = keyButton(self.pixel_space * key[1], self.height, [0,0,0], [0.5,0.5,0.5])
+ hbox.pack_start(self.btn_dic[key[0]], padding = self.pixel_space//2)
+ vbox.pack_start(hbox, padding = self.pixel_space//2)
+ mainhbox.pack_start(vbox)
+
+ #Right part of the keyboard
+ right_vbox = gtk.VBox()
+ right_tophbox = gtk.HBox()
+ right_lowhbox = gtk.HBox()
+
+ self.btn_dic[self.right_section[0][0]] = keyButton(self.pixel_space * self.right_section[0][1], self.height, [0,0,0], [0.5,0.5,0.5])
+ self.btn_dic[self.right_section[1][0]] = keyButton(self.pixel_space * self.right_section[1][1][0], self.pixel_space * self.right_section[1][1][1], [0,0,0], [0.5,0.5,0.5])
+ self.btn_dic[self.right_section[2][0]] = keyButton(self.pixel_space * self.right_section[2][1], self.height, [0,0,0], [0.5,0.5,0.5])
+ self.btn_dic[self.right_section[3][0]] = keyButton(self.pixel_space * self.right_section[3][1], self.height, [0,0,0], [0.5,0.5,0.5])
+ self.btn_dic[self.right_section[4][0]] = keyButton(self.pixel_space * self.right_section[4][1], self.height, [0,0,0], [0.5,0.5,0.5])
+ self.btn_dic[self.right_section[5][0]] = keyButton(self.pixel_space * self.right_section[5][1], self.height, [0,0,0], [0.5,0.5,0.5])
+
+ right_vbox.pack_start(self.btn_dic[self.right_section[0][0]], padding = self.pixel_space//2)
+ right_vbox.pack_start(self.btn_dic[self.right_section[1][0]], padding = self.pixel_space//2)
+ right_tophbox.pack_start(self.btn_dic[self.right_section[2][0]], padding = self.pixel_space//2)
+ right_tophbox.pack_start(self.btn_dic[self.right_section[3][0]], padding = self.pixel_space//2)
+ right_lowhbox.pack_start(self.btn_dic[self.right_section[4][0]], padding = self.pixel_space//2)
+ right_lowhbox.pack_start(self.btn_dic[self.right_section[5][0]], padding = self.pixel_space//2)
+ right_vbox.pack_start(right_tophbox, padding = self.pixel_space//2)
+ right_vbox.pack_start(right_lowhbox, padding = self.pixel_space//2)
+
+ #Mouse buttons
+ mouse_hbox = gtk.HBox()
+ self.btn_dic["left_mouse"] = keyButton(self.pixel_space * 6, self.pixel_space * 2, [0,0,0], [0.5,0.5,0.5])
+ self.btn_dic["right_mouse"] = keyButton(self.pixel_space * 6, self.pixel_space * 2, [0,0,0], [0.5,0.5,0.5])
+ mouse_hbox.pack_start(self.btn_dic["left_mouse"], True, True, self.pixel_space//2)
+ mouse_hbox.pack_end(self.btn_dic["right_mouse"], True, True, self.pixel_space//2)
+
+
+ #Enter and Leave connections
+ for key in self.btn_dic:
+ self.btn_dic[key].connect("enter",self.handle_mouseEnter)
+ self.btn_dic[key].connect("leave",self.handle_mouseLeave)
+
+ mainhbox.pack_start(right_vbox)
+ mainvbox.pack_start(mainhbox)
+ mainvbox.pack_start(mouse_hbox, padding = self.pixel_space//2)
+
+ self.add(mainvbox)
+
+ def set_pos(self,_pos = 0):
+ width = self.get_screen().get_width()
+ height = self.get_screen().get_height()
+ win_width = self.get_size()[0]
+ win_height = self.get_size()[1]
+
+ self.pos = _pos
+
+ pos = [0,0]
+ pos[0] = (0, 0)
+ pos[1] = (width - win_width, height - win_height)
+ self.move(pos[self.pos][0],pos[self.pos][1])
+
+ def color_piano(self):
+ for key in KEY_MAP_PIANO:
+ self.btn_dic[key].set_fillcolor(1,1,1)
+
+
+ def handle_keypress(self,widget,event):
+ if event.hardware_keycode == 9: # Hide the keyboard with escape Key
+ self.hide_all()
+ elif event.hardware_keycode == 216: # Send a fake mouse event
+ self.btn_dic["left_mouse"].set_fillcolor(random.random(),random.random(),random.random())
+ elif event.hardware_keycode == 133: # Send a fake mouse event
+ self.btn_dic["right_mouse"].set_fillcolor(random.random(),random.random(),random.random())
+ else:
+ if self.btn_dic.has_key(event.hardware_keycode):
+ self.btn_dic[event.hardware_keycode].set_fillcolor(random.random(),random.random(),random.random())
+
+ def handle_keyrelease(self,widget,event):
+ if KEY_MAP_PIANO.has_key(event.hardware_keycode):
+ self.btn_dic[event.hardware_keycode].set_fillcolor(1,1,1)
+ else:
+ if self.btn_dic.has_key(event.hardware_keycode):
+ self.btn_dic[event.hardware_keycode].set_fillcolor(0,0,0)
+ if event.hardware_keycode == 216 or event.hardware_keycode == 133:
+ self.btn_dic["left_mouse"].set_fillcolor(0,0,0)
+ self.btn_dic["right_mouse"].set_fillcolor(0,0,0)
+
+
+ def handle_mousePress(self,widget,event):
+ if event.button == 1:
+ self.btn_dic["left_mouse"].set_fillcolor(random.random(),random.random(),random.random())
+ elif event.button == 3:
+ self.btn_dic["right_mouse"].set_fillcolor(random.random(),random.random(),random.random())
+
+ def handle_mouseRelease(self,widget,event):
+ if event.button == 1:
+ self.btn_dic["left_mouse"].set_fillcolor(0,0,0)
+ elif event.button == 3:
+ self.btn_dic["right_mouse"].set_fillcolor(0,0,0)
+
+ def handle_mouseEnter(self,widget,event = None):
+ widget.set_strokecolor(1,1,1)
+
+ def handle_mouseLeave(self,widget,event = None):
+ widget.set_strokecolor(0.5,0.5,0.5)
+
+ def handle_enter(self,widget,event):
+ if self.popup is False:
+ return
+ if self.pos == 0:
+ self.set_pos(1)
+ else:
+ self.set_pos(0)
+
+ def close(self,widget,event = None):
+ self.hide_all()
+
+
+
+if __name__ == "__main__":
+ win = KeyboardWindow()
+ win.connect("destroy",gtk.main_quit)
+ win.show_all()
+ gtk.main() \ No newline at end of file
diff --git a/common/Util/LoopSettings.py b/common/Util/LoopSettings.py
new file mode 100644
index 0000000..e866861
--- /dev/null
+++ b/common/Util/LoopSettings.py
@@ -0,0 +1,230 @@
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+import os
+from common.Util.ThemeWidgets import *
+import common.Config as Config
+import commands
+Tooltips = Config.Tooltips()
+
+class LoopSettings( gtk.VBox ):
+ def __init__( self, popup, playFunction, setChannelFunction, doneLoopSettingsPopup ):
+ gtk.VBox.__init__( self )
+ self.tooltips = gtk.Tooltips()
+ self.popup = popup
+ self.playFunction = playFunction
+ self.setChannel = setChannelFunction
+ self.doneLoopSettingsPopup = doneLoopSettingsPopup
+ self.loopedSound = False
+ self.soundLength = 1.00
+ self.start = 0
+ self.end = 1.00
+ self.dur = 0.01
+ self.register = 0
+ self.ok = True
+
+ self.settingsBox = gtk.HBox()
+ self.pack_start(self.settingsBox)
+
+ self.fixed = gtk.Fixed()
+ self.settingsBox.pack_start(self.fixed)
+
+ self.mainBox = gtk.VBox()
+
+ self.controlsBox = gtk.HBox()
+
+ self.GUI = {}
+
+ nameBox = gtk.VBox()
+ self.nameEntry = gtk.Entry()
+ self.nameEntry.set_text("name_of_the_sound")
+ nameBox.pack_start(self.nameEntry)
+ self.mainBox.pack_start(nameBox, False, False, 5)
+
+ loopedBox = gtk.HBox()
+ loopedLabel = gtk.Label("Looped sound: ")
+ loopedBox.pack_start(loopedLabel)
+ loopedToggle = ImageToggleButton(Config.IMAGE_ROOT+"checkOff.svg",Config.IMAGE_ROOT+"checkOn.svg")
+ loopedToggle.connect('button-press-event', self.handleLooped )
+ loopedBox.pack_start(loopedToggle)
+ self.mainBox.pack_start(loopedBox, False, False, 5)
+
+ categoryBox = gtk.HBox()
+ categoryMenu = gtk.MenuBar()
+ cmenu = gtk.Menu()
+ for cat in Config.CATEGORIES:
+ if cat != 'all':
+ entry = gtk.MenuItem(cat)
+ cmenu.append(entry)
+ entry.connect("activate", self.handleCategory, cat)
+ entry.show()
+ self.categoryButton = gtk.Button("Category")
+ self.categoryButton.connect_object("event", self.categoryBtnPress, cmenu)
+ categoryBox.pack_end(self.categoryButton)
+ #self.mainBox.pack_start(categoryBox, False, False, 5)
+
+ registerBox = gtk.HBox()
+ registerMenu = gtk.MenuBar()
+ rmenu = gtk.Menu()
+ self.registerList = ['LOW', 'MID', 'HIGH', 'PUNCH']
+ for reg in self.registerList:
+ entry = gtk.MenuItem(reg)
+ rmenu.append(entry)
+ entry.connect("activate", self.handleRegister, self.registerList.index(reg))
+ entry.show()
+ self.registerButton = gtk.Button("Register")
+ self.registerButton.connect_object("event", self.registerBtnPress, rmenu)
+ registerBox.pack_end(self.registerButton)
+ self.mainBox.pack_start(registerBox, False, False, 5)
+
+ startBox = gtk.VBox()
+ self.startAdjust = gtk.Adjustment( 0.01, 0, 1., .001, .001, 0)
+ self.GUI['startSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.startAdjust, 7 )
+ self.startAdjust.connect("value-changed", self.handleStart)
+ self.GUI['startSlider'].set_inverted(True)
+ self.GUI['startSlider'].set_size_request(50, 200)
+ self.startEntry = gtk.Entry()
+ self.startEntry.set_width_chars(5)
+ self.handleStart( self.startAdjust )
+ startBox.pack_start(self.GUI['startSlider'], True, True, 5)
+ startBox.pack_start(self.startEntry, True, True, 5)
+ self.controlsBox.pack_start(startBox)
+
+ endBox = gtk.VBox()
+ self.endAdjust = gtk.Adjustment( 0.9, 0, 1, .001, .001, 0)
+ self.GUI['endSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.endAdjust, 7 )
+ self.endAdjust.connect("value-changed", self.handleEnd)
+ self.GUI['endSlider'].set_inverted(True)
+ self.GUI['endSlider'].set_size_request(50, 200)
+ self.endEntry = gtk.Entry()
+ self.endEntry.set_width_chars(5)
+ self.handleEnd( self.endAdjust )
+ endBox.pack_start(self.GUI['endSlider'], True, True, 5)
+ endBox.pack_start(self.endEntry, True, True, 5)
+ self.controlsBox.pack_start(endBox)
+
+ durBox = gtk.VBox()
+ self.durAdjust = gtk.Adjustment( 0.01, 0, 0.2, .001, .001, 0)
+ self.GUI['durSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.durAdjust, 7 )
+ self.durAdjust.connect("value-changed", self.handleDur)
+ self.GUI['durSlider'].set_inverted(True)
+ self.GUI['durSlider'].set_size_request(50, 200)
+ self.durEntry = gtk.Entry()
+ self.durEntry.set_width_chars(5)
+ self.handleDur( self.durAdjust )
+ durBox.pack_start(self.GUI['durSlider'], True, True, 5)
+ durBox.pack_start(self.durEntry, True, True, 5)
+ self.controlsBox.pack_start(durBox)
+
+ self.mainBox.pack_start(self.controlsBox, False, False, 5)
+
+ previewBox = gtk.VBox()
+ self.playStopButton = ImageToggleButton(Config.IMAGE_ROOT + 'miniplay.png', Config.IMAGE_ROOT + 'stop.png')
+ self.playStopButton.connect('button-press-event' , self.handlePlayButton)
+ previewBox.pack_start(self.playStopButton)
+ self.mainBox.pack_start(previewBox, False, False, 5)
+
+ checkBox = gtk.VBox()
+ checkButton = ImageButton(Config.IMAGE_ROOT + 'check.png')
+ checkButton.connect('clicked' , self.handleCheck)
+ checkBox.pack_start(checkButton)
+ self.mainBox.pack_start(checkBox, False, False, 5)
+
+ self.fixed.put( self.mainBox, 0, 0 )
+
+ self.show_all()
+
+ def handleCheck(self, widget):
+ ofile = open(Config.PREF_DIR + "/sounds_settings", 'a')
+ name = self.nameEntry.get_text()
+ if self.loopedSound:
+ tied = str(Config.INST_TIED)
+ else:
+ tied = str(Config.INST_SIMP)
+ register = str(self.register)
+ melo = 'melo'
+ category = 'mysounds'
+ start = str(self.start)
+ end = str(self.end)
+ dur = str(self.dur)
+
+ ofile.write(name + ' ' + tied + ' ' + register + ' ' + melo + ' ' + category + ' ' + start + ' ' + end + ' ' + dur + '\n')
+
+ ofile.close()
+ (s,o) = commands.getstatusoutput('cp ' + Config.SNDS_DIR + '/' + self.oldName + ' ' + Config.SNDS_DIR + '/' + name)
+ self.doneLoopSettingsPopup()
+
+ def set_name(self, name):
+ self.oldName = name
+ self.nameEntry.set_text('_' + name)
+
+ def set_values(self, soundLength):
+ self.soundLength = soundLength
+ self.handleStart(self.GUI['startSlider'])
+ self.handleEnd(self.GUI['endSlider'])
+
+ def handleLooped(self, widget, data=None):
+ if widget.get_active() == True:
+ self.loopedSound = False
+ else:
+ self.loopedSound = True
+
+ def categoryBtnPress(self, widget, event):
+ if event.type == gtk.gdk.BUTTON_PRESS:
+ widget.popup(None, None, None, event.button, event.time)
+ return True
+ return False
+
+ def handleCategory(self, widget, category):
+ self.category = category
+ self.categoryButton.set_label(self.category)
+
+ def registerBtnPress(self, widget, event):
+ if event.type == gtk.gdk.BUTTON_PRESS:
+ widget.popup(None, None, None, event.button, event.time)
+ return True
+ return False
+
+ def handleRegister(self, widget, register):
+ self.register = register
+ self.registerButton.set_label(self.registerList[self.register])
+
+ def handleStart(self, widget, data=None):
+ self.startSlider = self.startAdjust.value
+ self.start = self.startSlider * self.soundLength
+ if self.start > self.end:
+ self.start = self.end
+ self.startEntry.set_text(str(self.start))
+ self.setChannel('lstart', self.start)
+
+ def handleEnd(self, widget, data=None):
+ self.endSlider = self.endAdjust.value
+ self.end = self.endSlider * self.soundLength
+ if self.end < self.start:
+ self.end = self.start
+ self.endEntry.set_text(str(self.end))
+ self.setChannel('lend', self.end)
+
+ def handleDur(self, widget, data=None):
+ self.dur = self.durAdjust.value
+ self.durEntry.set_text(str(self.dur))
+ self.setChannel('ldur', self.dur)
+
+ def handlePlayButton(self, widget, data=None):
+ print widget.get_active()
+ if self.ok:
+ self.playFunction(widget.get_active(), self.loopedSound)
+ if self.loopedSound == False and widget.get_active() == False:
+ self.timeoutStop = gobject.timeout_add(int(self.soundLength * 1000)+500, self.playButtonState)
+
+ def setButtonState(self):
+ self.ok = False
+ self.playStopButton.set_active(False)
+ self.ok = True
+
+ def playButtonState(self):
+ self.ok = False
+ self.playStopButton.set_active(False)
+ gobject.source_remove(self.timeoutStop)
+ self.ok = True
diff --git a/common/Util/Network.py b/common/Util/Network.py
new file mode 100644
index 0000000..8e20a04
--- /dev/null
+++ b/common/Util/Network.py
@@ -0,0 +1,569 @@
+
+#===========================================================================
+# Networking Module
+#
+# - to force host mode create an empty file named "FORCE_HOST" in the base
+# TamTam directory
+# - to force peer mode create a file named "FORCE_PEER" with a single line
+# containing the IP of the host to connect to
+#
+# !! the host must be running before the peers start up !!
+#---------------------------------------------------------------------------
+
+import os
+import socket
+import select
+import threading
+import xdrlib
+import random
+
+import time
+import gtk
+import gobject
+import common.Config as Config
+
+PORT = 24420
+LISTENER_PORT = PORT-1
+WAIT_PORT = PORT-2
+
+BACKLOG = 5 # allow a backlog of N new connections
+MAX_SIZE = 1024 # max message size to receive in one go
+
+MD_OFFLINE = 0
+MD_HOST = 1
+MD_PEER = 2
+MD_WAIT = 3
+
+# enumerate message types
+# format: ("NAME", <message size>)
+# <message size> specified in bytes
+# special:
+# -1 == dynamic, first byte of data containes size
+# -2 == dynamic, first uint32 of data contains size
+message_enum = [
+("HT_LATENCY_REPLY", 4), # reply to latency test
+("HT_SYNC_REPLY", 8), # reply to sync test
+("HT_TEMPO_UPDATE", 4), # reply to sync test
+
+("PR_LATENCY_QUERY", 4), # test latency
+("PR_SYNC_QUERY", 4), # test sync
+("PR_TEMPO_QUERY", 0), # test sync
+("PR_REQUEST_TEMPO_CHANGE", 4), # request tempo change
+
+("MAX_MSG_ID", 0)
+]
+
+# Initialize message ids and MSG_NAME/MSG_SIZE arrays
+MSG_NAME = [""]
+MSG_SIZE = [0]
+i = 1
+for m in message_enum:
+ exec "%s = %d" % (m[0],i)
+ MSG_NAME.append(m[0])
+ MSG_SIZE.append(m[1])
+ i += 1
+del message_enum # clear memory
+if MAX_MSG_ID > 256:
+ print "Network:: MAX_MSG_ID exeeds limit of 256!"
+
+
+class Listener( threading.Thread ):
+
+ def __init__( self, owner, listenerSocket, inputSockets, outputSockets, exceptSockets ):
+ threading.Thread.__init__(self)
+ self.owner = owner
+ self.listenerSocket = listenerSocket
+ self.inputSockets = inputSockets # note that these are array pointers that match
+ self.outputSockets = outputSockets # those of the Network and should not be reset
+ self.exceptSockets = exceptSockets #
+
+ def run(self):
+ while 1: # rely on the owner to kill us when necessary
+ try:
+ inputReady, outputReady, exceptReady = select.select( self.inputSockets, self.outputSockets, self.exceptSockets )
+ if self.listenerSocket in inputReady:
+ data, s = self.listenerSocket.recvfrom(MAX_SIZE)
+ if data == "REFRESH":
+ continue
+ if data == "CLEAR":
+ self.owner._clearSockets()
+ continue
+ else:
+ break # exit thread
+ gtk.gdk.threads_enter()
+ self.owner._processSockets( inputReady, outputReady, exceptReady )
+ gtk.gdk.threads_leave()
+ except socket.error, (value, message):
+ print "Listener:: socket error: " + message
+ gtk.gdk.threads_leave()
+ break
+
+class Connection:
+
+ def __init__( self, sock, address ):
+ self.socket = sock
+ self.address = address
+ self.recvBuf = ""
+ self.waitingForData = 0
+ self.message = 0
+
+class Network:
+
+ def __init__( self, mode = MD_OFFLINE, hostaddress = None ):
+
+ # check for forced networking
+ if os.path.isfile("FORCE_HOST"):
+ mode = MD_HOST
+ elif os.path.isfile("FORCE_PEER"):
+ f = open("FORCE_PEER")
+ l = f.read(16)
+ print l
+ f.close()
+ mode = MD_PEER
+ hostaddress = (l,PORT)
+
+ # prepare message handlers
+ self.processMessage = {}
+ for i in range(1,MAX_MSG_ID):
+ self.processMessage[i] = []
+
+ self.statusWatcher = []
+
+ # data packing classes
+ self.packer = xdrlib.Packer()
+ self.unpacker = xdrlib.Unpacker("")
+
+ self.mode = -1
+ self.listener = None
+ self._fromListener = False
+ try:
+ self.listenerSocket = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
+ self.listenerSocket.bind( ("localhost", LISTENER_PORT) )
+ except socket.error, (value,message):
+ print "Network:: FAILED to open listenerSocket: " + message
+ mode = MD_OFFLINE
+
+ self.inputSockets = [ self.listenerSocket ] # NOTE that these array pointers are passed into
+ self.outputSockets = [] # the Listener and should not be reset
+ self.exceptSockets = [] #
+ self.connection = {} # dict of connections indexed by socket
+
+ self.latencyQueryHandler = {}
+ self.latencyQueryStart = {}
+
+ self.connectMessage( HT_LATENCY_REPLY, self.processHT_LATENCY_REPLY )
+ self.connectMessage( PR_LATENCY_QUERY, self.processPR_LATENCY_QUERY )
+
+ self.setMode( mode, hostaddress )
+
+ def shutdown( self ):
+ if Config.DEBUG > 1: print "Network:: shutting down!"
+
+ if self.listener:
+ self.listenerSocket.sendto( "EXIT", ("localhost",LISTENER_PORT) )
+ time.sleep(0.01) # get off the cpu so the listerer thread has a chance to clear.. IS THERE A BETTER WAY TO DO THIS?
+
+ if self.mode == MD_HOST:
+ for s in self.inputSockets:
+ s.close()
+ elif self.mode == MD_PEER:
+ self.socket.close()
+ self.hostAddress = None
+
+ def setMode( self, mode, hostaddress = None ):
+
+ # cleanup old mode
+ if Config.DEBUG > 1: print "Network:: cleaning up old connections"
+
+ if self._fromListener:
+ self._clearSockets()
+ elif self.listener: # make the listener wake so sockets can close properly
+ self.listenerSocket.sendto( "CLEAR", ("localhost",LISTENER_PORT) )
+ time.sleep(0.01) # get off the cpu so the listerer thread has a chance to clear.. IS THERE A BETTER WAY TO DO THIS?
+
+ self.hostAddress = None
+
+ # initialize new mode
+ self.mode = mode
+ if self.mode == MD_HOST:
+ if Config.DEBUG > 1: print "Network:: initializing network, host mode"
+ try:
+ self.socket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
+ address = ("",PORT)
+ self.connection[self.socket] = Connection( self.socket, address )
+ self.socket.bind(address)
+ self.socket.listen(BACKLOG)
+ self.inputSockets.append(self.socket)
+ if not self._fromListener and self.listener:
+ self.listenerSocket.sendto( "REFRESH", ("localhost", LISTENER_PORT) )
+ elif not self.listener:
+ self.listener = Listener( self, self.listenerSocket, self.inputSockets, self.outputSockets, self.exceptSockets )
+ self.listener.start()
+ except socket.error, (value, message):
+ if self.socket:
+ self.socket.close()
+ self.connection.pop(self.socket)
+ print "Network:: FAILED to open socket: " + message
+ self.mode = MD_OFFLINE
+ if self.listener:
+ self.listenerSocket.sendto( "EXIT", ("localhost", LISTENER_PORT) )
+ self.listener = None
+
+ elif self.mode == MD_PEER:
+ if Config.DEBUG > 1: print "Network:: initializing network, client mode: " + hostaddress[0]
+ self.hostAddress = hostaddress
+ try:
+ self.socket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
+ self.connection[self.socket] = Connection( self.socket, self.hostAddress )
+ self.socket.connect(self.hostAddress)
+ self.inputSockets.append(self.socket)
+ if not self._fromListener and self.listener:
+ self.listenerSocket.sendto( "REFRESH", ("localhost", LISTENER_PORT) )
+ elif not self.listener:
+ self.listener = Listener( self, self.listenerSocket, self.inputSockets, self.outputSockets, self.exceptSockets )
+ self.listener.start()
+ except socket.error, (value, message):
+ if self.socket:
+ self.socket.close()
+ self.connection.pop(self.socket)
+ print "Network:: FAILED to open socket: " + message
+ self.mode = MD_OFFLINE
+ self.hostAddress = None
+ if self.listener:
+ self.listenerSocket.sendto( "EXIT", ("localhost", LISTENER_PORT) )
+ self.listener = None
+
+ elif self.mode == MD_WAIT:
+ if Config.DEBUG > 1: print "Network:: initializing network, wait mode"
+ try:
+ self.socket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
+ address = ("",WAIT_PORT)
+ self.connection[self.socket] = Connection( self.socket, address )
+ self.socket.bind(address)
+ self.socket.listen(BACKLOG)
+ self.inputSockets.append(self.socket)
+ if not self._fromListener and self.listener:
+ self.listenerSocket.sendto( "REFRESH", ("localhost", LISTENER_PORT) )
+ elif not self.listener:
+ self.listener = Listener( self, self.listenerSocket, self.inputSockets, self.outputSockets, self.exceptSockets )
+ self.listener.start()
+ except socket.error, (value, message):
+ if self.socket:
+ self.socket.close()
+ self.connection.pop(self.socket)
+ print "Network:: FAILED to open socket: " + message
+ self.mode = MD_OFFLINE
+ if self.listener:
+ self.listenerSocket.sendto( "EXIT", ("localhost", LISTENER_PORT) )
+ self.listener = None
+
+ else:
+ if Config.DEBUG > 1: print "Network:: offline"
+ if self.listener:
+ self.listenerSocket.sendto( "EXIT", ("localhost", LISTENER_PORT) )
+ self.listener = None
+
+ for watcher in self.statusWatcher:
+ watcher( self.mode )
+
+ def _clearSockets( self ):
+ for s in self.inputSockets:
+ if s != self.listenerSocket:
+ self.inputSockets.remove(s)
+ self.connection.pop(s)
+ s.close()
+ for s in self.outputSockets:
+ self.outputSockets.remove(s)
+ s.close()
+ for s in self.exceptSockets:
+ self.exceptSockets.remove(s)
+ s.close()
+
+
+ def introducePeer( self, ip ):
+ if Config.DEBUG > 1: print "Network:: introducing self to peer " + ip
+ try:
+ poke = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
+ poke.setblocking(0)
+ except socket.error, (value, message):
+ print "Network::introducePeer:: FAILED to open socket: " + message
+ return
+ if poke.connect_ex( (ip, WAIT_PORT) ): # failed to connect
+ gobject.timeout_add( 500, self._pokePeer, poke, ip, 0 )
+ else: # connected
+ if Config.DEBUG > 1: print "Netwtork:: introduction succeeded"
+ poke.close()
+
+ def _pokePeer( self, poke, ip, retry ):
+ if poke.connect_ex( (ip, WAIT_PORT) ): # failed to connect
+ if retry > 120: # give up
+ print "Network::introducePeer:: peer failed to respond after 60 seconds, giving up!"
+ else:
+ gobject.timeout_add( 500, self._pokePeer, poke, ip, retry+1 )
+ else: # connected
+ if Config.DEBUG > 1: print "Netwtork:: introduction succeeded"
+ poke.close()
+
+ return False
+
+
+ def addPeer( self, peer, address ):
+ if Config.DEBUG > 1: print "Network:: adding peer: %s" % address[0]
+ self.connection[peer] = Connection( peer, address )
+ self.inputSockets.append( peer )
+ self.listenerSocket.sendto( "REFRESH", ("localhost", LISTENER_PORT) )
+ #self.listener.updateSockets( self.inputSockets, self.outputSockets, self.exceptSockets )
+
+ def removePeer( self, peer ):
+ if Config.DEBUG > 1: print "Network:: removing peer: %s" % self.connection[peer].address[0]
+ self.connection.pop(peer)
+ self.inputSockets.remove(peer)
+ self.listenerSocket.sendto( "REFRESH", ("localhost", LISTENER_PORT) )
+ #self.listener.updateSockets( self.inputSockets, self.outputSockets, self.exceptSockets )
+
+ # register a status watcher, format: func( self, status, args )
+ def addWatcher( self, func ):
+ self.statusWatcher.append( func )
+
+ def removeWatcher( self, func ):
+ self.statusWatcher.remove( func )
+
+ # connect a message handler, format: func( self, sock, message, data )
+ def connectMessage( self, message, func ):
+ self.processMessage[message].append(func)
+
+ def connectMessageAfter( self, message, func, after ):
+ try:
+ ind = self.processMessage[message].index(after)
+ self.processMessage[message].insert(ind+1,func)
+ except:
+ print "Network::connectMessageAfter:: function not registered: " + str(after)
+
+ def connectMessageBefore( self, message, func, before ):
+ try:
+ ind = self.processMessage[message].index(before)
+ self.processMessage[message].insert(ind,func)
+ except:
+ print "Network::connectMessageBefore:: function not registered: " + str(before)
+
+ def disconnectMessage( self, message, func ):
+ try:
+ self.processMessage[message].remove(func)
+ except:
+ print "Network::disconnectMessage:: function not registered: " + str(func)
+
+ def isOffline( self ):
+ if self.mode == MD_OFFLINE: return True
+ return False
+
+ def isOnline( self ):
+ if self.mode != MD_OFFLINE: return True
+ return False
+
+ def isHost( self ):
+ if self.mode == MD_HOST: return True
+ return False
+
+ def isPeer( self ):
+ if self.mode == MD_PEER: return True
+ return False
+
+ def isWaiting( self ):
+ if self.mode == MD_WAIT: return True
+ return False
+
+
+ #-----------------------------------------------------------------------
+ # Message Senders
+
+ # basic send function
+ # - message type will be automatically inserted before the data
+ # - message size will be automatically inserted if applicable
+ # - to is only defined in HOST mode
+ def send( self, message, data = "", to = None ):
+ if self.mode == MD_OFFLINE:
+ return
+
+ length = len(data)
+ size = MSG_SIZE[message]
+
+ if size >= 0:
+ if length != size:
+ print "Network:: message wrong length! Got %d expected %d: %s" % (len(data), MSG_SIZE[message], MSG_NAME[message])
+ return
+ msg = chr(message) + data
+ elif size == -1:
+ if length > 255:
+ print "Network:: oversized message! Got %d, max size 255: %s" % (length, MSG_NAME[message])
+ return
+ msg = chr(message) + chr(length) + data
+ else: # size == -2
+ self.packer.pack_uint(size)
+ msg = chr(message) + self.packer.get_buffer() + data
+ self.packer.reset()
+
+ if self.mode == MD_PEER:
+ try:
+ self.socket.send( msg )
+ #print "Network:: sent %d bytes: %s" % (len(msg),msg)
+ except socket.error, (value, errmsg):
+ print "Network:: FAILED to send message (%s) to %s: %s" % (MSG_NAME[message], self.hostAddress[0], errmsg)
+ # TODO something intelligent
+ else: # MD_HOST
+ try:
+ to.send( msg )
+ #print "Network:: sent %d bytes: %s" % (len(msg),msg)
+ except socket.error, (value, errmsg):
+ print "Network:: FAILED to send message (%s) to %s: %s" % (MSG_NAME[message], self.connection[to].address[0], errmsg)
+ # TODO something intelligent
+
+
+ def sendAll( self, message, data = "" ):
+ if self.mode != MD_HOST:
+ return
+
+ length = len(data)
+ size = MSG_SIZE[message]
+
+ if size >= 0:
+ if length != size:
+ print "Network:: message wrong length! Got %d expected %d: %s" % (MSG_SIZE[message], len(data), MSG_NAME[message])
+ return
+ msg = chr(message) + data
+ elif size == -1:
+ if length > 255:
+ print "Network:: oversized message! Size %d, max size 255: %s" % (length, MSG_NAME[message])
+ return
+ msg = chr(message) + chr(length) + data
+ else: # size == -2
+ self.packer.pack_uint(size)
+ msg = chr(message) + self.packer.get_buffer() + data
+ self.packer.reset()
+
+ for sock in self.connection:
+ if sock == self.socket:
+ continue
+ try:
+ sock.send( msg )
+ except socket.error, (value, errmsg):
+ print "Network:: FAILED to send message (%s) to %s: %s" % (MSG_NAME[message], self.connection[sock].address[0], errmsg)
+ # TODO something intelligent
+
+ def sendLatencyQuery( self, handler ):
+ if self.mode != MD_PEER:
+ return
+
+ self.packer.pack_float(random.random())
+ hash = self.packer.get_buffer()
+ self.packer.reset()
+ self.latencyQueryHandler[hash] = handler
+ self.latencyQueryStart[hash] = time.time()
+ self.send(PR_LATENCY_QUERY,hash)
+
+ #-----------------------------------------------------------------------
+ # Message Handlers
+
+ def _processSockets( self, inputReady, outputReady, exceptReady ):
+
+ self._fromListener = True
+
+ if self.mode == MD_HOST:
+
+ for s in inputReady:
+ if s == self.socket:
+ # accept new connections
+ try:
+ peer, address = self.socket.accept()
+ self.addPeer( peer, address )
+ except socket.error, (value, message):
+ print "Network:: error accepting connection: " + message
+
+ else:
+ try:
+ data = s.recv(MAX_SIZE)
+ #print "Network:: recv %d bytes: %s" % (len(data), data)
+ if not len(data): # no data to read, socket must be closed
+ self.removePeer(s)
+ else:
+ self.processStream( s, data )
+ except socket.error, (value, message):
+ print "Network:: error reading data: " + message
+
+ elif self.mode == MD_PEER:
+
+ for s in inputReady:
+ try:
+ data = s.recv(MAX_SIZE)
+ if not len(data): # no data to read, socket must be closed
+ self.setMode( MD_OFFLINE )
+ else:
+ #print "Network:: recv %d bytes: %s" % (len(data), data)
+ self.processStream( s, data )
+ except socket.error, (value, message):
+ print "Network:: error reading data: " + message
+
+ else: # MD_WAIT
+
+ for s in inputReady:
+ try:
+ peer, address = self.socket.accept()
+ self.setMode( MD_PEER, (address[0], PORT) )
+ except socket.error, (value, message):
+ print "Network:: error accepting connection: " + message
+
+ self._fromListener = False
+
+
+ def processStream( self, sock, newData = "" ):
+ con = self.connection[sock]
+ con.recvBuf += newData
+
+ if con.waitingForData == -1: # message size in char
+ con.waitingForData = ord(con.recvBuf[0])
+ con.recvBuf = con.recvBuf[1:]
+
+ elif con.waitingForData == -2: # message size in uint
+ if len(con.recvBuf) >= 4:
+ self.unpacker.reset(con.recvBuf[0:4])
+ con.waitingForData = self.unpacker.unpack_uint()
+ con.recvBuf = con.recvBuf[4:]
+ else:
+ return # wait for more data
+
+ elif con.waitingForData:
+ if len(con.recvBuf) >= con.waitingForData:
+ data = con.recvBuf[0:con.waitingForData]
+ con.recvBuf = con.recvBuf[con.waitingForData:]
+ con.waitingForData = 0
+ for func in self.processMessage[con.message]:
+ gobject.idle_add( func, sock, con.message, data )
+ else:
+ return # wait for more data
+
+ else:
+ con.message = ord(con.recvBuf[0])
+ if MSG_SIZE[con.message] == 0:
+ con.recvBuf = con.recvBuf[1:]
+ for func in self.processMessage[con.message]:
+ gobject.idle_add( func, sock, con.message, "" )
+ else:
+ con.waitingForData = MSG_SIZE[con.message]
+ con.recvBuf = con.recvBuf[1:]
+
+ if len(con.recvBuf):
+ self.processStream( sock )
+
+ #-- HOST handlers ------------------------------------------------------
+ def processPR_LATENCY_QUERY( self, sock, message, data ):
+ self.send( HT_LATENCY_REPLY, data, sock )
+
+ #-- PEER handlers ------------------------------------------------------
+ def processHT_LATENCY_REPLY( self, sock, message, data ):
+ t = time.time()
+ latency = t - self.latencyQueryStart[data]
+ #print "got latency reply %d" % (latency*1000)
+ self.latencyQueryHandler[data]( latency )
+ self.latencyQueryHandler.pop(data)
+ self.latencyQueryStart.pop(data)
+
+
diff --git a/common/Util/NoteDB.py b/common/Util/NoteDB.py
new file mode 100644
index 0000000..e62ca32
--- /dev/null
+++ b/common/Util/NoteDB.py
@@ -0,0 +1,811 @@
+
+import common.Config as Config
+
+class PARAMETER:
+ PAGE_BEATS, \
+ PAGE_COLOR, \
+ ONSET, \
+ PITCH, \
+ AMPLITUDE, \
+ DURATION, \
+ INSTRUMENT, \
+ PAN, \
+ REVERB, \
+ ATTACK, \
+ DECAY, \
+ FILTERTYPE, \
+ FILTERCUTOFF, \
+ INSTRUMENT2 \
+ = range(14) #python-stye enum
+
+class Note:
+ def __init__( self, page, track, id, cs ):
+ self.page = page
+ self.track = track
+ self.id = id
+ self.cs = cs
+
+ self.csStack = []
+
+ def pushState( self ):
+ self.csStack.append( self.cs.clone() )
+
+ def popState( self ):
+ self.cs = self.csStack.pop()
+
+class Page:
+ def __init__( self, beats, color = 0, instruments = False, local = True ): # , tempo, insruments, color = 0 ):
+ self.beats = beats
+ self.ticks = beats*Config.TICKS_PER_BEAT
+
+ self.color = color
+
+ if not instruments:
+ self.instruments = [ Config.INSTRUMENTS["kalimba"].instrumentId for i in range(Config.NUMBER_OF_TRACKS-1) ] + [ Config.INSTRUMENTS["drum1kit"].instrumentId ]
+ else:
+ self.instruments = instruments[:]
+
+ self.local = local # page local/global?
+
+ self.nextNoteId = 0 # first note will be 1
+
+ def genId( self ):
+ self.nextNoteId += 1
+ if self.nextNoteId == 65536: # short
+ print "note id overflow!"
+ # TODO think of how to handle this!?
+ return self.nextNoteId
+
+ def setLocal( self, local ):
+ self.local = local
+
+class PageListener:
+ def notifyPageAdd( self, id, at ):
+ pass
+
+ def notifyPageDelete( self, which, safe ):
+ pass
+
+ def notifyPageDuplicate( self, new, at ):
+ pass
+
+ def notifyPageMove( self, which, low, high ):
+ pass
+
+ def notifyPageUpdate( self, which, parameter, value ):
+ pass
+
+class NoteListener:
+ def notifyNoteAdd( self, page, track, id ):
+ pass
+ def notifyNoteDelete( self, page, track, id ):
+ pass
+ def notifyNoteUpdate( self, page, track, id, parameter, value ):
+ pass
+
+class NoteDB:
+ def __init__( self ):
+ self.noteD = {} # bins containing all the notes by page, track, and id
+ # structure self.noteD[pageId][trackIndex][noteId]
+
+ self.noteS = {} # bins containing all the notes by page and track
+ # first sorted by onset then by pitch (for drum hits)
+ # structure self.noteS[pageId][trackIndex][noteIndex]
+
+ self.pages = {} # dict of Pages indexed by pageId
+
+ self.tune = [] # list of pageIds ordered by tune
+
+ #self.beatsBefore = {} # count of beats on previous pages indexed by page id
+
+ self.listeners = [] # complete list of listeners
+ self.pageListeners = [] # list of listeners who want page notifications
+ self.noteListeners = [] # list of listeners who want note notifications
+ self.parasiteList = {} # dict of parasites indexed by listener
+
+ self.parasiteD = {} # bin of parasites indexed by listener
+ self.parasiteS = {} # parasites sorted as in self.noteS,
+
+ self.nextId = 0 # base id, first page will be 1
+
+ self.clipboard = [] # stores copied cs notes
+ self.clipboardArea = [] # stores the limits and tracks for each page in the clipboard
+
+ def dumpToStream( self, ostream, localOnly = False ):
+ for pid in self.tune:
+ if not localOnly or self.pages[pid].local:
+ ostream.page_add(pid, self.pages[pid])
+ for note in self.getNotesByPage( pid ):
+ ostream.note_add( note )
+
+ #-- private --------------------------------------------
+ def _genId( self ):
+ self.nextId += 1
+ if self.nextId == 65536: # short
+ print "page id overflow!"
+ # TODO think of how to handle this!?
+ return self.nextId
+
+ #=======================================================
+ # Page Functions
+
+ def addPage( self, pid, page, after = False ):
+ pid = self._newPage( pid, page )
+ at = self._insertPage( pid, after )
+
+ #self._updateBeatsBefore( at )
+
+ for l in self.pageListeners:
+ l.notifyPageAdd( pid, at )
+
+ return pid
+
+ def deletePages( self, which, instruments = False ):
+ beats = self.pages[self.tune[0]].beats
+
+ low = 999999
+ ind = -1
+ for id in which:
+ ind = self.tune.index(id)
+ if ind < low: low = ind
+
+ for t in range(Config.NUMBER_OF_TRACKS):
+ for n in self.noteD[id][t].keys():
+ self.deleteNote( id, t, n )
+
+ #del self.beatsBefore[id]
+
+ del self.noteD[id]
+ del self.noteS[id]
+ del self.parasiteD[id]
+ del self.parasiteS[id]
+ del self.pages[id]
+
+ at = self.tune.index( id )
+ self.tune.pop(at)
+
+ if not len(self.tune):
+ self.addPage( -1, Page(beats, instruments = instruments) ) # always have at least one page
+ safe = self.tune[0]
+ #self._updateBeatsBefore(0)
+ else:
+ safe = self.tune[max(ind-1,0)]
+ #self._updateBeatsBefore(low)
+
+ for l in self.pageListeners:
+ l.notifyPageDelete( which, safe )
+
+ def duplicatePages( self, which, after = False ):
+ sorted = []
+ if after: first = self.tune.index(after)+1
+ else: first = 0
+
+ i = j = 0
+ while i < len(self.tune) and j < len(which):
+ if self.tune[i] in which:
+ sorted.append(self.tune[i])
+ j += 1
+ i += 1
+
+ new = {}
+ for cp in sorted:
+ id = self._newPage( -1, Page(self.pages[cp].beats,self.pages[cp].color,self.pages[cp].instruments) )
+ self._insertPage( id, after )
+ after = id
+ new[cp] = id
+
+ #self._updateBeatsBefore( first )
+
+ for l in self.pageListeners:
+ l.notifyPageDuplicate( new, first )
+
+ for cp in sorted:
+ for t in range(Config.NUMBER_OF_TRACKS):
+ for n in self.noteD[cp][t].keys():
+ self.duplicateNote( cp, t, n, new[cp], t, 0 )
+
+ return new
+
+ def movePages( self, which, after = False ):
+ sorted = []
+ if after: at = self.tune.index(after)+1
+ else: at = 0
+ low = high = at
+
+ i = j = 0
+ while i < len(self.tune):
+ if self.tune[i] in which:
+ sorted.append(self.tune[i])
+ self.tune.pop(i)
+ if i < low: low = i
+ if i > high: high = i
+ if i < at: at -= 1
+ j += 1
+ else:
+ i += 1
+
+ self.tune = self.tune[:at] + sorted + self.tune[at:]
+
+ #self._updateBeatsBefore( low )
+
+ for l in self.pageListeners:
+ l.notifyPageMove( sorted, low, high )
+
+ def updatePage( self, page, parameter, value ):
+ if parameter == PARAMETER.PAGE_BEATS:
+ ticks = value*Config.TICKS_PER_BEAT
+ if self.pages[page].beats > value: # crop some notes
+ dstream = []
+ ustream = []
+ for track in range(Config.NUMBER_OF_TRACKS):
+ dsub = []
+ usub = []
+ for note in self.getNotesByTrack(page, track):
+ if ticks <= note.cs.onset:
+ dsub.append( note.id )
+ elif ticks < note.cs.onset + note.cs.duration:
+ usub.append( note.id )
+ usub.append( ticks - note.cs.onset )
+ if len(dsub):
+ dstream += [ page, track, len(dsub) ] + dsub
+ if len(usub):
+ ustream += [ page, track, PARAMETER.DURATION, len(usub)//2 ] + usub
+ if len(dstream):
+ self.deleteNotes( dstream + [-1] )
+ if len(ustream):
+ self.updateNotes( ustream + [-1] )
+
+ self.pages[page].beats = value
+ self.pages[page].ticks = ticks
+ #self._updateBeatsBefore(self.tune.index(page))
+ elif parameter == PARAMETER.PAGE_COLOR:
+ self.pages[page].color = value
+
+ for l in self.pageListeners:
+ l.notifyPageUpdate( page, parameter, value )
+
+ # stream format:
+ # parameter id
+ # number of following pages (N)
+ # page id
+ # value
+ def updatePages( self, stream ):
+ i = [-1]
+ parameter = self._readstream(stream,i)
+ N = self._readstream(stream,i)
+ for j in range(N):
+ page = self._readstream(stream,i)
+ val = self._readstream(stream,i)
+ self.updatePage( page, parameter, val )
+
+ def getInstruments(self, pages):
+ dict = {}
+ for page in pages:
+ list = []
+ for track in range(Config.NUMBER_OF_TRACKS):
+ list.append(Config.INSTRUMENTSID[self.pages[page].instruments[track]].name)
+ dict[page] = list[:]
+ return dict
+
+ #-- private --------------------------------------------
+ def _newPage( self, pid, page ):
+ if pid == -1 : pid = self._genId()
+ self.pages[pid] = page
+ self.noteD[pid] = [ {} for i in range(Config.NUMBER_OF_TRACKS) ]
+ self.noteS[pid] = [ [] for i in range(Config.NUMBER_OF_TRACKS) ]
+ self.parasiteD[pid] = [ {} for i in range(Config.NUMBER_OF_TRACKS) ]
+ self.parasiteS[pid] = [ {} for i in range(Config.NUMBER_OF_TRACKS) ]
+ for i in range(Config.NUMBER_OF_TRACKS):
+ for par in self.parasiteList.keys():
+ self.parasiteD[pid][i][par] = {}
+ self.parasiteS[pid][i][par] = []
+ return pid
+
+ def _insertPage( self, pid, after ):
+ if not after: at = 0
+ else: at = self.tune.index(after)+1
+ self.tune.insert( at, pid )
+
+ return at
+
+ #def _updateBeatsBefore( self, ind ):
+ # if ind == 0: beats = 0
+ # else: beats = self.beatsBefore[self.tune[ind-1]] + self.pages[self.tune[ind-1]].beats
+ # for i in range(ind, len(self.tune)):
+ # self.beatsBefore[self.tune[ind]] = beats
+ # beats += self.pages[self.tune[ind]].beats
+
+
+
+ #=======================================================
+ # Track Functions
+
+ def setInstrument( self, pages, track, instrumentId ):
+ stream = []
+ for page in pages:
+ self.pages[page].instruments[track] = instrumentId
+ notes = self.getNotesByTrack( page, track )
+ sub = []
+ for note in notes:
+ sub.append( note.id )
+ sub.append( instrumentId )
+ if len(sub):
+ stream += [ page, track, PARAMETER.INSTRUMENT, len(sub)//2 ] + sub
+ if len(stream):
+ self.updateNotes( stream + [-1] )
+
+ def setInstrument2( self, pages, track, instrumentId ):
+ stream = []
+ for page in pages:
+ #self.pages[page].instruments[track] = instrumentId
+ notes = self.getNotesByTrack( page, track )
+ sub = []
+ for note in notes:
+ sub.append( note.id )
+ sub.append( instrumentId )
+ if len(sub):
+ stream += [ page, track, PARAMETER.INSTRUMENT2, len(sub)//2 ] + sub
+ if len(stream):
+ self.updateNotes( stream + [-1] )
+
+ #=======================================================
+ # Note Functions
+
+ def addNote( self, nid, page, track, cs, hint = False ):
+ if nid == -1: nid = self.pages[page].genId()
+ n = self.noteD[page][track][nid] = Note( page, track, nid, cs )
+
+ if not hint: at = 0
+ else: at = hint[0]
+ while at > 0:
+ onset = self.noteS[page][track][at-1].cs.onset
+ if onset <= cs.onset:
+ if onset <= cs.onset: break
+ elif self.noteS[page][track][at-1].cs.pitch <= cs.pitch: break
+ at -= 1
+ last = len(self.noteS[page][track])
+ while at < last:
+ onset = self.noteS[page][track][at].cs.onset
+ if onset >= cs.onset:
+ if onset > cs.onset: break
+ elif self.noteS[page][track][at].cs.pitch > cs.pitch: break
+ at += 1
+
+ self.noteS[page][track].insert( at, n )
+
+ for par in self.parasiteList.keys():
+ parasite = self.parasiteList[par]( self, par, n )
+ self.parasiteD[page][track][par][nid] = parasite.attach() # give parasites the option of return something other than themselves
+ self.parasiteS[page][track][par].insert( at, parasite.attach() )
+
+ if hint: hint[0] = at + 1 # assume the next note will fall after this one
+
+ for l in self.noteListeners:
+ l.notifyNoteAdd( page, track, nid )
+
+ return nid
+
+ # stream format:
+ # page id
+ # track index
+ # number of following notes (N)
+ # cs pointer
+ # ... up to N
+ # page id or -1 to exit
+ def addNotes( self, stream ):
+ new = {}
+ i = [-1]
+ p = self._readstream(stream,i)
+ while p != -1:
+ if p not in new:
+ new[p] = [ [] for x in range(Config.NUMBER_OF_TRACKS) ]
+ t = self._readstream(stream,i)
+ N = self._readstream(stream,i)
+ hint = [0]
+ for j in range(N):
+ new[p][t].append( self.addNote( -1, p, t, self._readstream(stream,i), hint ) )
+ p = self._readstream(stream,i)
+
+ return new
+
+ def deleteNote( self, page, track, id ):
+ ind = self.noteS[page][track].index( self.noteD[page][track][id] )
+
+ for par in self.parasiteList.keys():
+ self.parasiteD[page][track][par][id].destroy()
+ self.parasiteS[page][track][par].pop(ind)
+ del self.parasiteD[page][track][par][id]
+
+ self.noteS[page][track].pop(ind)
+ del self.noteD[page][track][id]
+
+ for l in self.noteListeners:
+ l.notifyNoteDelete( page, track, id )
+
+ # stream format:
+ # page id
+ # track index
+ # number of following notes (N)
+ # note id
+ # ... up to N
+ # page id or -1 to exit
+ def deleteNotes( self, stream ):
+ i = [-1]
+ p = self._readstream(stream,i)
+ while p != -1:
+ t = self._readstream(stream,i)
+ N = self._readstream(stream,i)
+ for j in range(N):
+ self.deleteNote( p, t, self._readstream(stream,i) )
+ p = self._readstream(stream,i)
+
+ def deleteNotesByTrack( self, pages, tracks ):
+ for p in pages:
+ for t in tracks:
+ notes = self.noteS[p][t][:]
+ for n in notes:
+ self.deleteNote( p, t, n.id )
+
+ def duplicateNote( self, page, track, id, toPage, toTrack, offset ):
+ cs = self.noteD[page][track][id].cs.clone()
+ cs.trackId = toTrack
+ cs.pageId = toPage
+ cs.onset += offset
+ ticks = self.pages[toPage].ticks
+ if cs.onset >= ticks: return False # off the end of the page
+ if cs.onset + cs.duration > ticks:
+ cs.duration = ticks - cs.onset
+
+ return self.addNote( -1, toPage, toTrack, cs )
+
+ # stream format:
+ # page id
+ # track index
+ # toPage id
+ # toTrack index
+ # offset
+ # number of following notes (N)
+ # note id
+ # ... up to N
+ # page id or -1 to exit
+ def duplicateNotes( self, stream ):
+ i = [-1]
+ p = self._readstream(stream,i)
+ while p != -1:
+ t = self._readstream(stream,i)
+ toP = self._readstream(stream,i)
+ toT = self._readstream(stream,i)
+ offset = self._readstream(stream,i)
+ N = self._readstream(stream,i)
+ for j in range(N):
+ self.duplicateNote( p, t, self._readstream(stream,i), toP, toT, offset )
+ p = self._readstream(stream,i)
+
+
+ def updateNote( self, page, track, id, parameter, value ):
+ if parameter == PARAMETER.ONSET:
+ self.noteD[page][track][id].cs.onset = value
+ self._resortNote( page, track, id )
+ elif parameter == PARAMETER.PITCH:
+ self.noteD[page][track][id].cs.pitch= value
+ self._resortNote( page, track, id )
+ elif parameter == PARAMETER.AMPLITUDE:
+ self.noteD[page][track][id].cs.amplitude = value
+ elif parameter == PARAMETER.DURATION:
+ self.noteD[page][track][id].cs.duration = value
+ elif parameter == PARAMETER.INSTRUMENT:
+ self.noteD[page][track][id].cs.instrumentId = value
+ elif parameter == PARAMETER.PAN:
+ self.noteD[page][track][id].cs.pan = value
+ elif parameter == PARAMETER.REVERB:
+ self.noteD[page][track][id].cs.reverbSend = value
+ elif parameter == PARAMETER.ATTACK:
+ self.noteD[page][track][id].cs.attack = value
+ elif parameter == PARAMETER.DECAY:
+ self.noteD[page][track][id].cs.decay = value
+ elif parameter == PARAMETER.FILTERTYPE:
+ self.noteD[page][track][id].cs.filterType = value
+ elif parameter == PARAMETER.FILTERCUTOFF:
+ self.noteD[page][track][id].cs.filterCutoff = value
+ elif parameter == PARAMETER.INSTRUMENT2:
+ self.noteD[page][track][id].cs.instrumentId2 = value
+
+ for par in self.parasiteList.keys():
+ self.parasiteD[page][track][par][id].updateParameter( parameter, value )
+
+ for l in self.noteListeners:
+ l.notifyNoteUpdate( page, track, id, parameter, value )
+
+ # stream format:
+ # page id
+ # track index
+ # parameter id
+ # number of following notes (N)
+ # note id
+ # value
+ # ... up to N
+ # page id or -1 to exit
+ def updateNotes( self, stream ):
+ i = [-1]
+ p = self._readstream(stream,i)
+ while p != -1:
+ t = self._readstream(stream,i)
+ param = self._readstream(stream,i)
+ N = self._readstream(stream,i)
+ for j in range(N):
+ self.updateNote( p, t, self._readstream(stream,i), param, self._readstream(stream,i) )
+ p = self._readstream(stream,i)
+
+ #-- private --------------------------------------------
+ def _readstream( self, stream, i ):
+ i[0] += 1
+ return stream[i[0]]
+
+ def _resortNote( self, page, track, id ):
+ ins = out = self.noteS[page][track].index(self.noteD[page][track][id])
+ cs = self.noteD[page][track][id].cs
+ while ins > 0: # check backward
+ onset = self.noteS[page][track][ins-1].cs.onset
+ if onset <= cs.onset:
+ if onset <= cs.onset: break
+ elif self.noteS[page][track][ins-1].cs.pitch <= cs.pitch: break
+ ins -= 1
+ if ins == out: # check forward
+ ins += 1
+ last = len(self.noteS[page][track])
+ while ins < last:
+ onset = self.noteS[page][track][ins].cs.onset
+ if onset >= cs.onset:
+ if onset > cs.onset: break
+ elif self.noteS[page][track][ins].cs.pitch > cs.pitch: break
+ ins += 1
+
+ if ins != out: # resort
+ if ins > out: ins -= 1
+ n = self.noteS[page][track].pop( out )
+ self.noteS[page][track].insert( ins, n )
+ for par in self.parasiteList.keys():
+ p = self.parasiteS[page][track][par].pop( out )
+ self.parasiteS[page][track][par].insert( ins, p )
+
+
+ #=======================================================
+ # Clipboard Functions
+
+ # stream format:
+ # page id
+ # track index
+ # number of following notes (N)
+ # note id
+ # ... up to N
+ # page id or -1 to exit
+ def notesToClipboard( self, stream ):
+ self.clipboard = []
+ self.clipboardArea = []
+ i = [-1]
+ pages = []
+ p = self._readstream(stream,i)
+ while p != -1:
+ if p not in pages:
+ page = [ [] for x in range(Config.NUMBER_OF_TRACKS) ]
+ pageArea = { "limit": [ 99999, 0 ],
+ "tracks": [ 0 for x in range(Config.NUMBER_OF_TRACKS) ] }
+ pages.append(p)
+ self.clipboard.append(page)
+ self.clipboardArea.append(pageArea)
+ else:
+ ind = pages.index(p)
+ page = self.clipboard[ind]
+ pageArea = self.clipboardArea[ind]
+ t = self._readstream(stream,i)
+ pageArea["tracks"][t] = 1
+ N = self._readstream(stream,i)
+ for j in range(N):
+ cs = self.noteD[p][t][self._readstream(stream,i)].cs.clone()
+ if cs.onset < pageArea["limit"][0]: pageArea["limit"][0] = cs.onset
+ if cs.onset + cs.duration > pageArea["limit"][1]: pageArea["limit"][1] = cs.onset + cs.duration
+ page[t].append( cs )
+ p = self._readstream(stream,i)
+
+ return self.clipboardArea
+
+ def tracksToClipboard( self, pages, tracks ):
+ self.clipboard = []
+ self.clipboardOrigin = [ 0, 0 ]
+ self.clipboardArea = []
+ for p in pages:
+ page = [ [] for x in range(Config.NUMBER_OF_TRACKS) ]
+ pageArea = { "limit": [ 0, 99999 ],
+ "tracks": [ 0 for x in range(Config.NUMBER_OF_TRACKS) ] }
+ self.clipboard.append(page)
+ self.clipboardArea.append(pageArea)
+ for t in tracks:
+ pageArea["tracks"][t] = 1
+ for id in self.noteD[p][t]:
+ cs = self.noteD[p][t][id].cs.clone()
+ page[t].append( cs )
+
+ return self.clipboardArea
+
+ # trackMap = { X: Y, W: Z, ... }; X,W are track indices, Y,Z are clipboard indices
+ # instrumentMap = { X: Y, W: Z, ... }; X,W are track indices, Y,Z are instrument ids
+ def pasteClipboard( self, pages, offset, trackMap, instrumentMap = {} ):
+ if not len(self.clipboard): return
+
+ deleteStream = []
+ updateStream = []
+ addStream = []
+
+ pp = 0
+ ppMax = len(self.clipboard)
+ for p in pages:
+ ticks = self.pages[p].ticks
+ area = self.clipboardArea[pp]
+ area["limit"][0] += offset
+ area["limit"][1] += offset
+ for t in trackMap.keys():
+ if not area["tracks"][trackMap[t]]: continue
+ if instrumentMap.has_key(t):
+ updateInstrument = True
+ instrumentId = instrumentMap[t]
+ else:
+ updateInstrument = False
+ tdeleteStream = []
+ tupdateOStream = []
+ tupdateDStream = []
+ taddStream = []
+ # clear area
+ for n in self.noteS[p][t]:
+ start = n.cs.onset
+ end = start + n.cs.duration
+ if area["limit"][0] <= start < area["limit"][1]: start = area["limit"][1]
+ if area["limit"][0] < end <= area["limit"][1]: end = area["limit"][0]
+ if start < area["limit"][0] and end > area["limit"][1]: end = area["limit"][0]
+ if end <= start:
+ tdeleteStream.append( n.id )
+ elif start != n.cs.onset:
+ tupdateDStream += [ n.id, end - start ]
+ tupdateOStream += [ n.id, start ]
+ elif end != start + n.cs.duration:
+ tupdateDStream += [ n.id, end - start ]
+ if len(tdeleteStream):
+ deleteStream += [ p, t, len(tdeleteStream) ] + tdeleteStream
+ if len(tupdateOStream):
+ updateStream += [ p, t, PARAMETER.ONSET, len(tupdateOStream)//2 ] + tupdateOStream
+ if len(tupdateDStream):
+ updateStream += [ p, t, PARAMETER.DURATION, len(tupdateDStream)//2 ] + tupdateDStream
+ # paste notes
+ for cs in self.clipboard[pp][trackMap[t]]:
+ newcs = cs.clone()
+ newcs.onset += offset
+ if newcs.onset >= ticks: continue
+ if newcs.onset + newcs.duration > ticks:
+ newcs.duration = ticks - newcs.onset
+ newcs.pageId = p
+ newcs.trackId = t
+ if updateInstrument:
+ newcs.instrumentId = instrumentId
+ # TODO update any other parameters?
+ taddStream.append( newcs )
+ if len(taddStream):
+ addStream += [ p, t, len(taddStream) ] + taddStream
+
+ pp += 1
+ if pp == ppMax: pp -= ppMax
+
+
+
+ if len(deleteStream):
+ self.deleteNotes( deleteStream + [-1] )
+ if len(updateStream):
+ self.updateNotes( updateStream + [-1] )
+ if len(addStream):
+ return self.addNotes( addStream + [-1] )
+
+ return None
+
+ def getClipboardArea( self, ind ):
+ N = len(self.clipboardArea)
+ while ind >= N: ind -= N
+ return self.clipboardArea[ind]
+
+ #=======================================================
+ # Listener Functions
+
+ def addListener( self, listener, parasite = None, page = False, note = False ):
+ if listener in self.listeners:
+ return # only one listener per object
+
+ if parasite:
+ self.parasiteList[listener] = parasite
+ self._addParasite( listener, parasite )
+
+ if page: self.pageListeners.append( listener )
+ if note: self.noteListeners.append( listener )
+ self.listeners.append( listener )
+
+ def deleteListener( self, listener ):
+ self.listeners.remove( listener )
+ if listener in self.pageListeners:
+ self.pageListeners.remove( listener )
+ if listener in self.noteListeners:
+ self.noteListeners.remove( listener )
+ if self.parasites.has_key( listener ):
+ self._deleteParasite( listener )
+ del self.parasiteList[listener]
+
+ #-- private --------------------------------------------
+ def _addParasite( self, listener, parasite ):
+ for p in self.tune:
+ for t in range(Config.NUMBER_OF_TRACKS):
+ self.parasiteD[p][t][listener] = {}
+ self.parasiteS[p][t][listener] = []
+ for n in self.noteD[p][t].keys():
+ parasite( self, listener, self.noteD[p][t][n] )
+ self.parasiteD[p][t][listener][n] = parasite.attach() # give parasites the option of returning something other than themselves
+ self.parasiteS[p][t][listener].insert( self.noteS[p][t].index( self.noteD[p][t][n]), parasite.attach() )
+
+ def _deleteParasite( self, listener ):
+ for p in self.tune:
+ for t in range(Config.NUMBER_OF_TRACKS):
+ for n in self.notes[p][t].keys():
+ self.parasiteD[p][t][listener][n].destroy()
+ del self.parasiteD[p][t][listener]
+ del self.parasiteS[p][t][listener]
+
+ #=======================================================
+ # Get Functions
+
+ def getPageCount( self ):
+ return len(self.pages)
+
+ def getTune( self ):
+ return self.tune
+
+ def getPage( self, page ):
+ return self.pages[page]
+
+ def getPageByIndex( self, ind ):
+ return self.tune[ind]
+
+ def getPageIndex( self, page ):
+ return self.tune.index(page)
+
+ # Not sure if this is useful!
+ #def getBeatsBeforePage( self, page ):
+ # return self.beatsBefore[page]
+
+ def getNote( self, page, track, id, listener = None ):
+ if listener:
+ return self.parasiteD[page][track][listener][id]
+ return self.noteD[page][track][id]
+
+ def getNotesByPage( self, page, listener = None ):
+ notes = []
+ if listener:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ notes.extend( self.parasiteS[page][i][listener] )
+ else:
+ for i in range(Config.NUMBER_OF_TRACKS):
+ notes.extend( self.noteS[page][i] )
+ return notes
+
+
+ def getNotesByTrack( self, page, track, listener = None ):
+ if listener:
+ return self.parasiteS[page][track][listener]
+ else:
+ return self.noteS[page][track]
+
+ def getNotes(self, listener = None ):
+ notes = []
+ for p in self.pages:
+ notes.extend( self.getNotesByPage(p, listener ) )
+ return notes
+
+
+ def getCSNotesByPage( self, page ):
+ return map( lambda n: n.cs, self.getNotesByPage( page ) )
+
+ def getCSNotesByTrack( self, page, track ):
+ return map( lambda n: n.cs, self.getNotesByTrack( page, track ) )
diff --git a/common/Util/NoteLooper.py b/common/Util/NoteLooper.py
new file mode 100644
index 0000000..be6f0b6
--- /dev/null
+++ b/common/Util/NoteLooper.py
@@ -0,0 +1,199 @@
+import pickle
+import time
+import bisect
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import gobject
+
+import common.Config as Config
+from common.Util.CSoundNote import CSoundNote #maybe not actually used, but dependence is there. All notes are assumed to be CSoundNotes
+from common.Generation.GenerationConstants import GenerationConstants
+
+#------------------------------------------------------------------------------
+# A base class used to play a collection of Events at their respective onsets
+#------------------------------------------------------------------------------
+class NoteLooper_DONTUSE:
+
+ #PRIVATE
+ DRIFT = 0.01 #careful about changing this... coordinate with instrument 5777
+
+ #PUBLIC
+
+ def __init__( self, range_sec, ticks_per_sec ):
+ self.ticks_per_sec = ticks_per_sec # ticks last this long
+ self.secs_per_tick = 1.0 / ticks_per_sec # precomputed inverse
+ self.range_sec = range_sec # notes are checked-for, this many seconds in advance
+
+ self.duration = 0 # number of ticks in playback loop
+ self.loops = 0 # number of elapsed loops
+ self.notes = [] # sorted list of (onset, noteptr, cache)
+
+ self.time0 = time.time() + 1000000 # the real time at which tick == 0 (sometimes retro-active)
+
+ #self.time_start # remember to call NoteLooper.startTime
+ # at the same time as you call
+ # CSoundClient.startTime()
+ def setTick( self, tick ):
+ time_time = time.time()
+ self.time0 = time_time - tick * self.secs_per_tick
+ self.loops = tick // self.duration
+ self.hIdx = bisect.bisect_left(self.notes, tick - self.duration * self.loops )
+
+ def setRate( self, ticks_per_sec):
+ if ticks_per_sec != self.ticks_per_sec:
+ secs_per_tick = 1.0 / ticks_per_sec
+
+ time_time = time.time()
+ curtick = self.getTick( time_time, False )
+ curticktime = curtick * self.secs_per_tick + self.time0
+
+ self.ticks_per_sec = ticks_per_sec
+ self.secs_per_tick = secs_per_tick
+ self.time0 = curticktime - curtick * secs_per_tick
+ self.notes = [ (o,n,'',z) for (o,n,c,z) in self.notes ] #clear cache
+ self.loops = 0
+
+ def setDuration( self, duration ):
+ self.time0 += self.loops * self.duration * self.secs_per_tick
+ self.loops = 0
+ self.duration = duration
+
+ def getTick(self, t, domod): #t is for time
+ if domod :
+ return ( int( ( t - self.time0 ) * self.ticks_per_sec ) ) % self.duration
+ else :
+ return ( int( ( t - self.time0 ) * self.ticks_per_sec ) )
+
+ def next( self ) :
+ time_time = time.time()
+ #tickhorizon is tick where we'll be after range_sec
+ tickhorizon = self.getTick( self.range_sec + time_time, False )
+ time0_time = self.time0 - self.time_start + self.DRIFT
+
+ if tickhorizon < 0 : return []
+ if len(self.notes) == 0 : return []
+
+ def cache_cmd(secs_per_tick, amplitude, pitch, inst, trackId, duration, tied, fullDuration, overlap, attack, decay, reverbSend, filterType, filterCutoff, pan ):
+ if inst[0:4] == 'drum':
+ if pitch in GenerationConstants.DRUMPITCH:
+ key = GenerationConstants.DRUMPITCH[ pitch ]
+ else:
+ key = pitch
+
+ if inst == 'drum1kit':
+ inst = Config.DRUM1INSTRUMENTS[ key ]
+ if inst == 'drum2kit':
+ inst = Config.DRUM2INSTRUMENTS[ key ]
+ if inst == 'drum3kit':
+ inst = Config.DRUM3INSTRUMENTS[ key ]
+ pitch = 1
+
+ else:
+ pitch = GenerationConstants.TRANSPOSE[ pitch - 24 ]
+
+ # condition for tied notes
+ if Config.INSTRUMENTS[ inst ].csoundInstrumentId == 101 and tied and fullDuration:
+ duration= -1.0
+ # condition for overlaped notes
+ if Config.INSTRUMENTS[ inst ].csoundInstrumentId == 102 and overlap:
+ duration += 1.0
+
+ attack = max( 0.002, duration * attack)
+ decay = max( 0.002, duration * decay)
+
+ rval = Config.PLAY_NOTE_COMMAND_MINUS_DELAY % \
+ ( Config.INSTRUMENTS[ inst ].csoundInstrumentId,
+ trackId,
+ '%f', #delay,
+ duration,
+ pitch,
+ reverbSend,
+ amplitude,
+ pan,
+ Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ inst ].instrumentId,
+ attack,
+ decay,
+ filterType, filterCutoff )
+ return rval
+
+ def getText(i, secs_per_tick, time_offset):
+ (onset,note,cache,z) = self.notes[i]
+ if cache == '' or note.nchanges != z :
+ self.notes[i] = \
+ (
+ onset,
+ note,
+ cache_cmd(
+ secs_per_tick,
+ note.amplitude, # * track-level mixer rate
+ note.pitch,
+ note.instrumentFlag,
+ note.trackId,
+ note.duration * self.secs_per_tick,
+ note.tied,
+ note.fullDuration,
+ note.overlap,
+ note.attack,
+ note.decay,
+ note.reverbSend,
+ note.filterType,
+ note.filterCutoff,
+ note.pan),
+ note.nchanges
+ )
+ rval = self.notes[i][2] % float(onset * self.secs_per_tick + time_offset)
+ return rval
+
+ prev_secs = (self.loops * self.duration) * self.secs_per_tick
+ rval = []
+ while self.notes[self.hIdx][0] + self.loops * self.duration < tickhorizon:
+ rval.append ( getText(self.hIdx, self.secs_per_tick, prev_secs + time0_time ) )
+ self.hIdx += 1
+ if self.hIdx == len(self.notes):
+ self.hIdx = 0
+ self.loops += 1
+ prev_secs += self.duration * self.secs_per_tick
+
+ return rval
+
+ def insert( self, notes):
+ def insertMany():
+ self.notes += [ ( notes[i][0], notes[i][1], '', 0 ) for i in xrange(len(notes)) ]
+ self.notes.sort()
+ def insertFew():
+ for i in xrange(len(notes)):
+ t = (notes[i][0], notes[i][1],'',0)
+ l = bisect.bisect_left(self.notes, t )
+ self.notes.insert(l, t)
+
+ if len(notes) >= 1:
+ insertMany()
+ else:
+ insertFew()
+ self.hIdx = bisect.bisect_left(self.notes, self.getTick(self.range_sec + time.time(), True))
+
+ def remove(self, note):
+ def removeFew():
+ i = 0
+ while i < len(self.notes):
+ if self.notes[i][1] in note:
+ del self.notes[i]
+ else:
+ i += 1
+
+ def removeMany():
+ self.notes = [t for t in self.notes if t[1] not in note]
+
+ if len(idset) >= 0: #just guessing here, should do some timing tests to see if this is good or no
+ removeMany()
+ else:
+ removeFew()
+ self.hIdx = bisect.bisect_left(self.notes, self.getTick(self.range_sec + time.time(), True))
+
+ def clear(self):
+ self.notes = []
+
+ def startTime(self):
+ self.time_start = time.time()
diff --git a/common/Util/Profiler.py b/common/Util/Profiler.py
new file mode 100644
index 0000000..0019a6c
--- /dev/null
+++ b/common/Util/Profiler.py
@@ -0,0 +1,93 @@
+
+import time
+
+class TaskProfiler( object ):
+ def __init__( self ):
+ self.profiles = {}
+
+ def ProfileBegin( self, profile ):
+ if self.profiles.has_key(profile) == False: self.profiles[profile] = TaskProfile(profile)
+ self.profiles[profile].begin()
+
+ def ProfilePause( self, profile ):
+ if self.profiles.has_key(profile) == False: return False
+ self.profiles[profile].pause()
+
+ def ProfileEnd( self, profile ):
+ if self.profiles.has_key(profile) == False: return False
+ self.profiles[profile].end()
+
+ def Profile(self, profile):
+ if profile in self.profiles:
+ if self.profiles[profile].inProgress:
+ self.profiles[profile].end()
+ else:
+ self.profiles[profile].begin()
+ else:
+ self.profiles[profile] = TaskProfile(profile)
+ self.profiles[profile].begin()
+
+ def ProfilePrint( self, profile ):
+ if self.profiles.has_key(profile) == False: return "Couldn't find profile: " + profile
+ return self.profiles[profile].printoverall()
+
+ def ProfileEndAndPrint( self, profile ):
+ if self.profiles.has_key(profile) == False: return "Couldn't find profile: " + profile
+ self.profiles[profile].end()
+ return self.profiles[profile].printlast()
+
+
+ def PrintAll( self ):
+ str = ""
+ keys = self.profiles.keys()
+ keys.sort()
+ return "\n".join( [self.profiles[k].printoverall() for k in keys] )
+ #for p in self.profiles:
+ #str += "\n" + self.profiles[p].printoverall()
+ #return str
+
+
+class TaskProfile( object ):
+ def __init__( self, name ):
+ self.name = name
+ self.count = 0
+ self.min = 666666666.0 # really high
+ self.max = -1.0 # pretty low
+ self.avg = 0.0
+ self.dt = 0
+ self.inProgress = False
+ self.paused = False
+
+ def begin( self ):
+ if self.inProgress: return False # you fucked up your ProfileBegin and ProfileEnd pairs
+ self.inProgress = True
+ if self.paused:
+ self.paused = False
+ self.startTime += time.time() - self.pauseTime
+ else:
+ self.startTime = time.time()
+
+ def pause( self ):
+ self.pauseTime = time.time()
+ self.inProgress = False
+ self.paused = True
+
+ def end( self ):
+ self.dt = time.time() - self.startTime
+ if self.paused:
+ self.dt = self.pauseTime - self.startTime
+ if self.dt > self.max: self.max = self.dt
+ if self.dt < self.min: self.min = self.dt
+ self.avg = (self.dt + self.avg*self.count)/(self.count+1)
+ self.count += 1
+ self.inProgress = False
+ self.paused = False
+
+ def printlast( self ):
+ return "Profile: " + self.name + " last dt: %f" % (self.dt)
+
+ def printoverall( self ):
+ if self.count == 0: return "Profile: " + self.name + ", no data!"
+ return "Profile: " + self.name + " avg: %f max: %f min: %f count: %d" % (self.avg, self.max, self.min, self.count)
+
+TP = TaskProfiler()
diff --git a/common/Util/Sound.py b/common/Util/Sound.py
new file mode 100644
index 0000000..37edf8f
--- /dev/null
+++ b/common/Util/Sound.py
@@ -0,0 +1,289 @@
+import bisect
+import csnd
+import os
+import socket
+import select
+import sys
+import thread
+import time
+
+from sugar import env
+import common.Config as Config
+
+from common.Util.CSoundNote import CSoundNote #maybe not actually used, but dependence is there. All notes are assumed to be CSoundNotes
+from common.Generation.GenerationConstants import GenerationConstants
+
+class Sound:
+ #TODO: remove
+ def inputMessage(self, txt):
+ self.perf.InputMessage(txt)
+
+ #PRIVATE
+ DRIFT = 0.01 #careful about changing this... coordinate with instrument 5777
+ def loop_work(self, sleeptime):
+ def next( ) :
+ time_time = time.time()
+ #tickhorizon is tick where we'll be after range_sec
+ tickhorizon = self.getTick( self.range_sec + time_time, False )
+ time0_time = self.time0 - self.time_start + self.DRIFT
+
+ if tickhorizon < 0 : return []
+ if len(self.notes) == 0 : return []
+
+ def cache_cmd(secs_per_tick, amplitude, pitch, inst, trackId, duration, tied, fullDuration, overlap, attack, decay, reverbSend, filterType, filterCutoff, pan ):
+ if inst[0:4] == 'drum':
+ if pitch in GenerationConstants.DRUMPITCH:
+ key = GenerationConstants.DRUMPITCH[ pitch ]
+ else:
+ key = pitch
+
+ if inst == 'drum1kit':
+ inst = Config.DRUM1INSTRUMENTS[ key ]
+ if inst == 'drum2kit':
+ inst = Config.DRUM2INSTRUMENTS[ key ]
+ if inst == 'drum3kit':
+ inst = Config.DRUM3INSTRUMENTS[ key ]
+ pitch = 1
+
+ else:
+ pitch = GenerationConstants.TRANSPOSE[ pitch - 24 ]
+
+ # condition for tied notes
+ if Config.INSTRUMENTS[ inst ].csoundInstrumentId == 101 and tied and fullDuration:
+ duration= -1.0
+ # condition for overlaped notes
+ if Config.INSTRUMENTS[ inst ].csoundInstrumentId == 102 and overlap:
+ duration += 1.0
+
+ attack = max( 0.002, duration * attack)
+ decay = max( 0.002, duration * decay)
+
+ rval = Config.PLAY_NOTE_COMMAND_MINUS_DELAY % \
+ ( Config.INSTRUMENTS[ inst ].csoundInstrumentId,
+ trackId,
+ '%f', #delay,
+ duration,
+ pitch,
+ reverbSend,
+ amplitude,
+ pan,
+ Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ inst ].instrumentId,
+ attack,
+ decay,
+ filterType, filterCutoff )
+ return rval
+
+ def getText(i, secs_per_tick, time_offset):
+ (onset,note,cache,z) = self.notes[i]
+ if cache == '' or note.nchanges != z :
+ self.notes[i] = \
+ (
+ onset,
+ note,
+ cache_cmd(
+ secs_per_tick,
+ note.amplitude, # * track-level mixer rate
+ note.pitch,
+ note.instrumentFlag,
+ note.trackId,
+ note.duration * self.secs_per_tick,
+ note.tied,
+ note.fullDuration,
+ note.overlap,
+ note.attack,
+ note.decay,
+ note.reverbSend,
+ note.filterType,
+ note.filterCutoff,
+ note.pan),
+ note.nchanges
+ )
+ rval = self.notes[i][2] % float(onset * self.secs_per_tick + time_offset)
+ return rval
+
+ prev_secs = (self.loops * self.duration) * self.secs_per_tick
+ rval = []
+ while self.notes[self.hIdx][0] + self.loops * self.duration < tickhorizon:
+ rval.append ( getText(self.hIdx, self.secs_per_tick, prev_secs + time0_time ) )
+ self.hIdx += 1
+ if self.hIdx == len(self.notes):
+ self.hIdx = 0
+ self.loops += 1
+ prev_secs += self.duration * self.secs_per_tick
+
+ return rval
+
+ #thread.start_new_thread( testtimer, (0,) )
+ m = 0.0
+ while self.thread_continue:
+ t0 = time.time()
+ time.sleep(sleeptime)
+ t1 = time.time()
+ if t1 - t0 > 2.0 * sleeptime :
+ print 'critical lagginess: ', t1 - t0
+ if m < t1 - t0:
+ m = t1 - t0
+ print t1, ' timer max = ', m
+ if self.playing :
+ cmds = self.next()
+ for c in cmds:
+ self.perf.InputMessage( c )
+
+ # create the object, and launch the loop thread
+ def __init__(self, orc, range_sec, ticks_per_sec ):
+ self.orc = orc
+ self.up = False
+ self.ticks_per_sec = ticks_per_sec # ticks last this long
+ self.secs_per_tick = 1.0 / ticks_per_sec # precomputed inverse
+ self.range_sec = range_sec # notes are checked-for, this many seconds in advance
+ self.duration = 1 # number of ticks in playback loop
+ self.loops = 0 # number of elapsed loops
+ self.notes = [] # sorted list of (onset, noteptr, cache)
+ self.time0 = time.time() + 1000000 # the real time at which tick == 0 (sometimes retro-active)
+ self.thread_continue = 1
+ self.playing = False
+ #self.thread = thread.start_new_thread( self.loop_work, (0.040,) )
+ self.csound = csnd.Csound()
+
+ # join the loop thread, clean up everything.
+ def uninit(self):
+ #self.thread_continue = 0
+ #self.thread.join()
+ #if self.up :
+ # self.lower()
+ self.csound.Reset()
+ pass
+
+ # (re)start playback and seize the sound device
+ def connect(self):
+ def startTime():
+ if not self.up :
+ debug_print (1, "ERROR: Sound::startTime, performance thread isn't up yet.")
+ return
+ self.perf.InputMessage('i 5999 0.0 60000000')
+ self.time_start = time.time()
+ # if a note event is sent to csound before or simultaneous to this one, then it will not play correctly.
+ # thus we sleep right here, to (ideally) let csound pick up the message.
+ # NB: match this to the constant in the instrument 5777 of the csound orcestra
+ time.sleep(0.1)
+ def load_instruments( ):
+ home_path = env.get_profile_path() + Config.PREF_DIR
+ for instrumentSoundFile in Config.INSTRUMENTS.keys():
+ if instrumentSoundFile[0:3] == 'mic' or instrumentSoundFile[0:3] == 'lab':
+ fileName = home_path + '/' + instrumentSoundFile
+ else:
+ fileName = Config.SOUNDS_DIR + "/" + instrumentSoundFile
+ instrumentId = Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ instrumentSoundFile ].instrumentId
+ self.load_instruments(instrumentId, fileName)
+ if self.up :
+ debug_print(3, 'Sound::raise() already up.')
+ return
+ self.up = True
+ self.perf = csnd.CsoundPerformanceThread(self.csound)
+ self.csound.Compile( self.orc )
+ self.perf.Play()
+ load_instruments()
+ start_time()
+ debug_print(5, 'Sound::raise succeeded')
+
+ # stop playback and free the sound device
+ def disconnect(self):
+ def unload_instruments():
+ self.perf.InputMessage('i%d 0 0.1 %d' % (Config.INST_FREE, len(Config.INSTRUMENTS)))
+
+ if not self.up :
+ debug_print(3, 'Sound::lower() already down.')
+ return
+ self.up = False
+ unload_instruments()
+ self.perf.Stop()
+ rval = self.perf.Join()
+ self.csound.Reset()
+ debug_print(5, 'Sound::lower() succeeded')
+
+ def micRecording( self, table ):
+ self.perf.InputMessage('i5201 0 5 %d' % table)
+ def load_instrument(self, id, fname):
+ self.perf.InputMessage('f%d 0 0 -1 \"%s\" 0 0 0' % (id, fname ))
+ def load_mic_instrument( self, inst ):
+ home_path = env.get_profile_path() + Config.PREF_DIR
+ fileName = home_path + '/' + inst
+ instrumentId = Config.INSTRUMENT_TABLE_OFFSET + int(fileName[-1]) + 6
+ self.load_instrument(instrumentId, fileName)
+
+ def setMasterVolume(self, volume):
+ self.csound.SetChannel('masterVolume',volume )
+
+ def loop_start(self):
+ self.playing = True
+
+ def loop_stop(self):
+ self.playing = False
+
+ def loop_getTick(self, t, domod): #t is for time
+ if domod :
+ return ( int( ( t - self.time0 ) * self.ticks_per_sec ) ) % self.duration
+ else :
+ return ( int( ( t - self.time0 ) * self.ticks_per_sec ) )
+
+ def loop_setTick( self, tick ):
+ time_time = time.time()
+ self.time0 = time_time - tick * self.secs_per_tick
+ self.loops = tick // self.duration
+ self.hIdx = bisect.bisect_left(self.notes, tick - self.duration * self.loops )
+
+ def loop_setRate( self, ticks_per_sec):
+ if ticks_per_sec != self.ticks_per_sec:
+ secs_per_tick = 1.0 / ticks_per_sec
+
+ time_time = time.time()
+ curtick = self.getTick( time_time, False )
+ curticktime = curtick * self.secs_per_tick + self.time0
+
+ self.ticks_per_sec = ticks_per_sec
+ self.secs_per_tick = secs_per_tick
+ self.time0 = curticktime - curtick * secs_per_tick
+ self.notes = [ (o,n,'',z) for (o,n,c,z) in self.notes ] #clear cache
+ self.loops = 0
+
+ def loop_setDuration( self, duration ):
+ self.time0 += self.loops * self.duration * self.secs_per_tick
+ self.loops = 0
+ self.duration = duration
+
+ def loop_insert( self, notes):
+ def insertMany():
+ self.notes += [ ( notes[i][0], notes[i][1], '', 0 ) for i in xrange(len(notes)) ]
+ self.notes.sort()
+ def insertFew():
+ for i in xrange(len(notes)):
+ t = (notes[i][0], notes[i][1],'',0)
+ l = bisect.bisect_left(self.notes, t )
+ self.notes.insert(l, t)
+
+ if len(notes) >= 1:
+ insertMany()
+ else:
+ insertFew()
+ self.hIdx = bisect.bisect_left(self.notes, self.getTick(self.range_sec + time.time(), True))
+
+ def loop_remove(self, note):
+ def removeFew():
+ i = 0
+ while i < len(self.notes):
+ if self.notes[i][1] in note:
+ del self.notes[i]
+ else:
+ i += 1
+
+ def removeMany():
+ self.notes = [t for t in self.notes if t[1] not in note]
+
+ if len(idset) >= 0: #just guessing here, should do some timing tests to see if this is good or no
+ removeMany()
+ else:
+ removeFew()
+ self.hIdx = bisect.bisect_left(self.notes, self.getTick(self.range_sec + time.time(), True))
+
+ def loop_clear(self):
+ self.notes = []
diff --git a/common/Util/ThemeWidgets.py b/common/Util/ThemeWidgets.py
new file mode 100644
index 0000000..0acc498
--- /dev/null
+++ b/common/Util/ThemeWidgets.py
@@ -0,0 +1,1276 @@
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+from sugar.graphics.combobox import ComboBox
+from sugar.graphics.palette import Palette, WidgetInvoker
+
+
+class ITYPE:
+ PIXBUF = 0
+ PIXMAP = 1
+
+class ImageHScale( gtk.HScale ):
+ def __init__( self, image_name, adjustment = None, slider_border = 0, insensitive_name = None, trough_color = "#3D403A", snap = False ):
+ gtk.HScale.__init__( self, adjustment )
+
+ if snap: self.snap = 1/snap
+ else: self.snap = False
+
+ colormap = self.get_colormap()
+ self.troughcolor = colormap.alloc_color( trough_color, True, True )
+
+ img = gtk.Image()
+ img.set_from_file( image_name )
+ self.sliderPixbuf = img.get_pixbuf()
+
+ if insensitive_name == None:
+ self.insensitivePixbuf = None
+ else:
+ img = gtk.Image()
+ img.set_from_file( insensitive_name )
+ self.insensitivePixbuf = img.get_pixbuf()
+
+ name = image_name + "ImageHScale"
+ self.set_name(name)
+
+ rc_str = """
+style "scale_style" {
+ GtkRange::slider_width = %d
+ GtkScale::slider_length = %d
+}
+widget "*%s*" style "scale_style"
+ """ % ( self.sliderPixbuf.get_width(), self.sliderPixbuf.get_height(), name)
+ gtk.rc_parse_string( rc_str )
+
+ self.pixbufWidth = self.sliderPixbuf.get_width()
+ self.pixbufHeight = self.sliderPixbuf.get_height()
+ self.sliderBorder = slider_border
+ self.sliderBorderMUL2 = self.sliderBorder*2
+
+ self.set_draw_value(False)
+
+ self.connect( "expose-event", self.expose )
+ self.connect( "size-allocate", self.size_allocate )
+ self.connect( "button-release-event", self.button_release )
+ adjustment.connect( "changed", self.value_changed )
+ adjustment.connect( "value-changed", self.value_changed )
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ self.sliderY = self.alloc.height//2 - self.pixbufHeight//2
+ return False
+
+ def set_snap( self, snap ):
+ if snap: self.snap = 1/snap
+ else: self.snap = False
+ self.queue_draw()
+
+ def value_changed( self, adjustment ):
+ if self.snap:
+ val = round(self.snap*self.get_value())/self.snap
+ if val != self.get_value():
+ self.set_value( val )
+ return True
+
+ def expose( self, widget, event ):
+
+ style = self.get_style()
+ gc = style.fg_gc[gtk.STATE_NORMAL]
+
+ gc.foreground = self.troughcolor
+
+ self.window.draw_rectangle( gc, True, self.alloc.x + self.sliderBorder, self.alloc.y + self.alloc.height//2 - 1, self.alloc.width - self.sliderBorderMUL2, 3 )
+
+ val = self.get_value()
+ if self.snap:
+ val = round(self.snap*val)/self.snap
+ adj = self.get_adjustment()
+ if self.get_inverted():
+ sliderX = int((self.alloc.width - self.pixbufWidth)*(adj.upper-val)/(adj.upper - adj.lower))
+ else:
+ sliderX = int((self.alloc.width - self.pixbufWidth)*(val-adj.lower)/(adj.upper - adj.lower))
+
+ if self.insensitivePixbuf != None and self.state == gtk.STATE_INSENSITIVE:
+ self.window.draw_pixbuf( gc, self.insensitivePixbuf, 0, 0, self.alloc.x + sliderX, self.alloc.y + self.sliderY, self.pixbufWidth, self.pixbufHeight, gtk.gdk.RGB_DITHER_NORMAL, 0, 0 )
+ else:
+ self.window.draw_pixbuf( gc, self.sliderPixbuf, 0, 0, self.alloc.x + sliderX, self.alloc.y + self.sliderY, self.pixbufWidth, self.pixbufHeight, gtk.gdk.RGB_DITHER_NORMAL, 0, 0 )
+
+ return True
+
+ def button_release( self, widget, event ):
+
+ if self.snap:
+ self.set_value( round(self.snap*self.get_value())/self.snap )
+
+class ImageVScale( gtk.VScale ):
+ def __init__( self, image_name, adjustment = None, slider_border = 0, insensitive_name = None, trough_color = "#3D403A", snap = False ):
+ gtk.VScale.__init__( self, adjustment )
+
+ if snap: self.snap = 1/snap
+ else: self.snap = False
+
+ colormap = self.get_colormap()
+ self.troughcolor = colormap.alloc_color( trough_color, True, True )
+
+ img = gtk.Image()
+ img.set_from_file( image_name )
+ self.sliderPixbuf = img.get_pixbuf()
+
+ if insensitive_name == None:
+ self.insensitivePixbuf = None
+ else:
+ img = gtk.Image()
+ img.set_from_file( insensitive_name )
+ self.insensitivePixbuf = img.get_pixbuf()
+
+ name = image_name + "ImageVScale"
+ self.set_name(name)
+
+ rc_str = """
+style "scale_style" {
+ GtkRange::slider_width = %d
+ GtkScale::slider_length = %d
+}
+widget "*%s*" style "scale_style"
+ """ % ( self.sliderPixbuf.get_width(), self.sliderPixbuf.get_height(), name)
+ gtk.rc_parse_string( rc_str )
+
+ self.pixbufWidth = self.sliderPixbuf.get_width()
+ self.pixbufHeight = self.sliderPixbuf.get_height()
+ self.sliderBorder = slider_border
+ self.sliderBorderMUL2 = self.sliderBorder*2
+
+ self.set_draw_value(False)
+
+ self.connect( "expose-event", self.expose )
+ self.connect( "size-allocate", self.size_allocate )
+ self.connect( "button-release-event", self.button_release )
+ adjustment.connect( "value-changed", self.value_changed )
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ self.sliderX = self.alloc.width//2 - self.pixbufWidth//2
+ return False
+
+ def set_snap( self, snap ):
+ if snap: self.snap = 1/snap
+ else: self.snap = False
+ self.queue_draw()
+
+ def value_changed( self, adjustment ):
+ if self.snap:
+ val = round(self.snap*self.get_value())/self.snap
+ if val != self.get_value():
+ self.set_value( val )
+
+ def expose( self, widget, event ):
+
+ style = self.get_style()
+ gc = style.fg_gc[gtk.STATE_NORMAL]
+
+ gc.foreground = self.troughcolor
+
+ self.window.draw_rectangle( gc, True, self.alloc.x + self.alloc.width//2 - 1, self.alloc.y + self.sliderBorder, 3, self.alloc.height - self.sliderBorderMUL2 )
+
+ val = self.get_value()
+ if self.snap:
+ val = round(self.snap*val)/self.snap
+ adj = self.get_adjustment()
+ if self.get_inverted():
+ sliderY = int((self.alloc.height - self.pixbufHeight)*(adj.upper-val)/(adj.upper - adj.lower))
+ else:
+ sliderY = int((self.alloc.height - self.pixbufHeight)*(val-adj.lower)/(adj.upper - adj.lower))
+
+ if self.insensitivePixbuf != None and self.state == gtk.STATE_INSENSITIVE:
+ self.window.draw_pixbuf( gc, self.insensitivePixbuf, 0, 0, self.alloc.x + self.sliderX, self.alloc.y + sliderY, self.pixbufWidth, self.pixbufHeight, gtk.gdk.RGB_DITHER_NORMAL, 0, 0 )
+ else:
+ self.window.draw_pixbuf( gc, self.sliderPixbuf, 0, 0, self.alloc.x + self.sliderX, self.alloc.y + sliderY, self.pixbufWidth, self.pixbufHeight, gtk.gdk.RGB_DITHER_NORMAL, 0, 0 )
+
+ return True
+
+ def button_release( self, widget, event ):
+
+ if self.snap:
+ self.set_value( round(self.snap*self.get_value())/self.snap )
+
+class XYSlider( gtk.EventBox ):
+ def __init__( self, fixed, button, xadjustment, yadjustment, flipX = False, flipY = False ):
+ gtk.EventBox.__init__( self )
+
+ self.fixed = fixed
+ self.button = button
+ self.xadjustment = xadjustment
+ self.yadjustment = yadjustment
+ self.flipX = flipX
+ self.flipY = flipY
+
+ if ( button.get_parent() == None ):
+ fixed.put( button, 0, 0 )
+
+ self.add(fixed)
+
+ self.fWidth = self.fHeight = 1
+ self.bWidth = self.bHeight = 1
+
+ self.add_events(gtk.gdk.POINTER_MOTION_HINT_MASK)
+ self.connect( "size-allocate", lambda w,a:self.updateAlloc() )
+ self.connect( "button-press-event", self.handlePress )
+ self.connect( "button-release-event", self.handleRelease )
+ self.connect( "motion-notify-event", self.handleMotion )
+ self.button.connect( "size-allocate", lambda w,a: self.updateButton() )
+ self.button.connect( "button-press-event", self.handleButtonPress )
+ self.button.connect( "button-release-event", self.handleButtonRelease )
+ self.button.add_events(gtk.gdk.BUTTON_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK)
+ self.button.connect( "motion-notify-event", self.handleMotion )
+ self.xadjustment.connect( "changed", lambda a1: self.updateAdjustemnt("x") )
+ self.xadjustment.connect( "value-changed", lambda a1: self.updateLoc() )
+ self.yadjustment.connect( "changed", lambda a1: self.updateAdjustment("y") )
+ self.yadjustment.connect( "value-changed", lambda a1: self.updateLoc() )
+
+ self.updateAdjustment("x")
+ self.updateAdjustment("y")
+ self.updateButton()
+
+ def updateAlloc( self ):
+ alloc = self.fixed.get_allocation()
+ if self.fWidth != alloc.width or self.fHeight != alloc.height:
+ self.fWidth = alloc.width
+ self.fHeight = alloc.height
+ self.width = self.fWidth - self.bWidth
+ self.height = self.fHeight - self.bHeight
+ self.updateLoc()
+
+ def updateButton( self ):
+ alloc = self.button.get_allocation()
+ if self.bWidth != alloc.width or self.bHeight != alloc.height:
+ self.bWidth = alloc.width
+ self.bHeight = alloc.height
+ self.bWidthDIV2 = alloc.width//2
+ self.bHeightDIV2 = alloc.height//2
+ self.width = self.fWidth - self.bWidth
+ self.height = self.fHeight - self.bHeight
+ self.updateLoc()
+
+ def updateAdjustment( self, which ):
+ if which == "x": self.xRange = int(self.xadjustment.upper - self.xadjustment.lower)
+ else: self.yRange = int(self.yadjustment.upper - self.yadjustment.lower)
+
+ def updateLoc( self ):
+ if self.flipX: self.x = (self.width*int(self.xadjustment.upper - self.xadjustment.value))//self.xRange
+ else: self.x = (self.width*int(self.xadjustment.value - self.xadjustment.lower))//self.xRange
+ if self.flipY: self.y = (self.height*int(self.yadjustment.upper - self.yadjustment.value))//self.yRange
+ else: self.y = (self.height*int(self.yadjustment.value - self.yadjustment.lower))//self.yRange
+
+ self.fixed.move( self.button, self.x, self.y )
+
+ def handlePress( self, w, event ):
+ self.clickOffset = (0,0)
+ self.updatePointer( int(event.x), int(event.y) )
+ self.button.set_active(True)
+
+ def handleRelease( self, w, event ):
+ self.button.set_active(False)
+ return True
+
+ def handleButtonPress( self, w, event ):
+ self.clickOffset = ( event.x - self.bWidthDIV2, event.y - self.bHeightDIV2 )
+ self.button.set_active(True)
+
+ def handleButtonRelease( self, w, event ):
+ self.button.set_active(False)
+ return True # block event propagation
+
+ def handleMotion( self, w, event ):
+ x, y, state = self.window.get_pointer()
+ self.updatePointer( int(x - self.clickOffset[0]), int(y - self.clickOffset[1]) )
+ return True
+
+ def updatePointer( self, x, y ):
+ x -= self.bWidthDIV2
+ y -= self.bHeightDIV2
+ if x < 0: x = 0
+ elif x > self.width: x = self.width
+ if y < 0: y = 0
+ elif y > self.height: y = self.height
+ if self.flipX: xvalue = self.xadjustment.lower+(self.xRange*(self.width - x))//self.width
+ else: xvalue = self.xadjustment.lower+(self.xRange*x)//self.width
+ if xvalue != self.xadjustment.value: self.xadjustment.set_value(xvalue)
+ if self.flipY: yvalue = self.yadjustment.lower+(self.yRange*(self.height - y))//self.height
+ else: yvalue = self.yadjustment.lower+(self.yRange*y)//self.height
+ if yvalue != self.yadjustment.value: self.yadjustment.set_value(yvalue)
+
+class RoundHBox( gtk.HBox ):
+ def __init__( self, radius = 5, fillcolor = "#000", bordercolor = "#FFF", homogeneous = False, spacing = 0 ):
+ gtk.HBox.__init__( self, homogeneous, spacing )
+ self.alloc = None
+
+ self.radius = radius
+
+ colormap = self.get_colormap()
+ self.fillcolor = colormap.alloc_color(fillcolor,True,True)
+ self.bordercolor = colormap.alloc_color(bordercolor,True,True)
+
+ self.connect( "expose-event", self.expose )
+ self.connect( "size-allocate", self.size_allocate )
+
+ def update_constants( self ):
+
+ if self.alloc == None: return
+
+ self.borderW = self.get_border_width()
+ self.borderWMUL2 = self.borderW*2
+ self.corner = self.radius + self.borderW
+ self.cornerMUL2 = self.corner*2
+ self.cornerMINborderW = self.corner - self.borderW
+
+ self.xPLUborderW = self.alloc.x + self.borderW
+ self.xPLUcorner = self.alloc.x + self.corner
+ self.xPLUwidthMINborderW = self.alloc.x + self.alloc.width - self.borderW
+ self.xPLUwidthMINcorner = self.alloc.x + self.alloc.width - self.corner
+ self.yPLUborderW = self.alloc.y + self.borderW
+ self.yPLUcorner = self.alloc.y + self.corner
+ self.yPLUheightMINborderW = self.alloc.y + self.alloc.height - self.borderW
+ self.yPLUheightMINcorner = self.alloc.y + self.alloc.height - self.corner
+ self.widthMINborderW = self.alloc.width - self.borderW
+ self.widthMINcorner = self.alloc.width - self.corner
+ self.widthMINcornerMUL2 = self.alloc.width - self.cornerMUL2
+ self.heightMINborderW = self.alloc.height - self.borderW
+ self.heightMINcorner = self.alloc.height - self.corner
+ self.heightMINborderWMUL2 = self.alloc.height - self.borderWMUL2
+ self.heightMINcornerMUL2 = self.alloc.height - self.cornerMUL2
+
+ self.roundX1 = self.alloc.x + self.borderW - 1
+ self.roundX2 = self.alloc.x + self.alloc.width - self.corner - self.radius - 1
+ self.roundY1 = self.alloc.y + self.borderW - 1
+ self.roundY2 = self.alloc.y + self.alloc.height - self.corner - self.radius - 1
+ self.roundD = self.radius*2 + 1
+ self.rightAngle = 90*64
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ self.update_constants()
+ return False
+
+ def set_border_width( self, width ):
+ gtk.HBox.set_border_width( self, width )
+ self.update_constants()
+
+ def set_radius( self, radius ):
+ self.radius = radius
+ self.update_constants()
+
+ def set_fill_color( self, color ):
+ colormap = self.get_colormap()
+ self.fillcolor = colormap.alloc_color(color,True,True)
+
+ def set_border_color( self, color ):
+ colormap = self.get_colormap()
+ self.bordercolor = colormap.alloc_color(color,True,True)
+
+ def expose( self, widget, event ):
+
+ if self.alloc == None: return
+
+ #TP.ProfileBegin( "Round*Box::expose" )
+
+ style = self.get_style()
+ gc = style.fg_gc[gtk.STATE_NORMAL]
+
+ startX = event.area.x - self.alloc.x
+ startY = event.area.y - self.alloc.y
+ stopX = startX + event.area.width
+ stopY = startY + event.area.height
+
+ saveForeground = gc.foreground
+
+ # Note: could maybe do some optimization to fill only areas that are within the dirty rect, but drawing
+ # seems to be quite fast compared to python code, so just leave it at clipping by each geometry feature
+
+ gc.foreground = self.bordercolor
+ if self.borderW:
+ if stopY > self.corner and startY < self.heightMINcorner:
+ if startX < self.borderW: # draw left border
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.yPLUcorner, self.borderW, self.heightMINcornerMUL2 )
+ if stopX > self.widthMINborderW: # draw right border
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINborderW, self.yPLUcorner, self.borderW, self.heightMINcornerMUL2 )
+
+ if stopX > self.corner and startX < self.widthMINcorner:
+ if startY < self.borderW: # draw top border
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.alloc.y, self.widthMINcornerMUL2, self.borderW )
+ if stopY > self.heightMINborderW: # draw bottom border
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.yPLUheightMINborderW, self.widthMINcornerMUL2, self.borderW )
+
+ if startX < self.corner:
+ if startY < self.corner: # draw top left corner
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.alloc.y, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX1, self.roundY1, self.roundD, self.roundD, self.rightAngle, self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopY > self.heightMINcorner: # draw bottom left corner
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.yPLUheightMINcorner, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX1, self.roundY2, self.roundD, self.roundD, -self.rightAngle, -self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopX > self.widthMINcorner:
+ if startY < self.corner: # draw top right corner
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.alloc.y, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX2, self.roundY1, self.roundD, self.roundD, 0, self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopY > self.heightMINcorner: # draw bottom right corner
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.yPLUheightMINcorner, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX2, self.roundY2, self.roundD, self.roundD, 0, -self.rightAngle )
+ gc.foreground = self.bordercolor
+
+ gc.foreground = self.fillcolor
+ if startX < self.widthMINcorner and stopX > self.corner:
+ if startY < self.heightMINborderW and stopY > self.borderW: # draw centre fill
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.yPLUborderW, self.widthMINcornerMUL2, self.heightMINborderWMUL2 )
+ if startX < self.corner and stopX > self.borderW:
+ if startY < self.heightMINcorner and stopY > self.corner: # draw left fill
+ self.window.draw_rectangle( gc, True, self.xPLUborderW, self.yPLUcorner, self.cornerMINborderW, self.heightMINcornerMUL2 )
+ if startX < self.widthMINborderW and stopX > self.widthMINcorner:
+ if startY < self.heightMINcorner and stopY > self.corner: # draw right fill
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.yPLUcorner, self.cornerMINborderW, self.heightMINcornerMUL2 )
+
+ gc.foreground = saveForeground
+
+ #TP.ProfileEnd( "Round*Box::expose" )
+
+ return False
+
+class RoundVBox( gtk.VBox ):
+ def __init__( self, radius = 5, fillcolor = "#000", bordercolor = "#FFF", homogeneous = False, spacing = 0 ):
+ gtk.VBox.__init__( self, homogeneous, spacing )
+ self.alloc = None
+
+ self.radius = radius
+
+ colormap = self.get_colormap()
+ self.fillcolor = colormap.alloc_color(fillcolor,True,True)
+ self.bordercolor = colormap.alloc_color(bordercolor,True,True)
+
+ self.connect( "expose-event",self.expose )
+ self.connect( "size-allocate", self.size_allocate )
+
+ def update_constants( self ):
+
+ if self.alloc == None: return
+
+ self.borderW = self.get_border_width()
+ self.borderWMUL2 = self.borderW*2
+ self.corner = self.radius + self.borderW
+ self.cornerMUL2 = self.corner*2
+ self.cornerMINborderW = self.corner - self.borderW
+
+ self.xPLUborderW = self.alloc.x + self.borderW
+ self.xPLUcorner = self.alloc.x + self.corner
+ self.xPLUwidthMINborderW = self.alloc.x + self.alloc.width - self.borderW
+ self.xPLUwidthMINcorner = self.alloc.x + self.alloc.width - self.corner
+ self.yPLUborderW = self.alloc.y + self.borderW
+ self.yPLUcorner = self.alloc.y + self.corner
+ self.yPLUheightMINborderW = self.alloc.y + self.alloc.height - self.borderW
+ self.yPLUheightMINcorner = self.alloc.y + self.alloc.height - self.corner
+ self.widthMINborderW = self.alloc.width - self.borderW
+ self.widthMINcorner = self.alloc.width - self.corner
+ self.widthMINcornerMUL2 = self.alloc.width - self.cornerMUL2
+ self.heightMINborderW = self.alloc.height - self.borderW
+ self.heightMINcorner = self.alloc.height - self.corner
+ self.heightMINborderWMUL2 = self.alloc.height - self.borderWMUL2
+ self.heightMINcornerMUL2 = self.alloc.height - self.cornerMUL2
+
+ self.roundX1 = self.alloc.x + self.borderW - 1
+ self.roundX2 = self.alloc.x + self.alloc.width - self.corner - self.radius - 1
+ self.roundY1 = self.alloc.y + self.borderW - 1
+ self.roundY2 = self.alloc.y + self.alloc.height - self.corner - self.radius - 1
+ self.roundD = self.radius*2 + 1
+ self.rightAngle = 90*64
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ self.update_constants()
+ return False
+
+ def set_border_width( self, width ):
+ gtk.VBox.set_border_width( self, width )
+ self.update_constants()
+
+ def set_radius( self, radius ):
+ self.radius = radius
+ self.update_constants()
+
+ def set_fill_color( self, color ):
+ colormap = self.get_colormap()
+ self.fillcolor = colormap.alloc_color(color,True,True)
+
+ def set_border_color( self, color ):
+ colormap = self.get_colormap()
+ self.bordercolor = colormap.alloc_color(color,True,True)
+
+ def expose( self, widget, event ):
+
+ if self.alloc == None: return
+
+ #TP.ProfileBegin( "Round*Box::expose" )
+
+ style = self.get_style()
+ gc = style.fg_gc[gtk.STATE_NORMAL]
+
+ startX = event.area.x - self.alloc.x
+ startY = event.area.y - self.alloc.y
+ stopX = startX + event.area.width
+ stopY = startY + event.area.height
+
+ saveForeground = gc.foreground
+
+ # Note: could maybe do some optimization to fill only areas that are within the dirty rect, but drawing
+ # seems to be quite fast compared to python code, so just leave it at clipping by each geometry feature
+
+ gc.foreground = self.bordercolor
+ if self.borderW:
+ if stopY > self.corner and startY < self.heightMINcorner:
+ if startX < self.borderW: # draw left border
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.yPLUcorner, self.borderW, self.heightMINcornerMUL2 )
+ if stopX > self.widthMINborderW: # draw right border
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINborderW, self.yPLUcorner, self.borderW, self.heightMINcornerMUL2 )
+
+ if stopX > self.corner and startX < self.widthMINcorner:
+ if startY < self.borderW: # draw top border
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.alloc.y, self.widthMINcornerMUL2, self.borderW )
+ if stopY > self.heightMINborderW: # draw bottom border
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.yPLUheightMINborderW, self.widthMINcornerMUL2, self.borderW )
+
+ if startX < self.corner:
+ if startY < self.corner: # draw top left corner
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.alloc.y, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX1, self.roundY1, self.roundD, self.roundD, self.rightAngle, self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopY > self.heightMINcorner: # draw bottom left corner
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.yPLUheightMINcorner, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX1, self.roundY2, self.roundD, self.roundD, -self.rightAngle, -self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopX > self.widthMINcorner:
+ if startY < self.corner: # draw top right corner
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.alloc.y, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX2, self.roundY1, self.roundD, self.roundD, 0, self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopY > self.heightMINcorner: # draw bottom right corner
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.yPLUheightMINcorner, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX2, self.roundY2, self.roundD, self.roundD, 0, -self.rightAngle )
+ gc.foreground = self.bordercolor
+
+ gc.foreground = self.fillcolor
+ if startX < self.widthMINcorner and stopX > self.corner:
+ if startY < self.heightMINborderW and stopY > self.borderW: # draw centre fill
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.yPLUborderW, self.widthMINcornerMUL2, self.heightMINborderWMUL2 )
+ if startX < self.corner and stopX > self.borderW:
+ if startY < self.heightMINcorner and stopY > self.corner: # draw left fill
+ self.window.draw_rectangle( gc, True, self.xPLUborderW, self.yPLUcorner, self.cornerMINborderW, self.heightMINcornerMUL2 )
+ if startX < self.widthMINborderW and stopX > self.widthMINcorner:
+ if startY < self.heightMINcorner and stopY > self.corner: # draw right fill
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.yPLUcorner, self.cornerMINborderW, self.heightMINcornerMUL2 )
+
+ gc.foreground = saveForeground
+
+ #TP.ProfileEnd( "Round*Box::expose" )
+
+ return False
+
+class RoundFixed( gtk.Fixed ):
+ def __init__( self, radius = 5, fillcolor = "#000", bordercolor = "#FFF" ):
+ gtk.Fixed.__init__( self )
+ self.alloc = None
+
+ self.radius = radius
+
+ colormap = self.get_colormap()
+ self.fillcolor = colormap.alloc_color(fillcolor,True,True)
+ self.bordercolor = colormap.alloc_color(bordercolor,True,True)
+
+ self.connect( "expose-event", self.expose )
+ self.connect( "size-allocate", self.size_allocate )
+
+ def update_constants( self ):
+
+ if self.alloc == None: return
+
+ self.borderW = self.get_border_width()
+ self.borderWMUL2 = self.borderW*2
+ self.corner = self.radius + self.borderW
+ self.cornerMUL2 = self.corner*2
+ self.cornerMINborderW = self.corner - self.borderW
+
+ self.xPLUborderW = self.alloc.x + self.borderW
+ self.xPLUcorner = self.alloc.x + self.corner
+ self.xPLUwidthMINborderW = self.alloc.x + self.alloc.width - self.borderW
+ self.xPLUwidthMINcorner = self.alloc.x + self.alloc.width - self.corner
+ self.yPLUborderW = self.alloc.y + self.borderW
+ self.yPLUcorner = self.alloc.y + self.corner
+ self.yPLUheightMINborderW = self.alloc.y + self.alloc.height - self.borderW
+ self.yPLUheightMINcorner = self.alloc.y + self.alloc.height - self.corner
+ self.widthMINborderW = self.alloc.width - self.borderW
+ self.widthMINcorner = self.alloc.width - self.corner
+ self.widthMINcornerMUL2 = self.alloc.width - self.cornerMUL2
+ self.heightMINborderW = self.alloc.height - self.borderW
+ self.heightMINcorner = self.alloc.height - self.corner
+ self.heightMINborderWMUL2 = self.alloc.height - self.borderWMUL2
+ self.heightMINcornerMUL2 = self.alloc.height - self.cornerMUL2
+
+ self.roundX1 = self.alloc.x + self.borderW - 1
+ self.roundX2 = self.alloc.x + self.alloc.width - self.corner - self.radius - 1
+ self.roundY1 = self.alloc.y + self.borderW - 1
+ self.roundY2 = self.alloc.y + self.alloc.height - self.corner - self.radius - 1
+ self.roundD = self.radius*2 + 1
+ self.rightAngle = 90*64
+
+ def size_allocate( self, widget, allocation ):
+ self.alloc = allocation
+ self.update_constants()
+ return False
+
+ def set_border_width( self, width ):
+ gtk.Fixed.set_border_width( self, width )
+ self.update_constants()
+
+ def set_radius( self, radius ):
+ self.radius = radius
+ self.update_constants()
+
+ def set_fill_color( self, color ):
+ colormap = self.get_colormap()
+ self.fillcolor = colormap.alloc_color(color,True,True)
+
+ def set_border_color( self, color ):
+ colormap = self.get_colormap()
+ self.bordercolor = colormap.alloc_color(color,True,True)
+
+ def expose( self, widget, event ):
+
+ if self.alloc == None: return
+
+ #TP.ProfileBegin( "Round*Box::expose" )
+
+ style = self.get_style()
+ gc = style.fg_gc[gtk.STATE_NORMAL]
+
+ startX = event.area.x - self.alloc.x
+ startY = event.area.y - self.alloc.y
+ stopX = startX + event.area.width
+ stopY = startY + event.area.height
+
+ saveForeground = gc.foreground
+
+ # Note: could maybe do some optimization to fill only areas that are within the dirty rect, but drawing
+ # seems to be quite fast compared to python code, so just leave it at clipping by each geometry feature
+
+ gc.foreground = self.bordercolor
+ if self.borderW:
+ if stopY > self.corner and startY < self.heightMINcorner:
+ if startX < self.borderW: # draw left border
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.yPLUcorner, self.borderW, self.heightMINcornerMUL2 )
+ if stopX > self.widthMINborderW: # draw right border
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINborderW, self.yPLUcorner, self.borderW, self.heightMINcornerMUL2 )
+
+ if stopX > self.corner and startX < self.widthMINcorner:
+ if startY < self.borderW: # draw top border
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.alloc.y, self.widthMINcornerMUL2, self.borderW )
+ if stopY > self.heightMINborderW: # draw bottom border
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.yPLUheightMINborderW, self.widthMINcornerMUL2, self.borderW )
+
+ if startX < self.corner:
+ if startY < self.corner: # draw top left corner
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.alloc.y, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX1, self.roundY1, self.roundD, self.roundD, self.rightAngle, self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopY > self.heightMINcorner: # draw bottom left corner
+ self.window.draw_rectangle( gc, True, self.alloc.x, self.yPLUheightMINcorner, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX1, self.roundY2, self.roundD, self.roundD, -self.rightAngle, -self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopX > self.widthMINcorner:
+ if startY < self.corner: # draw top right corner
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.alloc.y, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX2, self.roundY1, self.roundD, self.roundD, 0, self.rightAngle )
+ gc.foreground = self.bordercolor
+ if stopY > self.heightMINcorner: # draw bottom right corner
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.yPLUheightMINcorner, self.corner, self.corner )
+ gc.foreground = self.fillcolor
+ self.window.draw_arc( gc, True, self.roundX2, self.roundY2, self.roundD, self.roundD, 0, -self.rightAngle )
+ gc.foreground = self.bordercolor
+
+ gc.foreground = self.fillcolor
+ if startX < self.widthMINcorner and stopX > self.corner:
+ if startY < self.heightMINborderW and stopY > self.borderW: # draw centre fill
+ self.window.draw_rectangle( gc, True, self.xPLUcorner, self.yPLUborderW, self.widthMINcornerMUL2, self.heightMINborderWMUL2 )
+ if startX < self.corner and stopX > self.borderW:
+ if startY < self.heightMINcorner and stopY > self.corner: # draw left fill
+ self.window.draw_rectangle( gc, True, self.xPLUborderW, self.yPLUcorner, self.cornerMINborderW, self.heightMINcornerMUL2 )
+ if startX < self.widthMINborderW and stopX > self.widthMINcorner:
+ if startY < self.heightMINcorner and stopY > self.corner: # draw right fill
+ self.window.draw_rectangle( gc, True, self.xPLUwidthMINcorner, self.yPLUcorner, self.cornerMINborderW, self.heightMINcornerMUL2 )
+
+ gc.foreground = saveForeground
+
+ #TP.ProfileEnd( "Round*Box::expose" )
+
+ return False
+
+class ImageButton(gtk.Button):
+ def __init__( self, mainImg_path, clickImg_path = None, enterImg_path = None, backgroundFill = None ):
+ gtk.Button.__init__(self)
+ self.alloc = None
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ self.image = {}
+ self.itype = {}
+ self.iwidth = {}
+ self.iwidthDIV2 = {}
+ self.iheight = {}
+ self.iheightDIV2 = {}
+
+ self.backgroundFill = backgroundFill
+
+ def prepareImage( name, path ):
+ pix = gtk.gdk.pixbuf_new_from_file(path)
+ if pix.get_has_alpha():
+ if backgroundFill == None:
+ self.image[name] = pix
+ self.itype[name] = ITYPE.PIXBUF
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ colormap = self.get_colormap()
+ self.gc.foreground = colormap.alloc_color( backgroundFill, True, True )
+ self.image[name].draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ self.iwidth[name] = pix.get_width()
+ self.iwidthDIV2[name] = self.iwidth[name]//2
+ self.iheight[name] = pix.get_height()
+ self.iheightDIV2[name] = self.iheight[name]//2
+
+ prepareImage( "main", mainImg_path )
+
+ if enterImg_path != None:
+ prepareImage( "enter", enterImg_path )
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+ if clickImg_path != None:
+ prepareImage( "click", clickImg_path )
+ self.connect('pressed',self.on_btn_press, None)
+ self.connect('released',self.on_btn_release, None)
+ if enterImg_path == None:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.curImage = self.upImage = "main"
+ self.down = False
+
+ self.connect('expose-event', self.expose)
+ self.connect('size-allocate', self.size_allocate)
+
+ self.set_size_request(self.iwidth["main"],self.iheight["main"])
+
+ def size_allocate(self, widget, allocation):
+ self.alloc = allocation
+ self.drawX = allocation.x + allocation.width//2
+ self.drawY = allocation.y + allocation.height//2
+
+ def expose(self, widget, event):
+ if self.itype[self.curImage] == ITYPE.PIXBUF:
+ self.window.draw_pixbuf( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage], gtk.gdk.RGB_DITHER_NONE)
+ else:
+ self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
+ return True
+
+ def setImage(self, name, pix):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ updateEnter = True
+ else:
+ updateEnter = False
+
+ if pix.get_has_alpha():
+ if self.backgroundFill == None:
+ self.image[name] = pix
+ self.itype[name] = ITYPE.PIXBUF
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ colormap = self.get_colormap()
+ self.gc.foreground = colormap.alloc_color( self.backgroundFill, True, True )
+ self.image[name].draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ self.iwidth[name] = pix.get_width()
+ self.iwidthDIV2[name] = self.iwidth[name]//2
+ self.iheight[name] = pix.get_height()
+ self.iheightDIV2[name] = self.iheight[name]//2
+
+ if updateEnter:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.queue_draw()
+
+ def on_btn_press(self, widget, event):
+ self.curImage = "click"
+ self.down = True
+ self.queue_draw()
+
+ def on_btn_enter(self, widget, event):
+ if event.mode == gtk.gdk.CROSSING_NORMAL:
+ self.upImage = "enter"
+ if self.down: self.curImage = "click"
+ else: self.curImage = "enter"
+ self.queue_draw()
+
+ def on_btn_leave(self, widget, event):
+ if event.mode == gtk.gdk.CROSSING_NORMAL:
+ self.curImage = self.upImage = "main"
+ self.queue_draw()
+
+ def on_btn_release(self, widget, event):
+ self.curImage = self.upImage
+ self.down = False
+ self.queue_draw()
+
+ def set_palette(self, palette):
+ self._palette = palette
+ self._palette.props.invoker = WidgetInvoker(self)
+ self._palette.props.invoker._position_hint = WidgetInvoker.AT_CURSOR
+
+class ImageToggleButton(gtk.ToggleButton):
+
+ def __init__(self , mainImg_path, altImg_path, enterImg_path = None, backgroundFill = None ):
+ gtk.ToggleButton.__init__(self)
+ self.alloc = None
+ self.within = False
+ self.clicked = False
+
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ self.image = {}
+ self.itype = {}
+ self.iwidth = {}
+ self.iwidthDIV2 = {}
+ self.iheight = {}
+ self.iheightDIV2 = {}
+
+ self.backgroundFill = backgroundFill
+
+ def prepareImage( name, path ):
+ pix = gtk.gdk.pixbuf_new_from_file(path)
+ if pix.get_has_alpha():
+ if backgroundFill == None:
+ self.image[name] = pix
+ self.itype[name] = ITYPE.PIXBUF
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ colormap = self.get_colormap()
+ self.gc.foreground = colormap.alloc_color( backgroundFill, True, True )
+ self.image[name].draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ self.iwidth[name] = pix.get_width()
+ self.iwidthDIV2[name] = self.iwidth[name]//2
+ self.iheight[name] = pix.get_height()
+ self.iheightDIV2[name] = self.iheight[name]//2
+
+ prepareImage( "main", mainImg_path )
+ prepareImage( "alt", altImg_path )
+
+ if enterImg_path != None:
+ prepareImage( "enter", enterImg_path )
+ else:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.connect('toggled',self.toggleImage)
+ self.connect('pressed',self.pressed )
+ self.connect('released',self.released )
+ self.connect('expose-event', self.expose)
+ self.connect('size-allocate', self.size_allocate)
+
+ self.set_size_request(self.iwidth["main"],self.iheight["main"])
+
+ self.toggleImage( self )
+
+ def size_allocate(self, widget, allocation):
+ self.alloc = allocation
+ self.drawX = allocation.x + allocation.width//2
+ self.drawY = allocation.y + allocation.height//2
+
+ def expose(self, widget, event):
+ if self.itype[self.curImage] == ITYPE.PIXBUF:
+ self.window.draw_pixbuf( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage], gtk.gdk.RGB_DITHER_NONE)
+ else:
+ self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
+ return True
+
+ def setImage(self, name, pix):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ updateEnter = True
+ else:
+ updateEnter = False
+
+ if pix.get_has_alpha():
+ if self.backgroundFill == None:
+ self.image[name] = pix
+ self.itype[name] = ITYPE.PIXBUF
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ colormap = self.get_colormap()
+ self.gc.foreground = colormap.alloc_color( self.backgroundFill, True, True )
+ self.image[name].draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ self.iwidth[name] = pix.get_width()
+ self.iwidthDIV2[name] = self.iwidth[name]//2
+ self.iheight[name] = pix.get_height()
+ self.iheightDIV2[name] = self.iheight[name]//2
+
+ if updateEnter:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.queue_draw()
+
+ def toggleImage(self, widget):
+ if not self.get_active():
+ if self.within and self.image.has_key("enter"):
+ self.curImage = "enter"
+ else:
+ self.curImage = "main"
+ else:
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def pressed( self, widget ):
+ self.clicked = True
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def released( self, widget ):
+ self.clicked = False
+ self.toggleImage( self )
+
+ def on_btn_enter(self, widget, event ):
+ if event.mode == gtk.gdk.CROSSING_NORMAL:
+ self.within = True
+ if not self.get_active() and not self.clicked:
+ self.curImage = "enter"
+ else:
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def on_btn_leave(self, widget, event ):
+ if event.mode == gtk.gdk.CROSSING_NORMAL:
+ self.within = False
+ if not self.get_active():
+ self.curImage = "main"
+ else:
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def set_palette(self, palette):
+ self._palette = palette
+ self._palette.props.invoker = WidgetInvoker(self)
+ self._palette.props.invoker._position_hint = WidgetInvoker.AT_CURSOR
+
+class ImageRadioButton(gtk.RadioButton):
+
+ def __init__( self, group, mainImg_path, altImg_path, enterImg_path = None, backgroundFill = None ):
+ gtk.RadioButton.__init__(self, group)
+ self.alloc = None
+ self.within = False
+ self.clicked = False
+
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC( win )
+ self.image = {}
+ self.itype = {}
+ self.iwidth = {}
+ self.iwidthDIV2 = {}
+ self.iheight = {}
+ self.iheightDIV2 = {}
+
+ self.backgroundFill = backgroundFill
+
+ def prepareImage( name, path ):
+ pix = gtk.gdk.pixbuf_new_from_file(path)
+ if pix.get_has_alpha():
+ if backgroundFill == None:
+ self.image[name] = pix
+ self.itype[name] = ITYPE.PIXBUF
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ colormap = self.get_colormap()
+ self.gc.foreground = colormap.alloc_color( backgroundFill, True, True )
+ self.image[name].draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ self.iwidth[name] = pix.get_width()
+ self.iwidthDIV2[name] = self.iwidth[name]//2
+ self.iheight[name] = pix.get_height()
+ self.iheightDIV2[name] = self.iheight[name]//2
+
+ prepareImage( "main", mainImg_path )
+ prepareImage( "alt", altImg_path )
+
+ if enterImg_path != None:
+ prepareImage( "enter", enterImg_path )
+ else:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.connect("toggled", self.toggleImage )
+ self.connect('pressed',self.pressed )
+ self.connect('released',self.released )
+ self.connect('expose-event', self.expose)
+ self.connect('size-allocate', self.size_allocate)
+
+ self.set_size_request(self.iwidth["main"],self.iheight["main"])
+
+ self.toggleImage( self )
+
+ def size_allocate(self, widget, allocation):
+ self.alloc = allocation
+ self.drawX = allocation.x + allocation.width//2
+ self.drawY = allocation.y + allocation.height//2
+
+ def expose(self, widget, event):
+ if self.itype[self.curImage] == ITYPE.PIXBUF:
+ self.window.draw_pixbuf( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage], gtk.gdk.RGB_DITHER_NONE)
+ else:
+ self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
+ return True
+
+ def setImage(self, name, pix):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ updateEnter = True
+ else:
+ updateEnter = False
+
+ if pix.get_has_alpha():
+ if self.backgroundFill == None:
+ self.image[name] = pix
+ self.itype[name] = ITYPE.PIXBUF
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ colormap = self.get_colormap()
+ self.gc.foreground = colormap.alloc_color( self.backgroundFill, True, True )
+ self.image[name].draw_rectangle( self.gc, True, 0, 0, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ else:
+ self.image[name] = gtk.gdk.Pixmap( win, pix.get_width(), pix.get_height() )
+ self.image[name].draw_pixbuf( self.gc, pix, 0, 0, 0, 0, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.itype[name] = ITYPE.PIXMAP
+ self.iwidth[name] = pix.get_width()
+ self.iwidthDIV2[name] = self.iwidth[name]//2
+ self.iheight[name] = pix.get_height()
+ self.iheightDIV2[name] = self.iheight[name]//2
+
+ if updateEnter:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.queue_draw()
+
+ def toggleImage( self, widget ):
+ if not self.get_active():
+ if self.within and self.image.has_key("enter"):
+ self.curImage = "enter"
+ else:
+ self.curImage = "main"
+ else:
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def pressed( self, widget ):
+ self.clicked = True
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def released( self, widget ):
+ self.clicked = False
+ self.toggleImage( self )
+
+ def on_btn_enter(self, widget, event):
+ if event.mode == gtk.gdk.CROSSING_NORMAL:
+ self.within = True
+ if not self.get_active() and not self.clicked:
+ self.curImage = "enter"
+ else:
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def on_btn_leave(self, widget, event):
+ if event.mode == gtk.gdk.CROSSING_NORMAL:
+ self.within = False
+ if not self.get_active():
+ self.curImage = "main"
+ else:
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def set_palette(self, palette):
+ self._palette = palette
+ self._palette.props.invoker = WidgetInvoker(self)
+ self._palette.props.invoker._position_hint = WidgetInvoker.AT_CURSOR
+
+class keyButton(gtk.Button):
+ import cairo
+ def __init__(self, width, height, fillcolor, strokecolor):
+ gtk.Button.__init__(self)
+ self.alloc = None
+ win = gtk.gdk.get_default_root_window()
+ self.gc = gtk.gdk.GC(win)
+
+ self.connect('expose-event', self.expose)
+ self.connect('size-allocate', self.size_allocate)
+
+ self.width = width
+ self.height = height
+ self.fillcolor = fillcolor
+ self.strokecolor = strokecolor
+
+ self.set_size_request(self.width,self.height)
+
+ def size_allocate(self, widget, allocation):
+ self.alloc = allocation
+ self.drawX = allocation.x + allocation.width//2
+ self.drawY = allocation.y + allocation.height//2
+
+ def expose(self, widget, event):
+ self.draw()
+ return True
+
+ def draw(self):
+ self.cr = self.window.cairo_create()
+ self.cr.set_source_rgb(self.fillcolor[0],self.fillcolor[1],self.fillcolor[2])
+ self.draw_round_rect(self.cr,self.drawX - self.width//2, self.drawY - self.height //2, self.width,self.height,10)
+ self.cr.fill()
+ self.cr.set_line_width(3)
+ self.cr.set_source_rgb(self.strokecolor[0],self.strokecolor[1],self.strokecolor[2])
+ self.draw_round_rect(self.cr,self.drawX - self.width//2, self.drawY - self.height //2, self.width,self.height,10)
+ self.cr.stroke()
+
+ def draw_round_rect(self,context,x,y,w,h,r):
+ context.move_to(x+r,y) # Move to A
+ context.line_to(x+w-r,y) # Straight line to B
+ context.curve_to(x+w,y,x+w,y,x+w,y+r) # Curve to C, Control points are both at Q
+ context.line_to(x+w,y+h-r) # Move to D
+ context.curve_to(x+w,y+h,x+w,y+h,x+w-r,y+h) # Curve to E
+ context.line_to(x+r,y+h) # Line to F
+ context.curve_to(x,y+h,x,y+h,x,y+h-r) # Curve to G
+ context.line_to(x,y+r) # Line to H
+ context.curve_to(x,y,x,y,x+r,y) # Curve to A
+ return
+
+ def set_fillcolor(self,r,g,b):
+ self.fillcolor = [r,g,b]
+ self.queue_draw()
+
+ def set_strokecolor(self,r,g,b):
+ self.strokecolor = [r,g,b]
+ self.queue_draw()
+
+class BigComboBox(ComboBox):
+ def __init__(self):
+ ComboBox.__init__(self)
+
+ def append_item(self, action_id, text, icon_name=None, size = None):
+ if not self._icon_renderer and icon_name:
+ self._icon_renderer = gtk.CellRendererPixbuf()
+
+ settings = self.get_settings()
+ w, h = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_MENU)
+ self._icon_renderer.props.stock_size = w
+
+ self.pack_start(self._icon_renderer, False)
+ self.add_attribute(self._icon_renderer, 'pixbuf', 2)
+
+ if not self._text_renderer and text:
+ self._text_renderer = gtk.CellRendererText()
+ self.pack_end(self._text_renderer, True)
+ self.add_attribute(self._text_renderer, 'text', 1)
+
+ if icon_name:
+ if not size:
+ size = gtk.ICON_SIZE_LARGE_TOOLBAR
+ width, height = gtk.icon_size_lookup(size)
+ else:
+ width, height = size
+ if icon_name[0:6] == "theme:":
+ icon_name = self._get_real_name_from_theme(icon_name[6:], size)
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_name, width, height)
+ else:
+ pixbuf = None
+
+ self._model.append([action_id, text, pixbuf, False])
+
diff --git a/common/Util/Trackpad.py b/common/Util/Trackpad.py
new file mode 100644
index 0000000..0ddb929
--- /dev/null
+++ b/common/Util/Trackpad.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+import gobject
+
+from common.Util.CSoundClient import new_csound_client
+import common.Config as Config
+
+KEY_MAP_PIANO = Config.KEY_MAP_PIANO
+
+class Trackpad:
+ def __init__(self, win):
+ self.win = win
+ self.csnd = new_csound_client()
+ win.add_events(gtk.gdk.POINTER_MOTION_MASK)
+ win.add_events(gtk.gdk.BUTTON_PRESS_MASK)
+ win.add_events(gtk.gdk.BUTTON_RELEASE_MASK)
+ win.connect('motion-notify-event',self.handle_motion)
+ win.connect('key-press-event',self.handle_keyPress)
+ win.connect('key-release-event',self.handle_keyRelease)
+
+ self.first_x = None
+ self.current_x = None
+ self.final_x = None
+ self.first_y = None
+ self.current_y = None
+ self.final_y = None
+
+ self.buttonPressed = False
+
+ self.create_invisible_cursor()
+
+ self.display = self.win.get_display()
+ self.screen = gtk.gdk.Display.get_default_screen(self.display)
+ self.context = None
+
+ def setContext(self, context):
+ self.context = context
+
+ def create_invisible_cursor(self):
+ pix_data = """/* XPM */
+ static char * invisible_xpm[] = {
+ "1 1 1 1",
+ " c None",
+ " "};"""
+ color = gtk.gdk.Color()
+ pix = gtk.gdk.pixmap_create_from_data(None, pix_data, 1, 1, 1, color, color)
+ self.invisible_cursor = gtk.gdk.Cursor(pix,pix,color,color,0,0)
+
+ def handle_motion(self,widget,event):
+ if self.context != 'edit':
+ if event.x < 0:
+ X = 0
+ elif event.x > self.screen.get_width():
+ X = self.screen.get_width()
+ else:
+ X = event.x
+
+ if event.y < 0:
+ Y = 0
+ elif event.y > self.screen.get_height():
+ Y = self.screen.get_height()
+ else:
+ Y = event.y
+
+ self.current_x = X
+ self.current_y = Y
+ if self.buttonPressed:
+ self.final_x = X - self.first_x
+ self.final_y = Y - self.first_y
+ self.csnd.setTrackpadX(self.final_x)
+ self.csnd.setTrackpadY(self.final_y)
+
+ def handle_keyPress(self,widget,event):
+ if KEY_MAP_PIANO.has_key(event.hardware_keycode) and self.buttonPressed == False:
+ gtk.gdk.Display.warp_pointer(self.display, self.screen, self.screen.get_width() / 2, self.screen.get_height() / 2)
+ gtk.gdk.pointer_grab(self.win.window, event_mask = gtk.gdk.POINTER_MOTION_MASK)#, cursor = self.invisible_cursor)
+ self.buttonPressed = True
+ self.first_x = self.screen.get_width() / 2
+ self.first_y = self.screen.get_height() / 2
+
+ def handle_keyRelease(self,widget,event):
+ if KEY_MAP_PIANO.has_key(event.hardware_keycode):
+ gtk.gdk.pointer_ungrab(time = 0L)
+ self.buttonPressed = False
+ self.restoreDelay = gobject.timeout_add(120, self.restore)
+
+ def restore( self ):
+ self.csnd.setTrackpadX(0)
+ self.csnd.setTrackpadY(0)
+ gobject.source_remove( self.restoreDelay )
+
diff --git a/common/Util/__init__.py b/common/Util/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common/Util/__init__.py
diff --git a/common/__init__.py b/common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/common/__init__.py