blob: e2b8ff31d7bdd4354cffcafd2b6fb9198778105e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
"""
//=========================================================
// 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)
|