forked from libxmp/libxmp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_replay_data.py
More file actions
executable file
·50 lines (37 loc) · 960 Bytes
/
Copy pathgen_replay_data.py
File metadata and controls
executable file
·50 lines (37 loc) · 960 Bytes
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
#!/usr/bin/python
import sys
import os
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(ROOT_PATH + "/../libxmp-python")
from pyxmp import *
argc = len(sys.argv)
argv = sys.argv
if argc < 2:
print "Usage: %s <module> [channels]" % (os.path.basename(argv[0]))
sys.exit(1)
try:
player = Player()
mod = Module(argv[1], player)
except IOError as (errno, strerror):
sys.stderr.write("%s: %s\n" % (argv[1], strerror))
sys.exit(1)
player.start(8000, 0)
mi = mod.get_info()
fi = FrameInfo()
channels = []
if argc > 2:
for i in range(argc - 2):
channels.append(int(argv[i + 2]))
else:
channels = range(mi.mod[0].chn)
while player.play_frame():
player.get_frame_info(fi)
if fi.loop_count > 0:
break
for i in channels:
ci = fi.channel_info[i]
print "%d %d %d %d %d %d %d %d %d" % (fi.time, fi.row,
fi.frame, i, ci.period, ci.volume, ci.instrument,
ci.pan, ci.sample)
player.end()
mod.release()