aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index efec58a0..1a2f7d8d 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -20,6 +20,7 @@
#include <vector>
#include <string>
#include <chrono>
+#include <algorithm>
#include "AL/al.h"
#include "AL/alc.h"
@@ -822,15 +823,11 @@ void SetDefaultWFXChannelOrder(ALCdevice *device);
const ALCchar *DevFmtTypeString(enum DevFmtType type);
const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans);
-inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan)
+inline ALint GetChannelIndex(const enum Channel (&names)[MAX_OUTPUT_CHANNELS], enum Channel chan)
{
- ALint i;
- for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
- {
- if(names[i] == chan)
- return i;
- }
- return -1;
+ auto iter = std::find(std::begin(names), std::end(names), chan);
+ if(iter == std::end(names)) return -1;
+ return std::distance(names, iter);
}
/**
* GetChannelIdxByName