From 9f223898f2f460d707d8506e28989d2952a767f9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 2 Aug 2019 12:38:20 -0700 Subject: Use an unsigned voice index --- al/source.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'al/source.cpp') diff --git a/al/source.cpp b/al/source.cpp index 5ba36524..a021cd1a 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -75,15 +75,15 @@ using namespace std::placeholders; inline ALvoice *GetSourceVoice(ALsource *source, ALCcontext *context) { - ALint idx{source->VoiceIdx}; - if(idx >= 0 && static_cast(idx) < context->mVoiceCount.load(std::memory_order_relaxed)) + ALuint idx{source->VoiceIdx}; + if(idx < context->mVoiceCount.load(std::memory_order_relaxed)) { ALuint sid{source->id}; ALvoice &voice = (*context->mVoices)[idx]; if(voice.mSourceID.load(std::memory_order_acquire) == sid) return &voice; } - source->VoiceIdx = -1; + source->VoiceIdx = INVALID_VOICE_IDX; return nullptr; } @@ -2894,7 +2894,7 @@ START_API_FUNC } ); assert(voice != voices_end); - auto vidx = static_cast(std::distance(context->mVoices->begin(), voice)); + auto vidx = static_cast(std::distance(context->mVoices->begin(), voice)); voice->mPlayState.store(ALvoice::Stopped, std::memory_order_release); source->PropsClean.test_and_set(std::memory_order_acquire); @@ -3554,16 +3554,7 @@ ALsource::ALsource(ALsizei num_sends) send.LFReference = HIGHPASSFREQREF; } - Offset = 0.0; - OffsetType = AL_NONE; - SourceType = AL_UNDETERMINED; - state = AL_INITIAL; - - queue = nullptr; - PropsClean.test_and_set(std::memory_order_relaxed); - - VoiceIdx = -1; } ALsource::~ALsource() -- cgit v1.2.3