ad1938声卡提示不能pcm_open(PCM_CARD) failed: cannot set hw params: Invalid argument,card number = 0

看到很多博文关于pcm_open(PCM_CARD) failed描述,都是要修改android上的内容,但声卡是有两片,其中一片能工作,所以想不改,应该有其它方法,费话不多说,记录如下:

1.添加声卡ad1938后显示错误pcm_open(PCM_CARD) failed: cannot set hw params: Invalid argument,card number = 0

2.查看到audio_hw.c中有pcm_open函数,但同时我有一声卡cs4265都能工作,查看到是44.1kHz的频率:

3.另一声卡是没有问题,可以的正常工作,所以不能是这里的问题,只是驱动不匹配,采用命令方式:

发现48KHz能正常工作,44.1KHz不能工作,

查看ad193x.c驱动,内核驱动中只有一种工作频率48KHz,查看原厂驱动,也没有44.1Khz的驱动,转到数据手册,数据手册是低致8k都没有问题,所以改动频率到44.1KHz是没问题的。

4.以下代码是设置频率相关内容,频率能正常工作,没有提示以上错误,直接上代码:

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This error occurs when a condition_variable is waiting for a notification, but the underlying condition is not valid. This can happen if the function is called with an invalid argument or if the condition was not initialized properly. To fix this error, you need to check the arguments being passed to the condition_variable and ensure that they are valid. You may also need to initialize the condition properly before using it. Here's an example of how to use a condition_variable: ``` #include <iostream> #include <condition_variable> #include <mutex> #include <thread> std::condition_variable cv; std::mutex mtx; bool ready = false; void thread_func() { std::unique_lock<std::mutex> lock(mtx); ready = true; cv.notify_one(); } int main() { std::thread t(thread_func); std::unique_lock<std::mutex> lock(mtx); while (!ready) { cv.wait(lock); } t.join(); return 0; } ``` In this example, we create a condition_variable named `cv`, a mutex named `mtx`, and a boolean flag called `ready`. We start a new thread that sets the `ready` flag to true and notifies the condition_variable. In the main thread, we wait for the notification by calling `cv.wait(lock)` in a loop. Note that we need to acquire the lock before calling `cv.wait()` or `cv.notify_one()`. This ensures that the condition is modified atomically and prevents race conditions. If you are still experiencing the error after checking your code, you may need to consult the documentation for the specific function that is throwing the exception to see if there are any known issues or limitations.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值