Skip to content

Commit

Permalink
Return result from audoutPlayBuffer (switchbrew#46)
Browse files Browse the repository at this point in the history
* Return result from audoutPlayBuffer
* Add alignment note in header file
  • Loading branch information
hexkyz authored and yellows8 committed Feb 19, 2018
1 parent 9f8a33b commit cde0706
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nx/include/switch/services/audout.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct AudioOutBuffer AudioOutBuffer;
struct AudioOutBuffer
{
AudioOutBuffer* next; ///< Next buffer.
void* buffer; ///< Sample buffer.
void* buffer; ///< Sample buffer (aligned to 0x1000 bytes).
u64 buffer_size; ///< Sample buffer size.
u64 data_size; ///< Size of data inside the buffer.
u64 data_offset; ///< Offset of data inside the buffer.
Expand All @@ -52,7 +52,7 @@ Result audoutContainsAudioOutBuffer(AudioOutBuffer *Buffer, bool *ContainsBuffer
* @param source AudioOutBuffer containing the source sample data to be played.
* @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.
u32 audoutGetSampleRate(void); ///< Supported sample rate (48000Hz).
Expand Down
4 changes: 3 additions & 1 deletion nx/source/services/audout.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ AudioOutState audoutGetDeviceState(void) {
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
Result do_append = audoutAppendAudioOutBuffer(source);

Expand All @@ -103,6 +103,8 @@ void audoutPlayBuffer(AudioOutBuffer *source, AudioOutBuffer *released) {
do_release = audoutGetReleasedAudioOutBuffer(released, &released_count);
}
}

return do_append;
}

Result audoutListAudioOuts(char *DeviceNames, u32 *DeviceNamesCount) {
Expand Down

0 comments on commit cde0706

Please sign in to comment.