NAO robot: porting ALSoundExtractor to qi framwork

后端 未结 4 819
臣服心动
臣服心动 2021-01-22 07:28

When porting from NAOqi to qi framework I achieved a partial success. I do however still have the following problem. I do not know how to implement sound processing with ALSound

4条回答
  •  遇见更好的自我
    2021-01-22 08:21

    The following is what I did. The code compiles, but I won't have a chance to test it on a live robot for about one week or so.

    typedef signed short AL_SOUND_FORMAT; // copy from alaudio/alsoundextractor.h
    
    void process(const int& nbOfChannels, const int& nbrOfSamplesByChannel, const AL_SOUND_FORMAT *buffer, const qi::AnyValue& timeStamp); // I do not use the timeStamp variable in my code, so AnyValue would work?
    
    qi::AnyObject audioDevice = _session->service("ALAudioDevice"); // same variable name as in the original ALSoundExtractor module, just as a convenience
    
    audioDevice.call("setClientPreferences", audioDevice.call("getName"), 48000, 0, 1);
    
    audioDevice.call("subscribe", audioDevice.call("getName")); // this is the key call
    
    audioDevice.call("startDetection"); // is it still necessary?
    

    My question is - do I do it right now? If I cannot override the virtual function process(), does subscribing of my module guarantee a callback to my process(...)?

提交回复
热议问题