1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5<meta http-equiv="Content-Style-Type" content="text/css" /> 6<title>DSP_PlayShutterSound</title> 7<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 8</head> 9<body> 10 11<h1>DSP_PlayShutterSound <IMG src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13 14<pre><code> 15BOOL DSP_PlayShutterSound(const void *src, u32 len); 16</code></pre> 17 18<h2>Arguments</h2> 19<table style="width:100%"> 20<tbody> 21<tr> 22<td style="width:13%"><SPAN class="argument">src</SPAN></td> 23<td style="width:87%">Wave format shutter sound data.<br />You can only specify the 32730-Hz and 47610-Hz data below the <CODE>$TwlSDK/data/shutter_sound</CODE> and <CODE>$TwlSDK/data/videorec_sound</CODE> directories. The sampling rate must match the I2S operating frequency obtained with the <a href="../../snd/sndex/SNDEX_GetI2SFrequency.html"><CODE>SNDEX_GetI2SFrequency</CODE></a> function.<br /><span style='color:Red'>The specified buffer has the same restrictions as a 16-bit DMA transfer. See <B>Note</B> below for more details.</span></td> 24</tr> 25<tr> 26<td style="width:13%"><SPAN class="argument">len</SPAN></td> 27<td style="width:87%">Byte size of the wave data.</td> 28</tr> 29</tbody> 30</table> 31 32<h2>Return Values</h2> 33<p>Returns <CODE>FALSE</CODE> if the specified shutter sound does not match the I2S operating frequency or if invalid data has been specified.</p> 34 35<h2>Description</h2> 36<p>Plays the shutter sound from the DSP.<br />Playing the sound specified by this function has priority over all other sound output. Internally it is exclusively controlled as follows.</p> 37<ul> 38<li>Before playback, the <a href="../../snd/sndex/SNDEX_GetI2SFrequency.html"><CODE>SNDEX_GetI2SFrequency</CODE></a> function is called to confirm that the sample rate of the shutter sound matches the I2S operating frequency, and then playback is set so that only DSP sound plays from the speaker. After playback, the original setting is restored.</li> 39<li>The <a href="DSP_PlaySound.html"><CODE>DSP_PlaySound</CODE></a> function is ignored if it is called during play.</li> 40<li>During the playback process, if a <CODE>SNDEX</CODE> function runs, it returns <CODE>SNDEX_RESULT_EXCLUSIVE</CODE> and does nothing until playback ends. (There are some exceptions, however.)</li> 41</ul> 42<p> 43This function can be used if any of the DSP components have been loaded. 44</p> 45<p>This function performs preprocessing using the <A href="../../snd/sndex/doc/aboutSNDEX.html">SNDEX library</A>.<br> Thus, depending on how the program is written, the preprocessing may in some cases fail because of exclusive control of the SNDEX library.<br> If preprocessing fails, this function retries until it succeeds.<br>The <A href="../../os/thread/OS_Sleep.html"><CODE>OS_Sleep</CODE></a> function is called from inside the retry process.<br> To always play the shutter sound without performing this internal retry process, you need to use the method below to eliminate the possibility of preprocess failure. </p> 46<ul> 47<li>Use the <a href="../../os/mutex/OS_LockMutex.html"><CODE>OS_LockMutex</CODE></a> function to run this function exclusively so that there is no overlap with processes of other SNDEX functions.</li> 48</ul> 49 50<h2>Notes</h2> 51<ul> 52<li><span style='color:Red'>The specified buffers must all satisfy the same conditions as 16-bit DMA transfers.</span> 53<ul> 54<li>Addresses must be 16-bit aligned.</li> 55<li>The buffer content must be cached in advance.</li> 56</ul> 57</li> 58<li>While the shutter sound is being played, an IIR filter that has been set by <A href="../../snd/sndex/SNDEX_SetIirFilter.html"><CODE>SNDEX_SetIirFilter[Async]</CODE></A> is disabled. 59</li> 60<li>Use the <a href="DSP_IsShutterSoundPlaying.html"><CODE>DSP_IsShutterSoundPlaying</CODE></a> function to determine whether playback of the shutter sound has completed. 61</li> 62</ul> 63 64<h2>See Also</h2> 65<p><a href="DSP_IsShutterSoundPlaying.html"><CODE>DSP_IsShutterSoundPlaying</CODE></a><BR> <a href="../g711/DSP_LoadG711.html"><CODE>DSP_LoadG711</CODE></a></p> 66 67<h2>Revision History</h2> 68<p> 692009/09/02 Deleted a note stating that this cannot be used together with other component features. <br />2009/07/16 Added an explanation about using this together with other component features. <br>2009/01/07 Changed descriptions to say that internal function processing retries until the shutter sound is played successfully. <br>2008/11/26 Deleted the stereo and monaural specifications. <br>2008/11/14 Added a description of the kinds of shutter sounds that can be specified. <br>2008/11/07 Mentioned that SNDEX functions cannot be used during shutter sound playback, and added information for correctly playing the shutter sound. <br>2008/10/23 Added a description about the function to use to wait for shutter sound playback to end. <br>2008/09/26 Mentioned that IIR filters are disabled during shutter sound playback. <br>2008/09/25 Mentioned that sound output is controlled exclusively. <br />2008/07/09 Changed the size accepted as an argument from half-words to bytes. <BR>2008/06/24 Initial version. 70</p> 71<hr><p>CONFIDENTIAL</p></body> 72</html> 73