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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//en">
<!--Converted with LaTeX2HTML 2021 (Released January 1, 2021) -->
<HTML lang="en">
<HEAD>
<TITLE>Begin/End Blocks</TITLE>
<META NAME="description" CONTENT="Begin/End Blocks">
<META NAME="keywords" CONTENT="mma">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
<META NAME="Generator" CONTENT="LaTeX2HTML v2021">
<LINK REL="STYLESHEET" HREF="mma.css">
<LINK REL="next" HREF="node32.html">
<LINK REL="previous" HREF="node30.html">
<LINK REL="next" HREF="node32.html">
</HEAD>
<BODY bgcolor="#ffffff">
<DIV CLASS="navigation"><!--Navigation Panel-->
<A
HREF="node32.html">
<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
<A
HREF="mma.html">
<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
<A
HREF="node30.html">
<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
<BR>
<B> Next:</B> <A
HREF="node32.html">Documentation Strings</A>
<B> Up:</B> <A
HREF="mma.html">Reference Manual</A>
<B> Previous:</B> <A
HREF="node30.html">Other Commands and Directives</A>
<BR>
<BR></DIV>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A ID="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL CLASS="ChildLinks">
<LI><A ID="tex2html734"
HREF="node31.html#SECTION003110000000000000000">Begin</A>
<LI><A ID="tex2html735"
HREF="node31.html#SECTION003120000000000000000">End</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<H1><A ID="SECTION003100000000000000000"></A>
<A ID="sec-blocks"></A>
<BR>
Begin/End Blocks
</H1>
<P>
Entering a series of directives for a specific track can get quite
tedious. To make the creation of library files a bit easier, you can
create a block. For example, the following:
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Drum Define X 0 2 100; 50 2 90
<BR>
Drum Define Y 0 2 100
<BR>
Drum Sequence X Y </B>
</td></tr>
</Table>
<P>
Can be replaced with:
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Drum Begin
<BR> Define X 0 2 100; 50 2 90
<BR> Define Y 0 2 100
<BR>
End
<BR>
Drum Sequence X Y </B>
</td></tr>
</Table>
<P>
Or, even more simply, with:
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Begin Drum Define
<BR> X 0 2 100; 50 2 90
<BR> Y 0 2 100
<BR>
End </B>
</td></tr>
</Table>
<P>
If you examine some of the library files you will see that this
shortcut is used a lot.
<P>
<H1><A ID="SECTION003110000000000000000">
Begin</A>
</H1>
<P>
The B<SMALL>EGIN</SMALL> command requires any number of arguments. Valid
examples include:
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Begin Drum
<BR>
Begin Chord2
<BR>
Begin Walk Define </B>
</td></tr>
</Table>
<P>
Once a B<SMALL>EGIN</SMALL> block has been entered, all subsequent lines have
the words from the B<SMALL>EGIN</SMALL> command prepended to each line of
data. There is not much magic here—B<SMALL>EGIN</SMALL>/E<SMALL>ND</SMALL> is really
just some syntactic sugar.
<P>
<H1><A ID="SECTION003120000000000000000">
End</A>
</H1>
<P>
To finish off a B<SMALL>EGIN</SMALL> block, use a single E<SMALL>ND</SMALL> on a line
by itself.
<P>
Defining musical data or repeats inside a block
(other than COMMENT blocks) will not work.
<P>
Nesting is permitted, e.g.,
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Scale Begin
<BR> Begin Define
<BR> </B><SPAN CLASS="textit">stuff</SPAN><B>
<BR> End
<BR> Sequence </B><SPAN CLASS="textit">stuff</SPAN><B>
<BR>
End </B>
</td></tr>
</Table>
<P>
A B<SMALL>EGIN</SMALL> must be competed with a E<SMALL>ND</SMALL> before the end of a
file, otherwise an error will be generated. The U<SMALL>SE</SMALL> and
I<SMALL>NCLUDE</SMALL> commands are not permitted inside a block.
<P>
Caution:
<UL>
<LI>Be careful when using user defined plugins inside a
block. If you were to do something like:
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Begin @myplugin
<BR> some args
<BR>
End </B>
</td></tr>
</Table>
<P>
and the plugin returns strings back into your source file, you will
end up forever loop. The plugin is returning a data line back and
<FONT Face="Serif" Color="Navy"><I>MMA</I></FONT> will insert “@myplugin” to the new line. However, the block:
<P>
<Table Hspace="40%" CellSpacing=0 CellPadding=10 BGColor="OldLace" Border=3>
<tr><td>
<B>Begin
<BR> @myplugin ...
<BR>
End </B>
</td></tr>
</Table>
<P>
should work fine.
</LI>
</UL>
<P>
<DIV CLASS="navigation"><HR>
<!--Navigation Panel-->
<A
HREF="node32.html">
<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
<A
HREF="mma.html">
<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
<A
HREF="node30.html">
<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
<BR>
<B> Next:</B> <A
HREF="node32.html">Documentation Strings</A>
<B> Up:</B> <A
HREF="mma.html">Reference Manual</A>
<B> Previous:</B> <A
HREF="node30.html">Other Commands and Directives</A></DIV>
<!--End of Navigation Panel-->
</BODY>
</HTML>
|