summaryrefslogtreecommitdiff
path: root/attic/muse2-oom/muse2/share/pybridge
diff options
context:
space:
mode:
Diffstat (limited to 'attic/muse2-oom/muse2/share/pybridge')
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/CMakeLists.txt26
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/Pyro_NS_URI1
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/addpartexample.py29
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/addtrack.py33
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/ctrlexample.py26
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/effecttoggle.py23
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/mute.py20
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/repeatpart.py61
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/setpositionexample.py35
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/tempoexample.py6
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/examples/trackparamchangeexample.py21
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/musepclient.py17
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/museplauncher.py257
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/parter/main.py26
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/parter/parter.py107
-rw-r--r--attic/muse2-oom/muse2/share/pybridge/robert.py46
16 files changed, 734 insertions, 0 deletions
diff --git a/attic/muse2-oom/muse2/share/pybridge/CMakeLists.txt b/attic/muse2-oom/muse2/share/pybridge/CMakeLists.txt
new file mode 100644
index 00000000..bee3a0d0
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/CMakeLists.txt
@@ -0,0 +1,26 @@
+#=============================================================================
+# MusE
+# Linux Music Editor
+# $Id:$
+#
+# Copyright (C) 2002-2006 by Werner Schweer and others
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
+
+file (GLOB pybridge_files *.py)
+
+install( FILES ${pybridge_files}
+ DESTINATION ${MusE_SHARE_DIR}/pybridge
+ )
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/Pyro_NS_URI b/attic/muse2-oom/muse2/share/pybridge/Pyro_NS_URI
new file mode 100644
index 00000000..8e304cc1
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/Pyro_NS_URI
@@ -0,0 +1 @@
+PYRO://127.0.1.1:9090/7f0001010beb68ea2286bbe6686be546
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/addpartexample.py b/attic/muse2-oom/muse2/share/pybridge/examples/addpartexample.py
new file mode 100644
index 00000000..65c41bdf
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/addpartexample.py
@@ -0,0 +1,29 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+
+#
+# Example on how to insert a new note, outcommented since I run the script several times and it inserts so many notes :-)
+# But it works!
+#
+
+
+rpos = muse.getRPos()
+lpos = muse.getLPos()
+
+event = {'data':[61,100,0],
+ 'tick':0, # Relative offset of part - 0 = beginning of part
+ 'type':"note",
+ 'len':rpos - lpos}
+
+part = {'events': [event],
+ 'tick': lpos}
+muse.createPart("Track 1", lpos, rpos - lpos, part)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/addtrack.py b/attic/muse2-oom/muse2/share/pybridge/examples/addtrack.py
new file mode 100644
index 00000000..116b35c0
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/addtrack.py
@@ -0,0 +1,33 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+
+for j in range(0,5):
+ for i in range(0,30):
+ muse.addMidiTrack("amiditrack" + str(i))
+ for i in range(0,30):
+ muse.deleteTrack("amiditrack" + str(i))
+
+for i in range(0, 10):
+ print i
+ muse.addMidiTrack("amiditrack")
+ muse.addWaveTrack("awavetrack")
+ muse.addOutput("anoutput")
+ muse.addInput("aninput")
+ muse.setMute("aninput", False)
+ muse.setAudioTrackVolume("aninput",1.0)
+ muse.deleteTrack("amiditrack")
+ muse.deleteTrack("awavetrack")
+ muse.deleteTrack("anoutput")
+ muse.deleteTrack("aninput")
+ time.sleep(1)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/ctrlexample.py b/attic/muse2-oom/muse2/share/pybridge/examples/ctrlexample.py
new file mode 100644
index 00000000..9e28afad
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/ctrlexample.py
@@ -0,0 +1,26 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+#for i in range(0,10):
+# print "Ctrl no " + str(i) + " = " + str(muse.getMidiControllerValue("Track 1", i))
+
+"""
+for i in range(0,127):
+ muse.setMidiControllerValue("Track 1", 7, i)
+ time.sleep(0.1)
+"""
+
+muse.setMidiControllerValue("Track 1", 7, 56)
+print muse.getMidiControllerValue("Track 1", 7)
+print muse.getAudioTrackVolume("Out 1")
+muse.setAudioTrackVolume("Out 1", -1.0)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/effecttoggle.py b/attic/muse2-oom/muse2/share/pybridge/examples/effecttoggle.py
new file mode 100644
index 00000000..6feb4bca
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/effecttoggle.py
@@ -0,0 +1,23 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+trackname = "wavtrack"
+
+fxs = muse.getTrackEffects(trackname)
+print fxs
+
+for i in range (0,10):
+ muse.toggleTrackEffect(trackname,0, False)
+ time.sleep(1)
+ muse.toggleTrackEffect(trackname,0, True)
+ time.sleep(1)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/mute.py b/attic/muse2-oom/muse2/share/pybridge/examples/mute.py
new file mode 100644
index 00000000..5732a7f8
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/mute.py
@@ -0,0 +1,20 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+for i in range(0,10):
+ muse.setMute("Strings", False)
+ muse.setMute("Lead1", True)
+ time.sleep(1)
+ muse.setMute("Strings", True)
+ muse.setMute("Lead1", False)
+ time.sleep(1)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/repeatpart.py b/attic/muse2-oom/muse2/share/pybridge/examples/repeatpart.py
new file mode 100644
index 00000000..e2b8ff31
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/repeatpart.py
@@ -0,0 +1,61 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+import sys
+import time
+
+SLEEPIVAL=0.3
+
+def advanceToNextSection(muse, newlpos, newrpos):
+ print "Advancing..."
+ currpos = muse.getRPos()
+ curlpos = muse.getLPos()
+ curpos = muse.getCPos()
+ muse.setLoop(False)
+
+ while curpos < currpos:
+ time.sleep(SLEEPIVAL)
+ curpos = muse.getCPos()
+ print "Leaving current section..."
+ muse.setRPos(newrpos)
+ curpos = muse.getCPos()
+
+ while curpos < newlpos:
+ time.sleep(SLEEPIVAL)
+ curpos = muse.getCPos()
+ print "Entered new section"
+ muse.setLPos(newlpos)
+ muse.setLoop(True)
+ return
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+muse.stopPlay()
+parts = muse.getParts("Track 1")
+muse.setLPos(parts[0]['tick'])
+muse.setRPos(parts[0]['tick'] + parts[0]['len'])
+muse.setCPos(0)
+time.sleep(0.2) # Hmmm, don't like it but it seems necessary to pause a short while before starting play
+muse.setLoop(True)
+muse.startPlay()
+
+for i in range(1, len(parts)):
+ part = parts[i]
+ tick = part['tick']
+ len = part['len']
+ print "Press enter to advance to next section/part!"
+ sys.stdin.read(1)
+ advanceToNextSection(muse, tick, tick + len)
+
+print "This is the final section. Disabling loop and leaving..."
+muse.setLoop(False)
+
+#print "Press enter to leave final section"
+#sys.stdin.read(1)
+#muse.setLoop(False)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/setpositionexample.py b/attic/muse2-oom/muse2/share/pybridge/examples/setpositionexample.py
new file mode 100644
index 00000000..476410d9
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/setpositionexample.py
@@ -0,0 +1,35 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+
+import Pyro.core
+import time
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+parts = muse.getParts("Track 1")
+
+ptick = parts[0]['tick']
+len = parts[0]['len']
+muse.setLPos(ptick)
+muse.setRPos(ptick + len)
+muse.setCPos(ptick + len / 2)
+
+songlen = muse.getSongLen()
+#print "Song length: " + str(songlen)
+
+#
+# Copy first part to after current song length, thus increase song length with length of first part
+#
+newsonglen = songlen + parts[0]['len']
+muse.setSongLen(newsonglen)
+muse.createPart("Track 1", songlen + 1, parts[0]['len'], parts[0])
+time.sleep(1)
+
+lastpart = muse.getParts("Track 1").pop()
+print lastpart['id']
+muse.deletePart(lastpart['id'])
+print muse.getDivision()
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/tempoexample.py b/attic/muse2-oom/muse2/share/pybridge/examples/tempoexample.py
new file mode 100644
index 00000000..ed12638d
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/tempoexample.py
@@ -0,0 +1,6 @@
+import Pyro.core
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+
+print "Tempo: " + str(muse.getTempo(0))
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/examples/trackparamchangeexample.py b/attic/muse2-oom/muse2/share/pybridge/examples/trackparamchangeexample.py
new file mode 100644
index 00000000..0681ccb4
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/examples/trackparamchangeexample.py
@@ -0,0 +1,21 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+"""
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+
+muse.setMidiTrackParameter("Track 1", "velocity",10)
+muse.setMidiTrackParameter("Track 1", "compression",101)
+muse.setMidiTrackParameter("Track 1", "delay",2)
+muse.setMidiTrackParameter("Track 1", "transposition",1)
+
+for i in range(-127, 127):
+ muse.setMidiTrackParameter("Track 1", "velocity",i)
+ time.sleep(0.1)
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/musepclient.py b/attic/muse2-oom/muse2/share/pybridge/musepclient.py
new file mode 100644
index 00000000..dc87e4e8
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/musepclient.py
@@ -0,0 +1,17 @@
+#
+# Example client for MusE Pyro bridge (Python Remote Object)
+#
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+print "Current position is: " + str(muse.getCPos())
+muse.startPlay()
+time.sleep(1) # Sleep one second
+muse.stopPlay()
+print "New position is: " + str(muse.getCPos())
+muse.rewindStart()
+print "Pos after rewind is: " + str(muse.getCPos())
+print "Lpos, Rpos: " + str(muse.getLPos()) + ":" + str(muse.getRPos())
+
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/museplauncher.py b/attic/muse2-oom/muse2/share/pybridge/museplauncher.py
new file mode 100644
index 00000000..24206213
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/museplauncher.py
@@ -0,0 +1,257 @@
+"""
+//=========================================================
+// MusE
+// Linux Music Editor
+// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
+//=========================================================
+
+This file is used by MusE for launching a Pyro name service and connecting a remote object to the global Python functions
+"""
+
+import Pyro.naming
+import Pyro.core
+from Pyro.errors import PyroError,NamingError
+import sys, time
+import threading
+
+#
+# Note: this module, 'muse' is activated from within MusE - thus it is not possible to execute the scripts without a running
+# MusE instance
+#
+import muse
+
+#
+# Class which implements the functionality that is used remotely.
+# In short just repeating the global functions in the muse-module
+#
+# TODO: It should be better to skip this class completely by implementing
+# functionality as a class in pyapi.cpp instead of global functions
+# that need to be wrapped like this
+#
+class MusE:
+ def getCPos(self): # Get current position
+ return muse.getCPos()
+
+ def startPlay(self): # Start playback
+ return muse.startPlay()
+
+ def stopPlay(self): # Stop playback
+ return muse.stopPlay()
+
+ def rewindStart(self): # Rewind current position to start
+ return muse.rewindStart()
+
+ def getLPos(self): # Get position of left locator
+ return muse.getLPos()
+
+ def getRPos(self): # Get position of right locator
+ return muse.getRPos()
+
+ def getTempo(self, tick): #Get tempo at particular tick
+ return muse.getTempo(tick)
+
+ def getTrackNames(self): # get track names
+ return muse.getTrackNames()
+
+ def getParts(self, trackname): # get parts in a particular track
+ return muse.getParts(trackname)
+
+ def createPart(self, trackname, starttick, lenticks, part): # create part in track
+ return muse.createPart(trackname, starttick, lenticks, part)
+
+ def modifyPart(self, part): # modify a part (the part to be modified is specified by its id
+ return muse.modifyPart((part))
+
+ def deletePart(self, part): # delete a part
+ return muse.deletePart((part))
+
+ def getSelectedTrack(self): # get first selected track in arranger window
+ return muse.getSelectedTrack()
+
+ def importPart(self, trackname, filename, tick): # import part file to a track at a given position
+ return muse.importPart(trackname, filename, tick)
+
+ def setCPos(self, tick): # set current position
+ return muse.setPos(0, tick)
+
+ def setLPos(self, tick): # set left locator
+ return muse.setPos(1, tick)
+
+ def setRPos(self, tick): # set right locator
+ return muse.setPos(2, tick)
+
+ def setSongLen(self, ticks): # set song length
+ return muse.setSongLen(ticks)
+
+ def getSongLen(self): # get song length
+ return muse.getSongLen()
+
+ def getDivision(self): # get division (ticks per 1/4, or per beat?)
+ return muse.getDivision()
+
+ def setMidiTrackParameter(self, trackname, paramname, value): # set midi track parameter (velocity, compression, len, transpose)
+ return muse.setMidiTrackParameter(trackname, paramname, value);
+
+ def getLoop(self): # get loop flag
+ return muse.getLoop()
+
+ def setLoop(self, loopFlag): # set loop flag
+ return muse.setLoop(loopFlag)
+
+ def getMute(self, trackname): # get track mute parameter
+ return muse.getMute(trackname)
+
+ def setMute(self, trackname, enabled): # set track mute parameter
+ return muse.setMute(trackname, enabled)
+
+ def setVolume(self, trackname, volume): # set mixer volume
+ return muse.setVolume(trackname, volume)
+
+ def getMidiControllerValue(self, trackname, ctrlno): # get a particular midi controller value for a track
+ return muse.getMidiControllerValue(trackname, ctrlno)
+
+ def setMidiControllerValue(self, trackname, ctrlno, value): # set a particular midi controller value for a track
+ return muse.setMidiControllerValue(trackname, ctrlno, value)
+
+ def setAudioTrackVolume(self, trackname, dvol): # set volume for audio track
+ return muse.setAudioTrackVolume(trackname, dvol)
+
+ def getAudioTrackVolume(self, trackname): # get volume for audio track
+ return muse.getAudioTrackVolume(trackname)
+
+ def getTrackEffects(self, trackname): # get effect names for an audio track
+ return muse.getTrackEffects(trackname)
+
+ def toggleTrackEffect(self, trackname, effectno, onoff): # toggle specific effect on/off
+ return muse.toggleTrackEffect(trackname, effectno, onoff)
+
+ def findNewTrack(self, oldtracknames): #internal function
+ tracknames = muse.getTrackNames()
+ for trackname in tracknames:
+ if trackname in oldtracknames:
+ continue
+
+ return trackname
+
+ def changeTrackName(self, trackname, newname): #change track name
+ return muse.changeTrackName(trackname, newname)
+
+ def nameNewTrack(self, newname, oldtracknames):# Internal function, wait until new track shows up in tracknames, then rename it
+ tmpname = None
+ for i in range(0,100):
+ tmpname = self.findNewTrack(oldtracknames)
+ if tmpname == None:
+ time.sleep(0.1)
+ continue
+ else:
+ self.changeTrackName(tmpname, newname)
+ time.sleep(0.1) # Ouch!!
+ break
+
+
+ def addMidiTrack(self, trackname): # add midi track
+ oldtracknames = muse.getTrackNames()
+ if trackname in oldtracknames:
+ return None
+
+ muse.addMidiTrack()
+ self.nameNewTrack(trackname, oldtracknames)
+
+
+ def addWaveTrack(self, trackname): # add wave track
+ oldtracknames = muse.getTrackNames()
+ if trackname in oldtracknames:
+ return None
+
+ muse.addWaveTrack()
+ self.nameNewTrack(trackname, oldtracknames)
+
+ def addInput(self, trackname): # add audio input
+ oldtracknames = muse.getTrackNames()
+ if trackname in oldtracknames:
+ return None
+
+ muse.addInput()
+ self.nameNewTrack(trackname, oldtracknames)
+
+ def addOutput(self, trackname): # add audio output
+ oldtracknames = muse.getTrackNames()
+ if trackname in oldtracknames:
+ return None
+
+ muse.addOutput()
+ self.nameNewTrack(trackname, oldtracknames)
+
+ def addGroup(self, trackname): # add audio group
+ oldtracknames = muse.getTrackNames()
+ if trackname in oldtracknames:
+ return None
+
+ muse.addGroup()
+ self.nameNewTrack(trackname, oldtracknames)
+
+ def deleteTrack(self, trackname): # delete a track
+ tracknames = muse.getTrackNames()
+ if trackname not in tracknames:
+ return False
+
+ muse.deleteTrack(trackname)
+
+# def getOutputRoute(self, trackname):
+# return muse.getOutputRoute(trackname)
+
+class NameServiceThread(threading.Thread):
+ def __init__(self):
+ threading.Thread.__init__(self)
+ self.starter = Pyro.naming.NameServerStarter()
+
+ def run(self):
+ self.starter.start()
+
+ def verifyRunning(self):
+ return self.starter.waitUntilStarted(10)
+
+#
+# museclass Pyro object
+#
+class museclass(Pyro.core.ObjBase, MusE):
+ pass
+
+#
+# main server program
+#
+def main():
+ Pyro.core.initServer()
+ nsthread = NameServiceThread()
+ nsthread.start()
+ if (nsthread.verifyRunning() == False):
+ print "Failed to launch name service..."
+ sys.exit(1)
+
+ daemon = Pyro.core.Daemon()
+ # locate the NS
+ locator = Pyro.naming.NameServerLocator()
+ #print 'searching for Name Server...'
+ ns = locator.getNS()
+ daemon.useNameServer(ns)
+
+ # connect a new object implementation (first unregister previous one)
+ try:
+ # 'test' is the name by which our object will be known to the outside world
+ ns.unregister('muse')
+ except NamingError:
+ pass
+
+ # connect new object implementation
+ daemon.connect(museclass(),'muse')
+
+ # enter the server loop.
+ print 'Muse remote object published'
+ daemon.requestLoop()
+
+if __name__=="__main__":
+ main()
+
+main()
+
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/parter/main.py b/attic/muse2-oom/muse2/share/pybridge/parter/main.py
new file mode 100644
index 00000000..40b85734
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/parter/main.py
@@ -0,0 +1,26 @@
+import sys,time
+from PyQt4 import QtGui
+
+from parter import ParterMainwidget
+import sys, os
+import Pyro.core
+
+#import musemock
+#muse = musemock.MusEMock()
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+"""
+strack = muse.getSelectedTrack()
+cpos = muse.getCPos()
+muse.importPart(strack, "/home/ddskmlg/.muse/parts/testpart2.mpt", cpos)
+sys.exit(0)
+"""
+
+
+if __name__ == '__main__':
+ app = QtGui.QApplication(sys.argv)
+ partsdir = os.getenv("HOME") + "/.muse/parts"
+ mainw = ParterMainwidget(None, muse, partsdir)
+ mainw.show()
+ #muse.importPart("Track 1","/home/ddskmlg/.muse/parts/testpart2.mpt",18432)
+ sys.exit(app.exec_())
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/parter/parter.py b/attic/muse2-oom/muse2/share/pybridge/parter/parter.py
new file mode 100644
index 00000000..889b00a1
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/parter/parter.py
@@ -0,0 +1,107 @@
+import sys,time,os
+from PyQt4 import QtGui, QtCore
+from PyQt4.QtGui import QFileDialog, QListView, QStringListModel, QButtonGroup, QPushButton
+
+class ParterMainwidget(QtGui.QWidget):
+ def __init__(self, parent=None, muse=None, partsdir=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.muse = muse
+ self.partsdir = partsdir
+ self.lcurdir = QtGui.QLabel(partsdir)
+ moveupbutton = QPushButton("Parent dir")
+ appendbutton = QPushButton("Append")
+ putbutton = QPushButton("Put")
+ blayout = QtGui.QGridLayout()
+ blayout.addWidget(self.lcurdir)
+ blayout.addWidget(moveupbutton)
+ blayout.addWidget(appendbutton)
+ blayout.addWidget(putbutton)
+ self.tree = QtGui.QTreeView()
+ self.dirmodel = QtGui.QDirModel()
+ self.tree.setModel(self.dirmodel)
+ self.tree.setRootIndex(self.dirmodel.index(self.partsdir))
+
+ layout = QtGui.QGridLayout()
+ self.setLayout(layout)
+ layout.addWidget(self.tree, 0, 0)
+ layout.addLayout(blayout, 0, 1)
+
+ self.connect(moveupbutton, QtCore.SIGNAL('clicked()'), self.parentDir)
+ self.connect(appendbutton, QtCore.SIGNAL('clicked()'), self.appendPressed)
+ self.connect(putbutton, QtCore.SIGNAL('clicked()'), self.putPressed)
+
+ self.connect(self.tree, QtCore.SIGNAL('activated(QModelIndex)'), self.activated)
+
+ def parentDir(self):
+ f = QtCore.QFileInfo(self.partsdir)
+ self.changeDir(f.canonicalPath())
+
+ def changeDir(self, newdir):
+ self.partsdir = newdir
+ self.tree.setRootIndex(self.dirmodel.index(self.partsdir))
+ self.lcurdir.setText(self.partsdir)
+
+ def activated(self, s):
+ fileInfo = self.dirmodel.fileInfo(s)
+ if fileInfo.isDir():
+ self.changeDir(fileInfo.absoluteFilePath())
+ return
+
+ fname = str(fileInfo.absoluteFilePath()) # if not str() around it crashes!
+ self.putPart(fname)
+
+ def putPart(self, fname):
+ trackid = self.muse.getSelectedTrack()
+ if trackid == None:
+ return
+ cpos = self.muse.getCPos()
+ self.muse.importPart(trackid, fname, cpos)
+
+ def getSelectedItem(self):
+ selectionmodel = self.tree.selectionModel()
+ for i in selectionmodel.selectedIndexes():
+ fileInfo = self.dirmodel.fileInfo(i)
+ return str(fileInfo.absoluteFilePath())
+ return None
+
+ def appendPressed(self):
+ selected = self.getSelectedItem()
+ if selected == None:
+ return
+ trackid = self.muse.getSelectedTrack()
+ if trackid == None:
+ return
+ parts = self.muse.getParts(trackid)
+ if parts == None:
+ return
+
+ pos = 0
+ if len(parts) > 0:
+ part = parts[len(parts) - 1]
+ pos = part['tick'] + part['len']
+ print "Appending " + selected
+ self.muse.importPart(trackid, selected, pos)
+
+
+
+ def putPressed(self):
+ selected = self.getSelectedItem()
+ if selected == None:
+ return
+ trackid = self.muse.getSelectedTrack()
+ if trackid == None:
+ return
+ cpos = self.muse.getCPos()
+ self.muse.importPart(trackid, selected, cpos)
+
+ def testfunc2(self, index):
+ print str(index.row()) + " " + str(index.column())
+ print index.data().toString()
+
+if __name__ == '__main__':
+ app = QtGui.QApplication(sys.argv)
+ mainw = ParterMainwidget()
+ mainw.show()
+ sys.exit(app.exec_())
+
+
diff --git a/attic/muse2-oom/muse2/share/pybridge/robert.py b/attic/muse2-oom/muse2/share/pybridge/robert.py
new file mode 100644
index 00000000..2de8e1ab
--- /dev/null
+++ b/attic/muse2-oom/muse2/share/pybridge/robert.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+#
+# Example client for MusE Pyro bridge (Python Remote Object)
+#
+import Pyro.core
+import time
+
+muse=Pyro.core.getProxyForURI('PYRONAME://:Default.muse')
+print "Current position is: " + str(muse.getCPos())
+
+midiDevice=file("/dev/snd/midiC1D0")
+nextIsCommand=False
+while True:
+ v=midiDevice.read(1)
+ if nextIsCommand:
+ print " %d"%ord(v)
+ if ord(v) == 0:
+ print "set hh"
+ muse.setMute("hh", False)
+ muse.setMute("RIDE", True)
+ if ord(v) == 1:
+ muse.setMute("hh", True)
+ muse.setMute("RIDE", False)
+ print "set ride"
+ if ord(v) == 2:
+ muse.setMute("ACCENT1", False)
+ if ord(v) == 3:
+ muse.setMute("ACCENT2", False)
+ if ord(v) == 127:
+ print "mute all accents"
+ muse.setMute("ACCENT1", True)
+ muse.setMute("ACCENT2", True)
+ nextIsCommand=False
+ if ord(v) == 192:
+ nextIsCommand=True
+
+'''
+muse.startPlay()
+time.sleep(1) # Sleep one second
+muse.stopPlay()
+print "New position is: " + str(muse.getCPos())
+muse.rewindStart()
+print "Pos after rewind is: " + str(muse.getCPos())
+print "Lpos, Rpos: " + str(muse.getLPos()) + ":" + str(muse.getRPos())
+
+'''