Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SoundRecorder::getAvailableDevices() only prints "true"  (Read 6497 times)

0 Members and 1 Guest are viewing this topic.

tienery

  • Newbie
  • *
  • Posts: 7
    • View Profile
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.

    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;
    }

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SoundRecorder::getAvailableDevices() only prints "true"
« Reply #1 on: February 23, 2016, 09:17:41 pm »
It would be interesting to reproduce this issue in a minimal C++ application without Haxe, to verify it's a problem in SFML. See also this post.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

tienery

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: SoundRecorder::getAvailableDevices() only prints "true"
« Reply #2 on: February 23, 2016, 10:26:42 pm »
Okay, yeah, I have done so but have been getting different results than before. Instead of three "true"'s I get nothing:

std::vector<std::string> values = sf::SoundRecorder::getAvailableDevices();
std::cout << values.size();
 

Result:


Notion

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: SoundRecorder::getAvailableDevices() only prints "true"
« Reply #3 on: November 01, 2019, 04:01:56 pm »
Very same problem here, while isAvailable() returns true, the vector<std::string> has a size of 0. Any way to solve or workaround? Or does audio recording simply not work?