Active Topics

 


Reply
Thread Tools
Posts: 26 | Thanked: 1 time | Joined on Oct 2010
#1
I need write application recording sounds and it's needed to choose device. So, what I did so far:
- Wrote recorder with QtMultimedia. It's working for default device, but list provided by Qt is really short and choosing device from it doesn't work. From both reasons, this is no right way.
- Wrote recorder with PulseAudio. It's working for default device, but I can not use any other. I founded this http://pulseaudio.org/wiki/SampleAsyncDeviceList code to find out all devices (I couldn't find it anywhere else) and when I try any of them, it doesn't works. Sometimes error is "Invalid argument" and sometimes "No such entity".

My recorder uses simple API of pulseaudio, not the asynchronous one.

So, please, is there any tutorial how to record sound from non-default device with pa?

Language: C++
Project: I can not use existing application nor other language (like Python).

Last edited by Laethnes; 2011-04-29 at 08:59.
 
Posts: 237 | Thanked: 193 times | Joined on Feb 2010 @ Brighton, UK
#2
Hi,
What do you mean by non-default device?

Typically the mic or mixer can easily be exposed, even bluetooth mic (although naturally very laggy).

I have not worked with QtMultimedia in the past, as it hasn't proved flexible enough for my needs when I've looked at it. GStreamer is available on the device and may well be an easier route to go for development. It's not a natural fit with Qt but Gtk/GStreamer is fine with C++.

Last edited by mr id; 2010-11-05 at 14:31. Reason: Typos
 
Posts: 26 | Thanked: 1 time | Joined on Oct 2010
#3
Thank you for reply.

I mean, I create input with pa_simple_new(NULL, "MyApp", PA_STREAM_RECORD, NULL, device, "record", &m_format, NULL, NULL, &error), where m_format and error are some variables and device (type: const char*) is THE device. If it is NULL, it is default and all works, if it is string identifying device (for example "source.hw1.monitor"), it doesn't work like I described above. That was mine point.

GStreamer - ok, that is next library I'll try if this won't work, thank you for suggesting. (But first I'll try to figure out how to do it with PA, because I'm really running out of time and I have not so much time to learn yet another library :3.)
 
Posts: 237 | Thanked: 193 times | Joined on Feb 2010 @ Brighton, UK
#4
Thanks for the clarification, wasn't quite sure where the problem was.

http://talk.maemo.org/showthread.php?p=441501 looks like it may offer some insight into some additional tools you can use at the terminal (pulseaudio-utils) to help you verify your set up. There may be other insightful postings elsewhere on this forum as well.

A quick read of that posting suggests you may want to be attatching to sink.hw1.monitor and not source.hw1.monitor but as I say using parec from the utils package should help you get up and running with this and verify the correct device setup.

If you end up going the GStreamer route I may be able to be more helpful.

Last edited by mr id; 2010-11-05 at 14:53. Reason: Typos
 
Posts: 26 | Thanked: 1 time | Joined on Oct 2010
#5
Thank you very much, I'm going to check it. (If it's about source.../sink... I tryied both :3.)
 
Posts: 237 | Thanked: 193 times | Joined on Feb 2010 @ Brighton, UK
#6
Hmm, hopefully the utils will really help. Is it a stupid question to ask if you actually had something connected to hw1 (bluetooth I believe) when you tried testing it?
 
Posts: 26 | Thanked: 1 time | Joined on Oct 2010
#7
I don't test such devices - for now. I just want to record from normal mic - but with right device name and not NULL. For now.

Well, the utils tells me I do something terribly wrong, because they work, but when I use same device name - "sink.hw0.monitor" or "source.hw0" in my app, it doesn't work. But NULL does.
 
Posts: 237 | Thanked: 193 times | Joined on Feb 2010 @ Brighton, UK
#8
Are you able to post your code (or ideally the smallest compilable snippet) that illustrates this? Could be something simple in the code that is wrong rather than with the set-up.

I wouldn't be able to compile and run it until this evening, but someone else viewing the thread may be better placed to before then.
 
Posts: 26 | Thanked: 1 time | Joined on Oct 2010
#9
I'm so dumb! All it was problem wrong retyping from QString to classic C string (const char*). (I just tested it with std::cout and it looked ok...)

Anyway, thank you very much for your effort and help, I really appreciate it.

And I apologize for late answer, I ran out of time...
 
Posts: 237 | Thanked: 193 times | Joined on Feb 2010 @ Brighton, UK
#10
good news. happy coding.
 
Reply


 
Forum Jump


All times are GMT. The time now is 23:02.