summaryrefslogtreecommitdiff
path: root/examples-xml/maxarray.csd.xml
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2014-01-24 13:54:37 -0300
committerFelipe Sateler <fsateler@debian.org>2014-01-24 13:54:37 -0300
commitbcf06a42deb371baf3deb9f4addb474b08273120 (patch)
tree4a8c3fb811dd164d4486628d8eff6043ebe8a6c3 /examples-xml/maxarray.csd.xml
parent3a91171181113761a14bcc36a086a8dda144b77b (diff)
Imported Upstream version 6.02~dfsg
Diffstat (limited to 'examples-xml/maxarray.csd.xml')
-rw-r--r--examples-xml/maxarray.csd.xml36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples-xml/maxarray.csd.xml b/examples-xml/maxarray.csd.xml
new file mode 100644
index 0000000..ac95b14
--- /dev/null
+++ b/examples-xml/maxarray.csd.xml
@@ -0,0 +1,36 @@
+<programlisting>
+<emphasis role="csdtag">&lt;CsoundSynthesizer&gt;</emphasis>
+<emphasis role="csdtag">&lt;CsOptions&gt;</emphasis>
+<emphasis role="comment">; Select audio/midi flags here according to platform</emphasis>
+-n
+<emphasis role="csdtag">&lt;/CsOptions&gt;</emphasis>
+<emphasis role="csdtag">&lt;CsInstruments&gt;</emphasis>
+<emphasis role="comment">;example by joachim heintz</emphasis>
+
+ <emphasis role="ohdr">seed</emphasis> 0
+
+<emphasis role="oblock">instr</emphasis> 1
+<emphasis role="comment">;create an array with 10 elements</emphasis>
+kArr[] <emphasis role="opc">init</emphasis> 10
+<emphasis role="comment">;fill in random numbers and print them out</emphasis>
+kIndx <emphasis role="op">=</emphasis> 0
+ until kIndx <emphasis role="op">==</emphasis> 10 do
+kNum <emphasis role="opc">random</emphasis> <emphasis role="op">-</emphasis>100, 100
+kArr[kIndx] <emphasis role="op">=</emphasis> kNum
+ <emphasis role="opc">printf</emphasis> "kArr[<emphasis role="op">%</emphasis>d] <emphasis role="op">=</emphasis> <emphasis role="op">%</emphasis>10f\n", kIndx<emphasis role="op">+</emphasis>1, kIndx, kNum
+kIndx <emphasis role="op">+</emphasis><emphasis role="op">=</emphasis> 1
+ od
+<emphasis role="comment">;investigate maximum number and print it out</emphasis>
+kMax, kMaxIndx <emphasis role="opc">maxarray</emphasis> kArr
+ <emphasis role="opc">printf</emphasis> "Maximum of kArr <emphasis role="op">=</emphasis> <emphasis role="op">%</emphasis>f at index <emphasis role="op">%</emphasis>d\n", kIndx<emphasis role="op">+</emphasis>1, kMax, kMaxIndx
+ <emphasis role="opc">turnoff</emphasis>
+<emphasis role="oblock">endin</emphasis>
+
+
+<emphasis role="csdtag">&lt;/CsInstruments&gt;</emphasis>
+<emphasis role="csdtag">&lt;CsScore&gt;</emphasis>
+<emphasis role="stamnt">i</emphasis>1 0 0.1
+<emphasis role="stamnt">e</emphasis>
+<emphasis role="csdtag">&lt;/CsScore&gt;</emphasis>
+<emphasis role="csdtag">&lt;/CsoundSynthesizer&gt;</emphasis>
+</programlisting> \ No newline at end of file