Return result from audoutPlayBuffer (#46)

* Return result from audoutPlayBuffer
* Add alignment note in header file
This commit is contained in:
Mike H 2018-02-19 21:43:58 +00:00 committed by yellows8
parent 9f8a33ba11
commit cde07068dd
2 changed files with 5 additions and 3 deletions

View File

@ -29,7 +29,7 @@ typedef struct AudioOutBuffer AudioOutBuffer;
struct AudioOutBuffer struct AudioOutBuffer
{ {
AudioOutBuffer* next; ///< Next buffer. AudioOutBuffer* next; ///< Next buffer.
void* buffer; ///< Sample buffer. void* buffer; ///< Sample buffer (aligned to 0x1000 bytes).
u64 buffer_size; ///< Sample buffer size. u64 buffer_size; ///< Sample buffer size.
u64 data_size; ///< Size of data inside the buffer. u64 data_size; ///< Size of data inside the buffer.
u64 data_offset; ///< Offset of data inside the buffer. u64 data_offset; ///< Offset of data inside the buffer.
@ -52,7 +52,7 @@ Result audoutContainsAudioOutBuffer(AudioOutBuffer *Buffer, bool *ContainsBuffer
* @param source AudioOutBuffer containing the source sample data to be played. * @param source AudioOutBuffer containing the source sample data to be played.
* @param released AudioOutBuffer to receive the last played buffer. * @param released AudioOutBuffer to receive the last played buffer.
*/ */
void audoutPlayBuffer(AudioOutBuffer *source, AudioOutBuffer *released); Result audoutPlayBuffer(AudioOutBuffer *source, AudioOutBuffer *released);
/// These return the state associated with the currently active audio output device. /// These return the state associated with the currently active audio output device.
u32 audoutGetSampleRate(void); ///< Supported sample rate (48000Hz). u32 audoutGetSampleRate(void); ///< Supported sample rate (48000Hz).

View File

@ -82,7 +82,7 @@ AudioOutState audoutGetDeviceState(void) {
return g_deviceState; return g_deviceState;
} }
void audoutPlayBuffer(AudioOutBuffer *source, AudioOutBuffer *released) { Result audoutPlayBuffer(AudioOutBuffer *source, AudioOutBuffer *released) {
// Try to push the supplied buffer to the audio output device // Try to push the supplied buffer to the audio output device
Result do_append = audoutAppendAudioOutBuffer(source); Result do_append = audoutAppendAudioOutBuffer(source);
@ -103,6 +103,8 @@ void audoutPlayBuffer(AudioOutBuffer *source, AudioOutBuffer *released) {
do_release = audoutGetReleasedAudioOutBuffer(released, &released_count); do_release = audoutGetReleasedAudioOutBuffer(released, &released_count);
} }
} }
return do_append;
} }
Result audoutListAudioOuts(char *DeviceNames, u32 *DeviceNamesCount) { Result audoutListAudioOuts(char *DeviceNames, u32 *DeviceNamesCount) {