opus_defines.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited
  2. Written by Jean-Marc Valin and Koen Vos */
  3. /*
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. - Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  13. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  14. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  15. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  16. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  17. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  19. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  20. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  21. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  22. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. /**
  25. * @file opus_defines.h
  26. * @brief Opus reference implementation constants
  27. */
  28. #ifndef OPUS_DEFINES_H
  29. #define OPUS_DEFINES_H
  30. #include "opus_types.h"
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /** @defgroup opus_errorcodes Error codes
  35. * @{
  36. */
  37. /** No error @hideinitializer*/
  38. #define OPUS_OK 0
  39. /** One or more invalid/out of range arguments @hideinitializer*/
  40. #define OPUS_BAD_ARG -1
  41. /** Not enough bytes allocated in the buffer @hideinitializer*/
  42. #define OPUS_BUFFER_TOO_SMALL -2
  43. /** An internal error was detected @hideinitializer*/
  44. #define OPUS_INTERNAL_ERROR -3
  45. /** The compressed data passed is corrupted @hideinitializer*/
  46. #define OPUS_INVALID_PACKET -4
  47. /** Invalid/unsupported request number @hideinitializer*/
  48. #define OPUS_UNIMPLEMENTED -5
  49. /** An encoder or decoder structure is invalid or already freed @hideinitializer*/
  50. #define OPUS_INVALID_STATE -6
  51. /** Memory allocation has failed @hideinitializer*/
  52. #define OPUS_ALLOC_FAIL -7
  53. /**@}*/
  54. /** @cond OPUS_INTERNAL_DOC */
  55. /**Export control for opus functions */
  56. #ifndef OPUS_EXPORT
  57. # if defined(WIN32)
  58. # if defined(OPUS_BUILD) && defined(DLL_EXPORT)
  59. # define OPUS_EXPORT __declspec(dllexport)
  60. # else
  61. # define OPUS_EXPORT
  62. # endif
  63. # elif defined(__GNUC__) && defined(OPUS_BUILD)
  64. # define OPUS_EXPORT __attribute__ ((visibility ("default")))
  65. # else
  66. # define OPUS_EXPORT
  67. # endif
  68. #endif
  69. # if !defined(OPUS_GNUC_PREREQ)
  70. # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
  71. # define OPUS_GNUC_PREREQ(_maj,_min) \
  72. ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
  73. # else
  74. # define OPUS_GNUC_PREREQ(_maj,_min) 0
  75. # endif
  76. # endif
  77. #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
  78. # if OPUS_GNUC_PREREQ(3,0)
  79. # define OPUS_RESTRICT __restrict__
  80. # elif (defined(_MSC_VER) && _MSC_VER >= 1400)
  81. # define OPUS_RESTRICT __restrict
  82. # else
  83. # define OPUS_RESTRICT
  84. # endif
  85. #else
  86. # define OPUS_RESTRICT restrict
  87. #endif
  88. #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
  89. # if OPUS_GNUC_PREREQ(2,7)
  90. # define OPUS_INLINE __inline__
  91. # elif (defined(_MSC_VER))
  92. # define OPUS_INLINE __inline
  93. # else
  94. # define OPUS_INLINE
  95. # endif
  96. #else
  97. # define OPUS_INLINE inline
  98. #endif
  99. /**Warning attributes for opus functions
  100. * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
  101. * some paranoid null checks. */
  102. #if defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
  103. # define OPUS_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
  104. #else
  105. # define OPUS_WARN_UNUSED_RESULT
  106. #endif
  107. #if !defined(OPUS_BUILD) && defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4)
  108. # define OPUS_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x)))
  109. #else
  110. # define OPUS_ARG_NONNULL(_x)
  111. #endif
  112. /** These are the actual Encoder CTL ID numbers.
  113. * They should not be used directly by applications.
  114. * In general, SETs should be even and GETs should be odd.*/
  115. #define OPUS_SET_APPLICATION_REQUEST 4000
  116. #define OPUS_GET_APPLICATION_REQUEST 4001
  117. #define OPUS_SET_BITRATE_REQUEST 4002
  118. #define OPUS_GET_BITRATE_REQUEST 4003
  119. #define OPUS_SET_MAX_BANDWIDTH_REQUEST 4004
  120. #define OPUS_GET_MAX_BANDWIDTH_REQUEST 4005
  121. #define OPUS_SET_VBR_REQUEST 4006
  122. #define OPUS_GET_VBR_REQUEST 4007
  123. #define OPUS_SET_BANDWIDTH_REQUEST 4008
  124. #define OPUS_GET_BANDWIDTH_REQUEST 4009
  125. #define OPUS_SET_COMPLEXITY_REQUEST 4010
  126. #define OPUS_GET_COMPLEXITY_REQUEST 4011
  127. #define OPUS_SET_INBAND_FEC_REQUEST 4012
  128. #define OPUS_GET_INBAND_FEC_REQUEST 4013
  129. #define OPUS_SET_PACKET_LOSS_PERC_REQUEST 4014
  130. #define OPUS_GET_PACKET_LOSS_PERC_REQUEST 4015
  131. #define OPUS_SET_DTX_REQUEST 4016
  132. #define OPUS_GET_DTX_REQUEST 4017
  133. #define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
  134. #define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021
  135. #define OPUS_SET_FORCE_CHANNELS_REQUEST 4022
  136. #define OPUS_GET_FORCE_CHANNELS_REQUEST 4023
  137. #define OPUS_SET_SIGNAL_REQUEST 4024
  138. #define OPUS_GET_SIGNAL_REQUEST 4025
  139. #define OPUS_GET_LOOKAHEAD_REQUEST 4027
  140. /* #define OPUS_RESET_STATE 4028 */
  141. #define OPUS_GET_SAMPLE_RATE_REQUEST 4029
  142. #define OPUS_GET_FINAL_RANGE_REQUEST 4031
  143. #define OPUS_GET_PITCH_REQUEST 4033
  144. #define OPUS_SET_GAIN_REQUEST 4034
  145. #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */
  146. #define OPUS_SET_LSB_DEPTH_REQUEST 4036
  147. #define OPUS_GET_LSB_DEPTH_REQUEST 4037
  148. #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039
  149. #define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040
  150. #define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041
  151. #define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042
  152. #define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043
  153. /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */
  154. #define OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 4046
  155. #define OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST 4047
  156. #define OPUS_GET_IN_DTX_REQUEST 4049
  157. #define OPUS_SET_WAVEFORM_MATCHING_REQUEST 4050
  158. #define OPUS_GET_WAVEFORM_MATCHING_REQUEST 4051
  159. /** Defines for the presence of extended APIs. */
  160. #define OPUS_HAVE_OPUS_PROJECTION_H
  161. /* Macros to trigger compilation errors when the wrong types are provided to a CTL */
  162. #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x))
  163. #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr)))
  164. #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr)))
  165. #define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr)))
  166. /** @endcond */
  167. /** @defgroup opus_ctlvalues Pre-defined values for CTL interface
  168. * @see opus_genericctls, opus_encoderctls
  169. * @{
  170. */
  171. /* Values for the various encoder CTLs */
  172. #define OPUS_AUTO -1000 /**<Auto/default setting @hideinitializer*/
  173. #define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hideinitializer*/
  174. /** Best for most VoIP/videoconference applications where listening quality and intelligibility matter most
  175. * @hideinitializer */
  176. #define OPUS_APPLICATION_VOIP 2048
  177. /** Best for broadcast/high-fidelity application where the decoded audio should be as close as possible to the input
  178. * @hideinitializer */
  179. #define OPUS_APPLICATION_AUDIO 2049
  180. /** Only use when lowest-achievable latency is what matters most. Voice-optimized modes cannot be used.
  181. * @hideinitializer */
  182. #define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051
  183. #define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is voice */
  184. #define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is music */
  185. #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass @hideinitializer*/
  186. #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hideinitializer*/
  187. #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hideinitializer*/
  188. #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/
  189. #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/
  190. #define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size from the argument (default) */
  191. #define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */
  192. #define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */
  193. #define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */
  194. #define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */
  195. #define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */
  196. #define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */
  197. #define OPUS_FRAMESIZE_80_MS 5007 /**< Use 80 ms frames */
  198. #define OPUS_FRAMESIZE_100_MS 5008 /**< Use 100 ms frames */
  199. #define OPUS_FRAMESIZE_120_MS 5009 /**< Use 120 ms frames */
  200. /**@}*/
  201. /** @defgroup opus_encoderctls Encoder related CTLs
  202. *
  203. * These are convenience macros for use with the \c opus_encode_ctl
  204. * interface. They are used to generate the appropriate series of
  205. * arguments for that call, passing the correct type, size and so
  206. * on as expected for each particular request.
  207. *
  208. * Some usage examples:
  209. *
  210. * @code
  211. * int ret;
  212. * ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO));
  213. * if (ret != OPUS_OK) return ret;
  214. *
  215. * opus_int32 rate;
  216. * opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate));
  217. *
  218. * opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
  219. * @endcode
  220. *
  221. * @see opus_genericctls, opus_encoder
  222. * @{
  223. */
  224. /** Configures the encoder's computational complexity.
  225. * The supported range is 0-10 inclusive with 10 representing the highest complexity.
  226. * @see OPUS_GET_COMPLEXITY
  227. * @param[in] x <tt>opus_int32</tt>: Allowed values: 0-10, inclusive.
  228. *
  229. * @hideinitializer */
  230. #define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, __opus_check_int(x)
  231. /** Gets the encoder's complexity configuration.
  232. * @see OPUS_SET_COMPLEXITY
  233. * @param[out] x <tt>opus_int32 *</tt>: Returns a value in the range 0-10,
  234. * inclusive.
  235. * @hideinitializer */
  236. #define OPUS_GET_COMPLEXITY(x) OPUS_GET_COMPLEXITY_REQUEST, __opus_check_int_ptr(x)
  237. /** Configures the bitrate in the encoder.
  238. * Rates from 500 to 512000 bits per second are meaningful, as well as the
  239. * special values #OPUS_AUTO and #OPUS_BITRATE_MAX.
  240. * The value #OPUS_BITRATE_MAX can be used to cause the codec to use as much
  241. * rate as it can, which is useful for controlling the rate by adjusting the
  242. * output buffer size.
  243. * @see OPUS_GET_BITRATE
  244. * @param[in] x <tt>opus_int32</tt>: Bitrate in bits per second. The default
  245. * is determined based on the number of
  246. * channels and the input sampling rate.
  247. * @hideinitializer */
  248. #define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __opus_check_int(x)
  249. /** Gets the encoder's bitrate configuration.
  250. * @see OPUS_SET_BITRATE
  251. * @param[out] x <tt>opus_int32 *</tt>: Returns the bitrate in bits per second.
  252. * The default is determined based on the
  253. * number of channels and the input
  254. * sampling rate.
  255. * @hideinitializer */
  256. #define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, __opus_check_int_ptr(x)
  257. /** Enables or disables variable bitrate (VBR) in the encoder.
  258. * The configured bitrate may not be met exactly because frames must
  259. * be an integer number of bytes in length.
  260. * @see OPUS_GET_VBR
  261. * @see OPUS_SET_VBR_CONSTRAINT
  262. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  263. * <dl>
  264. * <dt>0</dt><dd>Hard CBR. For LPC/hybrid modes at very low bit-rate, this can
  265. * cause noticeable quality degradation.</dd>
  266. * <dt>1</dt><dd>VBR (default). The exact type of VBR is controlled by
  267. * #OPUS_SET_VBR_CONSTRAINT.</dd>
  268. * </dl>
  269. * @hideinitializer */
  270. #define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __opus_check_int(x)
  271. /** Determine if variable bitrate (VBR) is enabled in the encoder.
  272. * @see OPUS_SET_VBR
  273. * @see OPUS_GET_VBR_CONSTRAINT
  274. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  275. * <dl>
  276. * <dt>0</dt><dd>Hard CBR.</dd>
  277. * <dt>1</dt><dd>VBR (default). The exact type of VBR may be retrieved via
  278. * #OPUS_GET_VBR_CONSTRAINT.</dd>
  279. * </dl>
  280. * @hideinitializer */
  281. #define OPUS_GET_VBR(x) OPUS_GET_VBR_REQUEST, __opus_check_int_ptr(x)
  282. /** Enables or disables constrained VBR in the encoder.
  283. * This setting is ignored when the encoder is in CBR mode.
  284. * @warning Only the MDCT mode of Opus currently heeds the constraint.
  285. * Speech mode ignores it completely, hybrid mode may fail to obey it
  286. * if the LPC layer uses more bitrate than the constraint would have
  287. * permitted.
  288. * @see OPUS_GET_VBR_CONSTRAINT
  289. * @see OPUS_SET_VBR
  290. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  291. * <dl>
  292. * <dt>0</dt><dd>Unconstrained VBR.</dd>
  293. * <dt>1</dt><dd>Constrained VBR (default). This creates a maximum of one
  294. * frame of buffering delay assuming a transport with a
  295. * serialization speed of the nominal bitrate.</dd>
  296. * </dl>
  297. * @hideinitializer */
  298. #define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __opus_check_int(x)
  299. /** Determine if constrained VBR is enabled in the encoder.
  300. * @see OPUS_SET_VBR_CONSTRAINT
  301. * @see OPUS_GET_VBR
  302. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  303. * <dl>
  304. * <dt>0</dt><dd>Unconstrained VBR.</dd>
  305. * <dt>1</dt><dd>Constrained VBR (default).</dd>
  306. * </dl>
  307. * @hideinitializer */
  308. #define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, __opus_check_int_ptr(x)
  309. /** Configures mono/stereo forcing in the encoder.
  310. * This can force the encoder to produce packets encoded as either mono or
  311. * stereo, regardless of the format of the input audio. This is useful when
  312. * the caller knows that the input signal is currently a mono source embedded
  313. * in a stereo stream.
  314. * @see OPUS_GET_FORCE_CHANNELS
  315. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  316. * <dl>
  317. * <dt>#OPUS_AUTO</dt><dd>Not forced (default)</dd>
  318. * <dt>1</dt> <dd>Forced mono</dd>
  319. * <dt>2</dt> <dd>Forced stereo</dd>
  320. * </dl>
  321. * @hideinitializer */
  322. #define OPUS_SET_FORCE_CHANNELS(x) OPUS_SET_FORCE_CHANNELS_REQUEST, __opus_check_int(x)
  323. /** Gets the encoder's forced channel configuration.
  324. * @see OPUS_SET_FORCE_CHANNELS
  325. * @param[out] x <tt>opus_int32 *</tt>:
  326. * <dl>
  327. * <dt>#OPUS_AUTO</dt><dd>Not forced (default)</dd>
  328. * <dt>1</dt> <dd>Forced mono</dd>
  329. * <dt>2</dt> <dd>Forced stereo</dd>
  330. * </dl>
  331. * @hideinitializer */
  332. #define OPUS_GET_FORCE_CHANNELS(x) OPUS_GET_FORCE_CHANNELS_REQUEST, __opus_check_int_ptr(x)
  333. /** Configures the maximum bandpass that the encoder will select automatically.
  334. * Applications should normally use this instead of #OPUS_SET_BANDWIDTH
  335. * (leaving that set to the default, #OPUS_AUTO). This allows the
  336. * application to set an upper bound based on the type of input it is
  337. * providing, but still gives the encoder the freedom to reduce the bandpass
  338. * when the bitrate becomes too low, for better overall quality.
  339. * @see OPUS_GET_MAX_BANDWIDTH
  340. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  341. * <dl>
  342. * <dt>OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
  343. * <dt>OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
  344. * <dt>OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
  345. * <dt>OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
  346. * <dt>OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband (default)</dd>
  347. * </dl>
  348. * @hideinitializer */
  349. #define OPUS_SET_MAX_BANDWIDTH(x) OPUS_SET_MAX_BANDWIDTH_REQUEST, __opus_check_int(x)
  350. /** Gets the encoder's configured maximum allowed bandpass.
  351. * @see OPUS_SET_MAX_BANDWIDTH
  352. * @param[out] x <tt>opus_int32 *</tt>: Allowed values:
  353. * <dl>
  354. * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
  355. * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
  356. * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
  357. * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
  358. * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband (default)</dd>
  359. * </dl>
  360. * @hideinitializer */
  361. #define OPUS_GET_MAX_BANDWIDTH(x) OPUS_GET_MAX_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
  362. /** Sets the encoder's bandpass to a specific value.
  363. * This prevents the encoder from automatically selecting the bandpass based
  364. * on the available bitrate. If an application knows the bandpass of the input
  365. * audio it is providing, it should normally use #OPUS_SET_MAX_BANDWIDTH
  366. * instead, which still gives the encoder the freedom to reduce the bandpass
  367. * when the bitrate becomes too low, for better overall quality.
  368. * @see OPUS_GET_BANDWIDTH
  369. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  370. * <dl>
  371. * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
  372. * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
  373. * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
  374. * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
  375. * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
  376. * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd>
  377. * </dl>
  378. * @hideinitializer */
  379. #define OPUS_SET_BANDWIDTH(x) OPUS_SET_BANDWIDTH_REQUEST, __opus_check_int(x)
  380. /** Configures the type of signal being encoded.
  381. * This is a hint which helps the encoder's mode selection.
  382. * @see OPUS_GET_SIGNAL
  383. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  384. * <dl>
  385. * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
  386. * <dt>#OPUS_SIGNAL_VOICE</dt><dd>Bias thresholds towards choosing LPC or Hybrid modes.</dd>
  387. * <dt>#OPUS_SIGNAL_MUSIC</dt><dd>Bias thresholds towards choosing MDCT modes.</dd>
  388. * </dl>
  389. * @hideinitializer */
  390. #define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, __opus_check_int(x)
  391. /** Gets the encoder's configured signal type.
  392. * @see OPUS_SET_SIGNAL
  393. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  394. * <dl>
  395. * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
  396. * <dt>#OPUS_SIGNAL_VOICE</dt><dd>Bias thresholds towards choosing LPC or Hybrid modes.</dd>
  397. * <dt>#OPUS_SIGNAL_MUSIC</dt><dd>Bias thresholds towards choosing MDCT modes.</dd>
  398. * </dl>
  399. * @hideinitializer */
  400. #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __opus_check_int_ptr(x)
  401. /** Configures the encoder's intended application.
  402. * The initial value is a mandatory argument to the encoder_create function.
  403. * @see OPUS_GET_APPLICATION
  404. * @param[in] x <tt>opus_int32</tt>: Returns one of the following values:
  405. * <dl>
  406. * <dt>#OPUS_APPLICATION_VOIP</dt>
  407. * <dd>Process signal for improved speech intelligibility.</dd>
  408. * <dt>#OPUS_APPLICATION_AUDIO</dt>
  409. * <dd>Favor faithfulness to the original input.</dd>
  410. * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
  411. * <dd>Configure the minimum possible coding delay by disabling certain modes
  412. * of operation.</dd>
  413. * </dl>
  414. * @hideinitializer */
  415. #define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __opus_check_int(x)
  416. /** Gets the encoder's configured application.
  417. * @see OPUS_SET_APPLICATION
  418. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  419. * <dl>
  420. * <dt>#OPUS_APPLICATION_VOIP</dt>
  421. * <dd>Process signal for improved speech intelligibility.</dd>
  422. * <dt>#OPUS_APPLICATION_AUDIO</dt>
  423. * <dd>Favor faithfulness to the original input.</dd>
  424. * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
  425. * <dd>Configure the minimum possible coding delay by disabling certain modes
  426. * of operation.</dd>
  427. * </dl>
  428. * @hideinitializer */
  429. #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __opus_check_int_ptr(x)
  430. /** Gets the total samples of delay added by the entire codec.
  431. * This can be queried by the encoder and then the provided number of samples can be
  432. * skipped on from the start of the decoder's output to provide time aligned input
  433. * and output. From the perspective of a decoding application the real data begins this many
  434. * samples late.
  435. *
  436. * The decoder contribution to this delay is identical for all decoders, but the
  437. * encoder portion of the delay may vary from implementation to implementation,
  438. * version to version, or even depend on the encoder's initial configuration.
  439. * Applications needing delay compensation should call this CTL rather than
  440. * hard-coding a value.
  441. * @param[out] x <tt>opus_int32 *</tt>: Number of lookahead samples
  442. * @hideinitializer */
  443. #define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __opus_check_int_ptr(x)
  444. /** Configures the encoder's use of inband forward error correction (FEC).
  445. * @note This is only applicable to the LPC layer
  446. * @see OPUS_GET_INBAND_FEC
  447. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  448. * <dl>
  449. * <dt>0</dt><dd>Disable inband FEC (default).</dd>
  450. * <dt>1</dt><dd>Enable inband FEC.</dd>
  451. * </dl>
  452. * @hideinitializer */
  453. #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
  454. /** Gets encoder's configured use of inband forward error correction.
  455. * @see OPUS_SET_INBAND_FEC
  456. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  457. * <dl>
  458. * <dt>0</dt><dd>Inband FEC disabled (default).</dd>
  459. * <dt>1</dt><dd>Inband FEC enabled.</dd>
  460. * </dl>
  461. * @hideinitializer */
  462. #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)
  463. /** Configures the encoder's expected packet loss percentage.
  464. * Higher values trigger progressively more loss resistant behavior in the encoder
  465. * at the expense of quality at a given bitrate in the absence of packet loss, but
  466. * greater quality under loss.
  467. * @see OPUS_GET_PACKET_LOSS_PERC
  468. * @param[in] x <tt>opus_int32</tt>: Loss percentage in the range 0-100, inclusive (default: 0).
  469. * @hideinitializer */
  470. #define OPUS_SET_PACKET_LOSS_PERC(x) OPUS_SET_PACKET_LOSS_PERC_REQUEST, __opus_check_int(x)
  471. /** Gets the encoder's configured packet loss percentage.
  472. * @see OPUS_SET_PACKET_LOSS_PERC
  473. * @param[out] x <tt>opus_int32 *</tt>: Returns the configured loss percentage
  474. * in the range 0-100, inclusive (default: 0).
  475. * @hideinitializer */
  476. #define OPUS_GET_PACKET_LOSS_PERC(x) OPUS_GET_PACKET_LOSS_PERC_REQUEST, __opus_check_int_ptr(x)
  477. /** Configures the encoder's use of discontinuous transmission (DTX).
  478. * @note This is only applicable to the LPC layer
  479. * @see OPUS_GET_DTX
  480. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  481. * <dl>
  482. * <dt>0</dt><dd>Disable DTX (default).</dd>
  483. * <dt>1</dt><dd>Enabled DTX.</dd>
  484. * </dl>
  485. * @hideinitializer */
  486. #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, __opus_check_int(x)
  487. /** Gets encoder's configured use of discontinuous transmission.
  488. * @see OPUS_SET_DTX
  489. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  490. * <dl>
  491. * <dt>0</dt><dd>DTX disabled (default).</dd>
  492. * <dt>1</dt><dd>DTX enabled.</dd>
  493. * </dl>
  494. * @hideinitializer */
  495. #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, __opus_check_int_ptr(x)
  496. /** Configures the depth of signal being encoded.
  497. *
  498. * This is a hint which helps the encoder identify silence and near-silence.
  499. * It represents the number of significant bits of linear intensity below
  500. * which the signal contains ignorable quantization or other noise.
  501. *
  502. * For example, OPUS_SET_LSB_DEPTH(14) would be an appropriate setting
  503. * for G.711 u-law input. OPUS_SET_LSB_DEPTH(16) would be appropriate
  504. * for 16-bit linear pcm input with opus_encode_float().
  505. *
  506. * When using opus_encode() instead of opus_encode_float(), or when libopus
  507. * is compiled for fixed-point, the encoder uses the minimum of the value
  508. * set here and the value 16.
  509. *
  510. * @see OPUS_GET_LSB_DEPTH
  511. * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24
  512. * (default: 24).
  513. * @hideinitializer */
  514. #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, __opus_check_int(x)
  515. /** Gets the encoder's configured signal depth.
  516. * @see OPUS_SET_LSB_DEPTH
  517. * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and
  518. * 24 (default: 24).
  519. * @hideinitializer */
  520. #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, __opus_check_int_ptr(x)
  521. /** Configures the encoder's use of variable duration frames.
  522. * When variable duration is enabled, the encoder is free to use a shorter frame
  523. * size than the one requested in the opus_encode*() call.
  524. * It is then the user's responsibility
  525. * to verify how much audio was encoded by checking the ToC byte of the encoded
  526. * packet. The part of the audio that was not encoded needs to be resent to the
  527. * encoder for the next call. Do not use this option unless you <b>really</b>
  528. * know what you are doing.
  529. * @see OPUS_GET_EXPERT_FRAME_DURATION
  530. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  531. * <dl>
  532. * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
  533. * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
  534. * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 5 ms frames.</dd>
  535. * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
  536. * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
  537. * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
  538. * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
  539. * <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd>
  540. * <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd>
  541. * <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd>
  542. * </dl>
  543. * @hideinitializer */
  544. #define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int(x)
  545. /** Gets the encoder's configured use of variable duration frames.
  546. * @see OPUS_SET_EXPERT_FRAME_DURATION
  547. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  548. * <dl>
  549. * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd>
  550. * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd>
  551. * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 5 ms frames.</dd>
  552. * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd>
  553. * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd>
  554. * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd>
  555. * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd>
  556. * <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd>
  557. * <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd>
  558. * <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd>
  559. * </dl>
  560. * @hideinitializer */
  561. #define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, __opus_check_int_ptr(x)
  562. /** If set to 1, disables almost all use of prediction, making frames almost
  563. * completely independent. This reduces quality.
  564. * @see OPUS_GET_PREDICTION_DISABLED
  565. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  566. * <dl>
  567. * <dt>0</dt><dd>Enable prediction (default).</dd>
  568. * <dt>1</dt><dd>Disable prediction.</dd>
  569. * </dl>
  570. * @hideinitializer */
  571. #define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUEST, __opus_check_int(x)
  572. /** Gets the encoder's configured prediction status.
  573. * @see OPUS_SET_PREDICTION_DISABLED
  574. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  575. * <dl>
  576. * <dt>0</dt><dd>Prediction enabled (default).</dd>
  577. * <dt>1</dt><dd>Prediction disabled.</dd>
  578. * </dl>
  579. * @hideinitializer */
  580. #define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x)
  581. /** Gets the DTX state of the encoder.
  582. * Returns whether the last encoded frame was either a comfort noise update
  583. * during DTX or not encoded because of DTX.
  584. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  585. * <dl>
  586. * <dt>0</dt><dd>The encoder is not in DTX.</dd>
  587. * <dt>1</dt><dd>The encoder is in DTX.</dd>
  588. * </dl>
  589. * @hideinitializer */
  590. #define OPUS_GET_IN_DTX(x) OPUS_GET_IN_DTX_REQUEST, __opus_check_int_ptr(x)
  591. /** If set to 1, attempt to better match the input waveform, at the cost
  592. * of reducing the perceptual quality of the signal. This option
  593. * disables the use of coding tools like folding, intensity stereo,
  594. * and disables some encoder-side filtering. This option will *never* improve
  595. * the quality of normal mono or stereo audio and is only meant to be used
  596. * for signals where inaudible phase differences matter (e.g. family 2 ambisonics).
  597. * @see OPUS_GET_WAVEFORM_MATCHING
  598. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  599. * <dl>
  600. * <dt>0</dt><dd>Disable waveform matching (default).</dd>
  601. * <dt>1</dt><dd>Enable waveform matching.</dd>
  602. * </dl>
  603. * @hideinitializer */
  604. #define OPUS_SET_WAVEFORM_MATCHING(x) OPUS_SET_WAVEFORM_MATCHING_REQUEST, __opus_check_int(x)
  605. /** Gets the encoder's configured waveform matching status.
  606. * @see OPUS_SET_WAVEFORM_MATCHING
  607. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  608. * <dl>
  609. * <dt>0</dt><dd>Waveform matching disabled (default).</dd>
  610. * <dt>1</dt><dd>Waveform matching enabled.</dd>
  611. * </dl>
  612. * @hideinitializer */
  613. #define OPUS_GET_WAVEFORM_MATCHING(x) OPUS_GET_WAVEFORM_MATCHING_REQUEST, __opus_check_int_ptr(x)
  614. /**@}*/
  615. /** @defgroup opus_genericctls Generic CTLs
  616. *
  617. * These macros are used with the \c opus_decoder_ctl and
  618. * \c opus_encoder_ctl calls to generate a particular
  619. * request.
  620. *
  621. * When called on an \c OpusDecoder they apply to that
  622. * particular decoder instance. When called on an
  623. * \c OpusEncoder they apply to the corresponding setting
  624. * on that encoder instance, if present.
  625. *
  626. * Some usage examples:
  627. *
  628. * @code
  629. * int ret;
  630. * opus_int32 pitch;
  631. * ret = opus_decoder_ctl(dec_ctx, OPUS_GET_PITCH(&pitch));
  632. * if (ret == OPUS_OK) return ret;
  633. *
  634. * opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
  635. * opus_decoder_ctl(dec_ctx, OPUS_RESET_STATE);
  636. *
  637. * opus_int32 enc_bw, dec_bw;
  638. * opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&enc_bw));
  639. * opus_decoder_ctl(dec_ctx, OPUS_GET_BANDWIDTH(&dec_bw));
  640. * if (enc_bw != dec_bw) {
  641. * printf("packet bandwidth mismatch!\n");
  642. * }
  643. * @endcode
  644. *
  645. * @see opus_encoder, opus_decoder_ctl, opus_encoder_ctl, opus_decoderctls, opus_encoderctls
  646. * @{
  647. */
  648. /** Resets the codec state to be equivalent to a freshly initialized state.
  649. * This should be called when switching streams in order to prevent
  650. * the back to back decoding from giving different results from
  651. * one at a time decoding.
  652. * @hideinitializer */
  653. #define OPUS_RESET_STATE 4028
  654. /** Gets the final state of the codec's entropy coder.
  655. * This is used for testing purposes,
  656. * The encoder and decoder state should be identical after coding a payload
  657. * (assuming no data corruption or software bugs)
  658. *
  659. * @param[out] x <tt>opus_uint32 *</tt>: Entropy coder state
  660. *
  661. * @hideinitializer */
  662. #define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, __opus_check_uint_ptr(x)
  663. /** Gets the encoder's configured bandpass or the decoder's last bandpass.
  664. * @see OPUS_SET_BANDWIDTH
  665. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  666. * <dl>
  667. * <dt>#OPUS_AUTO</dt> <dd>(default)</dd>
  668. * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd>
  669. * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd>
  670. * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd>
  671. * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd>
  672. * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd>
  673. * </dl>
  674. * @hideinitializer */
  675. #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, __opus_check_int_ptr(x)
  676. /** Gets the sampling rate the encoder or decoder was initialized with.
  677. * This simply returns the <code>Fs</code> value passed to opus_encoder_init()
  678. * or opus_decoder_init().
  679. * @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder.
  680. * @hideinitializer
  681. */
  682. #define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, __opus_check_int_ptr(x)
  683. /** If set to 1, disables the use of phase inversion for intensity stereo,
  684. * improving the quality of mono downmixes, but slightly reducing normal
  685. * stereo quality. Disabling phase inversion in the decoder does not comply
  686. * with RFC 6716, although it does not cause any interoperability issue and
  687. * is expected to become part of the Opus standard once RFC 6716 is updated
  688. * by draft-ietf-codec-opus-update.
  689. * @see OPUS_GET_PHASE_INVERSION_DISABLED
  690. * @param[in] x <tt>opus_int32</tt>: Allowed values:
  691. * <dl>
  692. * <dt>0</dt><dd>Enable phase inversion (default).</dd>
  693. * <dt>1</dt><dd>Disable phase inversion.</dd>
  694. * </dl>
  695. * @hideinitializer */
  696. #define OPUS_SET_PHASE_INVERSION_DISABLED(x) OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, __opus_check_int(x)
  697. /** Gets the encoder's configured phase inversion status.
  698. * @see OPUS_SET_PHASE_INVERSION_DISABLED
  699. * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
  700. * <dl>
  701. * <dt>0</dt><dd>Stereo phase inversion enabled (default).</dd>
  702. * <dt>1</dt><dd>Stereo phase inversion disabled.</dd>
  703. * </dl>
  704. * @hideinitializer */
  705. #define OPUS_GET_PHASE_INVERSION_DISABLED(x) OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, __opus_check_int_ptr(x)
  706. /**@}*/
  707. /** @defgroup opus_decoderctls Decoder related CTLs
  708. * @see opus_genericctls, opus_encoderctls, opus_decoder
  709. * @{
  710. */
  711. /** Configures decoder gain adjustment.
  712. * Scales the decoded output by a factor specified in Q8 dB units.
  713. * This has a maximum range of -32768 to 32767 inclusive, and returns
  714. * OPUS_BAD_ARG otherwise. The default is zero indicating no adjustment.
  715. * This setting survives decoder reset.
  716. *
  717. * gain = pow(10, x/(20.0*256))
  718. *
  719. * @param[in] x <tt>opus_int32</tt>: Amount to scale PCM signal by in Q8 dB units.
  720. * @hideinitializer */
  721. #define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, __opus_check_int(x)
  722. /** Gets the decoder's configured gain adjustment. @see OPUS_SET_GAIN
  723. *
  724. * @param[out] x <tt>opus_int32 *</tt>: Amount to scale PCM signal by in Q8 dB units.
  725. * @hideinitializer */
  726. #define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, __opus_check_int_ptr(x)
  727. /** Gets the duration (in samples) of the last packet successfully decoded or concealed.
  728. * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling rate).
  729. * @hideinitializer */
  730. #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, __opus_check_int_ptr(x)
  731. /** Gets the pitch of the last decoded frame, if available.
  732. * This can be used for any post-processing algorithm requiring the use of pitch,
  733. * e.g. time stretching/shortening. If the last frame was not voiced, or if the
  734. * pitch was not coded in the frame, then zero is returned.
  735. *
  736. * This CTL is only implemented for decoder instances.
  737. *
  738. * @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not available)
  739. *
  740. * @hideinitializer */
  741. #define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, __opus_check_int_ptr(x)
  742. /**@}*/
  743. /** @defgroup opus_libinfo Opus library information functions
  744. * @{
  745. */
  746. /** Converts an opus error code into a human readable string.
  747. *
  748. * @param[in] error <tt>int</tt>: Error number
  749. * @returns Error string
  750. */
  751. OPUS_EXPORT const char *opus_strerror(int error);
  752. /** Gets the libopus version string.
  753. *
  754. * Applications may look for the substring "-fixed" in the version string to
  755. * determine whether they have a fixed-point or floating-point build at
  756. * runtime.
  757. *
  758. * @returns Version string
  759. */
  760. OPUS_EXPORT const char *opus_get_version_string(void);
  761. /**@}*/
  762. #ifdef __cplusplus
  763. }
  764. #endif
  765. #endif /* OPUS_DEFINES_H */