1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
2<head>
3<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
4<title>SND_SetupChannelPsg</title>
5<link rel="stylesheet" href="../css/nitro.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
7</head>
8<body>
9<div class="refentry" lang="ja"><a name="IDAFLWT"></a><div class="titlepage">
10<div></div>
11<div></div>
12</div>
13<h1>SND_SetupChannelPsg <IMG src="../image/NTR.gif" width="24" height="12" border="0" align=middle><IMG src="../image/TWL.gif" width="24" height="12" border="0" align=middle></h1>
14<h2>Syntax</h2>
15<dl>
16<dd><pre class="funcsynopsisinfo"><code>#include &lt;nitro/snd.h&gt;</code></pre></dd>
17<dd><pre class="funcprototype"><code class="funcprototype">void SND_SetupChannelPsg(
18        int <var>chNo</var>,
19        SNDDuty <var>duty</var>,
20        int <var>volume</var>,
21        SNDChannelDataShift <var>shift</var>,
22        int <var>timer</var>,
23        int <var>pan</var> );</code><br></pre></dd>
24</dl>
25<div class="refsection" lang="ja"><a name="IDAONWT"></a>
26      <h2>Arguments</h2>
27
28      <div class="variablelist">
29<table border="0">
30<col align="left" valign="top">
31<tbody>
32<tr>
33<td><em><strong><code>chNo</code></strong></em></td>
34<td>The channel number. Takes a value between 8 and 13.</td>
35</tr>
36<tr>
37<td><em><strong><code>duty</code></strong></em></td>
38<td>Duty ratio.</td>
39</tr>
40<tr>
41<td><em><strong><code>volume</code></strong></em></td>
42<td>The volume. Takes a value between 0 and 127.</td>
43</tr>
44<tr>
45<td><em><strong><code>shift</code></strong></em></td>
46<td>Data shift specification.</td>
47</tr>
48<tr>
49<td><em><strong><code>timer</code></strong></em></td>
50<td>The timer. Takes a value between 0x10 and 0xffff.</td>
51</tr>
52<tr>
53<td><em><strong><code>pan</code></strong></em></td>
54<td>The pan. Takes values in the range of 0 (left) to 64 (center) to 127 (right).</td>
55</tr>
56</tbody>
57</table>
58</div>
59
60    </div>
61<div class="refsection" lang="ja"><a name="IDAAPWT"></a>
62      <h2>Return Values</h2>
63
64      <p>None.</p>
65    </div>
66<div class="refsection" lang="ja"><a name="IDAHPWT"></a>
67      <h2>Description</h2>
68      <p>
69This function sets up a channel for playing PSG rectangular waves.
70</p>
71      <p>
72The function sets the parameters for the channel specified by <em><strong><code>chNo</code></strong></em>. The channel must first be locked by the <tt class="function"><a href="SND_LockChannel.html">SND_LockChannel</a></tt> function. Once the parameters have been set, call the <tt class="function"><a href="SND_StartTimer.html">SND_StartTimer</a></tt> function to begin actual playback.
73</p>
74      <p>
75Select the PSG rectangular wave duty ratio <em><strong><code>duty</code></strong></em> from the following values:
76</p>
77      <div class="table"><a name="IDAEQWT"></a><p class="title"><b>Table: SNDDuty</b></p>
78<table summary="SNDDuty" border="1">
79<colgroup><col><col></colgroup>
80<thead>
81<tr>
82<th>Label</th>
83<th>Description</th>
84</tr>
85</thead>
86<tbody>
87<tr>
88<td>SND_DUTY_1_8</td>
89<td>1/8 (12.5%) duty</td>
90</tr>
91<tr>
92<td>SND_DUTY_2_8</td>
93<td>2/8 (25.0%) duty</td>
94</tr>
95<tr>
96<td>SND_DUTY_3_8</td>
97<td>3/8 (37.5%) duty</td>
98</tr>
99<tr>
100<td>SND_DUTY_4_8</td>
101<td>4/8 (50.0%) duty</td>
102</tr>
103<tr>
104<td>SND_DUTY_5_8</td>
105<td>5/8 (62.5%) duty</td>
106</tr>
107<tr>
108<td>SND_DUTY_6_8</td>
109<td>6/8 (75.0%) duty</td>
110</tr>
111<tr>
112<td>SND_DUTY_7_8</td>
113<td>7/8 (87.5%) duty</td>
114</tr>
115</tbody>
116</table>
117</div>
118
119      <p>
120Choose from among these values for the data shift setting <code>shift</code>:
121</p>
122      <div class="table"><a name="IDAQSWT"></a><p class="title"><b><b>Table. SNDChannelDataShift</b></b></p>
123<table summary="SNDChannelDataShift" border="1">
124<colgroup><col><col></colgroup>
125<thead>
126<tr>
127<th>Label</th>
128<th>Description</th>
129</tr>
130</thead>
131<tbody>
132<tr>
133<td>SND_CHANNEL_DATASHIFT_NONE</td>
134<td>Do not perform a data shift.</td>
135</tr>
136<tr>
137<td>SND_CHANNEL_DATASHIFT_1BIT</td>
138<td>Shift data 1 bit right.</td>
139</tr>
140<tr>
141<td>SND_CHANNEL_DATASHIFT_2BIT</td>
142<td>Shift data 2 bits right.</td>
143</tr>
144<tr>
145<td>SND_CHANNEL_DATASHIFT_4BIT</td>
146<td>Shift data 4 bits right.</td>
147</tr>
148</tbody>
149</table>
150</div>
151
152      <p>
153<em>timer</em> specifies 8 cycles of white noise by clock count. The number of ticks per second is approximately 16.757 MHz with <code>SND_TIMER_CLOCK</code>. For example, the following calculation will play a pitch that has a frequency <em>freq</em> Hz.
154</p>
155<pre class="programlisting">timer = <code>SND_TIMER_CLOCK</code> / ( 8 * <em>freq</em> )</pre>
156      <p>
157
158</p>
159      <div class="note">
160<h3 class="title">Note</h3>
161<p>
162This function is an ARM7 reserved function. After this function is called, its processing will occur only after the command is issued with the <tt class="function"><a href="SND_FlushCommand.html">SND_FlushCommand</a></tt> function.
163</p>
164<p>
165If program execution must be synchronized with process completion, first use the <tt class="function"><a href="SND_GetCurrentCommandTag.html">SND_GetCurrentCommandTag</a></tt> function to obtain the command tag immediately after calling this function. Then, after the command is issued, use the command tag and call either the <tt class="function"><a href="SND_IsFinishedCommandTag.html">SND_IsFinishedCommandTag</a></tt> or <tt class="function"><a href="SND_WaitForCommandProc.html">SND_WaitForCommandProc</a></tt> function to confirm that processing has finished or to wait for it to complete.
166</p>
167</div>
168    </div>
169<h2>See Also</h2>
170<p><code><a href="SND_LockChannel.html">SND_LockChannel</a>, <a href="SND_StartTimer.html">SND_StartTimer</a>, <a href="SND_FlushCommand.html">SND_FlushCommand</a>, <a href="SND_GetCurrentCommandTag.html">SND_GetCurrentCommandTag</a>, <a href="SND_IsFinishedCommandTag.html">SND_IsFinishedCommandTag</a>, <a href="SND_WaitForCommandProc.html">SND_WaitForCommandProc</a></code></p>
171<h2>Revision History</h2>
172<p>2005/02/17 Added a note about ARM7 command processing.<br /> 2004/08/10 Initial version.</p>
173</div>
174<hr><p>CONFIDENTIAL</p></body>
175</html>
176