Skip to content

Commit 56dc4b7

Browse files
committed
Group指定に対応
1 parent 413da38 commit 56dc4b7

File tree

7 files changed

+30
-6
lines changed

7 files changed

+30
-6
lines changed

Template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<int name="symbol" value="73"/>
121121
<string name="text" value="{name}" wide="true"/>
122122
<string name="description" value="{name}" wide="true"/>
123-
<int name="group" value="0"/>
123+
<int name="group" value="{group}"/>
124124
</obj>"""
125125

126126
ARTICULATION_IN_SLOT_FOOTER = """
@@ -147,7 +147,7 @@
147147
<int name="symbol" value="73"/>
148148
<string name="text" value="{name}" wide="true"/>
149149
<string name="description" value="{name}" wide="true"/>
150-
<int name="group" value="0"/>
150+
<int name="group" value="{group}"/>
151151
</obj>"""
152152

153153
ARTICULATION_FOOTER = """

Template/Excel/Example.xlsx

1.69 KB
Binary file not shown.

Template/Excel/Template.xlsx

888 Bytes
Binary file not shown.

Template/Numbers/Example.numbers

2.09 KB
Binary file not shown.

Template/Numbers/Template.numbers

6.39 KB
Binary file not shown.

XLS2ExpressionMap.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ def float2int( v, defaultValue = 0 ):
5858
else:
5959
return defaultValue
6060

61+
def getGroupValue( sheet, row ):
62+
group = XLSUtil.getCellFromColmnName( sheet, row, "Group" )
63+
64+
# Since v0.0.5: Colmn "Group" check (+backward compatibility)
65+
if( group != None and hasattr( group, "value" ) ):
66+
# float to int saferty
67+
group = float2int( group.value ) - 1
68+
69+
if( group < 0 ):
70+
group = 0
71+
else:
72+
group = 0
73+
74+
return group
75+
6176
def genArticulation( sheet ):
6277
rowLength = sheet.nrows
6378

@@ -67,18 +82,25 @@ def genArticulation( sheet ):
6782

6883
name = XLSUtil.getCellFromColmnName( sheet, row, "Articulation" ).value.strip()
6984
artiType = XLSUtil.getCellFromColmnName( sheet, row, "Articulation Type" ).value.strip()
85+
group = getGroupValue( sheet, row )
7086

87+
# Must be required values to generate
7188
if( len( name ) == 0 or len( artiType ) == 0 ):
7289
continue
7390

74-
print( "[Articulation] {name}, Type={type}".format( name = name, type = artiType ) )
91+
print( "[Articulation] {name}, Type={type}, Group={group}".format(
92+
name = name,
93+
type = artiType,
94+
group = group
95+
))
7596

7697
artiType = Constants.ARTICULATION_TYPE.index( artiType ) # to integer format ( 0: Attribute 1: Direction).
7798

7899
ret += Template.ARTICULATION.format(
79100
uuid1 = createUUID(),
80101
type = artiType,
81-
name = name
102+
name = name,
103+
group = group
82104
)
83105

84106
ret += Template.ARTICULATION_FOOTER
@@ -96,6 +118,7 @@ def genKeySwitch( sheet ):
96118
name = XLSUtil.getCellFromColmnName( sheet, row, "Name" ).value.strip()
97119
articulation = XLSUtil.getCellFromColmnName( sheet, row, "Articulation" ).value.strip()
98120
color = XLSUtil.getCellFromColmnName( sheet, row, "Color" ).value
121+
group = getGroupValue( sheet, row )
99122
noteNo = XLSUtil.getCellFromColmnName( sheet, row, "MIDI Note" ).value.strip()
100123
vel = XLSUtil.getCellFromColmnName( sheet, row, "Velocity" ).value
101124
ccNo = XLSUtil.getCellFromColmnName( sheet, row, "CC No." ).value
@@ -130,7 +153,8 @@ def genKeySwitch( sheet ):
130153
tmp = ""
131154
tmp += Template.ARTICULATION_IN_SLOT_HEADER
132155
tmp += Template.ARTICULATION_IN_SLOT.format(
133-
uuid1 = createUUID(), name = articulation
156+
uuid1 = createUUID(), name = articulation,
157+
group = group
134158
)
135159
tmp += Template.ARTICULATION_IN_SLOT_FOOTER
136160
articulation = tmp

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
exe = Executable (script = 'XLS2ExpressionMap.py', base = None)
77

88
setup( name = 'XLS2ExpressionMap',
9-
version = '0.0.4',
9+
version = '0.0.5',
1010
description = 'Excel file(*.xlsx) to Cubase Expression Map file converter',
1111
executables = [exe] )

0 commit comments

Comments
 (0)