Skip to content

Commit

Permalink
Fix ASND_TestVoiceBufferReady
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Oct 16, 2023
1 parent 67ecb8f commit 9a07888
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions gc/asndlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,18 +349,18 @@ u32 ASND_GetTimerVoice(s32 voice);
/*! \brief Tests if \a pointer is in use by \a voice as a buffer.
* \param[in] voice Voice to test, from 0 to (MAX_VOICES-1).
* \param[in] pointer Address to test. This must be the same pointer sent to ASND_AddVoice() or ASND_SetVoice().
* \return SND_INVALID if invalid
* \return 0 if the pointer is unused
* \return 1 if the pointer used as a buffer. */
* \return SND_INVALID if invalid.
* \return SND_OK if the pointer is unused.
* \return SND_BUSY if the pointer is used as a buffer. */
s32 ASND_TestPointer(s32 voice, void *pointer);

/*! \brief Tests to determine if the \a voice is ready to receive a new buffer sample with ASND_AddVoice().
* \details You can use this function to block a reader when double buffering is used. It works similarly to ASND_TestPointer() without needing to pass a
* pointer.
* \param[in] voice Voice to test, from 0 to (MAX_VOICES-1).
* \return SND_INVALID
* \return 0 if voice is NOT ready to receive a new voice.
* \return 1 if voice is ready to receive a new voice with ASND_AddVoice(). */
* \return SND_INVALID if invalid.
* \return SND_OK if voice is ready to receive a new buffer with ASND_AddVoice().
* \return SND_BUSY if voice is NOT ready to receive a new buffer. */
s32 ASND_TestVoiceBufferReady(s32 voice);

/*! @} */
Expand Down
6 changes: 3 additions & 3 deletions libasnd/asndlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,10 @@ s32 ASND_AddVoice(s32 voice, void *snd, s32 size_snd)

s32 ASND_TestVoiceBufferReady(s32 voice)
{
if(voice<0 || voice>=MAX_VOICES) return 0; // invalid voice: not ready (of course XD)
if(sound_data[voice].start_addr && sound_data[voice].start_addr2) return 0; // not ready
if(voice<0 || voice>=MAX_VOICES) return SND_INVALID; // invalid voice: not ready (of course XD)
if(sound_data[voice].start_addr && sound_data[voice].start_addr2) return SND_BUSY; // not ready

return 1; // ready
return SND_OK; // ready
}

/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
Expand Down

0 comments on commit 9a07888

Please sign in to comment.