package aaudio foreign import aaudio "system:aaudio" /** * This is used to represent a value that has not been specified. * For example, an application could use {@link #AAUDIO_UNSPECIFIED} to indicate * that it did not care what the specific value of a parameter was * and would accept whatever it was given. */ AAUDIO_UNSPECIFIED :: 0 AAUDIO_SYSTEM_USAGE_OFFSET :: 1000 // TODO: doesn't belong here. move to sys/android or something. clockid_t :: i32 AAudioDirection :: enum i32 { /** * Audio data will travel out of the device, for example through a speaker. */ OUTPUT, /** * Audio data will travel into the device, for example from a microphone. */ INPUT } AAudioFormat :: enum i32 { INVALID = -1, UNSPECIFIED = 0, /** * This format uses the int16_t data type. * The maximum range of the data is -32768 (0x8000) to 32767 (0x7FFF). */ PCM_I16, /** * This format uses the float data type. * The nominal range of the data is [-1.0f, 1.0f). * Values outside that range may be clipped. * * See also the float Data in * * write(float[], int, int, int). */ PCM_FLOAT, /** * This format uses 24-bit samples packed into 3 bytes. * The bytes are in little-endian order, so the least significant byte * comes first in the byte array. * * The maximum range of the data is -8388608 (0x800000) * to 8388607 (0x7FFFFF). * * Note that the lower precision bits may be ignored by the device. * * Available since API level 31. */ PCM_I24_PACKED, /** * This format uses 32-bit samples stored in an int32_t data type. * The maximum range of the data is -2147483648 (0x80000000) * to 2147483647 (0x7FFFFFFF). * * Note that the lower precision bits may be ignored by the device. * * Available since API level 31. */ PCM_I32 } /** * These result codes are returned from AAudio functions to indicate success or failure. * Note that error return codes may change in the future so applications should generally * not rely on specific return codes. */ AAudioResult :: enum i32 { /** * The call was successful. */ OK, ERROR_BASE = -900, /** * The audio device was disconnected. This could occur, for example, when headphones * are plugged in or unplugged. The stream cannot be used after the device is disconnected. * Applications should stop and close the stream. * If this error is received in an error callback then another thread should be * used to stop and close the stream. */ ERROR_DISCONNECTED, /** * An invalid parameter was passed to AAudio. */ ERROR_ILLEGAL_ARGUMENT, // reserved ERROR_INTERNAL = ERROR_ILLEGAL_ARGUMENT + 2, /** * The requested operation is not appropriate for the current state of AAudio. */ ERROR_INVALID_STATE, // reserved // reserved /* The server rejected the handle used to identify the stream. */ ERROR_INVALID_HANDLE = ERROR_INVALID_STATE + 3, // reserved /** * The function is not implemented for this stream. */ ERROR_UNIMPLEMENTED = ERROR_INVALID_HANDLE + 2, /** * A resource or information is unavailable. * This could occur when an application tries to open too many streams, * or a timestamp is not available. */ ERROR_UNAVAILABLE, ERROR_NO_FREE_HANDLES, /** * Memory could not be allocated. */ ERROR_NO_MEMORY, /** * A NULL pointer was passed to AAudio. * Or a NULL pointer was detected internally. */ ERROR_NULL, /** * An operation took longer than expected. */ ERROR_TIMEOUT, ERROR_WOULD_BLOCK, /** * The requested data format is not supported. */ ERROR_INVALID_FORMAT, /** * A requested was out of range. */ ERROR_OUT_OF_RANGE, /** * The audio service was not available. */ ERROR_NO_SERVICE, /** * The requested sample rate was not supported. */ ERROR_INVALID_RATE } /** * AAudio Stream states, for details, refer to * Using an Audio Stream */ AAudioStreamState :: enum i32 { /** * The stream is created but not initialized yet. */ UNINITIALIZED = 0, /** * The stream is in an unrecognized state. */ UNKNOWN, /** * The stream is open and ready to use. */ OPEN, /** * The stream is just starting up. */ STARTING, /** * The stream has started. */ STARTED, /** * The stream is pausing. */ PAUSING, /** * The stream has paused, could be restarted or flushed. */ PAUSED, /** * The stream is being flushed. */ FLUSHING, /** * The stream is flushed, ready to be restarted. */ FLUSHED, /** * The stream is stopping. */ STOPPING, /** * The stream has been stopped. */ STOPPED, /** * The stream is closing. */ CLOSING, /** * The stream has been closed. */ CLOSED, /** * The stream is disconnected from audio device. */ DISCONNECTED } AAudioSharingMode :: enum i32 { /** * This will be the only stream using a particular source or sink. * This mode will provide the lowest possible latency. * You should close EXCLUSIVE streams immediately when you are not using them. */ EXCLUSIVE, /** * Multiple applications will be mixed by the AAudio Server. * This will have higher latency than the EXCLUSIVE mode. */ SHARED } AAudioPerformanceMode :: enum i32 { /** * No particular performance needs. Default. */ NONE = 10, /** * Extending battery life is more important than low latency. * * This mode is not supported in input streams. * For input, mode NONE will be used if this is requested. */ POWER_SAVING, /** * Reducing latency is more important than battery life. */ LOW_LATENCY } /** * The USAGE attribute expresses "why" you are playing a sound, what is this sound used for. * This information is used by certain platforms or routing policies * to make more refined volume or routing decisions. * * Note that these match the equivalent values in * AudioAttributes * in the Android Java API. * * Added in API level 28. */ AAudioUsage :: enum i32 { /** * Use this for streaming media, music performance, video, podcasts, etcetera. */ MEDIA = 1, /** * Use this for voice over IP, telephony, etcetera. */ VOICE_COMMUNICATION = 2, /** * Use this for sounds associated with telephony such as busy tones, DTMF, etcetera. */ VOICE_COMMUNICATION_SIGNALLING = 3, /** * Use this to demand the users attention. */ ALARM = 4, /** * Use this for notifying the user when a message has arrived or some * other background event has occured. */ NOTIFICATION = 5, /** * Use this when the phone rings. */ NOTIFICATION_RINGTONE = 6, /** * Use this to attract the users attention when, for example, the battery is low. */ NOTIFICATION_EVENT = 10, /** * Use this for screen readers, etcetera. */ ASSISTANCE_ACCESSIBILITY = 11, /** * Use this for driving or navigation directions. */ ASSISTANCE_NAVIGATION_GUIDANCE = 12, /** * Use this for user interface sounds, beeps, etcetera. */ ASSISTANCE_SONIFICATION = 13, /** * Use this for game audio and sound effects. */ GAME = 14, /** * Use this for audio responses to user queries, audio instructions or help utterances. */ ASSISTANT = 16, /** * Use this in case of playing sounds in an emergency. * Privileged MODIFY_AUDIO_ROUTING permission required. */ EMERGENCY = AAUDIO_SYSTEM_USAGE_OFFSET, /** * Use this for safety sounds and alerts, for example backup camera obstacle detection. * Privileged MODIFY_AUDIO_ROUTING permission required. */ SAFETY = AAUDIO_SYSTEM_USAGE_OFFSET + 1, /** * Use this for vehicle status alerts and information, for example the check engine light. * Privileged MODIFY_AUDIO_ROUTING permission required. */ VEHICLE_STATUS = AAUDIO_SYSTEM_USAGE_OFFSET + 2, /** * Use this for traffic announcements, etc. * Privileged MODIFY_AUDIO_ROUTING permission required. */ ANNOUNCEMENT = AAUDIO_SYSTEM_USAGE_OFFSET + 3, } /** * The CONTENT_TYPE attribute describes "what" you are playing. * It expresses the general category of the content. This information is optional. * But in case it is known (for instance AAUDIO_CONTENT_TYPE_MOVIE for a * movie streaming service or AAUDIO_CONTENT_TYPE_SPEECH for * an audio book application) this information might be used by the audio framework to * enforce audio focus. * * Note that these match the equivalent values in * AudioAttributes * in the Android Java API. * * Added in API level 28. */ AAudioContentType :: enum i32 { /** * Use this for spoken voice, audio books, etcetera. */ SPEECH = 1, /** * Use this for pre-recorded or live music. */ MUSIC = 2, /** * Use this for a movie or video soundtrack. */ MOVIE = 3, /** * Use this for sound is designed to accompany a user action, * such as a click or beep sound made when the user presses a button. */ SONIFICATION = 4 } AAudioSpatializationBehavior :: enum i32 { /** * Constant indicating the audio content associated with these attributes will follow the * default platform behavior with regards to which content will be spatialized or not. */ AUTO = 1, /** * Constant indicating the audio content associated with these attributes should never * be spatialized. */ NEVER = 2, } /** * Defines the audio source. * An audio source defines both a default physical source of audio signal, and a recording * configuration. * * Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API. * * Added in API level 28. */ AAudioInputPreset :: enum i32 { /** * Use this preset when other presets do not apply. */ GENERIC = 1, /** * Use this preset when recording video. */ CAMCORDER = 5, /** * Use this preset when doing speech recognition. */ VOICE_RECOGNITION = 6, /** * Use this preset when doing telephony or voice messaging. */ VOICE_COMMUNICATION = 7, /** * Use this preset to obtain an input with no effects. * Note that this input will not have automatic gain control * so the recorded volume may be very low. */ UNPROCESSED = 9, /** * Use this preset for capturing audio meant to be processed in real time * and played back for live performance (e.g karaoke). * The capture path will minimize latency and coupling with playback path. * Available since API level 29. */ VOICE_PERFORMANCE = 10, } /** * Specifying if audio may or may not be captured by other apps or the system. * * Note that these match the equivalent values in * AudioAttributes * in the Android Java API. * * Added in API level 29. */ AAudioAllowedCapturePolicy :: enum i32 { /** * Indicates that the audio may be captured by any app. * * For privacy, the following usages can not be recorded: AAUDIO_VOICE_COMMUNICATION*, * AAUDIO_USAGE_NOTIFICATION*, AAUDIO_USAGE_ASSISTANCE* and {@link #AAUDIO_USAGE_ASSISTANT}. * * On Build.VERSION_CODES, * this means only {@link #AAUDIO_USAGE_MEDIA} and {@link #AAUDIO_USAGE_GAME} may be captured. * * See * ALLOW_CAPTURE_BY_ALL. */ ALLOW_CAPTURE_BY_ALL = 1, /** * Indicates that the audio may only be captured by system apps. * * System apps can capture for many purposes like accessibility, user guidance... * but have strong restriction. See * * ALLOW_CAPTURE_BY_SYSTEM * for what the system apps can do with the capture audio. */ ALLOW_CAPTURE_BY_SYSTEM = 2, /** * Indicates that the audio may not be recorded by any app, even if it is a system app. * * It is encouraged to use {@link #AAUDIO_ALLOW_CAPTURE_BY_SYSTEM} instead of this value as system apps * provide significant and useful features for the user (eg. accessibility). * See * ALLOW_CAPTURE_BY_NONE. */ ALLOW_CAPTURE_BY_NONE = 3, } /** * These may be used with AAudioStreamBuilder_setSessionId(). * * Added in API level 28. */ AAudioSessionId :: enum i32 { /** * Do not allocate a session ID. * Effects cannot be used with this stream. * Default. * * Added in API level 28. */ NONE = -1, /** * Allocate a session ID that can be used to attach and control * effects using the Java AudioEffects API. * Note that using this may result in higher latency. * * Note that this matches the value of AudioManager.AUDIO_SESSION_ID_GENERATE. * * Added in API level 28. */ ALLOCATE = 0, } /** * Defines the audio channel mask. * Channel masks are used to describe the samples and their * arrangement in the audio frame. They are also used in the endpoint * (e.g. a USB audio interface, a DAC connected to headphones) to * specify allowable configurations of a particular device. * * Added in API level 32. */ AAudioChannelMask :: enum u32 { /** * Invalid channel mask */ INVALID = 0xFFFFFFFF, // -1 /** * Output audio channel mask */ FRONT_LEFT = 1 << 0, FRONT_RIGHT = 1 << 1, FRONT_CENTER = 1 << 2, LOW_FREQUENCY = 1 << 3, BACK_LEFT = 1 << 4, BACK_RIGHT = 1 << 5, FRONT_LEFT_OF_CENTER = 1 << 6, FRONT_RIGHT_OF_CENTER = 1 << 7, BACK_CENTER = 1 << 8, SIDE_LEFT = 1 << 9, SIDE_RIGHT = 1 << 10, TOP_CENTER = 1 << 11, TOP_FRONT_LEFT = 1 << 12, TOP_FRONT_CENTER = 1 << 13, TOP_FRONT_RIGHT = 1 << 14, TOP_BACK_LEFT = 1 << 15, TOP_BACK_CENTER = 1 << 16, TOP_BACK_RIGHT = 1 << 17, TOP_SIDE_LEFT = 1 << 18, TOP_SIDE_RIGHT = 1 << 19, BOTTOM_FRONT_LEFT = 1 << 20, BOTTOM_FRONT_CENTER = 1 << 21, BOTTOM_FRONT_RIGHT = 1 << 22, LOW_FREQUENCY_2 = 1 << 23, FRONT_WIDE_LEFT = 1 << 24, FRONT_WIDE_RIGHT = 1 << 25, MONO = FRONT_LEFT, STEREO = FRONT_LEFT | FRONT_RIGHT, _2POINT1 = FRONT_LEFT | FRONT_RIGHT | LOW_FREQUENCY, TRI = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER, TRI_BACK = FRONT_LEFT | FRONT_RIGHT | BACK_CENTER, _3POINT1 = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY, _2POINT0POINT2 = FRONT_LEFT | FRONT_RIGHT | TOP_SIDE_LEFT | TOP_SIDE_RIGHT, _2POINT1POINT2 = _2POINT0POINT2 | LOW_FREQUENCY, _3POINT0POINT2 = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | TOP_SIDE_LEFT | TOP_SIDE_RIGHT, _3POINT1POINT2 = _3POINT0POINT2 | LOW_FREQUENCY, QUAD = FRONT_LEFT | FRONT_RIGHT | BACK_LEFT | BACK_RIGHT, QUAD_SIDE = FRONT_LEFT | FRONT_RIGHT | SIDE_LEFT | SIDE_RIGHT, SURROUND = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | BACK_CENTER, PENTA = QUAD | FRONT_CENTER, // aka 5POINT1_BACK _5POINT1 = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT, _5POINT1_SIDE = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SIDE_LEFT | SIDE_RIGHT, _6POINT1 = FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT | BACK_CENTER, _7POINT1 = _5POINT1 | SIDE_LEFT | SIDE_RIGHT, _5POINT1POINT2 = _5POINT1 | TOP_SIDE_LEFT | TOP_SIDE_RIGHT, _5POINT1POINT4 = _5POINT1 | TOP_FRONT_LEFT | TOP_FRONT_RIGHT | TOP_BACK_LEFT | TOP_BACK_RIGHT, _7POINT1POINT2 = _7POINT1 | TOP_SIDE_LEFT | TOP_SIDE_RIGHT, _7POINT1POINT4 = _7POINT1 | TOP_FRONT_LEFT | TOP_FRONT_RIGHT | TOP_BACK_LEFT | TOP_BACK_RIGHT, _9POINT1POINT4 = _7POINT1POINT4 | FRONT_WIDE_LEFT | FRONT_WIDE_RIGHT, _9POINT1POINT6 = _9POINT1POINT4 | TOP_SIDE_LEFT | TOP_SIDE_RIGHT, FRONT_BACK = FRONT_CENTER | BACK_CENTER, } /** * Return one of these values from the data callback function. */ AAudioDataCallbackResult :: enum i32 { /** * Continue calling the callback. */ CONTINUE = 0, /** * Stop calling the callback. * * The application will still need to call AAudioStream_requestPause() * or AAudioStream_requestStop(). */ STOP, } AAudioStream :: struct{} AAudioStreamBuilder :: struct{} /** * Prototype for the data function that is passed to AAudioStreamBuilder_setDataCallback :: proc(). * * For an output stream, this function should render and write numFrames of data * in the streams current data format to the audioData buffer. * * For an input stream, this function should read and process numFrames of data * from the audioData buffer. * * The audio data is passed through the buffer. So do NOT call AAudioStream_read :: proc() or * AAudioStream_write :: proc() on the stream that is making the callback. * * Note that numFrames can vary unless AAudioStreamBuilder_setFramesPerDataCallback :: proc() * is called. * * Also note that this callback function should be considered a "real-time" function. * It must not do anything that could cause an unbounded delay because that can cause the * audio to glitch or pop. * * These are things the function should NOT do: *
* AAudioResult result = AAUDIO_OK
* AAudioStreamState currentState = AAudioStream_getState :: proc(stream)
* AAudioStreamState inputState = currentState
* while (result == AAUDIO_OK && currentState != AAUDIO_STREAM_STATE_PAUSED) {
* result = AAudioStream_waitForStateChange :: proc(
* stream, inputState, ¤tState, MY_TIMEOUT_NANOS)
* inputState = currentState
* }
*
*
* Available since API level 26.
*
* @param stream A reference provided by AAudioStreamBuilder_openStream :: proc()
* @param inputState The state we want to avoid.
* @param nextState Pointer to a variable that will be set to the new state.
* @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion.
* @return {@link #AAUDIO_OK} or a negative error.
*/
AAudioStream_waitForStateChange :: proc(stream: ^AAudioStream, inputState: AAudioStreamState, nextState: ^AAudioStreamState, timeoutNanoseconds: i64) -> AAudioResult ---
// ============================================================
// Stream I/O
// ============================================================
/**
* Read data from the stream.
*
* The call will wait until the read is complete or until it runs out of time.
* If timeoutNanos is zero then this call will not wait.
*
* Note that timeoutNanoseconds is a relative duration in wall clock time.
* Time will not stop if the thread is asleep.
* So it will be implemented using CLOCK_BOOTTIME.
*
* This call is "strong non-blocking" unless it has to wait for data.
*
* If the call times out then zero or a partial frame count will be returned.
*
* Available since API level 26.
*
* @param stream A stream created using AAudioStreamBuilder_openStream :: proc().
* @param buffer The address of the first sample.
* @param numFrames Number of frames to read. Only complete frames will be written.
* @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion.
* @return The number of frames actually read or a negative error.
*/
AAudioStream_read :: proc(stream: ^AAudioStream, buffer: rawptr, numFrames: i32, timeoutNanoseconds: i64) -> AAudioResult ---
/**
* Write data to the stream.
*
* The call will wait until the write is complete or until it runs out of time.
* If timeoutNanos is zero then this call will not wait.
*
* Note that timeoutNanoseconds is a relative duration in wall clock time.
* Time will not stop if the thread is asleep.
* So it will be implemented using CLOCK_BOOTTIME.
*
* This call is "strong non-blocking" unless it has to wait for room in the buffer.
*
* If the call times out then zero or a partial frame count will be returned.
*
* Available since API level 26.
*
* @param stream A stream created using AAudioStreamBuilder_openStream :: proc().
* @param buffer The address of the first sample.
* @param numFrames Number of frames to write. Only complete frames will be written.
* @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion.
* @return The number of frames actually written or a negative error.
*/
AAudioStream_write :: proc(stream: ^AAudioStream, buffer: rawptr, numFrames: i32, timeoutNanoseconds: i64) -> AAudioResult ---
// ============================================================
// Stream - queries
// ============================================================
/**
* This can be used to adjust the latency of the buffer by changing
* the threshold where blocking will occur.
* By combining this with AAudioStream_getXRunCount :: proc(), the latency can be tuned
* at run-time for each device.
*
* This cannot be set higher than AAudioStream_getBufferCapacityInFrames :: proc().
*
* Note that you will probably not get the exact size you request.
* You can check the return value or call AAudioStream_getBufferSizeInFrames :: proc()
* to see what the actual final size is.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @param numFrames requested number of frames that can be filled without blocking
* @return actual buffer size in frames or a negative error
*/
AAudioStream_setBufferSizeInFrames :: proc(stream: ^AAudioStream, numFrames: i32) -> AAudioResult ---
/**
* Query the maximum number of frames that can be filled without blocking.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return buffer size in frames.
*/
AAudioStream_getBufferSizeInFrames :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Query the number of frames that the application should read or write at
* one time for optimal performance. It is OK if an application writes
* a different number of frames. But the buffer size may need to be larger
* in order to avoid underruns or overruns.
*
* Note that this may or may not match the actual device burst size.
* For some endpoints, the burst size can vary dynamically.
* But these tend to be devices with high latency.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return burst size
*/
AAudioStream_getFramesPerBurst :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Query maximum buffer capacity in frames.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return buffer capacity in frames
*/
AAudioStream_getBufferCapacityInFrames :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Query the size of the buffer that will be passed to the dataProc callback
* in the numFrames parameter.
*
* This call can be used if the application needs to know the value of numFrames before
* the stream is started. This is not normally necessary.
*
* If a specific size was requested by calling
* AAudioStreamBuilder_setFramesPerDataCallback :: proc() then this will be the same size.
*
* If AAudioStreamBuilder_setFramesPerDataCallback :: proc() was not called then this will
* return the size chosen by AAudio, or {@link #AAUDIO_UNSPECIFIED}.
*
* {@link #AAUDIO_UNSPECIFIED} indicates that the callback buffer size for this stream
* may vary from one dataProc callback to the next.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return callback buffer size in frames or {@link #AAUDIO_UNSPECIFIED}
*/
AAudioStream_getFramesPerDataCallback :: proc(stream: ^AAudioStream) -> i32 ---
/**
* An XRun is an Underrun or an Overrun.
* During playing, an underrun will occur if the stream is not written in time
* and the system runs out of valid data.
* During recording, an overrun will occur if the stream is not read in time
* and there is no place to put the incoming data so it is discarded.
*
* An underrun or overrun can cause an audible "pop" or "glitch".
*
* Note that some INPUT devices may not support this function.
* In that case a 0 will always be returned.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return the underrun or overrun count
*/
AAudioStream_getXRunCount :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual sample rate
*/
AAudioStream_getSampleRate :: proc(stream: ^AAudioStream) -> i32 ---
/**
* A stream has one or more channels of data.
* A frame will contain one sample for each channel.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual number of channels
*/
AAudioStream_getChannelCount :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Identical to AAudioStream_getChannelCount :: proc().
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual number of samples frame
*/
AAudioStream_getSamplesPerFrame :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual device ID
*/
AAudioStream_getDeviceId :: proc(stream: ^AAudioStream) -> i32 ---
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual data format
*/
AAudioStream_getFormat :: proc(stream: ^AAudioStream) -> AAudioFormat ---
/**
* Provide actual sharing mode.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual sharing mode
*/
AAudioStream_getSharingMode :: proc(stream: ^AAudioStream) -> AAudioSharingMode ---
/**
* Get the performance mode used by the stream.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
*/
AAudioStream_getPerformanceMode :: proc(stream: ^AAudioStream) -> AAudioPerformanceMode ---
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return direction
*/
AAudioStream_getDirection :: proc(stream: ^AAudioStream) -> AAudioDirection ---
/**
* Passes back the number of frames that have been written since the stream was created.
* For an output stream, this will be advanced by the application calling write :: proc()
* or by a data callback.
* For an input stream, this will be advanced by the endpoint.
*
* The frame position is monotonically increasing.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return frames written
*/
AAudioStream_getFramesWritten :: proc(stream: ^AAudioStream) -> i64 ---
/**
* Passes back the number of frames that have been read since the stream was created.
* For an output stream, this will be advanced by the endpoint.
* For an input stream, this will be advanced by the application calling read :: proc()
* or by a data callback.
*
* The frame position is monotonically increasing.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return frames read
*/
AAudioStream_getFramesRead :: proc(stream: ^AAudioStream) -> i64 ---
/**
* Passes back the session ID associated with this stream.
*
* The session ID can be used to associate a stream with effects processors.
* The effects are controlled using the Android AudioEffect Java API.
*
* If AAudioStreamBuilder_setSessionId :: proc() was
* called with {@link #AAUDIO_SESSION_ID_ALLOCATE}
* then a new session ID should be allocated once when the stream is opened.
*
* If AAudioStreamBuilder_setSessionId :: proc() was called with a previously allocated
* session ID then that value should be returned.
*
* If AAudioStreamBuilder_setSessionId :: proc() was not called then this function should
* return {@link #AAUDIO_SESSION_ID_NONE}.
*
* The sessionID for a stream should not change once the stream has been opened.
*
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return session ID or {@link #AAUDIO_SESSION_ID_NONE}
*/
AAudioStream_getSessionId :: proc(stream: ^AAudioStream) -> AAudioSessionId ---
/**
* Passes back the time at which a particular frame was presented.
* This can be used to synchronize audio with video or MIDI.
* It can also be used to align a recorded stream with a playback stream.
*
* Timestamps are only valid when the stream is in {@link #AAUDIO_STREAM_STATE_STARTED}.
* {@link #AAUDIO_ERROR_INVALID_STATE} will be returned if the stream is not started.
* Note that because requestStart :: proc() is asynchronous, timestamps will not be valid until
* a short time after calling requestStart :: proc().
* So {@link #AAUDIO_ERROR_INVALID_STATE} should not be considered a fatal error.
* Just try calling again later.
*
* If an error occurs, then the position and time will not be modified.
*
* The position and time passed back are monotonically increasing.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @param clockid CLOCK_MONOTONIC or CLOCK_BOOTTIME
* @param framePosition pointer to a variable to receive the position
* @param timeNanoseconds pointer to a variable to receive the time
* @return {@link #AAUDIO_OK} or a negative error
*/
AAudioStream_getTimestamp :: proc(stream: ^AAudioStream, clockid: clockid_t, framePosition: ^i64, timeNanoseconds: ^i64) -> AAudioResult ---
/**
* Return the use case for the stream.
*
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return frames read
*/
AAudioStream_getUsage :: proc(stream: ^AAudioStream) -> AAudioUsage ---
/**
* Return the content type for the stream.
*
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return content type, for example {@link #AAUDIO_CONTENT_TYPE_MUSIC}
*/
AAudioStream_getContentType :: proc(stream: ^AAudioStream) -> AAudioContentType ---
/**
* Return the spatialization behavior for the stream.
*
* If none was explicitly set, it will return the default
* {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} behavior.
*
* Available since API level 32.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return spatialization behavior, for example {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO}
*/
AAudioStream_getSpatializationBehavior :: proc(stream: ^AAudioStream) -> AAudioSpatializationBehavior ---
/**
* Return whether the content of the stream is spatialized.
*
* Available since API level 32.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return true if the content is spatialized
*/
AAudioStream_isContentSpatialized :: proc(stream: ^AAudioStream) -> bool ---
/**
* Return the input preset for the stream.
*
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return input preset, for example {@link #AAUDIO_INPUT_PRESET_CAMCORDER}
*/
AAudioStream_getInputPreset :: proc(stream: ^AAudioStream) -> AAudioInputPreset ---
/**
* Return the policy that determines whether the audio may or may not be captured
* by other apps or the system.
*
* Available since API level 29.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return the allowed capture policy, for example {@link #AAUDIO_ALLOW_CAPTURE_BY_ALL}
*/
AAudioStream_getAllowedCapturePolicy :: proc(stream: ^AAudioStream) -> AAudioAllowedCapturePolicy ---
/**
* Return whether this input stream is marked as privacy sensitive or not.
*
* See {@link #AAudioStreamBuilder_setPrivacySensitive :: proc()}.
*
* Added in API level 30.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return true if privacy sensitive, false otherwise
*/
AAudioStream_isPrivacySensitive :: proc(stream: ^AAudioStream) -> bool ---
/**
* Return the channel mask for the stream. This will be the mask set using
* {@link #AAudioStreamBuilder_setChannelMask}, or {@link #AAUDIO_UNSPECIFIED} otherwise.
*
* Available since API level 32.
*
* @param stream reference provided by AAudioStreamBuilder_openStream :: proc()
* @return actual channel mask
*/
AAudioStream_getChannelMask :: proc(stream: ^AAudioStream) -> AAudioChannelMask ---
}