1
Audio / SoundRecorder::getAvailableDevices() only prints "true"
« on: February 23, 2016, 08:51:39 pm »
Using the sf::SoundRecorder::getAvailableDevices() seems to be only printing "true" in the output:
The implementation is in C++, because Haxe does not handle std::vector's that well, but whether this is a bug in the core or just simply my implementation I'm unsure. The below code is the C++ implementation by extracting the results of the getAvailableDevices() function and adding each element into a native Haxe Array. I would not have thought this would affect the output of the results, but "true" is all I'm getting, which seems rather unusual.
Calling getDefaultDevice(), however, does get the result you expect.
The implementation is in C++, because Haxe does not handle std::vector's that well, but whether this is a bug in the core or just simply my implementation I'm unsure. The below code is the C++ implementation by extracting the results of the getAvailableDevices() function and adding each element into a native Haxe Array. I would not have thought this would affect the output of the results, but "true" is all I'm getting, which seems rather unusual.
Calling getDefaultDevice(), however, does get the result you expect.
Array< ::String > SoundHelper::getAvailableDevices()
{
std::vector<std::string> devices = sf::SoundRecorder::getAvailableDevices();
Array< ::String > values = Array_obj< ::String >::__new();
for (int i = 0; i < devices.size(); i++)
{
const char* n_v = devices[i].c_str();
String v = n_v;
values->push(v);
}
return values;
}
{
std::vector<std::string> devices = sf::SoundRecorder::getAvailableDevices();
Array< ::String > values = Array_obj< ::String >::__new();
for (int i = 0; i < devices.size(); i++)
{
const char* n_v = devices[i].c_str();
String v = n_v;
values->push(v);
}
return values;
}