| 1 | |
| 2 | <refentry id="pgmassign"> |
| 3 | <indexterm id="IndexPgmassign"><primary>pgmassign</primary></indexterm> |
| 4 | <refentryinfo><title>Real-time MIDI:Input</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>pgmassign</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>pgmassign</refname> |
| 13 | <refpurpose> |
| 14 | Assigns an instrument number to a specified MIDI program. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Assigns an instrument number to a specified (or all) MIDI program(s). |
| 22 | </para> |
| 23 | |
| 24 | <para> |
| 25 | By default, the instrument is the same as the program number. If the selected instrument is zero or negative or does not exist, the program change is ignored. This opcode is normally used in the orchestra header. Although, like <link linkend="massign"><citetitle>massign</citetitle></link>, it also works in instruments. |
| 26 | </para> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Syntax</title> |
| 31 | <synopsis><command>pgmassign</command> ipgm, inst[, ichn]</synopsis> |
| 32 | <synopsis><command>pgmassign</command> ipgm, "insname"[, ichn]</synopsis> |
| 33 | </refsect1> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Initialization</title> |
| 37 | <para> |
| 38 | <emphasis>ipgm</emphasis> -- MIDI program number (1 to 128). A value of zero selects all programs. |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | <emphasis>inst</emphasis> -- instrument number. If set to zero, or negative, MIDI program changes to <emphasis>ipgm</emphasis> are ignored. Currently, assignment to an instrument that does not exist has the same effect. This may be changed in a later release to print an error message. |
| 43 | </para> |
| 44 | |
| 45 | <para> |
| 46 | <emphasis><quote>insname</quote></emphasis> -- A string (in double-quotes) representing a named instrument. |
| 47 | </para> |
| 48 | |
| 49 | <para> |
| 50 | <emphasis><quote>ichn</quote></emphasis> (optional, defaults to zero) -- channel number. If zero, program changes are assigned on all channels. |
| 51 | </para> |
| 52 | <para> |
| 53 | You can disable the turning on of any instruments by using the following in the header: |
| 54 | <programlisting> |
| 55 | massign 0, 0 |
| 56 | pgmassign 0, 0 |
| 57 | </programlisting> |
| 58 | </para> |
| 59 | </refsect1> |
| 60 | |
| 61 | <refsect1> |
| 62 | <title>Examples</title> |
| 63 | <para> |
| 64 | Here is an example of the pgmassign opcode. It uses the file <ulink url="examples/pgmassign.csd"><citetitle>pgmassign.csd</citetitle></ulink>. |
| 65 | |
| 66 | <example> |
| 67 | <title>Example of the pgmassign opcode.</title> |
| 68 | |
| 69 | |
| 70 | |
| 71 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 72 | <xi:include href="examples-xml/pgmassign.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 73 | </example> |
| 74 | </para> |
| 75 | |
| 76 | <para> |
| 77 | Here is an example of the pgmassign opcode that will ignore program change events. It uses the file <ulink url="examples/pgmassign_ignore.csd"><citetitle>pgmassign_ignore.csd</citetitle></ulink>. |
| 78 | |
| 79 | <example> |
| 80 | <title>Example of the pgmassign opcode that will ignore program change events.</title> |
| 81 | |
| 82 | <xi:include href="examples-xml/pgmassign_ignore.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 83 | </example> |
| 84 | </para> |
| 85 | |
| 86 | <para> |
| 87 | Here is an advanced example of the pgmassign opcode. It uses the file <ulink url="examples/pgmassign_advanced.csd"><citetitle>pgmassign_advanced.csd</citetitle></ulink>. |
| 88 | </para> |
| 89 | |
| 90 | <para> |
| 91 | Do not forget that you must include the <link linkend="FlagsMinusUpperF"><citetitle>-F flag</citetitle></link> when using an external MIDI file like <quote>pgmassign_advanced.mid</quote>. |
| 92 | </para> |
| 93 | |
| 94 | <para> |
| 95 | <example> |
| 96 | <title>An advanced example of the pgmassign opcode.</title> |
| 97 | |
| 98 | <xi:include href="examples-xml/pgmassign_advanced.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 99 | </example> |
| 100 | </para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>See also</title> |
| 105 | <para><link linkend="MidiInput"><citetitle>MIDI input and Initialization</citetitle></link></para> |
| 106 | <para><link linkend="OrchHeader"><citetitle>Orchestra Header Statements</citetitle></link></para> |
| 107 | </refsect1> |
| 108 | |
| 109 | <refsect1> |
| 110 | <title>Credits</title> |
| 111 | <para> |
| 112 | <simplelist> |
| 113 | <member>Author: &nameistvan;</member> |
| 114 | <member>May 2002</member> |
| 115 | </simplelist> |
| 116 | </para> |
| 117 | |
| 118 | <para>New in version 4.20</para> |
| 119 | </refsect1> |
| 120 | </refentry> |