Another minor comment update
[alure.git] / examples / alure-enum.cpp
blobafa2a645ee21cd665a85b04363a5c15d108edb51
1 /*
2 * An example showing how to enumerate available devices and show its
3 * capabilities.
4 */
6 #include <iostream>
8 #include "alure2.h"
10 int main(int argc, char *argv[])
12 alure::DeviceManager devMgr = alure::DeviceManager::get();
13 alure::Vector<alure::String> list;
14 alure::String defname;
16 list = devMgr.enumerate(alure::DeviceEnumeration::Basic);
17 defname = devMgr.defaultDeviceName(alure::DefaultDeviceType::Basic);
18 std::cout<< "Available basic devices:\n";
19 for(const auto &name : list)
20 std::cout<< " "<<name<<((defname==name)?" [DEFAULT]":"") <<'\n';
21 std::cout<<std::endl;
23 list = devMgr.enumerate(alure::DeviceEnumeration::Full);
24 defname = devMgr.defaultDeviceName(alure::DefaultDeviceType::Full);
25 std::cout<< "Available devices:\n";
26 for(const auto &name : list)
27 std::cout<< " "<<name<<((defname==name)?" [DEFAULT]":"") <<'\n';
28 std::cout<<std::endl;
30 list = devMgr.enumerate(alure::DeviceEnumeration::Capture);
31 defname = devMgr.defaultDeviceName(alure::DefaultDeviceType::Capture);
32 std::cout<< "Available capture devices:\n";
33 for(const auto &name : list)
34 std::cout<< " "<<name<<((defname==name)?" [DEFAULT]":"") <<'\n';
35 std::cout<<std::endl;
37 alure::Device dev = devMgr.openPlayback((argc > 1) ? argv[1] : "");
38 std::cout<< "Info for device \""<<dev.getName(alure::PlaybackName::Full)<<"\":" <<std::endl;
39 alure::Version version = dev.getALCVersion();
40 std::cout<< "ALC version: "<<version.getMajor()<<"."<<version.getMinor() <<std::endl;
41 version = dev.getEFXVersion();
42 if(!version.isZero())
44 std::cout<< "EFX version: "<<version.getMajor()<<"."<<version.getMinor() <<'\n';
45 std::cout<< "Max auxiliary sends: "<<dev.getMaxAuxiliarySends() <<std::endl;
47 else
48 std::cout<< "EFX not supported" <<std::endl;
49 dev.close();
51 return 0;