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_SetupAlarm</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_SetupAlarm <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="funcsynopsisinfo"><code>typedef void (*SNDAlarmHandler)( void* arg );</code></pre></dd>
18<dd><pre class="funcprototype"><code class="funcprototype">void SND_SetupAlarm(
19        int <var>alarmNo</var>,
20        u32 <var>tick</var>,
21        u32 <var>period</var>,
22        SNDAlarmHandler <var>handler</var>,
23        void* <var>arg</var> );</code><br></pre></dd>
24</dl>
25<div class="refsection" lang="ja"><a name="IDAVNWT"></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>alarmNo</code></strong></em></td>
34<td>The alarm number. Takes a value between 0 and 7.</td>
35</tr>
36<tr>
37<td><em><strong><code>tick</code></strong></em></td>
38<td>The tick count until the first sound of the alarm.</td>
39</tr>
40<tr>
41<td><em><strong><code>period</code></strong></em></td>
42<td>The periodic spacing for sounding the alarm.</td>
43</tr>
44<tr>
45<td><em><strong><code>handler</code></strong></em></td>
46<td>The alarm handler called when alarm is invoked. This callback is called from within the interrupt handler.</td>
47</tr>
48<tr>
49<td><em><strong><code>arg</code></strong></em></td>
50<td>The value passed to the alarm handler's argument.</td>
51</tr>
52</tbody>
53</table>
54</div>
55
56    </div>
57<div class="refsection" lang="ja"><a name="IDAAPWT"></a>
58      <h2>Return Values</h2>
59
60      <p>None.</p>
61    </div>
62<div class="refsection" lang="ja"><a name="IDAHPWT"></a>
63      <h2>Description</h2>
64      <p>
65This function sets up the sound alarm.
66</p>
67      <p>
68Use the Sound alarm to conduct processes accurately synchronized with channel sounds and captures. Start alarms with the <tt class="function"><a href="SND_StartTimer.html">SND_StartTimer</a></tt> function.
69</p>
70      <p>
71The alarm will sound <code>tick</code> tick-counts after the alarm has been started. It will sound with a periodicity specified by <code>period</code>. If 0 is specified for <code>period</code>, the alarm will sound once and then stop automatically.
72</p>
73      <p>
74When the alarm sounds, the alarm handler <em><strong><code>handler</code></strong></em> gets called and <em><strong><code>arg</code></strong></em> gets passed to the alarm handler's argument. <em><strong><code>arg</code></strong></em> is passed to the alarm handler argument.
75</p>
76      <p>
77The values for the tick-count <em><strong><code>tick</code></strong></em> and the alarm period <em><strong><code>period</code></strong></em> are expressed in units of 1/32 of the sound timer clock <code>SND_TIMER_CLOCK</code>. Thus, if a channel has the channel timer value <code>timer</code> and you want to completely synchronize with that channel, you would set <code>timer</code>/32. For this, <code>timer</code> must be divided by 32.
78</p>
79      <div class="note">
80<h3 class="title">Note</h3>
81<p>
82This 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.
83</p>
84<p>
85If 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.
86</p>
87</div>
88    </div>
89<h2>See Also</h2>
90<p><code><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>
91<h2>Revision History</h2>
92<p>
932005/06/01 Added statement about callbacks being called from the interrupt handler.<br>2005/02/17 Added cautions for ARM7 command processing.<br>2004/10/21 Standardized terminology so handler argument is referred to as alarm handler.<br>2004/07/20 Initial version</p>
94</div>
95<hr><p>CONFIDENTIAL</p></body>
96</html>
97