mirror of https://github.com/mosra/magnum.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
4.5 KiB
121 lines
4.5 KiB
|
10 years ago
|
/*
|
||
|
|
This file is part of Magnum.
|
||
|
|
|
||
|
8 years ago
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||
|
10 years ago
|
Vladimír Vondruš <mosra@centrum.cz>
|
||
|
|
|
||
|
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
|
copy of this software and associated documentation files (the "Software"),
|
||
|
|
to deal in the Software without restriction, including without limitation
|
||
|
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||
|
|
and/or sell copies of the Software, and to permit persons to whom the
|
||
|
|
Software is furnished to do so, subject to the following conditions:
|
||
|
|
|
||
|
|
The above copyright notice and this permission notice shall be included
|
||
|
|
in all copies or substantial portions of the Software.
|
||
|
|
|
||
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||
|
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||
|
|
DEALINGS IN THE SOFTWARE.
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <Corrade/Utility/Arguments.h>
|
||
|
|
|
||
|
|
#include "Magnum/Magnum.h"
|
||
|
|
#include "Magnum/Audio/Context.h"
|
||
|
|
|
||
|
|
namespace Magnum {
|
||
|
|
|
||
|
|
/** @page magnum-al-info Magnum OpenAL Info
|
||
|
|
@brief Displays information about Magnum OpenAL capabilities
|
||
|
|
|
||
|
9 years ago
|
@m_footernavigation
|
||
|
|
|
||
|
8 years ago
|
@m_div{m-button m-primary} <a href="http://magnum.graphics/showcase/magnum-al-info/">@m_div{m-big}Live web version @m_enddiv @m_div{m-small} uses WebAssembly & WebAudio @m_enddiv </a> @m_enddiv
|
||
|
|
|
||
|
10 years ago
|
@section magnum-al-info-usage Usage
|
||
|
|
|
||
|
8 years ago
|
@code{.sh}
|
||
|
9 years ago
|
magnum-al-info [-h|--help] [-s|--short] [--extension-strings]
|
||
|
|
@endcode
|
||
|
10 years ago
|
|
||
|
|
Arguments:
|
||
|
9 years ago
|
|
||
|
|
- `-h`,` --help` --- display this help message and exit
|
||
|
|
- `-s`, `--short` --- display just essential info and exit
|
||
|
|
- `--extension-strings` --- list all extension strings provided by the driver
|
||
|
10 years ago
|
(implies `--short`)
|
||
|
|
|
||
|
|
@section magnum-al-info-example Example output
|
||
|
|
|
||
|
9 years ago
|
@code{.shell-session}
|
||
|
|
|
||
|
10 years ago
|
+---------------------------------------------------------+
|
||
|
|
| Information about Magnum engine and OpenAL capabilities |
|
||
|
|
+---------------------------------------------------------+
|
||
|
|
|
||
|
|
Audio Renderer: OpenAL Soft by OpenAL Community
|
||
|
|
OpenAL version: 1.1 ALSOFT 1.17.2
|
||
|
|
Available devices:
|
||
|
|
OpenAL Soft
|
||
|
|
Current device: OpenAL Soft
|
||
|
|
Vendor extension support:
|
||
|
|
AL_EXT_FLOAT32 SUPPORTED
|
||
|
|
AL_EXT_DOUBLE SUPPORTED
|
||
|
|
AL_EXT_ALAW SUPPORTED
|
||
|
|
AL_EXT_MULAW SUPPORTED
|
||
|
|
AL_EXT_MCFORMATS SUPPORTED
|
||
|
|
ALC_ENUMERATION_EXT SUPPORTED
|
||
|
|
ALC_SOFTX_HRTF -
|
||
|
|
ALC_SOFT_HRTF SUPPORTED
|
||
|
9 years ago
|
...
|
||
|
|
@endcode
|
||
|
10 years ago
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
using namespace Magnum;
|
||
|
|
|
||
|
|
int main(const int argc, const char** const argv) {
|
||
|
|
Utility::Arguments args;
|
||
|
|
args.addBooleanOption('s', "short").setHelp("short", "display just essential info and exit")
|
||
|
|
.addBooleanOption("extension-strings").setHelp("extension-strings", "list all extension strings provided by the driver (implies --short)")
|
||
|
|
.parse(argc, argv);
|
||
|
|
|
||
|
|
Debug() << "";
|
||
|
|
Debug() << " +---------------------------------------------------------+";
|
||
|
|
Debug() << " | Information about Magnum engine and OpenAL capabilities |";
|
||
|
|
Debug() << " +---------------------------------------------------------+";
|
||
|
|
Debug() << "";
|
||
|
|
|
||
|
|
Audio::Context c;
|
||
|
10 years ago
|
Debug() << "Available devices:";
|
||
|
|
for(const auto& device: Audio::Context::deviceSpecifierStrings())
|
||
|
|
Debug() << " " << device;
|
||
|
|
Debug() << "Current device:" << c.deviceSpecifierString();
|
||
|
10 years ago
|
|
||
|
|
if(args.isSet("extension-strings")) {
|
||
|
|
Debug() << "Extension strings:" << Debug::newline
|
||
|
|
<< c.extensionStrings();
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
if(args.isSet("short")) return 0;
|
||
|
|
|
||
|
|
Debug() << "Vendor extension support:";
|
||
|
|
for(const auto& extension: Audio::Extension::extensions()) {
|
||
|
|
std::string extensionName = extension.string();
|
||
|
|
Debug d;
|
||
|
|
d << " " << extensionName << std::string(60-extensionName.size(), ' ');
|
||
|
|
if(c.isExtensionSupported(extension))
|
||
|
|
d << "SUPPORTED";
|
||
|
|
else
|
||
|
|
d << " -";
|
||
|
|
}
|
||
|
|
}
|