CTR-VCT  2.0.2
VoiceChat Libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vct.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*
2 Project: VoiceChat library
3 File: vct.h
4 
5 Copyright (C) 2011-2014 Nintendo Co., Ltd. All rights reserved.
6 
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #ifndef VCT_VOICECHAT_H_
16 #define VCT_VOICECHAT_H_
17 
18 /*---------------------------------------------------------------------------*
19 Include
20  *---------------------------------------------------------------------------*/
21 #ifdef NN_VCT_TARGET_CAFE
22 
23 #include <cafe.h>
24 
25 #elif NN_VCT_TARGET_CTR
26 
27 #include <nn.h>
28 
29 #endif
30 
31 
32 /*---------------------------------------------------------------------------*
33 Extern "C"
34  *---------------------------------------------------------------------------*/
35 #ifdef __cplusplus
36 extern "C" {
37 #endif // ifdef __cplusplus
38 
39 
40 /*---------------------------------------------------------------------------*
41 Define
42  *---------------------------------------------------------------------------*/
43 // --- Common error codes.
44 #define VCT_ERROR_NONE 0
45 #define VCT_ERROR_BAD_PARAM -1
46 #define VCT_ERROR_BAD_MODE -2
47 #define VCT_ERROR_BAD_REQUEST -3
48 #define VCT_ERROR_SEND_FAIL -4
49 #define VCT_ERROR_EXHAUST_CLIENTS -6
50 
51 // --- Session and client limitations.
52 #define VCT_MAX_SESSION 16
53 #define VCT_MAX_CONFERENCE_CLIENT 16
54 #define VCT_MAX_CLIENT 16
55 
56 #define VCT_MAX_AUDIO_STREAM (VCT_MAX_CONFERENCE_CLIENT - 1)
57 
58 // Magic Number in VCT
59 #define VCT_MAGIC_PACKET_HEADER 0x5f564354 //!< Magic number in the VCT packet header.
60 
61 #define VCT_CODEC_DEFAULT VCT_CODEC_4BIT_ADPCM //!< Default audio codec.
62 #define VCT_SPARE_CODEC_DEFAULT VCT_CODEC_2BIT_ADPCM //!< Default audio codec for spare packets.
63 
64 #define VCT_AUDIO_FRAME_LENGTH_MIN 64 //!< Specifies the minimum audio frame length (in milliseconds).
65 #define VCT_AUDIO_FRAME_LENGTH_MAX 192 //!< Specifies the maximum audio frame length (in milliseconds).
66 #define VCT_AUDIO_FRAME_LENGTH_DEFAULT 144 //!< Specifies the default audio frame length (in milliseconds).
67 
68 #define VCT_AUDIO_DATA_SIZE_PER_MILLI_SEC 16
69 
70 #define VCT_AUDIO_DATA_SIZE_MIN (VCT_AUDIO_FRAME_LENGTH_MIN * VCT_AUDIO_DATA_SIZE_PER_MILLI_SEC)
71 #define VCT_AUDIO_DATA_SIZE_MAX (VCT_AUDIO_FRAME_LENGTH_MAX * VCT_AUDIO_DATA_SIZE_PER_MILLI_SEC)
72 #define VCT_AUDIO_DATA_SIZE_DEFAULT (VCT_AUDIO_FRAME_LENGTH_DEFAULT * VCT_AUDIO_DATA_SIZE_PER_MILLI_SEC)
73 
74 #define VCT_AUDIO_FRAME_RATE 8000 //!< Audio frame rate (8 kHz).
75 
76 // --- Receive buffer size.
77 #define VCT_AUDIO_HEADER_SIZE 12 //!< Header size for VCT audio data packets.
78 #define VCT_AUDIO_2_BIT_ADPCM_PACKET_SIZE_MAX (VCT_AUDIO_HEADER_SIZE + 2 * VCT_AUDIO_FRAME_LENGTH_MAX + 4)
79 #define VCT_AUDIO_3_BIT_ADPCM_PACKET_SIZE_MAX (VCT_AUDIO_HEADER_SIZE + 3 * VCT_AUDIO_FRAME_LENGTH_MAX + 4)
80 #define VCT_AUDIO_4_BIT_ADPCM_PACKET_SIZE_MAX (VCT_AUDIO_HEADER_SIZE + 4 * VCT_AUDIO_FRAME_LENGTH_MAX + 4)
81 
82 #define VCT_AUDIO_SPARE_PACKET_SIZE_MAX VCT_AUDIO_2_BIT_ADPCM_PACKET_SIZE_MAX
83 
84 #define VCT_AUDIO_PACKET_BUFFER_SIZE (VCT_AUDIO_DATA_SIZE_MAX + VCT_AUDIO_SPARE_PACKET_SIZE_MAX)
85 
86 #ifdef NN_VCT_TARGET_CAFE
87 #define VCT_AUDIO_BUFFER_PACKET_HEADER 64
88 #elif NN_VCT_TARGET_CTR
89 #define VCT_AUDIO_BUFFER_PACKET_HEADER 56
90 #endif
91 #define VCT_AUDIO_BUFFER_SIZE (VCT_AUDIO_PACKET_BUFFER_SIZE + VCT_AUDIO_BUFFER_PACKET_HEADER)
92 
93 #define VCT_DEFAULT_AUDIO_BUFFER_COUNT 8
94 #define VCT_MIN_AUDIO_BUFFER_COUNT 4
95 #define VCT_MAX_AUDIO_BUFFER_COUNT (24 * VCT_MAX_AUDIO_STREAM)
96 
97 #define VCT_DEFAULT_AUDIO_BUFFER_SIZE (VCT_AUDIO_BUFFER_SIZE \
98  * VCT_DEFAULT_AUDIO_BUFFER_COUNT \
99  * VCT_MAX_AUDIO_STREAM)
100 
101 #ifdef NN_VCT_TARGET_CAFE
102  #define VCT_VAD_DETECT_GAIN_UP_DEFAULT 350
103  #define VCT_VAD_LOST_GAIN_UP_DEFAULT 280
104 #elif NN_VCT_TARGET_CTR
105  #define VCT_VAD_DETECT_GAIN_UP_DEFAULT 350
106  #define VCT_VAD_LOST_GAIN_UP_DEFAULT 280
107 #endif
108 
109 #define VCT_VAD_INVALID_SCALE_THRESHOLD_DEFAULT (7 * 7)
110 #define VCT_VAD_CLAMP_GAIN_MAX 0x3FFFFFFF
111 #define VCT_VAD_RELEASE_TIME_DEFAULT 5 // 144 (default frame length) * 5 = 720 ms
112 
113 // --- Library configuration.
114 #define VCT_CONFIG_FLAG_NONE 0x00
115 #define VCT_CONFIG_FLAG_VAD 0x01 //!< VAD (Voice Activity Detection) feature.
116 #define VCT_CONFIG_FLAG_ECHO_CANCEL 0x02 //!< Echo cancellation.
117 #define VCT_CONFIG_FLAG_HPF 0x04 //!< High-pass filter.
118 #define VCT_CONFIG_FLAG_SPARE_PACKET 0x08 //!< Spare packet.
119 #define VCT_CONFIG_FLAG_DROP_RECOVER 0x20 //!< Drop recovery.
120 #define VCT_CONFIG_FLAG_BPF 0x40 //!< Biquad filter.
121 #define VCT_CONFIG_FLAG_ALL 0xff
122 
123 #ifdef NN_VCT_TARGET_CAFE
124  #define VCT_CONFIG_FLAG_DEFAULT (VCT_CONFIG_FLAG_VAD | \
125  VCT_CONFIG_FLAG_SPARE_PACKET | \
126  VCT_CONFIG_FLAG_DROP_RECOVER)
127 #elif NN_VCT_TARGET_CTR
128  #define VCT_CONFIG_FLAG_DEFAULT (VCT_CONFIG_FLAG_VAD | \
129  VCT_CONFIG_FLAG_ECHO_CANCEL | \
130  VCT_CONFIG_FLAG_SPARE_PACKET | \
131  VCT_CONFIG_FLAG_DROP_RECOVER)
132 #endif
133 
134 
135 // --- VoiceChat mode.
136 /* @enum VCTMode
137 * @brief Enumerates chat modes. */
138 typedef enum {
140  VCT_MODE_CONFERENCE //!< Conference mode.
141 } VCTMode;
142 
143 /*!
144 @brief Enumerates session states.
145  */
146 typedef enum {
147  VCT_STATE_INIT, //!< Specifies an initialized state.
148  VCT_STATE_TALKING //!< Specifies that the peers are talking.
149 } VCTState;
150 
151 /*!
152 @brief Enumerates voice chat library events.
153  */
154 typedef enum {
156  VCT_EVENT_CONNECTED, //!< Connected to the remote client.
157  VCT_EVENT_DISCONNECTED //!< Disconnected.
158 } VCTEvent;
159 
160 /*!
161 @brief Enumerates audio codecs.
162  */
163 typedef enum {
164  VCT_CODEC_8BIT_RAW, //!< Specifies 8-bit 8 kHz raw audio.
165  VCT_CODEC_G711_ULAW, //!< Specifies G711 u-Law.
166  VCT_CODEC_2BIT_ADPCM, //!< Specifies 2-bit IMA-ADPCM (non-standard).
167  VCT_CODEC_3BIT_ADPCM, //!< Specifies 3-bit IMA-ADPCM.
168  VCT_CODEC_4BIT_ADPCM, //!< Specifies 4-bit IMA-ADPCM.
169 
171 } VCTCodec;
172 
173 /*!
174 @brief Enumerates echo cancellation modes.
175  */
176 typedef enum {
177  VCT_EC_STANDARD, //!< Specifies standard echo cancellation.
178  VCT_EC_HIGHPERFORMANCE //!< Specifies high-performance echo cancellation (only available in debug mode).
179 } VCTECMode;
180 
181 typedef struct VCTSession_ VCTSession;
182 
183 // --- Callback function prototypes.
184 
185 /*!
186 @brief Defines the type for an event callback.
187 
188 @see VCTConfig, VCTSendCallback
189  */
190 typedef void (*VCTEventCallback)( u16 cid, VCTEvent result, VCTSession *session, void *param );
191 
192 /*!
193 @brief Defines the type for a send callback.
194 
195 @see VCTConfig, VCTEventCallback
196  */
197 typedef bool (*VCTSendCallback) ( u16 cid, const void *buff, u32 size, bool isReliable );
198 
199 /*!
200 @brief Stores information related to audio.
201 */
202 typedef struct
203 {
204  VCTCodec codec; //!< Specifies the audio codec of the peer.
205  u8 padding0_[3]; //!< Represents a reserved region.
206 
207  u32 sequence; //!< Sequence number of the current audio packet.
208 
209 #ifdef NN_VCT_TARGET_CAFE
210  OSTime bufferLatency; //!< Latency of the jitter buffer.
211  OSTime jitter; //!< Maximum jitter (in ticks).
212  OSTime clockSkew; //!< Clock skew (in ticks).
213 #elif NN_VCT_TARGET_CTR
214  nn::os::Tick bufferLatency; //!< Latency of the jitter buffer.
215  nn::os::Tick jitter; //!< Maximum jitter (in ticks).
216  nn::os::Tick clockSkew; //!< Clock skew (in ticks).
217 #endif
218 
219  u32 internalLatency; //!< Internal library latency.
220  u32 bufferCount; //!< Specifies the number of packets in the jitter buffer.
221  u32 dropCount; //!< Specifies the number of packets that were dropped.
222  u32 continuousDrop; //!< Number of consecutive dropped packets in the most recent frame.
223 
224  u32 jamCount; //!< Number of jammed packets.
225  u32 duplicateCount; //!< Specifies the number of duplicate packets.
226  u32 waitCount; //!< Number of packets on hold due to the loss of the previous packet.
227  u32 lateCount; //!< Number of packets that were late due to network traffic or another reason.
228 
229  u32 recentLateCount; //!< Number of packets that arrived late in the most recent frame.
230  u32 recentReceiveCount; //!< Number of packets that arrived in the most recent frame.
231  u32 recentLateRatio; //!< Ratio of packets that were late (<tt>recentLateCount</tt> / <tt>recentReceiveCount</tt>).
232  u32 recoverCount; //!< Number of recovered packets.
233 
234  u32 recoverUsingSpareCount; //!< Number of packets that were recovered using spare packets.
235  u32 padding1_; //!< Represents a reserved region.
236 } VCTAudioInfo;
237 
238 // --- SSP session information.
239 /*!
240 @brief Defines the structure for a session. Used for managing CIDs and the session state.
241 
242 @see VCTConfig
243 */
244 typedef struct VCTSession_
245 {
246  VCTMode mode; //!< Chat mode in this session.
247  u8 _padding0_; //!< Represents a reserved region.
248  u16 cid; //!< Remote CID.
249  u16 _padding1_; //!< Represents a reserved region.
250  u16 cidList[VCT_MAX_CLIENT]; //!< List of client CIDs in conference mode.
251  VCTState state; //!< State of this session.
252  u8 _padding2_; //!< Represents a reserved region.
253  void* userData; //!< User data.
254 
256 } VCTSession;
257 
258 /*!
259 @cond PRIVATE
260 @brief Stores data related to the biquad filter.
261 */
262 typedef struct vct_biquad_data
263 {
264  s16 input1;
265  s16 input2;
266  s16 output1;
267  s16 output2;
268 } vct_biquad_data;
269 //! @endcond
270 
271 
272 /*!
273 @cond PRIVATE
274 @brief Stores information related to the VAD (Voice Activity Detection) feature.
275 */
276 typedef struct VCTVADInfo
277 {
278  u32 scale; //!< Scale for input audio (0-127).
279  u32 releaseCount; //!< VAD release count.
280  u32 releaseTime; //!< VAD release time.
281  bool activity; //!< <tt>true</tt> if VAD detects sound, or <tt>false</tt> if VAD detects noise.
282  u8 _padding_[3]; //!< Reserved.
283 } VCTVADInfo;
284 //! @endcond
285 
286 /*!
287 @brief Stores initialization parameters for the VCT library.
288 
289 @see VCT_Init
290 
291 @date 2011/10/21 Added the <tt>ecMode</tt> member to specify the operation mode of echo cancellation.
292 */
293 typedef struct
294 {
295  VCTSession* session; //!< Specifies the region to save the <tt>VCTSession</tt> structure in.
296  u32 numSession; //!< Specifies the size of the region specified in <tt>session</tt>.
297  VCTMode mode; //!< Specifies the chat mode (always specify <tt>VCT_MODE_CONFERENCE</tt>).
298  VCTECMode ecMode; //!< Specifies the operation mode of echo cancellation.
299  u16 cid; //!< Specifies the CID of the client.
300  u8 codec; //!< Specifies the codec for the main packets (always specify <tt>VCT_CODEC_4BIT_ADPCM</tt>).
301  u8 frameLength; //!< Specifies the audio frame length in milliseconds.
302  u8 flag; //!< Enables or disables VAD, spare packets, drop recovery, and high-pass filter features.
303  u8 _padding1_; //!< Represents a reserved region.
304  void* audioBuffer; //!< Specifies the receive buffer for the audio stream (requires 32-byte alignment).
305  u32 audioBufferSize; //!< Specifies the size of the buffer specified in <tt>audioBuffer</tt>.
306  VCTEventCallback callback; //!< Specifies the event callback function.
307  VCTSendCallback sendCallback; //!< Specifies the send callback function.
308  void* userData; //!< Specifies the user data to pass when calling the callback function.
309 
310 } VCTConfig;
311 
312 
313 /*===========================================================================*
314  *
315 * Initialize / Finalize Functions
316  *
317  *===========================================================================*/
318 /*!
319 @name Initialization and Finalization
320  @{
321 */
322  /*!
323 @brief This function initializes the VCT library.
324 
325 @param[in] config <tt>@ref VCTConfig</tt> structure.
326 
327 @retval true Initialization succeeded.
328 @retval false Initialization failed.
329 
330 @date 2011/08/31 Initial version.
331  */
332 bool VCT_Init ( VCTConfig* config );
333 
334  /*!
335 @brief Checks whether the VCT library is finished being initialized.
336 
337 @retval true Already initialized.
338 @retval false Pre-initialized state.
339 
340 @date 2011/08/31 Initial version.
341  */
342 bool VCT_IsInitialized ( void );
343 
344  /*!
345 @brief Finalizes the VCT library.
346 
347 @details Call this function when finalizing VoiceChat or changing the operation mode (<tt>@ref VCTMode</tt>).
348 
349 @date 2011/08/31 Initial version.
350  */
351 
352 void VCT_Cleanup ( void );
353 
354  /*!
355 @brief This function runs the main loop of the VCT library.
356 
357 @details Sends the audio data queued by <tt>@ref VCT_SendAudioEx</tt> and decodes the received audio data passed by <tt>@ref VCT_HandleData</tt>.
358 
359 @details The process for sending data that takes place inside <tt>VCT_Main</tt> (the calling of the send callback) must be called a sufficient number of times, so you also need to call <tt>VCT_Main</tt> a sufficient number of times.
360 If the audio frame length is <i>length</i> ms and there are <i>num</i> number of communication partners, you must call it more than (<i>num</i> * 1000 / <i>length</i>) times each second.
361 For example, if the audio frame length is 144 ms and there are 8 connected systems, the calculation is 7 * 1000 / 144 = 48.6, so you must call it about 50 to 60 times each second.
362 Also, make calls at regular intervals rather than all at once whenever possible, because audio processing is performed at regular intervals. For example, call it a sufficient number of times in each game frame.
363 
364 @date 2013/06/07 Added a description of the number of times to call <tt>VCT_Main</tt>.
365 @date 2011/08/31 Initial version.
366 
367 */
368 void VCT_Main ( void );
369 
370 /*!
371 end of name Initialization and Finalization
372  @}
373 */
374 
375 /*!
376 @name Per-frame Execution
377  @{
378 */
379 
380  /*!
381 @brief Processes voice chat data.
382 
383 @details Pass the data received by the communications library to this function.
384 
385 @note If the return value is <tt>true</tt> (that is, the received data is voice chat data), no additional processing is necessary because the callback function specified in the <tt>callback</tt> member variable of the <tt>@ref VCTConfig</tt> structure is called from this function.
386 If the return value is <tt>false</tt>, the received data is something other than voice chat data (game data, for example), and you must implement some means for the application to perform the necessary processing on the data.
387 
388 @param[in] cid <tt>ConnectionID</tt> of the data sender.
389 @param[in] buffer Pointer to the start of the received data.
390 @param[in] size The size of the received data. This value is in bytes.
391 
392 @retval true The passed data is voice chat data.
393 @retval false Either the passed data is voice chat data, or the VCT library is not initialized.
394 
395 @date 2013/06/07 Revised the description.
396 @date 2011/08/31 Initial version.
397 
398 
399 
400 */
401 bool VCT_HandleData ( u16 cid, u8* buffer, u32 size );
402 
403 /*!
404 end of name Per-frame Execution
405  @}
406 */
407 
408  /*!
409 @brief Deletes the specified session.
410 
411 @param[in] session The <tt>@ref VCTSession</tt> structure to delete.
412 @retval true Deletion succeeded.
413 @retval false Deletion failed.
414 
415 @date 2011/08/31 Initial version.
416  */
417 bool VCT_DeleteSession ( VCTSession *session );
418 
419  /*!
420 @brief Adds a client to the conference.
421 
422 @details One's own connection ID does not need to be specified. (It is ignored internally by the function even if it is specified.) To start a conference, this function must be called by all parties for each other. For example, for three systems with the connection IDs 1, 2, and 3 to start a conference, system 1 must add 2 and 3, system 2 must add 1 and 3, and system 3 must add 1 and 2.
423 
424 @details If N is the maximum number of people who can connect in a conference, the maximum number of clients that the local system can add to a conference is N - 1. Before adding clients you must use the <tt>@ref VCT_Init</tt> function to specify x number of <tt>@ref VCTSession</tt> structures, where x = (total number of participants - 1). If there are not enough sessions, the function returns an error.
425 
426 @details An error also occurs if this function is called and the mode is not <tt>VCT_MODE_CONFERENCE</tt>.
427 
428 @param[in] cid The connection ID of the client being added.
429 
430 
431 @retval 0 Indicates that the connection ID of the client was added successfully.
432 @retval Negative The error code when adding the connection ID of the client failed.
433 
434 @date 2013/06/11 Fixed a mistake in the description of the return value.
435 @date 2011/08/31 Initial version.
436  */
437 s32 VCT_AddConferenceClient ( u16 cid );
438 
439  /*!
440 @brief Removes a client from the conference.
441 
442 @details Call this function for all participants in the conference, and not just the person being removed.
443 
444 @param[in] cid The connection ID of the client to remove.
445 
446 
447 @retval 0 Indicates that the connection ID of the client was removed successfully.
448 @retval Negative The error code that is returned when removal of the connection ID of the client fails.
449 @date 2011/08/31 Initial version.
450  */
451 
452 s32 VCT_RemoveConferenceClient ( u16 cid );
453  /*!
454 @brief Returns whether a client is in the conference.
455 
456 @param[in] cid The connection ID of the client to check for membership in the conference.
457 
458 @retval true Participating.
459 @retval false Not a member.
460 
461 @date 2011/08/31 Initial version.
462  */
463 bool VCT_OnConferenceClient ( u16 cid );
464 
465 /*===========================================================================*
466  *
467 * Audio Streaming Functions
468  *
469  *===========================================================================*/
470 /*!
471 @name Audio Streaming
472  @{
473 */
474  /*!
475 @brief Starts audio streaming.
476 
477 @details Call this function after the session has been established.
478 
479 @param[in] session The session for which to start streaming.
480 
481 @retval true Success.
482 @retval false Failed.
483 
484 @date 2011/09/29 - Clarified that the <tt>session</tt> variable is <tt>const</tt>.
485 @date 2011/08/31 Initial version.
486  */
487 
488 
489 bool VCT_StartStreaming ( const VCTSession *session );
490 
491 
492  /*!
493 @brief Clears audio streaming.
494 
495 @param[in] session The session for which to clear streaming.
496 
497 @date 2013/02/15 Initial version.
498  */
499 
500 void VCT_ClearStreaming( const VCTSession *session );
501  /*!
502 @brief Stops audio streaming.
503 
504 @param[in] session The session for which to stop streaming.
505 
506 @date 2011/09/29 The <tt>session</tt> variable was declared <tt>const</tt>.
507 @date 2011/08/31 Initial version.
508  */
509 void VCT_StopStreaming ( const VCTSession *session );
510 
511 #ifdef NN_VCT_TARGET_CTR
512  /*!
513 @brief Queues audio data in the send queue.
514 
515 @details This function queues audio data in the send queue. This function also handles echo canceler processing.
516 
517 @details VAD processing, audio encoding, and the sending of data packets are all performed in the <tt>@ref VCT_Main</tt> function.
518 
519 @details The data in <span class="argument">audio_data</span> must have been sampled at 16 bits/8 kHz and aligned to a 32-byte boundary. Calling this function once queues data for a single audio frame using this pointer as the starting point To get the corresponding size of a single audio frame, use the <tt>@ref VCT_GetAudioDataSize</tt> function.
520 
521 @details For <span class="argument">micScale</span>, specify the volume scale value that was returned by the <tt>@ref VCT_GetAudioScale</tt> function.
522 
523 @details For <span class="argument">micOffset</span>, specify the number of samples that is the computed difference between the newest microphone sample at the time of function execution and the last sample of microphone data input to this function. Specify <tt>0</tt> to input the most recent microphone sample to this function.
524 
525 @details This function can be called regardless of whether audio streaming has started. If audio streaming has not yet started, this function does nothing.
526 
527 @details If this function is called at varying intervals, the timestamps on the send packets also vary, and the receiving system experiences more errors. If at all possible, call this function in precise multiples of the currently set audio frame length. (Use a timer or other means to call this function in units of audio frames.) Use the <tt>@ref VCT_GetAudioFrameLength</tt> function to get the currently set audio frame length.
528 
529 @details <b>Note:</b> Use the <tt>@ref VCT_GetVADActivity</tt> function to get the VAD determination result.
530 
531 
532 @param[in] audio_data The audio data.
533 @param[in] micScale The volume scale value for the audio data.
534 
535 @param[in] micOffset Specifies the offset (number of samples) between the latest microphone sample and last sample of the input microphone data.
536 
537 @retval true The audio data has been queued in the send queue.
538 @retval false The audio data has not been queued in the send queue. (Streaming has not started, or the library is not initialized.)
539 
540 @date 2011/09/29 The <tt>session</tt> variable was declared <tt>const</tt>.
541 @date 2011/08/31 Initial version.
542  */
543 #elif NN_VCT_TARGET_CAFE
544  /*!
545 @brief Queues audio data in the send queue.
546 
547 @details This function queues audio data in the send queue. It also performs echo cancellation.
548 
549 @details VAD processing, audio encoding, and the sending of data packets are all performed in the <tt>@ref VCT_Main</tt> function.
550 
551 @details The data in <span class="argument">audio_data</span> must have been sampled at 16 bits/8 kHz and aligned to a 32-byte boundary. Calling this function once queues data for a single audio frame using this pointer as the starting point. To get the corresponding size of a single audio frame, use the <tt>@ref VCT_GetAudioDataSize</tt> function.
552 
553 @details For <span class="argument">micScale</span>, specify the volume scale value that was returned by the <tt>@ref VCT_GetAudioScale</tt> function.
554 
555 @details For <span class="argument">micOffset</span>, specify the number of samples that is the computed difference between the newest microphone sample at the time of function execution and the last sample of microphone data input to this function. Specify <tt>0</tt> to input the most recent microphone sample to this function.
556 
557 @details This function can be called regardless of whether audio streaming has started. If audio streaming has not started, this function does nothing.
558 
559 @details If this function is called at varying intervals, the timestamps on the send packets also vary, and the receiving system experiences more errors. If at all possible, call this function in precise multiples of the currently set audio frame length. (Use a timer or other means to call this function in units of audio frames.) Use the <tt>@ref VCT_GetAudioFrameLength</tt> function to get the currently set audio frame length.
560 
561 @details <b>Note:</b> Use the <tt>@ref VCT_GetVADActivity</tt> function to get the VAD determination result.
562 
563 
564 @param[in] audio_data The audio data.
565 @param[in] micScale The volume scale value for the audio data.
566 
567 @retval true The audio data has been queued in the send queue.
568 @retval false The audio data has not been queued in the send queue. (Streaming has not started, or the library is not initialized.)
569 
570 @date 2011/09/29 The <tt>session</tt> variable was declared <tt>const</tt>.
571 @date 2011/08/31 Initial version.
572  */
573 
574 #endif
575 
576 #ifdef NN_VCT_TARGET_CTR
577 bool VCT_SendAudioEx ( const void *audio_data, u32 micScale, u32 micOffset );
578 #endif
579 #ifdef NN_VCT_TARGET_CAFE
580 bool VCT_SendAudioEx ( const void *audio_data, u32 micScale);
581 #endif
582  /*!
583 @brief Extracts audio data from the receive buffer.
584 
585 @details The <tt>@ref VCT_HandleData</tt> function decodes the received audio data.
586 In Conference Mode, this function also acts internally to mix the audio if it is playing on more than one channel.
587 
588 @details The audio data written to <span class="argument">audio_data</span> is in 16 bit/8 kHz format. This buffer must be aligned to a 32-byte boundary.
589 
590 @details This function can be called regardless of whether audio streaming has started or not.
591 If audio streaming has not started, the function clears the <span class="argument">audio_data</span> buffer to all zeroes.
592 
593 @details If this function is called at varying intervals, breaks in the audio are more likely. If at all possible, call this function in precise multiples of the currently set audio frame length. (Use a timer or other means to call it in units of audio frames.)
594 Use the <tt>@ref VCT_GetAudioFrameLength</tt> function to get the currently set audio frame length.
595 
596 @details This currently set audio frame length is the basis of the data size that is calculated for the length of audio data to write to the buffer.
597 For <span class="argument">length</span>, specify the same value as this data size. If you specify any other value, data is not fetched.
598 Use the <tt>@ref VCT_GetAudioDataSize</tt> function to get the data size calculated based on the audio frame length that is currently set.
599 
600 @details Specify <span class="argument">outCIDList</span> to get a list of the remote connection IDs that sent the stream.
601 Use this option in Transceiver mode to do things such as switching the pan according to the person who is talking.
602 
603 @details You can use the value returned by this function to determine whether there is any audio currently to play.
604 This can be used to mute or turn down the volume of BGM when audio is playing.
605 
606 @param[out] audio_data Pointer to the audio data buffer.
607 @param[in] length Size of the audio data buffer.
608 @param[out] outCIDList A list of connection IDs for clients that have sent this stream. It is possible to specify <tt>NULL</tt>.
609 
610 
611 @retval true Audio data was written to the buffer.
612 @retval false Data is not audio data, streaming has not started, or the library is not initialized.
613 
614 @date 2012/04/03 - Revised the description of the <SPAN class="argument">outCIDList</SPAN> argument.
615 @date 2011/08/31 Initial version.
616 
617 */
618 bool VCT_ReceiveAudio ( void *audio_data, u32 length, u16 outCIDList[] );
619 
620  /*!
621 @brief Sets the audio codec.
622 
623 @details The codec can be changed even while streaming.
624 
625 @details The only supported codecs are 4-bit ADPCM and 2-bit ADPCM. Returns <tt>false</tt> when an unsupported audio codec is specified.
626 
627 @details Use the <tt>@ref VCT_SetSpareCodec</tt> function to change the audio codec for spare packets.
628 
629 @param[in] codec The changed audio codec type for the sender.
630 
631 
632 @retval true Audio data was written to the buffer.
633 @retval false Data is not audio data, streaming has not started, or the library is not initialized.
634 @date 2011/08/31 Initial version.
635  */
636 bool VCT_SetCodec ( VCTCodec codec );
637 
638  /*!
639 @brief Gets the currently configured audio codec.
640 
641 @details Use the <tt>@ref VCT_GetSpareCodec</tt> function to get the audio codec type for spare packets.
642 
643 
644 
645 @retval @ref VCTCodec The audio codec that is currently set for the main packet.
646 @date 2011/08/31 Initial version.
647  */
648 VCTCodec VCT_GetCodec ( void );
649 
650  /*!
651 @brief Determines whether the main packet audio codec type specified by <span class="argument">codec</span> is usable.
652 
653 @param[in] codec Audio codec type.
654 
655 @retval true Specifies that the codec can be used.
656 @retval false Specifies that the codec cannot be used.
657 
658 @date 2011/08/31 Initial version.
659  */
660 bool VCT_IsValidCodec ( VCTCodec codec );
661 
662  /*!
663 @brief Sets the audio frame length.
664 
665 @details For <span class="argument">frameLength</span>, you must specify a value between <tt>@ref VCT_AUDIO_FRAME_LENGTH_MIN </tt> and <tt>@ref VCT_AUDIO_FRAME_LENGTH_MAX</tt> that is also an integer multiple of 8.
666 
667 @param[in] frameLength Audio frame length (in milliseconds).
668 
669 
670 @retval true Configuration succeeded.
671 @retval false Configuration failed.
672 
673 @date 2011/08/31 Initial version.
674  */
675 bool VCT_SetAudioFrameLength ( u32 frameLength );
676 
677  /*!
678 @brief Gets the currently configured audio frame length.
679 
680 @details Returns the value set in the <span class="argument">frameLength</span> member of the <tt>@ref VCTConfig</tt> structure at time of initialization, or the value set by the <tt>@ref VCT_SetAudioFrameLength</tt> function after initialization.
681 
682 @details If you call this function before initialization, the recommended value <tt>@ref VCT_AUDIO_FRAME_LENGTH_DEFAULT</tt> is returned.
683 
684 @retval true Configuration succeeded.
685 @retval false Configuration failed.
686 
687 @date 2011/08/31 Initial version.
688  */
689 u32 VCT_GetAudioFrameLength ( void );
690 
691  /*!
692 @brief Gets the packet size of audio data.
693 
694 @details This function returns the data size calculated based on the currently configured audio frame length. You can use the <tt>@ref VCT_GetAudioFrameLength</tt> function to get the currently set audio frame length.
695 
696 @details If you call this function before initialization, the data size <tt>@ref VCT_AUDIO_DATA_SIZE_DEFAULT</tt> corresponding to the recommended audio frame length <tt>@ref VCT_AUDIO_FRAME_LENGTH_DEFAULT</tt> is returned.
697 
698 
699 @retval u32 Packet size of audio data.
700 @date 2011/08/31 Initial version.
701  */
702 u32 VCT_GetAudioDataSize ( void );
703 
704  /*!
705 @brief Gets the calculated audio scale (square of the average power) of the input audio data.
706 
707 @details Before using the <tt>@ref VCT_SendAudioEx</tt> function, use this function to get the volume scale value of the input audio data.
708 
709 @details The <SPAN class="argument">length</SPAN> argument specifies the number of bytes of audio data to input. The audio data must have been sampled at 16 bits/8 kHz.
710 
711 @param[in] audio Specifies the audio data.
712 @param[in] length Specifies the number of bytes of the audio data.
713 
714 @retval true The received data is VoiceChat data.
715 
716 @date 2012/04/19 - Corrected the description of the <SPAN class="argument">length</SPAN> argument by changing "number of samples" to "number of bytes."
717 @date 2011/09/29 - Clarified that the <span class="argument">audio variable</span> is <tt>const</tt>.
718 @date 2011/08/31 Initial version.
719  */
720 u32 VCT_GetAudioScale ( const void *audio, u32 length );
721  /*!
722 @brief Gets audio streaming information for the party specified by <SPAN class="argument">cid</SPAN>.
723 
724 @param[in] cid The connection ID of the other party from which to get audio streaming information.
725 @param[in] info Pointer to an <tt>@ref VCTAudioInfo</tt> structure.
726 
727 @date 2011/08/31 Initial version.
728  */
729 void VCT_GetAudioInfoFromCid ( u16 cid, VCTAudioInfo *info );
730 
731  /*!
732 @cond PRIVATE
733 @brief Resets audio streaming information for the terminal that has the specified connection ID.
734 
735 @details Use the <tt>@ref VCT_ResetAudioInfoAll</tt> function to reset all currently open streams.
736 
737 @param[in] cid The connection ID of the party for which to reset streaming information.
738 
739 @date 2011/08/31 Initial version.
740  */
741 void VCT_ResetAudioInfo ( u16 cid );
742 //! @endcond
743 
744  /*!
745 @cond PRIVATE
746 @brief Resets the information on all currently open audio streams.
747 
748 @details Use the <tt>@ref VCT_ResetAudioInfo</tt> function to reset the streaming information for a specific connection ID.
749 
750 @date 2011/08/31 Initial version.
751  */
752 void VCT_ResetAudioInfoAll ( void );
753 //! @endcond
754 
755 /*!
756 end of name Audio Streaming
757  @}
758 */
759 
760 /*!
761 @name Noise Skipping
762  @{
763 */
764 
765 /*!
766 @brief Sets the length of time for which sound is not sent in <tt>@ref VCT_SignalNoiseSkip</tt>.
767 
768 @param[in] count Specifies the length of time sound is not sent (in milliseconds).
769 @date 2012/03/01 Initial version.
770  */
771 void VCT_SetNoiseSkipTime ( u32 count );
772 
773  /*!
774 @brief Returns the length of time for which sound is not sent in <tt>@ref VCT_SignalNoiseSkip</tt>.
775 
776 @retval u32 The length of time for which sound is not sent (in milliseconds).
777 
778 @date 2012/03/01 Initial version.
779  */
780 u32 VCT_GetNoiseSkipTime ( void );
781 
782  /*!
783 @brief When VAD is enabled and not active, this function makes VAD active on the sound of button presses so that audio is not sent.
784 
785 @details Setting up this function enables you to prevent the VAD feature from activating and sending audio on the sound of button presses when VAD is enabled but not active.
786 By not sending audio for a certain time period after button presses, you can minimize the button pressing sounds received by other players.
787 
788 @details This function cannot remove button-press sounds while VAD is active and a conversation is being sent.
789 
790 @details The duration (in milliseconds) to not send sound is specified with <tt>@ref VCT_SetNoiseSkipTime</tt>.
791 
792 
793 @date 2012/05/10 - Revised the description.
794 @date 2012/03/15 - Supplemented the description.
795 @date 2012/03/01 Initial version.
796  */
797 
798 void VCT_SignalNoiseSkip ( void );
799 
800 /*!
801 end of name Noise Skipping
802  @}
803 */
804 
805 /*!
806 @name Spare Packets
807  @{
808 */
809 /*===========================================================================*
810  *
811 * Spare Packet Functions
812  *
813  *===========================================================================*/
814 
815  /*!
816 @brief This function enables and disables the spare packet feature.
817 
818 @details The spare packet feature is enabled by default.
819 
820 @param[in] flag Specify <tt>true</tt> to enable or <tt>false</tt> to disable.
821 
822 @date 2011/08/31 Initial version.
823  */
824 void VCT_EnableSparePacket ( bool flag );
825 
826  /*!
827 @brief This function gets whether the spare packet feature is enabled or disabled.
828 
829 @details The spare packet feature is enabled by default.
830 
831 @retval true Specifies that the spare packet feature is enabled.
832 @retval false Specifies that the spare packet feature is disabled.
833 
834 @date 2011/08/31 Initial version.
835  */
836 bool VCT_IsEnableSparePacket ( void );
837 
838  /*!
839 @brief Sets the audio codec for spare packets.
840 
841 @details By default, spare packets use the 2-bit ADPCM codec.
842 
843 @details Use the <tt>@ref VCT_SetCodec</tt> function to change the codec for main packets.
844 
845 @details <b>Note:</b> The only codec type supported for spare packets is 2-bit ADPCM. Accordingly, this function does not need to be called at this time. Returns <tt>false</tt> when an unsupported codec has been specified.
846 
847 @param[in] spareCodec The spare packet codec type.
848 
849 @retval true Setting succeeded.
850 @retval false Setting failed.
851 
852 @date 2011/08/31 Initial version.
853  */
854 bool VCT_SetSpareCodec ( VCTCodec spareCodec );
855 
856  /*!
857 @brief Gets the currently configured audio codec for spare packets.
858 
859 @details This value is meaningless if the spare packet feature is not used.
860 
861 @details <b>Note:</b> The only codec type supported for spare packets is 2-bit ADPCM. At the present time, this function always returns <tt>@ref VCT_CODEC_2BIT_ADPCM</tt>.
862 
863 @retval @ref VCTCodec The currently set codec type for spare packets.
864 
865 @date 2011/08/31 Initial version.
866  */
867 VCTCodec VCT_GetSpareCodec ( void );
868 
869  /*!
870 @brief Determines whether you can use the codec type specified by <span class="argument">codec</span> as a spare-packet codec type.
871 
872 @param[in] codec The codec type.
873 
874 @retval true Can be used.
875 @retval false Cannot be used.
876 
877 @date 2011/08/31 Initial version.
878  */
879 bool VCT_IsValidSpareCodec ( VCTCodec codec );
880 
881 /*!
882 end of name Spare Packets
883  @}
884 */
885 /*!
886 @name Drop Recovery
887  @{
888 */
889 /*===========================================================================*
890  *
891 * Drop Recovery
892  *
893  *===========================================================================*/
894 
895 /*!
896 @cond PRIVATE
897 @brief Enables or disables the drop recover feature.
898 
899 @details The drop recover feature is enabled by default.
900 
901 @details When the drop recovery feature is enabled, an attempt is made to recover audio data from lost packets.
902 
903 @details If the spare packet feature is enabled and the spare packet of the next packet is available, the audio data of the current packet is recovered based on the spare packet audio data. This improves audio quality.
904 
905 @param[in] flag Specify <tt>true</tt> to enable or <tt>false</tt> to disable.
906 
907 @date 2011/08/31 Initial version.
908  */
909 void VCT_EnableDropRecover ( bool flag );
910 //! @endcond
911 
912 /*!
913 @cond PRIVATE
914 @brief Gets whether the drop recover feature is enabled.
915 
916 @retval true Specifies that the drop recover feature is enabled.
917 @retval false Specifies that the drop recover feature is disabled.
918 
919 @date 2011/08/31 Initial version.
920  */
921 bool VCT_IsEnableDropRecover ( void );
922 //! @endcond
923 /*!
924 end of name Drop Recovery
925  @}
926 */
927 /*!
928 @name VAD
929  @{
930 */
931 /*===========================================================================*
932  *
933 * VAD Functions
934  *
935  *===========================================================================*/
936 /*!
937 @brief Enables or disables the VAD feature.
938 
939 @details The VAD feature is enabled by default.
940 
941 @details When VAD is enabled, in addition to evaluating audio inside the <tt>@ref VCT_Main</tt> function, decisions are also made automatically about whether to send packets.
942 
943 @param[in] flag Specify <tt>true</tt> to enable or <tt>false</tt> to disable.
944 
945 @date 2011/08/31 Initial version.
946  */
947 void VCT_EnableVAD ( bool flag );
948 
949 /*!
950 @brief Gets whether the VAD feature is enabled.
951 
952 @retval true Specifies that the VAD feature is enabled.
953 @retval false Specifies that the VAD feature is disabled.
954 
955 @date 2011/08/31 Initial version.
956  */
957 bool VCT_IsEnableVAD ( void );
958 
959 /*!
960 @brief VAD Gets the audio detection results from the VAD algorithm.
961 
962 @details Returns <tt>true</tt> while audio is detected in the frame (speech frame) and <tt>false</tt> while it is not (silent frame).
963 
964 @details Always returns <tt>false</tt> while the VAD feature is disabled, regardless of the presence of speech.
965 
966 @retval true Specifies that audio is present.
967 @retval false Specifies that no audio is present.
968 
969 @date 2011/08/31 Initial version.
970  */
971 bool VCT_GetVADActivity ( void );
972 
973 /*!
974 @cond PRIVATE
975 @brief Gets the average power of audio data in the current audio frame.
976 
977 @details The VAD algorithm detects audio based on the size of this value. This value is equal to the average power of the entire audio data sample (the square root of the audio data volume scale value used by the <tt>@ref VCT_GetAudioScale</tt> and <tt>@ref VCT_SetVADClampGain</tt> functions) divided by a normalizing factor (256).
978 
979 @retval u16 Average power of the audio data in the current audio frame.
980 
981 @date 2011/08/31 Initial version.
982  */
983 u16 VCT_GetVADPower ( void );
984 //! @endcond
985 
986 /*!
987 @brief Resets the internal VAD status.
988 
989 @details Call this function after making changes to the microphone gain or similar settings.
990 
991 
992 @date 2011/08/31 Initial version.
993  */
994 void VCT_ResetVAD ( void );
995 
996 /*!
997 @brief Sets the speech frame detection threshold.
998 
999 @details When the previous audio frame is recognized as a silent frame, this threshold value is used to determine whether the current audio frame contains speech.
1000 
1001 @details A frame is recognized as containing speech when the following condition is met, where Ts is the threshold value, Ec is the average speech power of the audio data in the current frame, and En is the average speech power of the audio data in the four previous frames.
1002 
1003 @details Ec > En * Ts / 100
1004 
1005 @details The value argument takes the threshold (Ts). The default value is 350. In this case, the threshold of the power difference between <tt>En</tt> and <tt>Ec</tt> is equivalent to <tt>20 * log (350 / 100) = 10.9 dB</tt>.
1006 
1007 @param[in] value Specifies the speech frame detection threshold.
1008 
1009 @date 2011/08/31 Initial version.
1010  */
1011 void VCT_SetVADActiveGain ( u16 value );
1012 
1013 /*!
1014 @brief Gets the current speech frame detection threshold.
1015 
1016 @retval u16 Threshold for detecting a speech frame.
1017 
1018 @date 2011/08/31 Initial version.
1019  */
1020 u16 VCT_GetVADActiveGain ( void );
1021 
1022 /*!
1023 @brief Sets the silent frame detection threshold.
1024 
1025 @details When the previous audio frame is recognized as a speech frame, this threshold value is used to determine whether the current audio frame is silent.
1026 
1027 @details A frame is recognized as being a silent frame when the following condition is met, where Tn is the threshold value, Ec is the average speech power of the audio data in the most-recent four frames, and En is the average speech power of the audio data in the four frames prior to the last audio frame that was determined to be a silent frame.
1028 
1029 @details Ec < En * Tn / 100
1030 
1031 @details However, the sending of audio frames actually stops when silence is determined to continue for the consecutive number of frames specified by the <tt>@ref VCT_SetVADReleaseTime</tt> function.
1032 
1033 @details The value argument takes the threshold (Tn). The default value is 280. In this case, the threshold of the power difference between <tt>En</tt> and <tt>Ec</tt> is equivalent to <tt>20 * log (280 / 100) = 8.94 dB</tt>.
1034 
1035 @param[in] value Specifies the silent frame detection threshold.
1036 
1037 @date 2011/08/31 Initial version.
1038  */
1039 void VCT_SetVADInactiveGain ( u16 value );
1040 /*!
1041 @brief Gets the current silent frame detection threshold.
1042 
1043 @retval u16 Threshold for detecting a silent frame.
1044 
1045 @date 2011/08/31 Initial version.
1046  */
1047 u16 VCT_GetVADInactiveGain ( void );
1048 
1049 /*!
1050 @brief Sets the time that must elapse after silence is detected before packet transmission is stopped.
1051 
1052 @details To prevent VAD from detecting silence in the middle of a conversation because, for example, the user takes a breath, set the release time to at least 500 ms.
1053 
1054 @details For <SPAN class="argument">count</SPAN>, specify the time (in packets) to wait after VAD has detected silence before packet transmission is halted. The default is 5 packets (<tt>144 * 5 = 720 ms</tt>).
1055 
1056 @param[in] count Release time (in number of packets).
1057 
1058 @date 2011/08/31 Initial version.
1059  */
1060 void VCT_SetVADReleaseTime ( u32 count );
1061 
1062 /*!
1063 @brief Gets the time that must elapse after silence is detected before packet transmission is stopped.
1064 
1065 @retval u32 Release time (in number of packets).
1066 
1067 @date 2011/08/31 Initial version.
1068  */
1069 u32 VCT_GetVADReleaseTime ( void );
1070 
1071 /*!
1072 @brief Sets the volume threshold as a volume scale value (the square of the average power) for unconditionally determining silence.
1073 
1074 @details <span class="argument">value</span> takes a volume scale value in a range from <tt>0</tt> through <tt>0x3FFFFFFF</tt>. Any audio frame with a volume scale value below this specified threshold is determined to be a silent frame.
1075 
1076 @details Uses the volume scale value for audio data obtained by the <tt>@ref VCT_GetAudioScale</tt> function.
1077 
1078 @details The default value is 49.
1079 
1080 @param[in] value The volume threshold at which a frame is unconditionally determined to be silent.
1081 @date 2011/08/31 Initial version.
1082  */
1083 void VCT_SetVADClampGain ( u32 value );
1084 
1085 /*!
1086 @brief Gets the volume threshold as a volume scale value for unconditionally determining silence.
1087 
1088 @details The volume scale value is specified in the range from <tt>0</tt> through <tt>0x3FFFFFFF</tt>.
1089 
1090 @retval u32 The volume threshold at which a frame is unconditionally determined to be silent.
1091 
1092 @date 2011/08/31 Initial version.
1093  */
1094 u32 VCT_GetVADClampGain ( void );
1095 
1096 /*!
1097 end of name VAD
1098  @}
1099 */
1100 
1101 /*!
1102 @name HPF
1103  @{
1104 */
1105 /*===========================================================================*
1106  *
1107 * HPF Functions
1108  *
1109  *===========================================================================*/
1110 /*!
1111 @cond PRIVATE
1112 @brief Enables or disables the high-pass filter.
1113 
1114 @details By default, the high-pass filter is disabled.
1115 
1116 @details When this feature is enabled, the high-pass filter is applied inside the <tt>@ref VCT_Main</tt> function to eliminate low-range noise from the audio being sent.
1117 
1118 @param[in] flag Specify <tt>true</tt> to enable or <tt>false</tt> to disable.
1119 
1120 @date 2011/08/31 Initial version.
1121  */
1122 void VCT_EnableHPF ( bool flag );
1123 //! @endcond
1124 
1125 /*!
1126 @cond PRIVATE
1127 @brief Gets whether the high-pass filter is enabled.
1128 
1129 @retval true The high-pass filter feature is enabled.
1130 @retval false The high-pass filter feature is disabled.
1131 
1132 @date 2011/08/31 Initial version.
1133  */
1134 bool VCT_IsEnableHPF ( void );
1135 //! @endcond
1136 /*!
1137 end of name HPF
1138  @}
1139 */
1140 
1141 /*!
1142 @name BPF
1143  @{
1144 */
1145 /*===========================================================================*
1146  *
1147 * BPF Functions
1148  *
1149  *===========================================================================*/
1150 
1151 /*!
1152 @cond PRIVATE
1153 @brief Enables or disables the biquad filter.
1154 
1155 @details By default, the biquad filter is disabled.
1156 
1157 @details When this feature is enabled, the biquad filter is applied inside the <tt>@ref VCT_Main</tt> function to eliminate noise outside of the range of speech from the audio being sent.
1158 
1159 
1160 @param[in] flag Specify <tt>true</tt> to enable or <tt>false</tt> to disable.
1161 
1162 @date 2011/12/09 Initial version.
1163  */
1164 void VCT_EnableBPF ( bool flag );
1165 //! @endcond
1166 
1167 /*!
1168 @cond PRIVATE
1169 @brief Gets whether the biquad filter is enabled.
1170 
1171 @retval true The biquad filter is enabled.
1172 @retval false The biquad filter is disabled.
1173 
1174 @date 2011/12/09 Initial version.
1175  */
1176 bool VCT_IsEnableBPF ( void );
1177 //! @endcond
1178 
1179 /*!
1180 end of name HPF
1181  @}
1182 */
1183 
1184 
1185 #ifdef NN_VCT_TARGET_CTR
1186 /*!
1187 @name Echo Canceler
1188  @{
1189 */
1190 /*===========================================================================*
1191  *
1192 * Echo-Canceler Functions
1193  *
1194  *===========================================================================*/
1195 /*!
1196 @cond PRIVATE
1197 @brief Enables or disables the echo canceler.
1198 
1199 @details The echo canceler feature is enabled by default.
1200 
1201 @details When this feature is enabled, echo cancellation is performed inside the <tt>@ref VCT_SendAudioEx</tt> function.
1202 
1203 @param[in] flag Specify <tt>true</tt> to enable or <tt>false</tt> to disable.
1204 
1205 @date 2013/06/11 Changed the default from disabled to enabled.
1206 @date 2011/08/31 Initial version.
1207  */
1208 void VCT_EnableEchoCancel ( bool flag );
1209 //! @endcond
1210 
1211 /*!
1212 @cond PRIVATE
1213 @brief Gets whether the echo canceler is enabled.
1214 
1215 @retval true The echo canceler is enabled.
1216 @retval false The echo canceler is disabled.
1217 @date 2011/08/31 Initial version.
1218  */
1219 bool VCT_IsEnableEchoCancel ( void );
1220 //! @endcond
1221 
1222 /*!
1223 @brief Supplies reference data for the echo canceler.
1224 
1225 @details Call the <tt>nn::snd::GetMixedBusData</tt> function at every sound DSP interrupt (every 5 ms), and pass the 5 ms of 16 bit/32 kHz/stereo data obtained by that function to the <span class="argument">buffer</span> of this function.
1226 
1227 @details This function does nothing if <SPAN class="argument">size</SPAN> is not the correct size for 5 milliseconds of 16-bit/32-kHz stereo data.
1228 
1229 @param[in] buffer Reference data for the echo canceler.
1230 @param[in] size The size of the reference data for the echo canceler.
1231 
1232 
1233 @date 2011/09/29 - Clarified that the <span class="argument">buffer</span> variable is <tt>const</tt>.
1234 @date 2011/08/31 Initial version.
1235  */
1236 
1237 void VCT_HandleReference ( const u8 *buffer, u32 size );
1238 /*!
1239 end of name Echo Canceller
1240  @}
1241 */
1242 #endif // NN_VCT_TARGET_CTR
1243 
1244 #ifdef __cplusplus
1245 }
1246 #endif
1247 
1248 #endif /* VCT_VOICECHAT_H_ */
1249 /*!!!! EOF !!!!*/