<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fooling Around &#187; Audio</title>
	<atom:link href="http://alax.info/blog/tag/audio/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>// Software Production Line</description>
	<lastBuildDate>Wed, 02 May 2012 15:42:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Sample: Simultaneous Audio Playback via Waveform Audio (waveOut) API</title>
		<link>http://alax.info/blog/1291</link>
		<comments>http://alax.info/blog/1291#comments</comments>
		<pubDate>Wed, 12 Oct 2011 17:15:50 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[playback]]></category>
		<category><![CDATA[waveOut]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1291</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1291" title="Sample: Simultaneous Audio Playback via Waveform Audio (waveOut) API"></a>The minimalistic sample demonstrates support of [deprecated] Waveform Audio API for multiple playback streams. Depending on command line parameters, the application starts threads to open audio hardware using separate waveOutOpen call and stream one or more generated sine waves: 1,000 &#8230;<p class="read-more"><a href="http://alax.info/blog/1291">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1291" title="Sample: Simultaneous Audio Playback via Waveform Audio (waveOut) API"></a><p>The minimalistic sample demonstrates support of [deprecated] <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd757715%28v=VS.85%29.aspx">Waveform Audio API</a> for multiple playback streams.</p>
<p>Depending on command line parameters, the application starts threads to open audio hardware using separate <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd743866%28v=VS.85%29.aspx">waveOutOpen</a> call and stream one or more generated sine waves:</p>
<ul>
<li>1,000 Hz sine wave as 22,050 Hz, Mono, 16-bit PCM (command line parameter &#8220;a&#8221;)</li>
<li>5,000 Hz sine wave as 32,000 Hz, Mono, 16-bit PCM (command line parameter &#8220;b&#8221;)</li>
<li>15,000 Hz sine wave as 44,100 Hz, Mono, 16-bit PCM (command line parameter &#8220;c&#8221;)</li>
</ul>
<pre style="color: #000000; background: #ffffff;">Check<span style="color: #808030;">(</span><span style="color: #400000;">waveOutOpen</span><span style="color: #808030;">(</span><span style="color: #808030;">&amp;</span>hWaveOut<span style="color: #808030;">,</span> WAVE_MAPPER<span style="color: #808030;">,</span> <span style="color: #808030;">&amp;</span>WaveFormatEx<span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> CALLBACK_NULL<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLASSERT<span style="color: #808030;">(</span>hWaveOut<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
WAVEHDR<span style="color: #808030;">*</span> pWaveHeader<span style="color: #800080;">;</span>
<span style="color: #603000;">HGLOBAL</span> hWaveHeader <span style="color: #808030;">=</span> <span style="color: #808030;">(</span>WAVEHDR<span style="color: #808030;">*</span><span style="color: #808030;">)</span> <span style="color: #400000;">GlobalAlloc</span><span style="color: #808030;">(</span>GMEM_MOVEABLE <span style="color: #808030;">|</span> GMEM_SHARE<span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">sizeof</span> <span style="color: #808030;">*</span>pWaveHeader <span style="color: #808030;">+</span> WaveFormatEx<span style="color: #808030;">.</span>nAvgBytesPerSec <span style="color: #808030;">*</span> <span style="color: #008c00;">10</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
pWaveHeader <span style="color: #808030;">=</span> <span style="color: #808030;">(</span>WAVEHDR<span style="color: #808030;">*</span><span style="color: #808030;">)</span> <span style="color: #400000;">GlobalLock</span><span style="color: #808030;">(</span>hWaveHeader<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_THROW<span style="color: #808030;">(</span>pWaveHeader<span style="color: #808030;">,</span> E_OUTOFMEMORY<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
pWaveHeader<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>lpData <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">LPSTR</span><span style="color: #808030;">)</span> <span style="color: #808030;">(</span><span style="color: #603000;">BYTE</span><span style="color: #808030;">*</span><span style="color: #808030;">)</span> <span style="color: #808030;">(</span>pWaveHeader <span style="color: #808030;">+</span> <span style="color: #008c00;">1</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
pWaveHeader<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>dwBufferLength <span style="color: #808030;">=</span> WaveFormatEx<span style="color: #808030;">.</span>nAvgBytesPerSec <span style="color: #808030;">*</span> <span style="color: #008c00;">10</span><span style="color: #800080;">;</span>
<span style="color: #696969;">//pWaveHeader-&gt;dwUser = </span>
pWaveHeader<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>dwFlags <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
pWaveHeader<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>dwLoops <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
<span style="color: #004a43;">#</span><span style="color: #004a43; font-weight: bold;">pragma </span><span style="color: #bb7977; font-weight: bold;">region Generate Actual Data</span>
<span style="color: #800080;">{</span>
    <span style="color: #603000;">SHORT</span><span style="color: #808030;">*</span> pnData <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">SHORT</span><span style="color: #808030;">*</span><span style="color: #808030;">)</span> pWaveHeader<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>lpData<span style="color: #800080;">;</span>
    SIZE_T nDataCount <span style="color: #808030;">=</span> pWaveHeader<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>dwBufferLength <span style="color: #808030;">/</span> <span style="color: #800000; font-weight: bold;">sizeof</span> <span style="color: #808030;">*</span>pnData<span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">for</span><span style="color: #808030;">(</span>SIZE_T nIndex <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span> nIndex <span style="color: #808030;">&lt;</span> nDataCount<span style="color: #800080;">;</span> nIndex<span style="color: #808030;">+</span><span style="color: #808030;">+</span><span style="color: #808030;">)</span>
    pnData<span style="color: #808030;">[</span>nIndex<span style="color: #808030;">]</span> <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">SHORT</span><span style="color: #808030;">)</span> <span style="color: #808030;">(</span><span style="color: #008c00;">32000</span> <span style="color: #808030;">*</span> <span style="color: #603000;">sin</span><span style="color: #808030;">(</span><span style="color: #008000;">1.0</span> <span style="color: #808030;">*</span> nIndex <span style="color: #808030;">/</span> WaveFormatEx<span style="color: #808030;">.</span>nSamplesPerSec <span style="color: #808030;">*</span> nFrequency <span style="color: #808030;">*</span> <span style="color: #008c00;">2</span> <span style="color: #808030;">*</span> M_PI<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span>
<span style="color: #004a43;">#</span><span style="color: #004a43; font-weight: bold;">pragma </span><span style="color: #bb7977; font-weight: bold;">endregion </span>
Check<span style="color: #808030;">(</span>waveOutPrepareHeader<span style="color: #808030;">(</span>hWaveOut<span style="color: #808030;">,</span> pWaveHeader<span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">sizeof</span> <span style="color: #808030;">*</span>pWaveHeader<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
Check<span style="color: #808030;">(</span>waveOutWrite<span style="color: #808030;">(</span>hWaveOut<span style="color: #808030;">,</span> pWaveHeader<span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">sizeof</span> <span style="color: #808030;">*</span>pWaveHeader<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #400000;">GlobalUnlock</span><span style="color: #808030;">(</span>hWaveHeader<span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<p>The operating system is supposed to mix the waves, which can be easily perceived taking place. It is possible to run the application with multiple waveforms within a process, e.g. &#8220;abc&#8221; command line parameter, and/or start multiple instances of the application.</p>
<p>A binary [<a href="http://www.alax.info/svn/public/trunk/Utilities/WaveOutMultiPlay/Release/WaveOutMultiPlay.exe">Win32</a>] and partial Visual C++ .NET 2010 <a href="http://www.alax.info/trac/public/browser/trunk/Utilities/WaveOutMultiPlay">source code</a> are available from SVN.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1291/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Utility Clearance: Enumerate Audio &#8216;MMDevice&#8217;s</title>
		<link>http://alax.info/blog/1279</link>
		<comments>http://alax.info/blog/1279#comments</comments>
		<pubDate>Tue, 30 Aug 2011 17:14:24 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WTL]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Core Audio]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[IMMDevice]]></category>
		<category><![CDATA[MMDevice]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[WASAPI]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1279</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1279" title="Utility Clearance: Enumerate Audio &#039;MMDevice&#039;s"></a>The utility and code does straightforward enumeration of MMDevices (Vista+, check MSDN for MMDevice API availability), which correspond to MMDevice API, WASAPI, Core Audio API. The code itself is straightforward, with a ready to use binary to quickly lookup data &#8230;<p class="read-more"><a href="http://alax.info/blog/1279">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1279" title="Utility Clearance: Enumerate Audio &#039;MMDevice&#039;s"></a><p>The utility and code does straightforward enumeration of MMDevices (Vista+, check MSDN for <a href="http://msdn.microsoft.com/en-us/library/dd371399%28v=vs.85%29.aspx">MMDevice API availability</a>), which correspond to MMDevice API, WASAPI, Core Audio API. The code itself is straightforward, with a ready to use binary to quickly lookup data of interest:</p>
<p><img class="alignnone size-full wp-image-1280" title="Enumerate Audio Devices in Action" src="http://alax.info/blog/wp-content/uploads/2011/08/Image0012.png" alt="" width="541" height="363" /></p>
<p>The data is detailed well and in Excel-friendly format (via Copy/Paste):</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/08/Image002.png"><img class="alignnone size-large wp-image-1281" title="Enumerate Audio Device Output in Microsoft Excel" src="http://alax.info/blog/wp-content/uploads/2011/08/Image002-800x362.png" alt="" width="620" height="280" /></a></p>
<p>The code also automatically looks up for named Windows SDK constants, such as <a href="http://msdn.microsoft.com/en-us/library/dd316594%28v=vs.85%29.aspx">PKEY_Device_FriendlyName</a>:</p>
<pre>Â Â Â  IdentifierÂ Â  Â {0.0.1.00000000}.{4c1a7642-3f91-43e5-8fcf-b4b1e803d3f9}
Â Â  Â StateÂ Â  Â DEVICE_STATE_DISABLEDÂ Â  Â 0x02
Â Â  Â Properties:
Â Â  Â Â Â  Â {B3F8FA53-0004-438E-9003-51A46E139BFC}, 15Â Â  Â 16 bytes of BLOB, DA 07 03 00 02 00 09 00 0E 00 39 00 16 00 C5 02Â Â  Â 65
Â Â  Â Â Â  Â PKEY_Device_DeviceDescÂ Â  Â Stereo MixÂ Â  Â 31
Â Â  Â Â Â  Â {B3F8FA53-0004-438E-9003-51A46E139BFC}, 6Â Â  Â Realtek High Definition AudioÂ Â  Â 31
Â Â  Â Â Â  Â {B3F8FA53-0004-438E-9003-51A46E139BFC}, 2Â Â  Â {1}.HDAUDIO\FUNC_01&amp;VEN_10EC&amp;DEV_0888&amp;SUBSYS_80860034&amp;REV_1002\4&amp;37D44F2F&amp;0&amp;0201Â Â  Â 31
Â Â  Â Â Â  Â {83DA6326-97A6-4088-9453-A1923F573B29}, 3Â Â  Â oem29.inf:AzaliaManufacturerID.NTamd64.6.0:IntcAzAudModel:6.0.1.5964:hdaudio\func_01&amp;ven_10ec&amp;dev_0888Â Â  Â 31
Â Â  Â Â Â  Â PKEY_Device_BaseContainerIdÂ Â  Â {00000000-0000-0000-FFFF-FFFFFFFFFFFF}Â Â  Â 72
Â Â  Â Â Â  Â PKEY_Device_ContainerIdÂ Â  Â {00000000-0000-0000-FFFF-FFFFFFFFFFFF}Â Â  Â 72
Â Â  Â Â Â  Â PKEY_Device_EnumeratorNameÂ Â  Â HDAUDIOÂ Â  Â 31
Â Â  Â Â Â  Â PKEY_AudioEndpoint_FormFactorÂ Â  Â 10Â Â  Â 19
Â Â  Â Â Â  Â PKEY_AudioEndpoint_JackSubTypeÂ Â  Â {DFF21FE1-F70F-11D0-B917-00A0C9223196}Â Â  Â 31
Â Â  Â Â Â  Â PKEY_DeviceClass_IconPathÂ Â  Â %windir%\system32\mmres.dll,-3018Â Â  Â 31
Â Â  Â Â Â  Â {840B8171-B0AD-410F-8581-CCCC0382CFEF}, 0Â Â  Â 316 bytes of BLOB, 01 00 00 00 38 01 00 00 ... 00 00 00 00Â Â  Â 65
Â Â  Â Â Â  Â PKEY_AudioEndpoint_AssociationÂ Â  Â {00000000-0000-0000-0000-000000000000}Â Â  Â 31
Â Â  Â Â Â  Â PKEY_AudioEndpoint_Supports_EventDriven_ModeÂ Â  Â 1Â Â  Â 19
Â Â  Â Â Â  Â {24DBB0FC-9311-4B3D-9CF0-18FF155639D4}, 3Â Â  Â 0Â Â  Â 11
Â Â  Â Â Â  Â {24DBB0FC-9311-4B3D-9CF0-18FF155639D4}, 4Â Â  Â -1Â Â  Â 11
Â Â  Â Â Â  Â {9A82A7DB-3EBB-41B4-83BA-18B7311718FC}, 1Â Â  Â 65536Â Â  Â 19
Â Â  Â Â Â  Â {233164C8-1B2C-4C7D-BC68-B671687A2567}, 1Â Â  Â {2}.\\?\hdaudio#func_01&amp;ven_10ec&amp;dev_0888&amp;subsys_80860034&amp;rev_1002#4&amp;37d44f2f&amp;0&amp;0201#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\rtstereomixwaveÂ Â  Â 31
Â Â  Â Â Â  Â {5A9125B7-F367-4924-ACE2-0803A4A3A471}, 0Â Â  Â 1610612916Â Â  Â 19
Â Â  Â Â Â  Â {B3F8FA53-0004-438E-9003-51A46E139BFC}, 0Â Â  Â 3Â Â  Â 19
<span style="color: #3366ff;"><strong>Â Â  Â Â Â  Â PKEY_Device_FriendlyNameÂ Â  Â Stereo Mix (Realtek High Definition Audio)Â Â  Â 31</strong></span>
Â Â  Â Â Â  Â PKEY_DeviceInterface_FriendlyNameÂ Â  Â Realtek High Definition AudioÂ Â  Â 31
Â Â  Â Â Â  Â PKEY_AudioEndpoint_GUIDÂ Â  Â {4C1A7642-3F91-43E5-8FCF-B4B1E803D3F9}Â Â  Â 31</pre>
<p>A binary [<a href="http://www.alax.info/svn/public/trunk/Utilities/EnumerateAudioDevices/_Bin/Win32/Release/EnumerateAudioDevices.exe">Win32</a>, <a href="http://www.alax.info/svn/public/trunk/Utilities/EnumerateAudioDevices/_Bin/x64/Release/EnumerateAudioDevices.exe">x64</a>] and partial Visual C++ .NET 2010 <a href="http://www.alax.info/trac/public/browser/trunk/Utilities/EnumerateAudioDevices">source code</a> are available from SVN.</p>
<p>See also:</p>
<ul>
<li><a href="http://blogs.msdn.com/b/matthew_van_eerde/archive/2011/06/13/how-to-enumerate-audio-endpoint-immdevice-properties-on-your-system.aspx">A similar tool with source code</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd371400%28v=VS.85%29.aspx">IMMDeviceEnumerator::EnumAudioEndpoints</a> on MSDN</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1279/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utility Clearance: Generate PCM .WAV File</title>
		<link>http://alax.info/blog/1274</link>
		<comments>http://alax.info/blog/1274#comments</comments>
		<pubDate>Thu, 25 Aug 2011 20:48:13 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[.WAV]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[dB]]></category>
		<category><![CDATA[generation]]></category>
		<category><![CDATA[Loudness]]></category>
		<category><![CDATA[PCM]]></category>
		<category><![CDATA[sine]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[wavdest]]></category>
		<category><![CDATA[waveform]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1274</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1274" title="Utility Clearance: Generate PCM .WAV File"></a>GeneratePcmWavFile tool is generating PCM .WAV files with requested parameters, silent or with a sine wave data. The utility uses WavDest SDK Sample as a multiplexer, so it is expected to be available. It is possible to define the following &#8230;<p class="read-more"><a href="http://alax.info/blog/1274">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1274" title="Utility Clearance: Generate PCM .WAV File"></a><p>GeneratePcmWavFile tool is generating PCM .WAV files with requested parameters, silent or with a sine wave data. The utility uses <a href="http://msdn.microsoft.com/en-us/library/dd390969%28v=vs.85%29.aspx">WavDest SDK Sample</a> as a multiplexer, so it is expected to be available.</p>
<p>It is possible to define the following audio data parameters:</p>
<ul>
<li>sampling frequency, number of samples per second, such as 44100 or 48000</li>
<li>number of channels; the utility does not constrain this to be stereo or 5.1, it will be able to create 64 or 128 channel audio data as well</li>
<li>8 or 16 bit audio samples</li>
<ul>
<li>16-bit PCM only: sine wave signal parameters, frequency in Hz and amplitude/loudness relative to full scale, that is 0 dB is maximal loudness, and an argument of 23 will result in -23 dB loud audio (such as -23 dbFS, also see <a href="http://tech.ebu.ch/loudness">EBU R128 Specification</a>, the signal depending on frequency may be used a reference source for normalized -23 LUFS audio)</li>
</ul>
<li>file duration in seconds</li>
</ul>
<pre>Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.Â  All rights reserved.

C:\&gt;GeneratePcmWavFile.exe
Syntax: GeneratePcmWavFile &lt;options&gt; &lt;output-path&gt;
Â  /s:N: Sampling Rate N, Hz
Â  /c:N: Channel Count N
Â  /b:N: Sample Bit Count N, 8 or 16
Â  /t:N: Length N, seconds
Â  /f:N: Sine Signal Frequency N, Hz
Â  /l:N: Sine Signal Loudness N, dB below full scale
  /n:N: Noise Signal Loudness N, dB below full scale</pre>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/08/Image0011.png"><img class="alignnone size-medium wp-image-1275" title="-23 dBFS Generated Audio Playback" src="http://alax.info/blog/wp-content/uploads/2011/08/Image0011-320x248.png" alt="" width="320" height="248" /></a></p>
<p>A binary [<a href="http://alax.info/trac/public/browser/trunk/Utilities/GeneratePcmWavFile/Win32/Release/GeneratePcmWavFile.exe?format=raw">Win32</a>] and partial Visual C++ .NET 2010 <a href="http://alax.info/trac/public/browser/trunk/Utilities/GeneratePcmWavFile">source code</a> are available from SVN.</p>
<p>UPDATE: An extra /n parameter lets the application add random noise within provided loudness parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1274/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adobe Flash Media Live Encoder 3.1</title>
		<link>http://alax.info/blog/1138</link>
		<comments>http://alax.info/blog/1138#comments</comments>
		<pubDate>Sat, 24 Jul 2010 08:02:59 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[crap]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[FMLE]]></category>
		<category><![CDATA[garbage]]></category>
		<category><![CDATA[media]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1138</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1138" title="Adobe Flash Media Live Encoder 3.1"></a>It is the first time ever &#8211; because probably I am not as experienced as Geraint &#8211; I witness availability of IMediaSample interface without availability of IMediaSample2. One might be curious what kind of software could provide such a weirdo &#8230;<p class="read-more"><a href="http://alax.info/blog/1138">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1138" title="Adobe Flash Media Live Encoder 3.1"></a><p>It is the first time ever &#8211; because probably I am not as experienced as <a href="http://www.gdcl.co.uk/">Geraint</a> &#8211; I witness availability of <a href="http://msdn.microsoft.com/en-us/library/dd407001%28VS.85%29.aspx">IMediaSample</a> interface without availability of <a href="http://msdn.microsoft.com/en-us/library/dd407002%28VS.85%29.aspx">IMediaSample2</a>. One might be curious what kind of software could provide such a weirdo in 2010? It is latest and greatest <a href="http://www.adobe.com/products/flashmediaserver/flashmediaencoder/">Adobe Flash Media Live Encoder 3.1</a>.</p>
<p>Additionally to this, they decided to provide garbage in <a href="http://msdn.microsoft.com/en-us/library/dd373477%28VS.85%29.aspx">AM_MEDIA_TYPE</a>::formattype field of <a href="http://msdn.microsoft.com/en-us/library/dd319788%28VS.85%29.aspx">IAMStreamConfig::SetFormat</a>. They perhaps learned that standard <a href="http://msdn.microsoft.com/en-us/library/dd317587%28VS.85%29.aspx">Audio Capture Filter</a> will ignore it anyway, so why bother then?</p>
<p>Having fixed that, <a href="http://alax.info/blog/859">Tone Source Filter</a> based virtual audio device is now compatible with <a href="http://www.adobe.com/products/flashmediaserver/flashmediaencoder/">Adobe Flash Media Live Encoder 3.1</a> and it is possible to send audio to remote Flash Media Server, e.g. such as <a href="http://www.ustream.tv/">Ustream.tv</a> service (over <a href="http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol">RTMP protocol</a>, as implemented by FMLE).</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2010/07/24-Image002.png"><img class="alignnone size-medium wp-image-1143" title="24-Image002" src="http://alax.info/blog/wp-content/uploads/2010/07/24-Image002-320x240.png" alt="24-Image002" width="320" height="240" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1138/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Audio Oscillogram DirectShow Filter</title>
		<link>http://alax.info/blog/1033</link>
		<comments>http://alax.info/blog/1033#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:01:32 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Media Tools]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[mediatools]]></category>
		<category><![CDATA[visual]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1033</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1033" title="Audio Oscillogram DirectShow Filter"></a>Unlike video, audio is difficult to troubleshoot in a way that once an issue has been noticed it was dynamic and already in past and it may be difficult to repeat, explain, forward as a screenshot etc. So it needs &#8230;<p class="read-more"><a href="http://alax.info/blog/1033">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1033" title="Audio Oscillogram DirectShow Filter"></a><p>Unlike video, audio is difficult to troubleshoot in a way that once an issue has been noticed it was dynamic and already in past and it may be difficult to repeat, explain, forward as a screenshot etc. So it needs a visualization in order to check certain specific of the media stream.</p>
<p>Here we go with a Audio Oscillogram Filter, a filter which may be inserted into audio part of the graph, it insists on PCM audio (multichannel is OK, 8 or 16 bits per sample), so decoders might be required upstream and will be automatically inserted.</p>
<p>Once the filter is running, it shows a tool window with a visualization of the waveform coming through. Additionally, it shows a discontinuity sample (that is, a sample with <a href="http://msdn.microsoft.com/en-us/library/dd373500%28VS.85%29.aspx">AM_SAMPLE_DATADISCONTINUITY</a> flag)  with a thick read vertical line, and a mismatch (gap or override) in neighboring sample start and stop times with a thin red line.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/09/18-image001.png"><img class="alignnone size-medium wp-image-1034" title="Alax.Info Audio Oscillogram Filter" src="http://alax.info/blog/wp-content/uploads/2009/09/18-image001-320x193.png" alt="Alax.Info Audio Oscillogram Filter" width="320" height="193" /></a></p>
<p>Additionally to this, a window provides an option to pop up downstream audio renderer property sheet in order to check/debug rendering statistics, such as buffer fullness and break count (programmatically available via <a href="http://msdn.microsoft.com/en-us/library/dd389140%28VS.85%29.aspx">IAMAudioRendererStats</a> interface). Unfortunately Microsoft does not provide a well done proxy/stub pair for this interface and the property page and there is no way to access this property page connecting to graph remotely. Using this filter the property sheet is shown directly from the hosting process and works correctly.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/09/20-image001.png"><img class="alignnone size-medium wp-image-1042" title="Audio Renderer Properties" src="http://alax.info/blog/wp-content/uploads/2009/09/20-image001-320x231.png" alt="Audio Renderer Properties" width="320" height="231" /></a></p>
<p>A partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/MediaTools/Utility">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/MediaTools/_Bin/Release%20Trace/Utility.dll?format=raw">included</a>.</p>
<h2>File and Class Summary</h2>
<h3>Utility.dll</h3>
<p>Utility.dll (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/MediaTools/_Bin/Release%20Trace/Utility.dll?format=raw">download</a>) hosts the following classes:</p>
<ul>
<li>DirectShow Filters
<ul>
<li><span style="text-decoration: underline;">Audio Oscillogram Filter</span>, to visualize/debug audio data</li>
</ul>
</li>
</ul>
<h2>Class Overview</h2>
<h3>Audio Oscillogram Filter</h3>
<p>The filter visualizes PCM audio data going through in a form of oscillogram.</p>
<ul>
<li>Filter Executable: Utility.dll</li>
<li>Filter CLSID: __uuidof(PcmAudioOscillogramFilter) {1450C047-C394-469e-BBB6-A1F949B893FA}</li>
<li>Filter Property Page CLSID: N/A</li>
<li>Filter Merit: <a href="http://msdn.microsoft.com/en-us/library/ms787275%28VS.85%29.aspx">MERIT_DO_NOT_USE</a></li>
<li>Filter Category: <a href="http://msdn.microsoft.com/en-us/library/ms783347%28VS.85%29.aspx">CLSID_LegacyAmFilterCategory</a></li>
<li>Filter Interfaces: <a href="http://msdn.microsoft.com/en-us/library/ms682273%28VS.85%29.aspx">IPersistStreamInit</a>, <a href="http://msdn.microsoft.com/en-us/library/ms690091%28VS.85%29.aspx">IPersistStream</a>, <a href="http://msdn.microsoft.com/en-us/library/ms784601%28VS.85%29.aspx">IBaseFilter</a>, <a href="http://msdn.microsoft.com/en-us/library/ms785914%28VS.85%29.aspx">IMediaFilter</a>, <a href="http://msdn.microsoft.com/en-us/library/ms688695%28VS.85%29.aspx">IPersist</a>, <a href="http://msdn.microsoft.com/en-us/library/ms784083%28VS.85%29.aspx">IAMovieSetup</a>, <a href="http://msdn.microsoft.com/en-us/library/ms783950%28VS.85%29.aspx">IAMFilterMiscFlags</a>, IPcmAudioOscillogramFilter, <a href="http://msdn.microsoft.com/en-us/library/ms221608.aspx">IDispatch</a></li>
<li>Filter Pins: single input pin (Input), single ouput pin (Ouput)</li>
<li>Input Pin Media Types: MEDIATYPE_Audio/MEDIASUBTYPE_PCM</li>
<li>Input Pin Interfaces: <a href="http://msdn.microsoft.com/en-us/library/ms786565%28VS.85%29.aspx">IPin</a>, <a href="http://msdn.microsoft.com/en-us/library/ms786054%28VS.85%29.aspx">IMemInputPin</a></li>
<li>Output Pin Media Types: MEDIATYPE_Audio/MEDIASUBTYPE_PCM</li>
<li>Output Pin Interfaces: <a href="http://msdn.microsoft.com/en-us/library/ms786565%28VS.85%29.aspx">IPin</a></li>
</ul>
<h4>Remarks</h4>
<p>The filter will create a tool window with audio visualization when put into paused/running state. The filter graph should be controlled (IMediaControl) from a GUI aware apartment so that window messages could reach internal filter&#8217;s window.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1033/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows Media Codec List</title>
		<link>http://alax.info/blog/1025</link>
		<comments>http://alax.info/blog/1025#comments</comments>
		<pubDate>Fri, 28 Aug 2009 16:58:47 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[WTL]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[windows media]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1025</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1025" title="Windows Media Codec List"></a>Windows Media Codec List utility uses IWMCodecInfo interface (see also IWMCodecInfo2, IWMCodecInfo3) lists installed Windows Media Codecs and their formats and presents the findings in a convenient way. The utility gives a quick idea what a programmer would obtain through &#8230;<p class="read-more"><a href="http://alax.info/blog/1025">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1025" title="Windows Media Codec List"></a><p>Windows Media Codec List utility uses <a href="http://msdn.microsoft.com/en-us/library/dd743313%28VS.85%29.aspx">IWMCodecInfo</a> interface (see also <a href="http://msdn.microsoft.com/en-us/library/dd743314(VS.85).aspx">IWMCodecInfo2</a>, <a href="http://msdn.microsoft.com/en-us/library/dd743317(VS.85).aspx">IWMCodecInfo3</a>) lists installed <a href="http://www.microsoft.com/windows/windowsmedia/default.mspx">Windows Media</a> Codecs and their formats and presents the findings in a convenient way. The utility gives a quick idea what a programmer would obtain through <a href="http://msdn.microsoft.com/en-us/library/dd743314(VS.85).aspx">IWMCodecInfo2</a>/<a href="http://msdn.microsoft.com/en-us/library/dd743317(VS.85).aspx">IWMCodecInfo3</a> interfaces and what well known format structures (<a href="http://msdn.microsoft.com/en-us/library/dd757963%28VS.85%29.aspx">WM_MEDIA_TYPE</a>, <a href="http://msdn.microsoft.com/en-us/library/dd373477%28VS.85%29.aspx">AM_MEDIA_TYPE</a>, <a href="http://msdn.microsoft.com/en-us/library/dd757720%28VS.85%29.aspx">WAVEFORMATEX</a>, <a href="http://msdn.microsoft.com/en-us/library/dd407325%28VS.85%29.aspx">VIDEOINFOHEADER</a>) correspond to particular format.</p>
<p>For a description of Windows Media video and audio codecs, check article <a href="http://www.microsoft.com/windows/windowsmedia/howto/articles/codecs.aspx">Encoding Audio and Video with Windows Media Codecs</a>.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/08/28-image001.png"><img class="size-medium wp-image-1024 alignnone" title="Windows Media Codec List Screenshot" src="http://alax.info/blog/wp-content/uploads/2009/08/28-image001-320x171.png" alt="Windows Media Codec List Screenshot" width="320" height="171" /></a></p>
<p>Copy button copies discovered information into clipboard in comma-separated values (CSV) format (e.g. suitable fo rMicrosoft Excel). Submit button posts the same information to this website for&#8230; possibly further aggregation.</p>
<p>Some quick facts immediately visualized by the utility:</p>
<ul>
<li>for a video codec there is exactly one generic codec format listed</li>
<li>video codec FOUCCs are: WM Video &#8211; WMV1, WMV2, WMV3; WM Video Screen &#8211; MSS1, MSS2; WM Video Image &#8211; WMVP, WVP2; WM Video Advanced Profile &#8211; WVC1</li>
<li>for audio codecs there are complete codec formats enumerated, with names/descriptions suitable for GUI</li>
<li>audio codecs enumerate different formats in response to enumeration settings (e.g. request for VBR formats)</li>
<li>WM Audio Lossless only lists formats for single pass VBR mode</li>
<li>audio format tags (wFormatTag) are: WM Audio including Professional and Lossless &#8211; 0&#215;0161, 0&#215;0162, 0&#215;0163; WM Audio Voice &#8211; 0x000A; ACELP.net &#8211; 0&#215;0130</li>
</ul>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/WindowsMediaCodecList">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/WindowsMediaCodecList/Release/WindowsMediaCodecList.exe?format=raw">included</a>.</p>
<p><span id="more-1025"></span>See also:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/VC-1">VC-1 on Wikipedia</a>:</li>
<li>
<blockquote><p><strong>WMV3</strong></p>
<p>Simple and Main Profiles of VC-1 remained completely faithful to the existing WMV3 implementation, making WMV3 bitstreams fully VC-1 compliant. The WMV3 codec was designed to primarily support progressive encoding for computer displays. An interlaced encoding mode was implemented, but quickly became deprecated when Microsoft started implementing WMV Advanced Profile. Whereas WMV3 progressive encoding was implemented in the YUV 4:2:0 color space, the deprecated interlaced mode was implemented in the less common YUV 4:1:1 color space.</p>
<p>The Windows Media Video 9 (WMV3) codec implements the Simple and Main modes of the VC-1 codec standard, providing high-quality video for streaming and downloading. &#8220;It provides support for a wide range of bit rates, from high-definition content at one-half to one-third the bit rate of MPEG-2, to low-bit-rate Internet video delivered over a dial-up modem. This codec also supports professional-quality downloadable video with two-pass and variable bit rate (VBR) encoding. Windows Media Video 9 is already supported by a wide variety of players and devices.&#8221;[citation needed]</p>
<p>A number of high definition movies and videos have been released commercially in a format dubbed WMV HD. These titles are encoded with WMV3 Main Profile @ High Level (MP@HL).</p>
<p>[...]</p>
<p><strong>WVC1</strong></p>
<p>WVC1, also known as Windows Media Video 9 Advanced Profile, implements a more recent and fully compliant Advanced Profile of the VC-1 codec standard. It offers support for interlaced content and is transport independent. With the previous version of the Windows Media Video 9 Series codec, users could deliver progressive content at data rates as low as one-third that of the MPEG-2 codec and still get equivalent or comparable quality to MPEG-2. The Windows Media Video 9 Advanced Profile codec also offers this same improvement in encoding efficiency with interlaced contents. A decoder for WVC1 is included in Windows Media Player 11, which is bundled with Windows Vista and is <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=1d224714-e238-4e45-8668-5166114010ca">available as a download for Windows XP</a>.</p></blockquote>
</li>
<li><a href="http://en.wikipedia.org/wiki/Windows_Media_Audio">Windows Media Audio on Wikipedia</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1025/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Confusing AUDIO_STREAM_CONFIG_CAPS</title>
		<link>http://alax.info/blog/849</link>
		<comments>http://alax.info/blog/849#comments</comments>
		<pubDate>Sat, 21 Feb 2009 14:06:13 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Seriously]]></category>
		<category><![CDATA[crap]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[realtek]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=849</guid>
		<description><![CDATA[<a href="http://alax.info/blog/849" title="Confusing AUDIO_STREAM_CONFIG_CAPS"></a>I don&#8217;t have any idea who makes software nowadays, but how can it expected to be reliable? Intel DG33FBC motherboard, onboard Realtek ALC888 High Definition Audio. I am tracing AUDIO_STREAM_CONFIG_CAPS capabilities reported by onboard audio capture board, one of them: &#8230;<p class="read-more"><a href="http://alax.info/blog/849">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/849" title="Confusing AUDIO_STREAM_CONFIG_CAPS"></a><p>I don&#8217;t have any idea who makes software nowadays, but how can it expected to be reliable?</p>
<p><a href="http://www.intel.com/Products/Desktop/Motherboards/DG33FB/DG33FB-overview.htm">Intel DG33FBC motherboard</a>, onboard Realtek ALC888 High Definition Audio. I am tracing <a href="http://msdn.microsoft.com/en-us/library/dd317597(VS.85).aspx">AUDIO_STREAM_CONFIG_CAPS</a> capabilities reported by onboard audio capture board, one of them:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/dd373477(VS.85).aspx">AM_MEDIA_TYPE</a>:</p>
<pre>majortype {73647561-0000-0010-8000-00AA00389B71}, subtype {00000001-0000-0010-8000-00AA00389B71}, pUnk 0x00000000
bFixedSizeSamples 1, bTemporalCompression 0, lSampleSize 4
formattype {05589F81-C356-11CE-BF01-00AA0055595A}, cbFormat 18, pbFormat 0x002911a8
pbFormat as <a href="http://msdn.microsoft.com/en-us/library/ms713497(VS.85).aspx">WAVEFORMATEX</a>:
  wFormatTag 1
  nChannels 2
<span style="color: #0000ff;"><strong>  nSamplesPerSec 8000</strong>
</span>  nAvgBytesPerSec 32000
  nBlockAlign 4
  wBitsPerSample 16
  cbSize 0</pre>
<p><a href="http://msdn.microsoft.com/en-us/library/dd317597(VS.85).aspx">AUDIO_STREAM_CONFIG_CAPS</a>:</p>
<pre>guid {73647561-0000-0010-8000-00AA00389B71}
MinimumChannels 1, MaximumChannels 2, ChannelsGranularity 1
MinimumBitsPerSample 8, MaximumBitsPerSample 16, BitsPerSampleGranularity 8
<strong><span style="color: #ff0000;">MinimumSampleFrequency 11025, MaximumSampleFrequency 44100, SampleFrequencyGranularity 11025</span></strong></pre>
<p>Media type sampling frequency is 8 KHz (correct) but associated capabilities structure still report different sampling rates and granularity (crap), it is in fact 11025..44100 Hz for all capabilities, including those with sampling frequencies from a different row.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/849/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multichannel audio recording</title>
		<link>http://alax.info/blog/724</link>
		<comments>http://alax.info/blog/724#comments</comments>
		<pubDate>Tue, 02 Dec 2008 20:37:09 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[multichannel]]></category>
		<category><![CDATA[PCM]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=724</guid>
		<description><![CDATA[<a href="http://alax.info/blog/724" title="Multichannel audio recording"></a>There has been recently an interesting post &#8220;Problem playing back multi-channel wave file under vista&#8221; on DirectShow Development forum about certain hardware that is capable of recording 64 channels of audio in 24-bit per sample PCM quality, with a sample &#8230;<p class="read-more"><a href="http://alax.info/blog/724">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/724" title="Multichannel audio recording"></a><p>There has been recently an interesting post &#8220;<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4175797&amp;SiteID=1"><span id="_ctl0_MainContent_PostFlatView"><span id="_ctl0_MainContent_PostFlatView__ctl0_PostSubject" class="forumName">Problem playing back multi-channel wave file under vista</span></span></a>&#8221; on <a href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=129&amp;SiteID=1">DirectShow Development forum</a> about certain hardware that is capable of recording 64 channels of audio in 24-bit per sample <a href="http://en.wikipedia.org/wiki/Pulse-code_modulation">PCM</a> quality, with a sample recorded .WAV file posted.</p>
<p>I was curious what kind of hardware implements such recording. Google suggests it could be <a href="http://www.sadie.com/products/pcm-h64/main.php">PCM H64 multichannel system</a> from <a href="http://www.sadie.com/sadie_home.php">Sadie, UK</a>.</p>
<p>This is definitely an interesting piece of hardware which can fill normally video&#8217;s bandwidth with audio only data. BTW, some <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/Play64ChannelWaveFile">useful related C++/DirectShow code is here</a> on new Assembla&#8217;s web itnerface into subversion repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/724/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DirectSound play buffer notification (IDirectSoundNotify8)</title>
		<link>http://alax.info/blog/682</link>
		<comments>http://alax.info/blog/682#comments</comments>
		<pubDate>Tue, 11 Nov 2008 07:49:30 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[DirectSound]]></category>
		<category><![CDATA[DirectX]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=682</guid>
		<description><![CDATA[<a href="http://alax.info/blog/682" title="DirectSound play buffer notification (IDirectSoundNotify8)"></a>IDirectSoundNotify8 is an interface to get notified on playback on capture audio buffer reaching certain position in the buffer. It is a must thing when implementing ring buffers with new data continuously added to the buffer for seamless playback (continuously &#8230;<p class="read-more"><a href="http://alax.info/blog/682">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/682" title="DirectSound play buffer notification (IDirectSoundNotify8)"></a><p><a href="http://msdn.microsoft.com/en-us/library/bb174483(VS.85).aspx">IDirectSoundNotify8</a> is an interface to get notified on playback on capture audio buffer reaching certain position in the buffer. It is a must thing when implementing ring buffers with new data continuously added to the buffer for seamless playback (continuously copied from in case of capture).</p>
<p>This project is a minimalistic C++ sample code to illustrate the API. To initialize the DirectSound subsystem it is required to provide a window handle, which is created using ATL&#8217;s <a href="http://msdn.microsoft.com/en-us/library/h4616bh2.aspx">CWindowImpl</a> (CMessageOnlyWindowImpl).</p>
<pre>...
ATLENSURE_SUCCEEDED(DirectSoundCreate8(NULL, &amp;pDirectSound8, NULL));
...
ATLENSURE_SUCCEEDED(pDirectSound8-&gt;SetCooperativeLevel(Window, DSSCL_PRIORITY));
...
ATLENSURE_SUCCEEDED(pDirectSound8-&gt;CreateSoundBuffer(&amp;BufferDescriptor, &amp;pDirectSoundBuffer, NULL));
...
CComQIPtr&lt;IDirectSoundNotify8, &amp;IID_IDirectSoundNotify8&gt; pDirectSoundNotify8 = pDirectSoundBuffer;
...
ATLENSURE_SUCCEEDED(pDirectSoundNotify8-&gt;SetNotificationPositions(g_nPositionCount, pPositionNotify));
ATLENSURE_SUCCEEDED(pDirectSoundBuffer-&gt;Play(0, 0, DSBPLAY_LOOPING));</pre>
<p><span id="more-682"></span></p>
<p>Application output:</p>
<pre>BufferDescriptor.dwBufferBytes 128000
g_nPositionCount 8
pPositionNotify[0].dwOffset 15999
pPositionNotify[1].dwOffset 31999
pPositionNotify[2].dwOffset 47999
pPositionNotify[3].dwOffset 63999
pPositionNotify[4].dwOffset 79999
pPositionNotify[5].dwOffset 95999
pPositionNotify[6].dwOffset 111999
pPositionNotify[7].dwOffset 127999
nWaitResult 0
nWaitResult 1
nWaitResult 2
nWaitResult 3
nWaitResult 4
nWaitResult 5
nWaitResult 6
nWaitResult 7
nWaitResult 0
nWaitResult 1
nWaitResult 2
nWaitResult 3
nWaitResult 4
nWaitResult 5
nWaitResult 6
nWaitResult 7</pre>
<p>A Visual C++ .NET 2008 source code <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/DirectSoundNotifySample01">is available from SVN</a>.</p>
<p>See Also:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/bb219693(VS.85).aspx">DirectSoundCreate8</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/bb174483(VS.85).aspx">IDirectSoundNotify8</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/682/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FFDShow is getting more annoying</title>
		<link>http://alax.info/blog/398</link>
		<comments>http://alax.info/blog/398#comments</comments>
		<pubDate>Fri, 27 Jun 2008 04:02:05 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Seriously]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[ffdshow]]></category>
		<category><![CDATA[merit]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=398</guid>
		<description><![CDATA[<a href="http://alax.info/blog/398" title="FFDShow is getting more annoying"></a>Surprisingly fast I got new problems having ffdshow installed as a part of K-Lite Codec Pack. No wonder though because let us take a look at registration information: Display Name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{0F40E1E5-4F79-4988-B1A9-CC98794E6B55} CLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55} Friendly Name: ffdshow Audio Decoder Path: C:\Program &#8230;<p class="read-more"><a href="http://alax.info/blog/398">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/398" title="FFDShow is getting more annoying"></a><p>Surprisingly fast I got new problems having <a href="http://sourceforge.net/projects/ffdshow">ffdshow</a> installed as a part of <a href="http://www.free-codecs.com/download/K_lite_codec_pack.htm">K-Lite Codec Pack</a>. No wonder though because let us take a look at registration information:</p>
<blockquote><p>Display Name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{0F40E1E5-4F79-4988-B1A9-CC98794E6B55}<br />
CLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55}<br />
Friendly Name: ffdshow Audio Decoder<br />
Path: C:\Program Files\K-Lite Codec Pack\ffdshow\ffdshow.ax<br />
<strong>Merit: 0x3fffffff</strong></p></blockquote>
<p>Nice merit, ain&#8217;t it? What is merit anyway? Let us check at <a href="http://msdn.microsoft.com/en-us/library/ms787275(VS.85).aspx">MSDN</a>:</p>
<blockquote><p>MERIT_PREFERRED     = 0&#215;800000,<br />
MERIT_NORMAL        = 0&#215;600000,<br />
&#8230;<br />
MERIT_HW_COMPRESSOR = 0&#215;100050</p></blockquote>
<p>The highest defined value is 0&#215;00800000, while ffdshow is registered with 0x3FFFFFFF, that is on top of everything. No doubt the developers read <a href="http://msdn.microsoft.com/en-us/library/ms783757(VS.85).aspx">Guidelines for Registering Filters</a> and decided to get rid of the rest of installed software as unnecessary crap.</p>
<p>Anyway back to the problem: I had an <a href="http://en.wikipedia.org/wiki/A-law_algorithm">A-law</a> wave file (WAVE_FORMAT_ALAW) to play and make sure its data is valid and quite unexpectedly there was a silence while playing. A quick check confirmed that the sustem has CCITT A-law codec installed, however GraphEdit shown ffdshow Audio Decoder intercepting decoding. Obviously it spoiled the thing!</p>
<p>Finally I decided it was a right time to take an advantage of <a href="http://msdn.microsoft.com/en-us/library/ms783952(VS.85).aspx">IAMGraphBuilderCallback</a> interface to detect and reject the bastard.</p>
<p><span id="more-398"></span></p>
<p>Luckily it is much easier than it may seem:</p>
<blockquote><p>CComQIPtr&lt; IObjectWithSite &gt; pObjectWithSite = pGraphBuilder;<br />
__D(pObjectWithSite, E_NOINTERFACE);<br />
CObjectPtr&lt; CAmGraphBuilderCallback &gt; pAmGraphBuilderCallback;<br />
pAmGraphBuilderCallback.Construct();<br />
__C(pObjectWithSite-&gt;SetSite(pAmGraphBuilderCallback));<br />
__C(pGraphBuilder-&gt;Render(_FilterGraphHelper::GetFilterPin(pSourceBaseFilter, PINDIR_OUTPUT)));<br />
__C(pObjectWithSite-&gt;SetSite(NULL));</p></blockquote>
<p>CAmGraphBuilderCallback is active between SetSite calls and it is sufficient to throw ffdshow Audio Decoder away.</p>
<p>Partial (some header files are excluded) Visual C++.NET 2005 source code can be downloaded <a href="http://alax.info/blog/wp-content/uploads/2008/06/rejectspecificdirectshowfilter01.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/398/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

