diff options
author | Chris Robinson <[email protected]> | 2014-10-02 21:19:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-10-02 21:19:34 -0700 |
commit | 70b23ab77f99c6e4baeca3cb74355a027cf6769d (patch) | |
tree | badc3fce317db7928dc2ddf06b870cf96c32413b /OpenAL32 | |
parent | 79fb86d8f79459b0144e4de750e9b6f07c4de473 (diff) |
Add a helper to search for a channel index by name
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 2c7784c8..8cbac90e 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -828,6 +828,23 @@ void SetDefaultWFXChannelOrder(ALCdevice *device); const ALCchar *DevFmtTypeString(enum DevFmtType type) DECL_CONST; const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans) DECL_CONST; +/** + * GetChannelIdxByName + * + * Returns the device's channel index given a channel name (e.g. FrontCenter), + * or -1 if it doesn't exist. + */ +inline ALint GetChannelIdxByName(const ALCdevice *device, enum Channel chan) +{ + ALint i = 0; + for(i = 0;i < MaxChannels;i++) + { + if(device->ChannelName[i] == chan) + return i; + } + return -1; +} + extern FILE *LogFile; |