/** Miscellaneous stream preferences. */ typedefenum {
CUBEB_STREAM_PREF_NONE = 0x00, /**< No stream preferences are requested. */
CUBEB_STREAM_PREF_LOOPBACK = 0x01, /**< Request a loopback stream. Should be specifiedontheinputparamsandan outputdevicetoloopbackfromshould
be passed in place of an input device. */
CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING = 0x02, /**< Disable switching defaultdeviceonOS
changes. */
CUBEB_STREAM_PREF_VOICE = 0x04, /**< This stream is going to transport voice data. Dependingonthebackendandplatform,thiscan changetheaudioinputoroutputdevices selected,aswellasthequalityofthestream, forexampletoaccomodatebluetoothSCOmodeson
bluetooth devices. */
CUBEB_STREAM_PREF_RAW = 0x08, /**< Windows only. Bypass all signal processing
except for always on APO, driver and hardware. */
CUBEB_STREAM_PREF_PERSIST = 0x10, /**< Request that the volume and mute settingsshouldpersistacrossrestarts ofthestreamand/orapplication.Thisis
obsolete and ignored by all backends. */
CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT = 0x20 /**< Don't automatically try to connectports.Onlyaffects
the jack backend. */
} cubeb_stream_prefs;
/** Stream format initialization parameters. */ typedefstruct {
cubeb_sample_format format; /**< Requested sample format. One of
#cubeb_sample_format. */
uint32_t rate; /**< Requested sample rate. Valid range is [1000, 384000]. */
uint32_t channels; /**< Requested channel count. Valid range is [1, 8]. */
cubeb_channel_layout
layout; /**< Requested channel layout. This must be consistent with the
provided channels. CUBEB_LAYOUT_UNDEFINED if unknown */
cubeb_stream_prefs prefs; /**< Requested preferences. */
cubeb_input_processing_params input_params; /**< Requested input processing params.Ignoredforoutputstreams.Atpresent,onlysupportedonthe
WASAPI backend; others should use cubeb_set_input_processing_params. */
} cubeb_stream_params;
/** Audio device description */ typedefstruct { char * output_name; /**< The name of the output device */ char * input_name; /**< The name of the input device */
} cubeb_device;
/** Stream states signaled via state_callback. */ typedefenum {
CUBEB_STATE_STARTED, /**< Stream started. */
CUBEB_STATE_STOPPED, /**< Stream stopped. */
CUBEB_STATE_DRAINED, /**< Stream drained. */
CUBEB_STATE_ERROR /**< Stream disabled due to error. */
} cubeb_state;
/** Result code enumeration. */ enum {
CUBEB_OK = 0, /**< Success. */
CUBEB_ERROR = -1, /**< Unclassified error. */
CUBEB_ERROR_INVALID_FORMAT =
-2, /**< Unsupported #cubeb_stream_params requested. */
CUBEB_ERROR_INVALID_PARAMETER = -3, /**< Invalid parameter specified. */
CUBEB_ERROR_NOT_SUPPORTED =
-4, /**< Optional function not implemented in current backend. */
CUBEB_ERROR_DEVICE_UNAVAILABLE =
-5/**< Device specified by #cubeb_devid not available. */
};
/** *Thestateofadevice.
*/ typedefenum {
CUBEB_DEVICE_STATE_DISABLED, /**< The device has been disabled at the system
level. */
CUBEB_DEVICE_STATE_UNPLUGGED, /**< The device is enabled, but nothing is
plugged into it. */
CUBEB_DEVICE_STATE_ENABLED /**< The device is enabled. */
} cubeb_device_state;
/** *Architecturespecificsampletype.
*/ typedefenum {
CUBEB_DEVICE_FMT_S16LE = 0x0010, /**< 16-bit integers, Little Endian. */
CUBEB_DEVICE_FMT_S16BE = 0x0020, /**< 16-bit integers, Big Endian. */
CUBEB_DEVICE_FMT_F32LE = 0x1000, /**< 32-bit floating point, Little Endian. */
CUBEB_DEVICE_FMT_F32BE = 0x2000 /**< 32-bit floating point, Big Endian. */
} cubeb_device_fmt;
#ifdefined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) /** 16-bit integers, native endianess, when on a Big Endian environment. */ #define CUBEB_DEVICE_FMT_S16NE CUBEB_DEVICE_FMT_S16BE /** 32-bit floating points, native endianess, when on a Big Endian environment.
*/ #define CUBEB_DEVICE_FMT_F32NE CUBEB_DEVICE_FMT_F32BE #else /** 16-bit integers, native endianess, when on a Little Endian environment. */ #define CUBEB_DEVICE_FMT_S16NE CUBEB_DEVICE_FMT_S16LE /** 32-bit floating points, native endianess, when on a Little Endian
* environment. */ #define CUBEB_DEVICE_FMT_F32NE CUBEB_DEVICE_FMT_F32LE #endif /** All the 16-bit integers types. */ #define CUBEB_DEVICE_FMT_S16_MASK \
(CUBEB_DEVICE_FMT_S16LE | CUBEB_DEVICE_FMT_S16BE) /** All the 32-bit floating points types. */ #define CUBEB_DEVICE_FMT_F32_MASK \
(CUBEB_DEVICE_FMT_F32LE | CUBEB_DEVICE_FMT_F32BE) /** All the device formats types. */ #define CUBEB_DEVICE_FMT_ALL \
(CUBEB_DEVICE_FMT_S16_MASK | CUBEB_DEVICE_FMT_F32_MASK)
/** Channel type for a `cubeb_stream`. Depending on the backend and platform *used,thiscancontrolinter-streaminterruption,ducking,andvolume *control.
*/ typedefenum {
CUBEB_DEVICE_PREF_NONE = 0x00,
CUBEB_DEVICE_PREF_MULTIMEDIA = 0x01,
CUBEB_DEVICE_PREF_VOICE = 0x02,
CUBEB_DEVICE_PREF_NOTIFICATION = 0x04,
CUBEB_DEVICE_PREF_ALL = 0x0F
} cubeb_device_pref;
/** This structure holds the characteristics *ofaninputoroutputaudiodevice.Itisobtainedusing *`cubeb_enumerate_devices`,whichreturnsthesestructuresvia *`cubeb_device_collection`andmustbedestroyedvia
* `cubeb_device_collection_destroy`. */ typedefstruct {
cubeb_devid devid; /**< Device identifier handle. */ charconst *
device_id; /**< Device identifier which might be presented in a UI. */ charconst * friendly_name; /**< Friendly device name which might be presented
in a UI. */ charconst * group_id; /**< Two devices have the same group identifier if they belongtothesamephysicaldevice;forexamplea
headset and microphone. */ charconst * vendor_name; /**< Optional vendor name, may be NULL. */
cubeb_device_type type; /**< Type of device (Input/Output). */
cubeb_device_state state; /**< State of device disabled/enabled/unplugged. */
cubeb_device_pref preferred; /**< Preferred device. */
cubeb_device_fmt format; /**< Sample format supported. */
cubeb_device_fmt
default_format; /**< The default sample format for this device. */
uint32_t max_channels; /**< Channels. */
uint32_t default_rate; /**< Default/Preferred sample rate. */
uint32_t max_rate; /**< Maximum sample rate supported. */
uint32_t min_rate; /**< Minimum sample rate supported. */
uint32_t latency_lo; /**< Lowest possible latency in frames. */
uint32_t latency_hi; /**< Higest possible latency in frames. */
} cubeb_device_info;
/** Device collection. *Returnedby`cubeb_enumerate_devices`anddestroyedby
* `cubeb_device_collection_destroy`. */ typedefstruct {
cubeb_device_info * device; /**< Array of pointers to device info. */
size_t count; /**< Device count in collection. */
} cubeb_device_collection;
/** Array of compiled backends returned by `cubeb_get_backend_names`. */ typedefstruct { constchar * const *
names; /**< Array of strings representing backend names. */
size_t count; /**< Length of the array. */
} cubeb_backend_names;
/** User supplied data callback. -Callingothercubebfunctionsfromthiscallbackisunsafe. -Thecodeinthecallbackshouldbenon-blocking. -Returninglessthanthenumberofframesthiscallbackasksforor providesputsthestreamindrainmode.Thiscallbackwillnotbecalled again,andthestatecallbackwillbecalledwithCUBEB_STATE_DRAINEDwhen alltheframeshavebeenoutput. @paramstreamThestreamforwhichthiscallbackfired. @paramuser_ptrThepointerpassedtocubeb_stream_init. @paraminput_bufferApointercontainingtheinputdata,ornullptr ifthisisanoutput-onlystream. @paramoutput_bufferApointertoabuffertobefilledwithaudiosamples, ornullptrifthisisaninput-onlystream. @paramnframesThenumberofframesofthetwobuffer. @retvalIfthestreamhasoutput,thisisthenumberofframeswrittento theoutputbuffer.Inthiscase,ifthisnumberislessthan nframesthenthestreamwillstarttodrain.Ifthestreamis inputonly,thenreturningnframesindicatesdatahasbeenread. Inthiscase,avaluelessthannframeswillresultinthestream beingstopped. @retvalCUBEB_ERRORonerror,inwhichcasethedatacallbackwillstop
and the stream will enter a shutdown state. */ typedeflong (*cubeb_data_callback)(cubeb_stream * stream, void * user_ptr, voidconst * input_buffer, void * output_buffer, long nframes);
/** User supplied state callback. @paramstreamThestreamforthisthiscallbackfired. @paramuser_ptrThepointerpassedtocubeb_stream_init.
@param state The new state of the stream. */ typedefvoid (*cubeb_state_callback)(cubeb_stream * stream, void * user_ptr,
cubeb_state state);
/** *Usersuppliedcallbackcalledwhentheunderlyingdevicechanged.
* @param user_ptr The pointer passed to cubeb_stream_init. */ typedefvoid (*cubeb_device_changed_callback)(void * user_ptr);
@paramcontextAoutparamwhereanopaquepointertotheapplication contextwillbereturned. @paramcontext_nameAnameforthecontext.Dependingontheplatformthis canappearindifferentlocations. @parambackend_nameThenameofthecubebbackenduserdesirestoselect. Acceptedvaluesself-documentedincubeb.c:init_oneshot IfNULL,adefaultorderingisusedforbackendchoice. Avalidchoiceoverridesallotherpossiblebackends, solongasthebackendwasincludedatcompiletime. @retvalCUBEB_OKincaseofsuccess. @retvalCUBEB_ERRORincaseoferror,forexamplebecausethehost
has no audio hardware. */
CUBEB_EXPORT int
cubeb_init(cubeb ** context, charconst * context_name, charconst * backend_name);
/** Get a read-only string identifying this context's current backend. @paramcontextApointertothecubebcontext.
@retval Read-only string identifying current backend. */
CUBEB_EXPORT charconst *
cubeb_get_backend_id(cubeb * context);
/** Get a read-only array of strings identifying available backends. Thesecanbepassedas`backend_name`parameterto`cubeb_init`.
@retval Struct containing the array with backend names. */
CUBEB_EXPORT cubeb_backend_names
cubeb_get_backend_names();
/** Get the maximum possible number of channels. @paramcontextApointertothecubebcontext. @parammax_channelsThemaximumnumberofchannels. @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETER @retvalCUBEB_ERROR_NOT_SUPPORTED
@retval CUBEB_ERROR */
CUBEB_EXPORT int
cubeb_get_max_channel_count(cubeb * context, uint32_t * max_channels);
/** Get the minimal latency value, in frames, that is guaranteed to work whencreatingastreamforthespecifiedsamplerate.Thisisplatform, hardwareandbackenddependent. @paramcontextApointertothecubebcontext. @paramparamsOnsomebackends,theminimumachievablelatencydependson thecharacteristicsofthestream. @paramlatency_framesThelatencyvalue,inframes,topassto cubeb_stream_init. @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETER
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_get_min_latency(cubeb * context, cubeb_stream_params * params,
uint32_t * latency_frames);
/** Get the preferred sample rate for this backend: this is hardware and platformdependent,andcanavoidresampling,and/ortriggerfastpaths. @paramcontextApointertothecubebcontext. @paramrateThesamplerate(inHz)thecurrentconfigurationprefers. @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETER
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate);
/** Get the supported input processing features for this backend. See cubeb_stream_set_input_processingforhowtosetthemforaparticularinput stream. @paramcontextApointertothecubebcontext. @paramparamsOutparameterfortheinputprocessingparamssupportedby thisbackend. @retvalCUBEB_OK
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_get_supported_input_processing_params(
cubeb * context, cubeb_input_processing_params * params);
/** Destroy an application context. This must be called after all stream have *beendestroyed.
@param context A pointer to the cubeb context.*/
CUBEB_EXPORT void
cubeb_destroy(cubeb * context);
/** Destroy a stream. `cubeb_stream_stop` MUST be called before destroying a stream.
@param stream The stream to destroy. */
CUBEB_EXPORT void
cubeb_stream_destroy(cubeb_stream * stream);
/** Get the current stream playback position. @paramstream @parampositionPlaybackpositioninframes. @retvalCUBEB_OK
@retval CUBEB_ERROR */
CUBEB_EXPORT int
cubeb_stream_get_position(cubeb_stream * stream, uint64_t * position);
/** Get the latency for this stream, in frames. This is the number of frames betweenthetimecubebacquiresthedatainthecallbackandthelistener canhearthesound. @paramstream @paramlatencyCurrentapproximatestreamlatencyinframes. @retvalCUBEB_OK @retvalCUBEB_ERROR_NOT_SUPPORTED
@retval CUBEB_ERROR */
CUBEB_EXPORT int
cubeb_stream_get_latency(cubeb_stream * stream, uint32_t * latency);
/** Get the input latency for this stream, in frames. This is the number of framesbetweenthetimetheaudioinputdevicesrecordsthedata,andthey areavailableinthedatacallback. ThisreturnsCUBEB_ERRORwhenthestreamisoutput-only. @paramstream @paramlatencyCurrentapproximatestreamlatencyinframes. @retvalCUBEB_OK @retvalCUBEB_ERROR_NOT_SUPPORTED
@retval CUBEB_ERROR */
CUBEB_EXPORT int
cubeb_stream_get_input_latency(cubeb_stream * stream, uint32_t * latency); /** Set the volume for a stream. @paramstreamthestreamforwhichtoadjustthevolume. @paramvolumeafloatbetween0.0(muted)and1.0(maximumvolume) @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETERvolumeisoutside[0.0,1.0]or streamisaninvalidpointer
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_volume(cubeb_stream * stream, float volume);
/** Change a stream's name. @paramstreamthestreamforwhichtosetthename. @paramstream_namethenewnameforthestream @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETERifanypointerisinvalid
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_name(cubeb_stream * stream, charconst * stream_name);
/** Get the current output device for this stream. @paramstmthestreamforwhichtoquerythecurrentoutputdevice @paramdeviceapointerinwhichthecurrentoutputdevicewillbestored. @retvalCUBEB_OKincaseofsuccess @retvalCUBEB_ERROR_INVALID_PARAMETERifeitherstm,deviceorcountare invalidpointers
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_get_current_device(cubeb_stream * stm,
cubeb_device ** const device);
/** Set input mute state for this stream. Some platforms notify the user when an applicationisaccessingaudioinput.Whenallinputsaremutedtheycan provetotheuserthattheapplicationisnotactivelycapturinganyinput. @paramstreamthestreamforwhichtosetinputmutestate @parammutewhethertheinputshouldmuteornot @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETERifthisstreamdoesnothaveaninput device
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute);
/** Set what input processing features to enable for this stream. @paramstreamthestreamforwhichtosetinputprocessingfeatures. @paramparamswhatinputprocessingfeaturestouse @retvalCUBEB_OK @retvalCUBEB_ERRORifparamscouldnotbeapplied @retvalCUBEB_ERROR_INVALID_PARAMETERifagivenparamisnotsupportedby thisbackend,orifthisstreamdoesnothaveaninputdevice
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_input_processing_params(cubeb_stream * stream,
cubeb_input_processing_params params);
/** Destroy a cubeb_device structure. @paramstreamthestreampassedincubeb_stream_get_current_device @paramdevicesthedevicestodestroy @retvalCUBEB_OKincaseofsuccess @retvalCUBEB_ERROR_INVALID_PARAMETERifdevicesisaninvalidpointer
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_device_destroy(cubeb_stream * stream, cubeb_device * devices);
/** Set a callback to be notified when the output device changes. @paramstreamthestreamforwhichtosetthecallback. @paramdevice_changed_callbackafunctioncalledwheneverthedevicehas changed.PassingNULLallowtounregisterafunction @retvalCUBEB_OK @retvalCUBEB_ERROR_INVALID_PARAMETERifeitherstreamor device_changed_callbackareinvalidpointers.
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_register_device_changed_callback(
cubeb_stream * stream,
cubeb_device_changed_callback device_changed_callback);
/** Return the user data pointer registered with the stream with cubeb_stream_init. @paramstreamthestreamforwhichtoretrieveuserdatapointer.
@retval user data pointer */
CUBEB_EXPORT void *
cubeb_stream_user_ptr(cubeb_stream * stream);
/** Destroy a cubeb_device_collection, and its `cubeb_device_info`. @paramcontext @paramcollectioncollectiontodestroy @retvalCUBEB_OK
@retval CUBEB_ERROR_INVALID_PARAMETER if collection is an invalid pointer */
CUBEB_EXPORT int
cubeb_device_collection_destroy(cubeb * context,
cubeb_device_collection * collection);
/** Registers a callback which is called when the system detects anewdeviceoradeviceisremoved,orwhenthedefaultdevice changesforthespecifieddevicetype. @paramcontext @paramdevtypedevicetypetoinclude.Differentcallbacksanduserpointers canberegisteredforeachdevtype.Thehybriddevtype `CUBEB_DEVICE_TYPE_INPUT|CUBEB_DEVICE_TYPE_OUTPUT`isalsovalid andwillregistertheprovidedcallbackanduserpointerinboth sides. @paramcallbackafunctioncalledwheneverthesystemdevicelistchanges, includingwhendefaultdeviceschange. PassingNULLallowtounregisterafunction.Youhavetounregister firstbeforeyouregisteranewcallback. @paramuser_ptrpointertouserspecifieddatawhichwillbepresentin subsequentcallbacks.
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_register_device_collection_changed(
cubeb * context, cubeb_device_type devtype,
cubeb_device_collection_changed_callback callback, void * user_ptr);
/** Set a callback to be called with a message. @paramlog_levelCUBEB_LOG_VERBOSE,CUBEB_LOG_NORMAL. @paramlog_callbackAfunctioncalledwithamessagewhenthereis somethingtolog.PassNULLtounregister. @retvalCUBEB_OKincaseofsuccess. @retvalCUBEB_ERROR_INVALID_PARAMETERifeithercontextorlog_callbackare invalidpointers,oriflevelisnot
in cubeb_log_level. */
CUBEB_EXPORT int
cubeb_set_log_callback(cubeb_log_level log_level,
cubeb_log_callback log_callback);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.