|
-
September 25th, 2008, 08:44 AM
#1
Getting input from Soundcard
Hi @ all,
is it possible to catch if the soundcard gets any input with basic c++, also without any windows methods? I ask this to try to make my application os undependent.
Greetz
Crazy
-
September 25th, 2008, 09:21 AM
#2
Re: Getting input from Soundcard
No.
Every OS uses a different method. Windows has several APIs, whereas Linux has a device that takes read/write with ioctl calls.
To be OS independant you would need a third party API that undefneith calls the local OS's soundcard functions. You could probably do this yourself by using complier directives.
There are several APIs for Windows:
MMAPI: Plus: Been around forever (Win 3.0), fairly simple. Minus: Can have latency issues and be processor intensive.
DirectX: Plus: Fast, simple. Minus: Poorly documented. API calls but no explanation.
ASIO: Plus: Fast. Minux: Requires 3rd party drivers.
WDM: Plus: Fastest. Directly uses kmixer. Minus: Not documented at all. (I have been trying to find info on this for ages.)
Good luck,
-Erik
-
September 25th, 2008, 09:59 AM
#3
Re: Getting input from Soundcard
Ok thanks for the info. Then I have to switch between the different os´s.
-
September 25th, 2008, 10:18 AM
#4
Re: Getting input from Soundcard
Portaudio is a pretty good cross-platform sound library that you could use. If you're a novice programmer and don't want to muck about with a separate thread for audio, this library is particularly neat in that it supports blocking I/O, which allows you to capture sound card input in a streams-like manner.
Detecting sound card input, however, is not something supported by most sound APIs (as far as I know). You could accomplish this by looking for samples in the sound input that exceed a reasonable noise threshold and firing some sort of event if one is encountered. The trick here is to use a time-out, i.e. the maximum interval between the current sample and the last non-silent sample, to detect when the input source has stopped (and therefore when it is okay to fire another input detection event).
- Alon
-
September 26th, 2008, 11:43 PM
#5
Re: Getting input from Soundcard
Any other cross platform API ?
Is this used for capture sound and play sound ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|