0
0

— edit: See my last reply for solution.

There’s an application titled Fraps, it’s designed to record video demos of anything on your PC. I’ve used it to record demos of some OpenGL applications I’ve written which play music along with.

The curious thing is this application can capture audio from ANY application which is playing, and record it.

I’m desperately seeking this ability, is it possible with FMOD (on windows (Vista preferably)) to get a hold of any system sound which is playing and record it? Or do I have to find a different API which has an interface to allow for this to happen?

Some searches on the topic yield no useful results which is why I’ve resorted to making this thread!

—- edit 1

Alright so it looks like there used to be the ability to ‘record what you hear’ but I’m not sure how people did that yet, somehow through the system mixer which is supposedly disabled in Vista+. But… somehow Fraps managed to do it regardless? Do they just have elite hackers that found some obscure method? … continues researching

  • You must to post comments
0
0

WASAPI -> IAudioCaptureClient, IAudioClient

http://msdn.microsoft.com/en-us/library/ms679162(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms678722(VS.85).aspx

Also found this with some searching,

http://blogs.msdn.com/matthew_van_eerde … -hear.aspx

And with good googling there’s even more. This is all initially obscure and difficult to put together but it’s possible and it’s out there now.

Will FMOD be designed to support WASAPI and access to these audio endpoints for future windows versions? Or is this out of scope for the API?

  • You must to post comments
0
0

FMOD currently does use WASAPI when you are on Vista or Win7, however we don’t expose a way to access those loopback devices.

I haven’t looked too closely at the API, but just on the face of it, it would be kind of cool if we exposed a virtual recording device (just like our mic recording interface). Then you could record "what you hear" directly into an FMOD sound.

I will log this idea on our tracker but I can’t give any indication of if or when it will be implemented.

  • You must to post comments
0
0

edit: …a permanent home for these instructions:
http://aev-mpt.blogspot.com/2009/10/cap … ows-7.html

Nice! I finally successfully implemented the WASAPI Loopback endpoint recording (VS2008), there’s actually more clear source code available from MSDN and a few extra instructions you have to follow.

http://msdn.microsoft.com/en-us/library/dd370800(VS.85).aspx

That source code requires two modifications which is described on another MSDN entry.

[quote:1uznzt72]
1. In the call to the IMMDeviceEnumerator::GetDefaultAudioEndpoint method, change the first parameter (dataFlow) from eCapture to eRender.

  1. In the call to the IAudioClient::Initialize method, change the value of the second parameter (StreamFlags) from 0 to AUDCLNT_STREAMFLAGS_LOOPBACK.
    [/quote:1uznzt72]

edit: MSDN doesn’t mention it but there is actually one more step.
3. You must call ‘CoInitializeEx(NULL, COINIT_SPEED_OVER_MEMORY)’ before any of the capture code is executed. There are a few different parameters other than what I’ve given.

http://msdn.microsoft.com/en-us/library/ms695279(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms678505(VS.85).aspx

If you make those changes to the source on the MSDN linked and the other I mentioned, the application will read data being sent to the Speakers endpoint! As described by a developer on the MSDN forum this method is entirely software based and requires no loopback feature on the audio card, also no recording device is required at all (which makes sense and is how this should work).

Hopefully Google picks this up for others and helps add clarity to the technique, there’s a lot of wrong information out there about Vista and Windows7 especially concerning ‘record what you hear’.

And for extra measure, you’ll just need to reference these header files (and have installed the Windows 7 SDK).

[code:1uznzt72]

include <windows.h>

include <mmsystem.h>

include <mmdeviceapi.h>

include <audioclient.h>

include <functiondiscoverykeys_devpkey.h>

[/code:1uznzt72]

And for *ridiculously unnecessarily long measure this snippet will help programmers interpret HRESULT’s. Depending on how your Visual Studio project is configured you may need to replace _tprintf with C++ std::cout, etc.

[code:1uznzt72]
void ErrorDescription(HRESULT hr)
{
if(FACILITY_WINDOWS == HRESULT_FACILITY(hr))
hr = HRESULT_CODE(hr);

TCHAR* szErrMsg; 

if(FormatMessage( 
    FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, 
    NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
    (LPTSTR)&amp;szErrMsg, 0, NULL) != 0) 
{ 
    _tprintf(TEXT(&quot;%s&quot;), szErrMsg); 
    LocalFree(szErrMsg); 
} else 
_tprintf( TEXT(&quot;[Could not find a description for error # %#x.]\n&quot;), hr); 

}
[/code:1uznzt72]

:]

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.