gpt4 book ai didi

nao-robot - NAO机器人: porting ALSoundExtractor to qi framwork

转载 作者:行者123 更新时间:2023-12-04 09:15:40 25 4
gpt4 key购买 nike

从 NAOqi 移植到 qi 框架时,我取得了部分成功。但是,我仍然有以下问题。
我不知道如何在 qi 框架中使用 ALSoundExtractor 实现声音处理。
在老脑奇里,有一个例子:
http://doc.aldebaran.com/2-8/dev/cpp/examples/audio/soundprocessing/soundprocessing.html
创建类的位置:
ALSoundProcessing 类:公共(public) ALSoundExtractor
然后声明一个覆盖虚函数的函数,用于声音处理:
无效进程(...)
我现在不知道的是:

  • 如何在qi框架中创建一个继承自旧样式类ALSoundExtractor的类?
  • 如何声明一个覆盖虚函数的函数 - 从技术上讲,基类函数 process() 需要旧 AL::约定中的变量。

  • 或者,还有其他方法可以读取音频 channel 吗?

    最佳答案

    我从未使用过 ALExtractor 或 ALSoundExtractor,但这是我所知道的。

    1. How to create a class in qi framework that inherits from the old style class ALSoundExtractor?

    在老脑奇,一个“ALExtractor”
  • 可以从主进程(使用 autoload.ini)或另一个进程(称为远程模式)运行。 qi 框架只支持远程模式。
  • 可以从 ALExtractor 或 ALAudioExtractor 继承以分解出一些代码。这些类尚未移植到 qi 框架。所以如果你不想继续使用 libnaoqi,你应该想办法不用它们。

  • 好消息:从未真正需要从他们那里继承。您会发现自己处于与以下问题类似的位置,其中提取器是在 python 中实现的(因此不能从 C++ 类继承,也不能从 autoload.ini 加载到主进程中)。
    NAO robot remote audio problems
    1. How to declare a function that is overriding the virtual function - technically the base class function process() expects variables in old AL:: convention.

    每当您使用“旧的 Naoqi”时,您实际上是在使用 qi 框架之上的兼容层。
    因此,每当您使用“老脑奇”时,您就已经在使用 qi 框架。
    libqi 的 qi::AnyValue 在运行时是可扩展的,libnaoqi 对其进行了扩展以使其知道如何处理 ALValue:如何将其转换为原始类型(浮点数、整数列表、字符串、缓冲区等)。
    因此,每当旧的 ALSoundExtractor 接收到 AL::ALvalue 时,它​​实际上是一个 qi::AnyValue,它在调用 process() 方法之前已转换为 ALValue。
    如果不与 libnaoqi 链接,则无法将该值用作 ALValue,但可以将其用作 qi::AnyValue 甚至将其用作原始类型。
    原始原型(prototype)是 (cfr doxygen http://doc.aldebaran.com/2-8/ref/libalaudio/classAL_1_1ALSoundExtractor.html ) 是
    void ALSoundExtractor::process (const int &nbOfChannels, const int &nbrOfSamplesByChannel, const AL_SOUND_FORMAT *buffer, const ALValue &timestamp);
    由于时间戳可能是两个整数的列表,我会尝试这样的事情
    void TmpSoundExtractor::process (const int &nbOfChannels, const int &nbrOfSamplesByChannel, qi::AnyValue buffer, const std::vector<int> &timestamp);
    我不确定如何处理缓冲区变量,但首先让其余的工作。

    关于nao-robot - NAO机器人: porting ALSoundExtractor to qi framwork,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63232083/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com