aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorChun-Min Chang <[email protected]>2016-12-21 13:18:07 +0800
committerMatthew Gregan <[email protected]>2016-12-20 19:18:07 -1000
commita900d6e511c3286956c38ca60162790ca6e8e18d (patch)
tree12969af1e27b0d0d127127a60d770b52100f76fb /include
parentc1e1e45dee4367c6f839b903417998049ad1baeb (diff)
downloadcubeb-a900d6e511c3286956c38ca60162790ca6e8e18d.tar.gz
cubeb-a900d6e511c3286956c38ca60162790ca6e8e18d.zip
Support multiple channels on Windows (#171)
* Multiple channel support on Windows * Move up/down mixing code from cubeb_wasapi.cpp to standalone cubeb_mixer.cpp
Diffstat (limited to 'include')
-rw-r--r--include/cubeb/cubeb.h80
1 files changed, 74 insertions, 6 deletions
diff --git a/include/cubeb/cubeb.h b/include/cubeb/cubeb.h
index 7a36b83..b435d16 100644
--- a/include/cubeb/cubeb.h
+++ b/include/cubeb/cubeb.h
@@ -176,12 +176,71 @@ typedef enum {
CUBEB_LOG_VERBOSE = 2, /**< Verbose logging of callbacks, can have performance implications. */
} cubeb_log_level;
+/** SMPTE channel layout (also known as wave order)
+ * DUAL-MONO L R
+ * DUAL-MONO-LFE L R LFE
+ * MONO M
+ * MONO-LFE M LFE
+ * STEREO L R
+ * STEREO-LFE L R LFE
+ * 3F L R C
+ * 3F-LFE L R C LFE
+ * 2F1 L R S
+ * 2F1-LFE L R LFE S
+ * 3F1 L R C S
+ * 3F1-LFE L R C LFE S
+ * 2F2 L R LS RS
+ * 2F2-LFE L R LFE LS RS
+ * 3F2 L R C LS RS
+ * 3F2-LFE L R C LFE LS RS
+ * 3F3R-LFE L R C LFE RC LS RS
+ * 3F4-LFE L R C LFE RLS RRS LS RS
+ *
+ * The abbreviation of channel name is defined in following table:
+ * Abbr Channel name
+ * ---------------------------
+ * M Mono
+ * L Left
+ * R Right
+ * C Center
+ * LS Left Surround
+ * RS Right Surround
+ * RLS Rear Left Surround
+ * RC Rear Center
+ * RRS Rear Right Surround
+ * LFE Low Frequency Effects
+ */
+
+typedef enum {
+ CUBEB_LAYOUT_UNDEFINED, // Indicate the speaker's layout is undefined.
+ CUBEB_LAYOUT_DUAL_MONO,
+ CUBEB_LAYOUT_DUAL_MONO_LFE,
+ CUBEB_LAYOUT_MONO,
+ CUBEB_LAYOUT_MONO_LFE,
+ CUBEB_LAYOUT_STEREO,
+ CUBEB_LAYOUT_STEREO_LFE,
+ CUBEB_LAYOUT_3F,
+ CUBEB_LAYOUT_3F_LFE,
+ CUBEB_LAYOUT_2F1,
+ CUBEB_LAYOUT_2F1_LFE,
+ CUBEB_LAYOUT_3F1,
+ CUBEB_LAYOUT_3F1_LFE,
+ CUBEB_LAYOUT_2F2,
+ CUBEB_LAYOUT_2F2_LFE,
+ CUBEB_LAYOUT_3F2,
+ CUBEB_LAYOUT_3F2_LFE,
+ CUBEB_LAYOUT_3F3R_LFE,
+ CUBEB_LAYOUT_3F4_LFE,
+ CUBEB_LAYOUT_MAX
+} cubeb_channel_layout;
+
/** Stream format initialization parameters. */
typedef struct {
- cubeb_sample_format format; /**< Requested sample format. One of
- #cubeb_sample_format. */
- unsigned int rate; /**< Requested sample rate. Valid range is [1000, 192000]. */
- unsigned int channels; /**< Requested channel count. Valid range is [1, 8]. */
+ cubeb_sample_format format; /**< Requested sample format. One of
+ #cubeb_sample_format. */
+ unsigned int rate; /**< Requested sample rate. Valid range is [1000, 192000]. */
+ unsigned int channels; /**< Requested channel count. Valid range is [1, 8]. */
+ cubeb_channel_layout layout; /**< Requested channel layout. This must be consistent with the provided channels. */
#if defined(__ANDROID__)
cubeb_stream_type stream_type; /**< Used to map Android audio stream types */
#endif
@@ -376,7 +435,7 @@ CUBEB_EXPORT int cubeb_get_max_channel_count(cubeb * context, uint32_t * max_cha
/** Get the minimal latency value, in frames, that is guaranteed to work
when creating a stream for the specified sample rate. This is platform,
- hardware and backend dependant.
+ hardware and backend dependent.
@param context A pointer to the cubeb context.
@param params On some backends, the minimum achievable latency depends on
the characteristics of the stream.
@@ -390,7 +449,7 @@ CUBEB_EXPORT int cubeb_get_min_latency(cubeb * context,
uint32_t * latency_frames);
/** Get the preferred sample rate for this backend: this is hardware and
- platform dependant, and can avoid resampling, and/or trigger fastpaths.
+ platform dependent, and can avoid resampling, and/or trigger fastpaths.
@param context A pointer to the cubeb context.
@param rate The samplerate (in Hz) the current configuration prefers.
@retval CUBEB_OK
@@ -398,6 +457,15 @@ CUBEB_EXPORT int cubeb_get_min_latency(cubeb * context,
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate);
+/** Get the preferred layout for this backend: this is hardware and
+ platform dependent.
+ @param context A pointer to the cubeb context.
+ @param layout The layout of the current speaker configuration.
+ @retval CUBEB_OK
+ @retval CUBEB_ERROR_INVALID_PARAMETER
+ @retval CUBEB_ERROR_NOT_SUPPORTED */
+CUBEB_EXPORT int cubeb_get_preferred_channel_layout(cubeb * context, cubeb_channel_layout * layout);
+
/** Destroy an application context. This must be called after all stream have
* been destroyed.
@param context A pointer to the cubeb context.*/