Windows Audio Capture Module (Through API Hook)

Some players need to capture audio output from other players/games/web browsers, and use these source as its input, by this way, it can mix multi audio stream into one audo stream, to achieve functions like Kalaokay.

Basicly, there are three types of audio output interfaces, they are:

1. waveout, the most old audio playback interface in windows, easy use, but fewer controls on detail.

2. directsound, a more recent audio playback interface, it offers more advanced features than waveout doesn’t offer.

3. audio session, the most latest audo playback interface, it offers more features and controls on detail, at the meantime, there are more interfaces we need to handle.

According the requirement, here is an audio capture module I made.

Features:

1. able to capture multi processes at the same time

2. able to publish the captured data to multi observers at the same time.

3. able to start and stop capture multi times to certain processes.

4. able to handle waveout, dsound,audio session.

5. support all windows versions(include the latest windows 8.1), both 32bit and 64bit.

3rdparty source in use:

1.  zmq, a very good network foundation, I uses the publisher and subscriber partern in this solution.

2. libhook, my own implement of api hook, supports x86,x64

3. liblogger, my own implement of logger, supports log level, log type(file, console, debugger, and use customized output)

the data flow:

1. a process that is hooked: it works as the zmq publisher. it could be multi instance. one handle(a waveout handle, a dsound instance, an audio session instance) is considered to be a audio session.

2. a daemon process: it works as the data hub, subscriber all hooked processes’ publication, and republish these data to our final product。

3. a product(the observer): it works as the final data observer to subscribe all data from the daemon process, and it can use all or some of the audio sessions to generate the final audio stream.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s