<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.1" -->
<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/"
	>

<channel>
	<title>Stanimir Stoyanov's Blog</title>
	<link>http://stoyanoff.info/blog</link>
	<description></description>
	<pubDate>Mon, 26 Jul 2010 13:19:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.1</generator>
	<language>en</language>
			<item>
		<title>Decoding FLAC audio files in C#</title>
		<link>http://stoyanoff.info/blog/2010/07/26/decoding-flac-audio-files-in-c/</link>
		<comments>http://stoyanoff.info/blog/2010/07/26/decoding-flac-audio-files-in-c/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 13:10:09 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Programming</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2010/07/26/decoding-flac-audio-files-in-c/</guid>
		<description><![CDATA[FlacReader + WavWriter
As a follow-up to my previous article on FLAC and encoding uncompressed audio, I have further developed the Wav2Flac library and added FLAC decoding to the WAVE container. Some key points of this aspect of the WavFlacTest library are:

Support for 16- and 24-bit audio streams 
Support for virtually all FLAC channel mappings: mono, [...]]]></description>
			<content:encoded><![CDATA[<h4>FlacReader + WavWriter</h4>
<p>As a follow-up to <a href="http://stoyanoff.info/blog/2010/01/08/encoding-uncompressed-audio-with-flac-in-c/" target="_blank">my previous article</a> on FLAC and encoding uncompressed audio, I have further developed the Wav2Flac library and added FLAC decoding to the WAVE container. Some key points of this aspect of the <strong>WavFlacTest</strong> library are:</p>
<ul>
<li>Support for <strong>16- </strong>and <strong>24-bit </strong>audio streams </li>
<li>Support for virtually all <a href="http://flac.sourceforge.net/" target="_blank">FLAC</a> channel mappings: <strong>mono</strong>,<strong> stereo</strong>,<strong> 5.1</strong>,<strong> 7.1</strong>, etc. </li>
<li>The resulting file is a <strong>bit-for-bit copy </strong>of the original audio stream
<ul>
<h6></h6>
</ul>
</li>
</ul>
<blockquote><p>All source code and the compiled 32-bit FLAC library can be downloaded from <a href="http://stoyanoff.info/code/wavflactest_src.zip">here</a>.</p>
</blockquote>
<h4>Known limitations</h4>
<ul>
<li>Due to the wave format used being 32-bit, uncompressed files greater than 2GB in size might not play in full in some players. </li>
<li>Even though FlacReader can receive metadata callbacks, the data is not interpreted. This can be further developed using the <a href="http://flac.sourceforge.net/api/group__flac__stream__decoder.html#ga14" target="_blank">FLAC API documentation</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2010/07/26/decoding-flac-audio-files-in-c/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Inline Tweet Translator</title>
		<link>http://stoyanoff.info/blog/2010/07/25/inline-tweet-translator/</link>
		<comments>http://stoyanoff.info/blog/2010/07/25/inline-tweet-translator/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 20:24:50 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Programming</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2010/07/25/inline-tweet-translator/</guid>
		<description><![CDATA[

One thing that popped in my mind yesterday after having a conversation over twitter (admittedly, a service I had rarely used until recently), is that the more followers you have, the higher the odds you would have to use other languages in addition to a lingua franca. This ‘leaves out’ other friends who could have [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
</blockquote>
<p><a href="http://stoyanoff.info/blog/wp-content/uploads/large1.png" rel="lightbox"><img style="border-right-width: 0px; display: block; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Translated tweet from @katyperry" border="0" alt="Translated tweet from @katyperry" src="http://stoyanoff.info/blog/wp-content/uploads/large1_thumb.png" width="151" height="87" /></a>One thing that popped in my mind yesterday after having a conversation over <a href="http://twitter.com" target="_blank">twitter</a> (admittedly, a service I had rarely used until recently), is that the more followers you have, the higher the odds you would have to use other languages in addition to a <em>lingua franca</em>. This ‘leaves out’ other friends who could have limited knowledge of foreign languages.</p>
<p>This is how the idea for the <strong><a href="http://userscripts.org/scripts/show/82241" target="_blank">Tweet Balloon Translator</a></strong> was born. It’s a <a href="https://addons.mozilla.org/firefox/addon/748" target="_blank">Greasemonkey</a> script for <a href="http://getfirefox.com" target="_blank">Firefox</a>, which uses the balloon/hover feature recently introduced in twitter plus the <a href="http://translate.google.com/" target="_blank">Google Translate service</a> to translate tweets quickly and inline.</p>
<blockquote><p>You can install the script from <a href="http://userscripts.org/scripts/show/82241" target="_blank"><strong>userscripts.org</strong></a><strong>&#160;</strong>or <a href="http://stoyanoff.info/code/tweet_translator.user.js" target="_blank"><strong>the local copy here</strong></a>.</p>
</blockquote>
<h4>Development notes</h4>
<p>The key phases I outlined for the script were as follows:</p>
<ol>
<li>Establish a working translation block of code using the <a href="http://code.google.com/apis/ajaxlanguage/documentation/#fonje" target="_blank">Google Translate JSON API</a> </li>
<li>Research the possibilities of inserting a <em>Translate </em>link in such aspects of twitter as the profile page, direct messages, retweets. The Guest/logged out user scenario also had to be taken into account as twitter serves the pages in a different manner. </li>
<li>Figure out a way to use the twitter internal API for the <strong>HoverCard </strong>balloon feature. This was probably the hardest of all three because of the way these are created and populated. </li>
<li>Integrate 1 through 3 in a single script. </li>
</ol>
<p>Needless to say, the script employs asynchronous requests to Google via the HTTPXMLRequest model so as to not break the UI thread, as well as exception handling.</p>
<p>Please feel free to try out, review, or contribute to the script at userscripts.org. I feel both international and English-speaking users could benefit from this by being able to communicate with more people on twitter, and understand international tweets.</p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2010/07/25/inline-tweet-translator/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Resizing forms while keeping aspect ratio</title>
		<link>http://stoyanoff.info/blog/2010/06/27/resizing-forms-while-keeping-aspect-ratio/</link>
		<comments>http://stoyanoff.info/blog/2010/06/27/resizing-forms-while-keeping-aspect-ratio/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 16:18:22 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Programming</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2010/06/27/resizing-forms-while-keeping-aspect-ratio/</guid>
		<description><![CDATA[Resizing a form while keeping aspect ratio is useful in many cases, like video playback or vector graphics. This way, the window can be resized while retaining the original ratio and avoiding the use of letterboxing or pillarboxing.
What’s needed is for the window function to be overriden (WndProc) and pre-process the target window rectangle used [...]]]></description>
			<content:encoded><![CDATA[<p>Resizing a form while keeping aspect ratio is useful in many cases, like video playback or vector graphics. This way, the window can be resized while retaining the original ratio and avoiding the use of <a href="http://en.wikipedia.org/wiki/Letterbox" target="_blank">letterboxing</a> or <a href="http://en.wikipedia.org/wiki/Pillarbox" target="_blank">pillarboxing</a>.</p>
<p>What’s needed is for the window function to be overriden (<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.wndproc(VS.71).aspx" target="_blank">WndProc</a>) and pre-process the target window rectangle used by the <a href="http://msdn.microsoft.com/en-us/library/ms632647(VS.85).aspx" target="_blank">WM_SIZING message</a>. </p>
<p>The new destination rectangle is calculated by taking into account the resizing handle and the window chrome size (title height, border width, etc.).</p>
<p><font face="courier new"><font color="#0000ff">protected override void</font> WndProc(<font color="#0000ff">ref</font> Message m)      <br />{      <br />&#160;&#160;&#160; <font color="#0000ff">if</font> (m.Msg == WM_SIZING)      <br />&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; RECT rc = (RECT)Marshal.PtrToStructure(m.LParam, <font color="#0000ff">typeof</font>(RECT)); </font></p>
<p><font face="courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">int</font> w = rc.Right - rc.Left - chromeWidth;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">int</font> h = rc.Bottom - rc.Top - chromeHeight; </font></p>
<p><font face="courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">switch</font> (m.WParam.ToInt32()) <font color="#008000">// Resize handle</font>      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</font></p>
<p><font color="#008000" face="courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // …</font></p>
<p><font face="courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </font></p>
<p><font face="courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Marshal.StructureToPtr(rc, m.LParam, <font color="#0000ff">true</font>);      <br />&#160;&#160;&#160; } </font></p>
<p><font face="courier new">&#160;&#160;&#160; <font color="#0000ff">base</font>.WndProc(<font color="#0000ff">ref</font> m);      <br />}</font></p>
<p>You can find the full C# source code <a href="http://stoyanoff.info/code/uniformresize.zip" target="_blank">here</a>, including a test program. The aspect ratio and initial client size is set to 16:9.</p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2010/06/27/resizing-forms-while-keeping-aspect-ratio/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Encoding uncompressed audio with FLAC in C#</title>
		<link>http://stoyanoff.info/blog/2010/01/08/encoding-uncompressed-audio-with-flac-in-c/</link>
		<comments>http://stoyanoff.info/blog/2010/01/08/encoding-uncompressed-audio-with-flac-in-c/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 20:22:29 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Programming</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2010/01/08/encoding-uncompressed-audio-with-flac-in-c/</guid>
		<description><![CDATA[Why lossless?
Lossless audio is used on various media, including studio masters, CD, DVD-Audio (via MLP) and Blu-ray (via Dolby TrueHD, which is technically a rebrand of and an extension to MLP, and DTS-HD Master Audio). All of these, when decoded, will result in a pulse-code modulated signal identical to the source, unlike the popular MP3 [...]]]></description>
			<content:encoded><![CDATA[<h4>Why lossless?</h4>
<p>Lossless audio is used on various media, including studio masters, CD, DVD-Audio (via <a href="http://en.wikipedia.org/wiki/Meridian_Lossless_Packing" target="_blank">MLP</a>) and Blu-ray (via <a href="http://en.wikipedia.org/wiki/Dolby_TrueHD" target="_blank">Dolby TrueHD</a>, which is technically a rebrand of and an extension to MLP, and <a href="http://www.dts.com/DTS_Audio_Formats/DTS-HD_Master_Audio.aspx" target="_blank">DTS-HD Master Audio</a>). All of these, when decoded, will result in a <strong>pulse-code modulated signal</strong> identical to the source, unlike the popular <a href="http://en.wikipedia.org/wiki/MP3" target="_blank">MP3</a> format. MP3 performs a quality-file size trade-off by discarding or reducing frequencies less audible to human hearing.</p>
<p><a href="http://en.wikipedia.org/wiki/Pulse-code_modulation" target="_blank">PCM</a> by design uses a constant bitrate, which is proportional to the <strong>sample rate</strong>, <strong>bit depth</strong> and <strong>number of audio channels</strong>, which results in very large file sizes with the increasing of each parameter, and/or duration of the audio track.</p>
<p>Solutions such as FLAC, TrueHD and DTS-HD MA are used to losslessly compress the source audio so that the rest of the medium (for example, a Blu-ray disc) can be used for more audio tracks, higher-bandwidth video or extras.</p>
<p>Out of the aforementioned, only FLAC is free to use—both TrueHD and DTS-HD MA encoders and decoders have to be licensed.</p>
<p>The first part of the series will explore the processing of uncompressed audio data with the <a href="http://flac.sourceforge.net/" target="_blank">FLAC</a> API in C#. In case you prefer to use Visual Basic .NET, you can use <a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/" target="_blank">this online converter</a>.</p>
<p><a id="more-94"></a></p>
<h4>Anatomy of a WAVE file</h4>
<p>In order to process a digital audio signal, we have to know three key parameters:</p>
<ul>
<li>The <strong>frequency</strong>, at which the signal was sampled. Usual sample rates are 44,100 Hz; 48,000 Hz, 96,000 Hz and rarely 192,000 Hz.
<li>The “<strong>depth</strong>” of each sample, measured in bits. The FLAC encoder supports up to 24 bits. Our C# WAVE reader will support 16 and 24 bits of audio data.
<li>The <strong>number of channels</strong>, which the recording consists of. This is usually mono, stereo (CD), 5.1 (DVD-Audio, Blu-ray) or 7.1 (Blu-ray). </li>
</ul>
<p>The most common container for PCM audio data is the WAVE file format. As noted above, PCM has a constant bitrate of</p>
<blockquote><p><font face="Courier New">SampleRate * BitDepth * Channels</font>,</p>
</blockquote>
<p>which makes it very easy to predict the size of each block of audio samples—a single second of audio data would be <strong><font face="Courier New">Bitrate / 8 bytes</font></strong> (8 bits in a byte)—e.g. 176.4KB for a second of CD-quality audio.</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="riff" border="0" alt="riff" src="http://stoyanoff.info/blog/wp-content/uploads/riff_thumb.png" width="308" height="300"></p>
</p>
<p>We can create the initialization method of the <font face="Courier New"><strong>WavReader</strong></font> class by starting with an input <font face="Courier New"><strong>Stream</strong></font> object. We have to ensure that there is enough available data for the wave format header, and check that the file is indeed a RIFF/WAVE file to avoid unnecessary reading and processing.</p>
<blockquote><p><font face="Courier New">uRiffHeader = reader.ReadInt32(); <br />uRiffHeaderSize = reader.ReadInt32(); <br />uWaveHeader = reader.ReadInt32(); </font></p>
<p><font face="Courier New">if (uRiffHeader != 0&#215;46464952 /* RIFF */ || <br />&nbsp;&nbsp;&nbsp; uWaveHeader != 0&#215;45564157 /* WAVE */) <br />&nbsp;&nbsp;&nbsp; throw new Exception(&#8221;Invalid WAVE header!&#8221;);</font></p>
</blockquote>
<p>&nbsp;</p>
<p>Right after the RIFF chunk there can be a number of <strong>JUNK</strong> (padding) chunks, which we can skip and <strong>data</strong> and <strong>fmt</strong> chunks, whose data we need.</p>
<p align="left"><font face="Courier New">// Read all WAVE chunks <br />while (reader.BaseStream.Position &lt; reader.BaseStream.Length) <br />{ <br />&nbsp;&nbsp;&nbsp; int type = reader.ReadInt32(); <br />&nbsp;&nbsp;&nbsp; int size = reader.ReadInt32(); </font></p>
<p align="left"><font face="Courier New">&nbsp;&nbsp;&nbsp; long last = reader.BaseStream.Position; </font></p>
<p align="left"><font face="Courier New">&nbsp;&nbsp;&nbsp; switch (type) <br />&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 0&#215;61746164: /* data */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uDataHeader = type; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nTotalAudioBytes = size; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; </font></p>
<p align="left"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 0&#215;20746d66: /* fmt&nbsp; */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uFmtHeader = type; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uFmtHeaderSize = size; </font></p>
<p align="left"><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.wFormatTag = reader.ReadInt16(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.nChannels = reader.ReadInt16(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.nSamplesPerSec = reader.ReadInt32(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.nAvgBytesPerSec = reader.ReadInt32(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.nBlockAlign = reader.ReadInt16(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.wBitsPerSample = reader.ReadInt16(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.cbSize = reader.ReadInt16(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br />&nbsp;&nbsp;&nbsp; } </font></p>
<p align="left"><font face="Courier New">&nbsp;&nbsp;&nbsp; if (uDataHeader == 0) // Do not skip the &#8216;data&#8217; chunk size <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.BaseStream.Position = last + size; <br />&nbsp;&nbsp;&nbsp; else <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br />}</font></p>
<p>Our <font face="Courier New"><strong>WavReader</strong></font> class only supports 16 and 24-bit PCM samples, so we have to ensure that format <font face="Courier New">format.wFormatTag</font> is 1 (PCM) and <font face="Courier New">format.wBitsPerSample ple</font> is either 16 or 24. These limitations can be further removed by implementing <strong>sample rate conversion</strong> on-the-fly.</p>
<p>After all headers are read, <font face="Courier New">nTotalAudioBytes</font> will contain the total count of audio data bytes in the WAVE file. To determine the duration of the audio file, we can simply divide it by the block size (<strong><font face="Courier New">Bitrate / 8 bytes</font></strong>).</p>
<p>The input stream will now be at the start of the audio samples. Every 16th or 24th bit (respectively, 2nd or 3rd byte) will mark the beginning of each sample. All audio samples are interleaved so the stream consists of:</p>
<blockquote><p><font face="Courier New">channel 0, sample 0</font></p>
<p><font face="Courier New">channel 1, sample 0</font></p>
<p><font face="Courier New">&#8230;</font></p>
<p><font face="Courier New">channel <em>n</em>, sample 0</font></p>
<p><font face="Courier New">channel 0, sample 1</font></p>
<p><font face="Courier New">&#8230;</font></p>
</blockquote>
<p>Now that we have reached the audio samples, we can start feeding them to FLAC.</p>
<h4>Free Lossless Audio Codec</h4>
<p><font face="Segoe UI"><font face="Segoe UI"></font></font><font face="Segoe UI"><font face="Segoe UI"></font></font></p>
<p></font></font><font face="Segoe UI"><font face="Segoe UI">
<p>The FLAC encoder is an open-source C/C++ project. In order to use it in a C# application we have to use <a href="http://msdn.microsoft.com/en-us/library/aa446536.aspx" target="_blank">PInvoke</a> to call its application programming interface—<strong>LibFlac.dll</strong>. The latest version of LibFlac can be found at <a title="http://sourceforge.net/projects/flac/files/flac-win/" href="http://sourceforge.net/projects/flac/files/flac-win/">http://sourceforge.net/projects/flac/files/flac-win/</a>.</p>
<p>When the encoder processes a block of audio samples, our callback functions will write the compressed data to the output stream.</p>
<p>In a nutshell, what our <font face="courier new">FlacWriter</font> class is going to do is:</p>
<ol>
<li>Create a new encoder instance.
<li>Set the three key parameters (sample rate, bits per sample,
<li>number of channels). </font>
<li><font face="Segoe UI"><font face="Segoe UI">Optionally set a compression level (default is 5).</font></font>
<li>Initialize the encoder by passing references to the callback functions (Write, Tell and Seek).
<li>Pass all (desired) audio samples to the encoder, which will return their compressed counterpart.
<li>Finalize and delete the encoder instance. This will release all memory allocated by FLAC. </font></li>
</ol>
<p><font face="Segoe UI"><font face="Segoe UI"><font face="Courier New">// Callbacks<br />[UnmanagedFunctionPointer(CallingConvention.Cdecl)]<br />delegate int WriteCallback(IntPtr context, IntPtr buffer, int bytes, uint samples, uint current_frame, IntPtr userData); </font></font></font></p>
<p><font face="Segoe UI"><font face="Segoe UI"><font face="Courier New">[UnmanagedFunctionPointer(CallingConvention.Cdecl)]<br />delegate int SeekCallback(IntPtr context, long absoluteOffset, IntPtr userData); </font></font></font></p>
<p><font face="Segoe UI"><font face="Segoe UI"><font face="Courier New">[UnmanagedFunctionPointer(CallingConvention.Cdecl)]<br />delegate int TellCallback(IntPtr context, out long absoluteOffset, IntPtr userData); </font></p>
<p>When a buffer of PCM samples has been read, we can pass it to <font face="courier new">FlacWriter</font>. Internally it has to pad all 16 or 24-bit sample to a 32-bit window (using <a href="http://en.wikipedia.org/wiki/Endianness#Little-endian" target="_blank"><font color="#444444">little-endian format</font></a>).</p>
<blockquote><p align="left"><font face="courier new">padded = new byte[buffer.Length * 8 / inputBitDepth];</font></p>
<p align="left"><font face="courier new">if (inputBitDepth == 16)<br />&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; paddedSamples; i++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; padded[i] = buffer[i * bytes + 1] &lt;&lt; 8 |<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer[i * bytes + 0]; </font></p>
<p align="left"><font face="courier new">else if (inputBitDepth == 24)<br />&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; paddedSamples; i++)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; padded[i] = buffer[i * bytes + 2] &lt;&lt; 16 |<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer[i * bytes + 1] &lt;&lt; 8 |<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer[i * bytes + 0];</font></p>
</blockquote>
<h4>Wav2Flac</h4>
<p>The main program will use a combination of <font face="courier new">WavReader</font> and <font face="courier new">FlacWriter </font>to perform the encoding of WAVE files. Because both classes implement the <font color="#444444" face="courier new"><a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx" target="_blank">IDisposable</a></font> interface, they close all input/output streams as well as the FLAC encoder instance when the <font color="#444444" face="courier new"><a href="http://msdn.microsoft.com/en-us/library/system.idisposable.dispose.aspx" target="_blank">Dispose()</a></font> method is called, or a <a href="http://msdn.microsoft.com/en-us/library/yh598w02.aspx" target="_blank"><font color="#444444">using</font></a> statement is used.</p>
<p></font><font face="courier new">using (WavReader wav = new WavReader(inputFile))<br />{<br />&nbsp;&nbsp;&nbsp; using (FlacWriter flac = new FlacWriter(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File.Create(outputFile),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wav.BitDepth,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wav.Channels,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wav.SampleRate))<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Buffer for 1 second&#8217;s worth of audio data<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] buffer = new byte[wav.Bitrate / 8];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int bytesRead;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bytesRead = wav.InputStream.Read(buffer, 0, buffer.Length);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flac.Write(buffer, 0, bytesRead);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } while (bytesRead &gt; 0); </font></p>
<p align="left"><font face="courier new">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Finished!<br />&nbsp;&nbsp;&nbsp; }<br />}</font></p>
<h4>Testing the program</h4>
<blockquote><p>All source code and the compiled 32-bit FLAC library can be downloaded from <a href="/code/wav2flac_src.zip" target="_blank">here</a>.</p>
</blockquote>
<p>The test program uses three sample WAVE files from the ‘<strong>wav</strong>’ folder and encodes them to ‘<strong>flac</strong>’. You can download the sample files from here, courtesy of <a href="http://www.2l.no/hires/index.html" target="_blank"><strong>2L</strong></a> (Username: <strong>HD&nbsp;&nbsp; </strong>Password: <strong>2L</strong>), and place them in ‘<strong>wav</strong>’:</p>
<ul>
<li>Britten: Simple Symphony, Op. 4 <a href="http://www.lindberg.no/hires/test/2L50SACD_tr1_96k_stereo.wav" target="_blank">96kHz/24-bit stereo sample</a>
<li>Britten: Simple Symphony, Op. 4 <a href="http://www.lindberg.no/hires/test/2L50SACD_tr01_multi_48.wav" target="_blank">48kHz/24-bit 5.1 surround sample</a>
<li>Haydn: String Quartet in D <a href="http://www.lindberg.no/hires/test/2L53SACD_04_stereo_96k.wav" target="_blank">96kHz/24-bit stereo sample</a></li>
</ul>
<p>The test program also uses the <a href="/blog/2010/01/05/cmd-progress-bar/" target="_blank">ConsoleProgress</a> class I have posted earlier.</p>
<p>The code can be further optimized and extended to support various other bit depths. The next part of the series will explore the decoding of DTS-HD Master Audio and its encoding using <font face="courier new">FlacWriter</font>.</p>
<p>I would appreciate any questions, suggestions or corrections!</p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2010/01/08/encoding-uncompressed-audio-with-flac-in-c/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Indicating progress in console windows</title>
		<link>http://stoyanoff.info/blog/2010/01/05/cmd-progress-bar/</link>
		<comments>http://stoyanoff.info/blog/2010/01/05/cmd-progress-bar/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 23:05:41 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Programming</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2010/01/05/snippet-command-line-interface-progress-bar/</guid>
		<description><![CDATA[
Command-line interface tools. We usually prefer to write these when we need a lightweight application to get work done.
Some operations can be lengthy, or we simply want to present the a visual indicator of progress to the user. For this purpose I usually update Console.Title for simplicity’s sake.
However, if the tool is intended for a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://stoyanoff.info/blog/wp-content/uploads/ConsoleProgressBar.png" rel="lightbox"><img style="border-right-width: 0px; margin: 3px 5px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ConsoleProgressBar" border="0" alt="ConsoleProgressBar" align="left" src="http://stoyanoff.info/blog/wp-content/uploads/ConsoleProgressBar_thumb.png" width="232" height="117"></a>
<p>Command-line interface tools. We usually prefer to write these when we need a lightweight application to get work done.</p>
<p>Some operations can be lengthy, or we simply want to present the a visual indicator of progress </font></font>to the<font face="Segoe UI"><font face="Segoe UI"> user. For this purpose I usually update <font face="Courier New">Console.Title</font> for simplicity’s sake.</p>
<p>However, if the tool is intended for a more wide audience (IT professionals or advanced users) you would want a CLI progress bar.</p>
<p><strong><a href="http://stoyanoff.info/code/ConsoleProgress.cs" target="_blank"><font color="#2b91af">ConsoleProgress</font></a></strong> is a <a href="http://msdn.microsoft.com/en-us/library/79b3xss3(VS.80).aspx" target="_blank">static class</a>. Usage is pretty much straight-forward:</p>
<ol>
<li>Call <font face="Courier New"><strong>Reset</strong> </font>to reset the progress bar’s state. This is <em>optional </em>if you wish to use the progress bar only once in your program.
<li>Call <font face="Courier New"><strong>Update</strong></font>. You can pass a <font face="Courier New">float</font>&nbsp; to indicate progress using a fraction <font size="1">(0.25 = 25%)</font>, or the current and maximum values<font size="1"> (e.g. 17 of 100 items processed)</font>.</li>
</ol>
<ul>
<li>If the operation can be canceled, either because of an internal exception or by the user, you can set the <font face="Courier New"><strong>Canceled</strong></font>&nbsp; property to <font face="Courier New">true</font>&nbsp; to update the console output.</li>
</ul>
<p>The sample code also contains several test cases, which demonstrate successful and canceled operations. I have also used relevant colors depending on each result.</p>
<p><a href="http://stoyanoff.info/blog/wp-content/uploads/ConsoleProgressBar1.png" rel="lightbox"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="ConsoleProgressBar" border="0" alt="ConsoleProgressBar" src="http://stoyanoff.info/blog/wp-content/uploads/ConsoleProgressBar_thumb1.png" width="240" height="128"></a></p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2010/01/05/cmd-progress-bar/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>2010</title>
		<link>http://stoyanoff.info/blog/2010/01/05/2010/</link>
		<comments>http://stoyanoff.info/blog/2010/01/05/2010/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 14:07:28 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Media</category>
	<category>Programming</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2010/01/05/2010/</guid>
		<description><![CDATA[

I&#8217;d like to wish everyone a very happy and successful new year!
This month I will be posting useful code snippets and a series on high-definition audio.
I would like to focus on the now-popular Blu-ray disc format and decoding DTS-HD Master Audio streams to PCM and compressing with the open-source FLAC codec in C#. The next [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://stoyanoff.info/blog/wp-content/uploads/2010.png" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="2010" border="0" alt="2010" align="left" src="http://stoyanoff.info/blog/wp-content/uploads/2010_thumb.png" width="240" height="165" /></a>
</p>
<p>I&#8217;d like to wish everyone a <strong>very happy </strong>and <strong>successful new year</strong>!</p>
<p>This month I will be posting useful code snippets and a series on high-definition audio.</p>
<p>I would like to focus on the now-popular Blu-ray disc format and decoding <a href="http://www.dts.com/DTS_Audio_Formats/DTS-HD_Master_Audio.aspx" target="_blank">DTS-HD Master Audio</a> streams to <a href="http://en.wikipedia.org/wiki/Pulse-code_modulation" target="_blank">PCM</a> and compressing with <a href="http://flac.sourceforge.net/" target="_blank">the open-source FLAC codec</a> in C#. The next part will go native and explore the writing of a <a href="http://msdn.microsoft.com/en-us/library/dd375464(VS.85).aspx" target="_blank">DirectShow filter</a> with Managed C++, which will utilize the DtsHD library.</p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2010/01/05/2010/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Windows 7 &#8211; Какво ново?</title>
		<link>http://stoyanoff.info/blog/2009/05/05/win7-rc-bg/</link>
		<comments>http://stoyanoff.info/blog/2009/05/05/win7-rc-bg/#comments</comments>
		<pubDate>Tue, 05 May 2009 15:09:41 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Windows 7</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2009/05/05/windows-7-%d0%9a%d0%b0%d0%ba%d0%b2%d0%be-%d0%bd%d0%be%d0%b2%d0%be/</guid>
		<description><![CDATA[Време е за първия блог пост на български. Каква по-добра тема от Windows 7? Днес Microsoft направи Windows 7 RC – Release Candidate, достъпен за всички. Можете да научите повече и свалите своето копие от тук. RC означава, че тази версия е много близо до крайната, която се очаква наесен.
Инсталацията е бърза и отнема не [...]]]></description>
			<content:encoded><![CDATA[<p><font face="Segoe UI">Време е за първия блог пост на български. Каква по-добра тема от Windows 7? Днес Microsoft направи Windows 7 RC – Release Candidate, <strong>достъпен за всички</strong>. Можете да научите повече и свалите своето копие от <strong><a href="http://www.microsoft.com/windows/windows-7/" target="_blank">тук</a></strong>. RC означава, че тази версия е много близо до крайната, която се очаква наесен.</font></p>
<p><font face="Segoe UI">Инсталацията е бърза и отнема не повече </font><font face="Segoe UI">от 20 минути, а единствената информация, която е неоходима да въведете е езика, който да се инсталира, на кой дял и евентуално сериен ключ за активация (но не е задължителен).</font></p>
<p><font face="Segoe UI">Нека разгледаме какво е ново и променено в Windows.</font></p>
<p><strong><font face="Segoe UI">Работният плот</font></strong></p>
<p><font face="Segoe UI">Лентата на задачите е първата промяна, която ще забележите. В Windows 7 Quick Launch и обичайният Taskbar са обединени. </font></p>
<p align="center"><font face="Segoe UI"><a href="http://stoyanoff.info/blog/wp-content/uploads/2.png" title="Работният плот" rel="lightbox[win7rcbg]"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px" title="Работният плот" border="0" alt="Работният плот" src="http://stoyanoff.info/blog/wp-content/uploads/2_thumb.png" width="160" height="100" /></a> <a href="http://stoyanoff.info/blog/wp-content/uploads/3.png" rel="lightbox[win7rcbg]" title="Internet Explorer с preview" ><img style="display: inline; border-width: 0px" title="Internet Explorer с preview" border="0" alt="Internet Explorer с preview" src="http://stoyanoff.info/blog/wp-content/uploads/3_thumb.png" width="160" height="100" /></a> <font face="Segoe UI"><a href="http://stoyanoff.info/blog/wp-content/uploads/12.png" rel="lightbox[win7rcbg]" title="Jump List" ><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px" title="Jump List" border="0" alt="Jump List" src="http://stoyanoff.info/blog/wp-content/uploads/12_thumb.png" width="79" height="100" /></a> </font></font></p>
<p><font face="Segoe UI"><font face="Segoe UI">Бутоните в тази лента се комбинират, а липсата на имената на всички програми пести пространство (можете и да намалите размера на иконите или да включите опцията за показване на имената). Например ако имате отворени 7 таба или прозорци на Internet Explorer ще има само една икона в лентата. За сметка на това смяната на прозорци става като преминете през бутоните и изберете желания прозорец. Също така има и приятна плаваща анимация за тези, които използват Aero.</font></font><font face="Segoe UI"><font face="Segoe UI"> </p>
<p><center><a href="http://stoyanoff.info/blog/wp-content/uploads/19_.png" rel="lightbox[win7rcbg]" title="Лентата на задачите в три възможни режима" ><img style="display: inline; border-width: 0px" title="Лентата на задачите в три възможни режима" border="0" alt="Лентата на задачите в три възможни режима" src="http://stoyanoff.info/blog/wp-content/uploads/19__thumb.png" width="500" height="108" /></a> </center>  </p>
<p><font face="Segoe UI">Ако щракнете с десния бутон върху някоя от програмите в таскбара, ще изкочи един нов вид списък – <strong>Jump List</strong>. Там повечето от програмите представят списък с последно отворени папки, картини в Paint, документи на Word или Еxcel, или страници посетени в интернет.</font></p>
<p><font face="Segoe UI">Една малка, но полезна промяна – ако премествате, копирате или сваляте файлове от интернет, <strong>бутона на програмата показва прогреса на операцията</strong>. Така можете да продължите работата си и само с един поглед ще разберете кога е готова.</font></p>
<p><a href="http://stoyanoff.info/blog/wp-content/uploads/27.png" rel="lightbox[win7rcbg]" title="Теми" ><img style="float: right; border-width: 0px" title="Теми" border="0" alt="Теми" src="http://stoyanoff.info/blog/wp-content/uploads/27_thumb.png" width="105" height="75" /></a><font face="Segoe UI"><strong>Темите</strong> в Windows “преобличат” работния плот и могат да сменят фона периодично. Sidebar от Windows Vista вече го няма, а <strong>притурките</strong> (gadgets) могат да се закрепят към всеки край на екрана.</font><br />
<a id="more-89"></a><br />
<center><object style="z-index:9999;" width="708" height="303"><br />
<param name="movie" value="http://stoyanoff.info/swf/Windows%207%20Taskbar_controller.swf"> <embed src="http://stoyanoff.info/swf/Windows%207%20Taskbar_controller.swf" width="708" height="303"> </embed> </object></center><br/><strong><font face="Segoe UI">Библиотеки</font></strong> </p>
<p><font face="Segoe UI">Библиотеките са нов вид папки – по-точно, колекция от такива. Всеки има документи, снимки, музика на компютъра си, но в много случаи те са <em>разхвърляни</em> по различни дялове, а даже и външни харддискове. Е, с библиотеките е лесно да се изберат местоположения с даден тип медия и само с влизането в една библиотека, всички те ще бъдат обединени. Библиотеките се използват на много места в Windows 7.</font></p>
<p align="center"><font face="Segoe UI"><a href="http://stoyanoff.info/blog/wp-content/uploads/4.png" rel="lightbox[win7rcbg]" title="Библиотеки" ><img style="display: inline; border-width: 0px" title="Библиотеки" border="0" alt="Библиотеки" src="http://stoyanoff.info/blog/wp-content/uploads/4_thumb.png" width="145" height="100" /></a> <a href="http://stoyanoff.info/blog/wp-content/uploads/9.png" rel="lightbox[win7rcbg]"><img style="display: inline; border-width: 0px" border="0" src="http://stoyanoff.info/blog/wp-content/uploads/9_thumb.png" width="144" height="100" /></a> <a href="http://stoyanoff.info/blog/wp-content/uploads/10.png" rel="lightbox[win7rcbg]" title="Библиотека с картини" ><img style="display: inline; border-width: 0px" title="Библиотека с картини" border="0" alt="Библиотека с картини" src="http://stoyanoff.info/blog/wp-content/uploads/10_thumb.png" width="146" height="100" /></a> </font></p>
<p><strong><font face="Segoe UI">Развлечение</font></strong></p>
<p><font face="Segoe UI">Media Player и Media Center, както повечето от приложенията в Windows 7, са с нов изглед. Windows 7 <strong>включва декодер за H.264 и поддръжка на формата QuickTime</strong>, което обезсмисля инсталирането на програмата на Apple. H.264 също така е и кодекът, който <strong>Blu-ray дисковете</strong> често използват.</font></p>
<p align="center"><a href="http://stoyanoff.info/blog/wp-content/uploads/5.png" rel="lightbox[win7rcbg]" title="Media Center - стартиране" ><img style="display: inline; border-width: 0px" title="Media Center - стартиране" border="0" alt="Media Center - стартиране" src="http://stoyanoff.info/blog/wp-content/uploads/5_thumb.png" width="164" height="100" /></a> <a href="http://stoyanoff.info/blog/wp-content/uploads/6.png" rel="lightbox[win7rcbg]" title="Media Center - картини"><img style="display: inline; border-width: 0px" title="Media Center - картини" border="0" alt="Media Center - картини" src="http://stoyanoff.info/blog/wp-content/uploads/6_thumb.png" width="166" height="100" /></a> <a href="http://stoyanoff.info/blog/wp-content/uploads/7.png" rel="lightbox[win7rcbg]" title="Media Center - възпроизвеждане на Blu-ray диск" ><img style="display: inline; border-width: 0px" title="Media Center - възпроизвеждане на Blu-ray диск" border="0" alt="Media Center - възпроизвеждане на Blu-ray диск" src="http://stoyanoff.info/blog/wp-content/uploads/7_thumb.png" width="169" height="100" /></a> <a href="http://stoyanoff.info/blog/wp-content/uploads/8.png" rel="lightbox[win7rcbg]" title="Media Center - възпроизвеждане на Blu-ray диск" ><img style="display: inline; border-width: 0px" title="Media Center - възпроизвеждане на Blu-ray диск" border="0" alt="8" src="http://stoyanoff.info/blog/wp-content/uploads/8_thumb.png" width="168" height="100" /></a></p>
<p><font face="Segoe UI">Дизайнерите в Microsoft наблягат на нюанси на синьото (“свежо”?) и се е получило добре. Paint и WordPad вече има много нови инструменти и изглеждат <em>по-професионално</em>, подобно на Office 2007.</font></p>
<p><font face="Segoe UI"><a href="http://stoyanoff.info/blog/wp-content/uploads/13.png" rel="lightbox[win7rcbg]" title="Paint" ><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px" title="Paint" border="0" alt="Paint" src="http://stoyanoff.info/blog/wp-content/uploads/13_thumb.png" width="756" height="100" /></a> </font></p>
<p><strong><font face="Segoe UI">Впечатление</font></strong></p>
<p><font face="Segoe UI">Windows 7 е по-лекият и бърз наследник на Vista. Microsoft доста са поработили върху производителността, облика и приложенията в новата версия. Като release candidate, този билд съдържа всички възможности на операционната система. Оттук нататък можем да очакваме дори още подобрения в бързината.</font></p>
<p><strong><font face="Segoe UI">Download</font></strong></p>
<p><font face="Segoe UI">Можете да свалите копие на Windows 7 RC (билд 7100) <strong><a href="http://www.microsoft.com/windows/windows-7/" target="_blank">тук</a></strong>.</font></p>
<p /></font></font></p>
<p><!-- <strong><font face="Segoe UI">Един минус!</font></strong></p>
<p><font face="Segoe UI">Единственото нещо, което не харесвам относно Windows 7 не се отнася до самата операционна система, а превода ѝ на български. В контролният панел някои от преводите имат граматични грешки, променят се думи и смисъла на действията в някои от стъпките. Много са и случаите, в които преводите са прекалено дълги или използват пояснения.</p>
<p>Има още време докато пакетът за български език е финализиран и се надявам, че тогава той ще бъде пооправен.</font><br />
&#8211;></p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2009/05/05/win7-rc-bg/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Most Valuable Professional and what&#8217;s to come</title>
		<link>http://stoyanoff.info/blog/2009/04/03/mvp-and-whats-to-come/</link>
		<comments>http://stoyanoff.info/blog/2009/04/03/mvp-and-whats-to-come/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 00:28:07 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Microsoft</category>
	<category>Programming</category>
	<category>MVP Program</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2009/04/03/april-fools-mvp-and-whats-to-come/</guid>
		<description><![CDATA[Just a couple of days ago Microsoft MVP lead Alessandro Teglia announced the newly awarded and renewed Most Valuable Professionals for 2009 &#8212; I would like to congratulate all of them on their achievements. Rock on!
I am also very happy and proud to be given the award for Visual C# this year. It is my programming language of [...]]]></description>
			<content:encoded><![CDATA[<p><img title="Microsoft Most Valuable Professional" alt="Microsoft Most Valuable Professional" align="left" src="http://blogs.msdn.com/blogfiles/powerpoint/WindowsLiveWriter/4c191c584518_11284/MVP2005_2.gif" width="100" />Just a couple of days ago Microsoft MVP lead <strong>Alessandro Teglia</strong> <a href="http://blogs.technet.com/alead_msft/archive/2009/04/01/mvp-award-program-april-2009.aspx" target="_blank">announced</a> the newly awarded and renewed <a href="http://mvp.support.microsoft.com/" target="_blank"><strong>Most Valuable Professionals</strong></a> for 2009 &#8212; I would like to congratulate all of them on their achievements. Rock on!</p>
<p>I am also very happy and proud to be given the award for <strong>Visual C#</strong> this year. It is my programming language of choice and in my opinion the .NET Framework will continue to be adopted by developers in 2009. I hope the MVP program will offer a lot of new doors and opportunities.</p>
<p><strong>So what&#8217;s to come on my blog?</strong> I plan on writing mosly technical posts about the .NET Framework as a whole, and coding patterns in .NET languages. Visual Studio 2010 is coming near release and it is going to introduce some very interesting additions, which I will go through in the coming days.</p>
<p>I am frequent on the <a href="http://www.microsoft.com/communities/newsgroups/default.mspx" target="_blank">official Microsoft newsgroups</a> (mostly .NET-related) and will be attending <a href="http://www.msbgregistration.com" target="_blank"><strong>Microsoft Days &#8216;09</strong></a> later this month. You can expect an essential coverage as well.</p>
<p>Last, but definitely not least, a big &#8220;Thanks&#8221; to Microsoft and a very good friend of mine, <a href="http://www.chrisse.se" target="_blank"><strong>Christoffer Andersson</strong></a>, for all the support!</p>
<p><em><strong>P.S.</strong> I am contemplating mirroring some or all of the articles in Bulgarian, my native language. Are there any Bulgarian readers out here?</em>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2009/04/03/mvp-and-whats-to-come/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Tweak DWM from your programs, Part 3</title>
		<link>http://stoyanoff.info/blog/2008/10/17/tweak-dwm-part-3/</link>
		<comments>http://stoyanoff.info/blog/2008/10/17/tweak-dwm-part-3/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 21:59:56 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Windows Vista</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2008/10/17/tweak-dwm-from-your-programs-part-3/</guid>
		<description><![CDATA[GlassLib is a wrapper library for the Desktop Window Manager API and is to be used by developers which would like their applications to take advantage of .NET Framework and Windows Presentation Foundation in particular.
It can be used to control the Desktop Composition due to application requirements, create and reference Live Thumbnails of arbitrary windows, [...]]]></description>
			<content:encoded><![CDATA[<p align="left"><strong>GlassLib</strong> is a wrapper library for the <em>Desktop Window Manager API</em> and is to be used by developers which would like their applications to take advantage of .NET Framework and Windows Presentation Foundation in particular.</p>
<p align="left">It can be used to control the Desktop Composition due to application requirements, create and reference Live Thumbnails of arbitrary windows, manipulate the Glass client area of windows and receive events which occur for them (<a target="_blank" href="/code/wpf/DwmWrapper_Common.png" rel="lightbox[images1]">Figure</a>). Developers who target their applications for Far East users can also use the wrapper library <a target="_blank" href="/code/wpf/DwmWrapper_Rtl.png" rel="lightbox[images1]">to control the flow direction of controls and caption bar</a>.</p>
<p align="left">While the library wraps a big portion of the API exposed by DWM, the timing and performance counter part is to follow up shortly.</p>
<p align="left">Documentation and a test application are provided. The usage of the wrapper library is pretty much straight-forward. Following is a list of several key facts:</p>
<ul>
<li>
<div align="left">Add a reference to the DwmWrapper.dll library to your project (from the Solution Explorer, select your project&#8217;s node, right click it and select <strong>Add Reference</strong>. From the new dialog box, browse the library file). <em>Please note that the library is compiled against the .NET Framework 2.0 therefore it can only be used in projects compiled against it, or a newer version.</em></div>
</li>
<li>
<div align="left">Include the GlassLib namespace so that the Dwm-related classes can be accessed more easily.</div>
</li>
<li>
<div align="left">When used in a System.Windows.Window, override the OnSourceInitialized method and then set up the event handlers.</div>
</li>
<li>
<div align="left">Per-window options can be set using the Dwm.Glass, Blur, Events, NonClientArea and Flip3D. This is available by using the indexer (default property) of these properties. The value passed to the indexer can be an IntPtr - handle to a window or a System.Windows.Media.Visual whose window handle will be manipulated. E.g:</div>
</li>
<ul>
<li>
<div align="left">In VB .NET: <font face="Courier New">Dwm.Glass<em><strong>(Me)</strong></em>.Enabled = False</font></div>
</li>
<li>
<div align="left">In C# .NET: <font face="Courier New">Dwm.Glass<em><strong>[this]</strong></em>.Enabled = false;</font></div>
</li>
<ul>
<li>
<div align="left">Note: <strong>this</strong> and <strong>Me</strong> refer to the calling instance, which is a System.Windows.Window in the example.</div>
</li>
</ul>
</ul>
<li>
<div align="left">The Dwm* structures have implicit operators. This allows for casting Windows Presentation Foundation Rect and Thickness implicitely to DwmRect and DwmMargins, respectively. For instance, the following expression will be valid:</div>
</li>
<ul>
<li>
<div align="left"><font face="Courier New"><font size="2"><font size="2"><font color="#008080" size="2">Thickness<font size="2"> foo = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">Thickness</font><font size="2">(5, 30, 5, 20);</font> </font></font></font></font></div>
<div align="left"><font face="Courier New"><font size="2"><font size="2"><font color="#008000" size="2">// Assign foo to a Visual&#8217;s margin.</font></font></font></font></div>
<div align="left"><font face="Courier New"><font size="2"><font color="#008080" size="2">Dwm<font size="2">.Glass[</font><font color="#0000ff" size="2">this</font><font size="2">].Margins = foo; </font><font color="#008000" size="2">// foo is implicitely casted to DwmMargins.</font></font></font></font></div>
</li>
</ul>
</ul>
<div align="left">
<p align="center"><a target="_blank" href="/code/wpf/DwmWrapper_Common.png" rel="lightbox[images2]"><img title="GlassLib Test Application" alt="GlassLib Test Application" src="/code/wpf/DwmWrapper_Common.th.png" /></a> <a target="_blank" href="/code/wpf/DwmWrapper_Rtl.png" rel="lightbox[images2]"><img title="GlassLib Test Application - Right-To-Left Layout" alt="GlassLib Test Application - Right-To-Left Layout" src="/code/wpf/DwmWrapper_Rtl.th.jpg" /></a></p>
<p align="left">If you have any questions, suggestions or would like to report an issue, please feel free to use the <a href="/contact/">Contact form</a>.</p>
<blockquote>
<p align="left">Written in C# .NET. Binaries and the sources of a test application are available <a href="/code/wpf/GlassLibWpf.070626-2042.zip">here</a>; <a href="/code/wpf/GlassLibWpf.bin.070626-2042.zip">only binaries</a>.</p>
</blockquote>
<p> </div>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2008/10/17/tweak-dwm-part-3/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Tweak DWM from your programs, Part 2</title>
		<link>http://stoyanoff.info/blog/2008/08/27/tweak-dwm-part-2/</link>
		<comments>http://stoyanoff.info/blog/2008/08/27/tweak-dwm-part-2/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 16:06:41 +0000</pubDate>
		<dc:creator>Stanimir Stoyanov</dc:creator>
		
	<category>Windows Vista</category>
		<guid isPermaLink="false">http://stoyanoff.info/blog/2008/08/27/tweak-dwm-part-2/</guid>
		<description><![CDATA[Following the first part of the Tweak DWM from your programs series, we are going to explore the actual usage of the Desktop Window Manager API in a Windows Forms-based program. The test application&#8211;included in the source package&#8211;also makes use of GlassBar, an extension to the existing control set.
Using GlassLib in your program
GlassLib is going [...]]]></description>
			<content:encoded><![CDATA[<p>Following the <a title="Tweak DWM from your programs, Part 1" href="/2008/07/tweak-dwm-part-1/">first part</a> of the <strong>Tweak DWM from your programs</strong> series, we are going to explore the actual usage of the <strong>Desktop Window Manager API</strong> in a Windows Forms-based program. The test application&#8211;included in the <a href="http://stoyanoff.info/code/dwm/GlassLib_pub.zip">source package</a>&#8211;also makes use of <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="glassbar" src="/blog/wp-content/uploads/glassbar.png" width="16" height="16" /><strong>GlassBar</strong>, an extension to the existing control set.</p>
<h3>Using GlassLib in your program</h3>
<p><span style="font-family: courier new"><a href="/blog/wp-content/uploads/project.png"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="project" src="/blog/wp-content/uploads/project24.png" width="16" height="15" /></a>GlassLib </span>is going to be main focus of this part of the series. It supersedes <span style="font-family: courier new"><a href="/blog/wp-content/uploads/project.png"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="project" src="/blog/wp-content/uploads/project24.png" width="16" height="15" /></a>DwmWrapper </span>by implementing a framework around <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="glassbar" src="/blog/wp-content/uploads/glassbar.png" width="16" height="16" /><span style="font-family: Courier New">GlassBar</span> which can be used as a complement to your visually-rich forms. In order to use this library in your project, you have to do the following:</p>
<ol>
<li>Include <strong>a)</strong> a reference to the DLL in your project from Visual Studio: <em>Project</em> menu =><em> Add reference</em>, or <strong>b)</strong> the actual code files to your C# project (adding them as links (shortcuts) as opposed to copying them is more suitable if you wish include the files in multiple projects and/or wish to make changes to the code yourself).</li>
<li>Remember that all of the functionality lies in the <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="namespace_" src="/blog/wp-content/uploads/namespace-thumb.png" width="15" height="15" /><span style="font-family: courier new">GlassLib </span>namespace. You can use the <span style="font-family: courier new"><span style="color: #0000ff">using</span> </span>or <span style="color: #0000ff">Imports</span> clause in the beginning of your C# or VB.NET code file, respectively, or the global imports if you code exclusively in VB.NET.</li>
</ol>
<h3>Exploring the GlassLib Test app</h3>
<p>Let&#8217;s begin exploring the framework by opening the project file for <span style="font-family: courier new"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="project" src="/blog/wp-content/uploads/project24.png" width="16" height="15" />GlassLibTest</span>. Included in the GlassLib solution, it depends on the <span style="font-family: courier new"><a href="/blog/wp-content/uploads/project.png"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="project" src="/blog/wp-content/uploads/project24.png" width="16" height="15" /></a>GlassLib </span>project reference, which on its part has all the <span style="font-family: courier new"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="project" src="/blog/wp-content/uploads/project24.png" width="16" height="15" />DwmWrapper</span> code. Open the <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="form" src="/blog/wp-content/uploads/form.png" width="15" height="15" />frmMain.cs file which is the form which is to be executed right at start up. As described in the first part, the first thing the class constructor <span style="font-family: Courier New"><span style="color: #0000ff">public</span> frmMain()</span> should do is to set <span style="font-family: courier new"><span style="color: #2b91af">Dwm</span>.ThrowExceptionTypes</span> to <span style="font-family: Courier New"><span style="color: #2b91af">DwmExceptionTypes</span>.None</span> in order to avoid any exceptions from being raised when DWM is not enabled or available on the OS, or if any function failed. The next thing the program does is to enable dragging from the Glass-extended area.</p>
<p><span style="font-family: Courier New"><span style="color: #2b91af">Dwm</span>.Glass[<span style="color: #0000ff">this</span>].DragExtendedArea = <span style="color: #0000ff">true</span>; </span>is useful if you want the extended area to act as the caption bar does, like in Windows Media Player. This is what the <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="glassbar" src="/blog/wp-content/uploads/glassbar.png" width="16" height="16" /><span style="font-family: Courier New">GlassBar </span>toolbar does as well (more on this later in this part). <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="toolbox" align="right" src="/blog/wp-content/uploads/toolbox.png" width="216" height="99" /> Switch to Designer mode (<em>View</em> <em>=> Designer</em>) and you can see the layout of the form: the usual Windows Forms buttons, combo and text boxes et cetera, but also <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="glassbar" src="/blog/wp-content/uploads/glassbar.png" width="16" height="16" /><span style="font-family: Courier New">GlassBar</span>. To add the latter to your own forms, open the Toolbox (<em>View => Toolbox</em>) and drag it to your form (see figure on right). The toolbar will automatically dock to the bottom of it and extend Glass from this side of the form. You are free to dock it to the whole form (or container for that matter) or one of the other sides. Because DWM only supports Glass on top-level windows, in designer mode <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="glassbar" src="/blog/wp-content/uploads/glassbar.png" width="16" height="16" /><span style="font-family: Courier New">GlassBar</span> falls back to UXTheme API in order to get the theme-specific background image or brush which is suitable for all non-Aero Glass themes such as Aero Basic, Luna (on Windows XP) or Windows Classic on any supported Windows version. On top of this, you can choose to write your own <a href="/blog/wp-content/uploads/class.png"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="class" src="/blog/wp-content/uploads/class-thumb.png" width="15" height="15" /></a><span style="font-family: Courier New">GlassBarRenderer</span>.</p>
<p>This feature provides two key benefits to your application&#8217;s design:</p>
<ul>
<li>For Windows Vista systems and future OS with support for Glass: <em>rich, seamless Glass UI</em></li>
<li>For Windows Vista systems where DWM is disabled or unavailable, <strong>and</strong> all previous Windows releases: <em>seamless UI deriving from the appropriate Windows</em> <em>theme, including custom themes</em> <em>created with software such as </em><a href="http://www.windowblinds.net/"><em>WindowBlinds</em></a>.</li>
</ul>
<p align="center"><a href="/blog/wp-content/uploads/glassbar-themes.png"><img style="border-width: 0px" border="0" alt="GlassBar " src="/blog/wp-content/uploads/glassbar-themes-thumb.png" width="700" height="267" /></a></p>
<h3>Managing the GlassBar items</h3>
<p>Adding your items to GlassBar is quite easy. While in Design Mode, make sure that the Properties pane is visible (<em>View </em>menu =><em> Properties Window </em>to invoke it), select <span style="font-family: courier new">Items </span>and expand the Collection Editor. You can add, remove and rearrange the items. For each one of them you can customize their:</p>
<table border="0" cellspacing="2" cellpadding="2" width="1010">
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb1.png" width="16" height="15" /><span style="font-family: courier new">Name</span></td>
<td style="width: 802px" valign="top">Used in code only (does not appear in UI)</td>
</tr>
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb11.png" width="16" height="15" /><span style="font-family: courier new">Enabled</span></td>
<td style="width: 794px" valign="top">Enables/disables the item from the UI</td>
</tr>
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: courier new">Icon</span></td>
<td style="width: 787px" valign="top">Preferably translucent PNG image 25&#215;25 pixels in size</td>
</tr>
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: courier new">IsSeparator</span></td>
<td style="width: 782px" valign="top">Denotes whether the item is a separator (its Icon will be disregarded)</td>
</tr>
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: courier new">Overlay</span></td>
<td style="width: 777px" valign="top">Image, useful for &#8216;hover&#8217; effects</td>
</tr>
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: courier new">Text</span></td>
<td style="width: 773px" valign="top">Alternative text shown when the item is hovered</td>
</tr>
<tr>
<td style="width: 10px" valign="top"> </td>
<td style="width: 188px" valign="top"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: courier new">Visible</span></td>
<td style="width: 770px" valign="top">Shows/hides the item</td>
</tr>
</table>
<p>You can of course manage items programmatically using the <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb1.png" width="16" height="15" /><span style="font-family: courier new">Items </span>property, for example adding one: <span style="font-family: Courier New"><span style="color: #2b91af">Image</span> img = <span style="color: #2b91af">Image</span>.FromFile(<span style="color: #a31515">&#8220;someFile.png&#8221;</span>);</span> <span style="font-family: Courier New"><span style="color: #2b91af">GlassBarItem</span> gbi = <span style="color: #0000ff">new</span> <span style="color: #2b91af">GlassBarItem</span>(<span style="color: #a31515">&#8220;Sample Text&#8221;</span> + i, img);</span> <span style="font-family: Courier New">glassBar.Items.Add(gbi);</span> When the logic of your program requires an item be disabled or hidden, e.g. an unavailable feature, you can use <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb11.png" width="16" height="15" /><span style="font-family: courier new">Enabled </span>or <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: courier new">Visible </span>to prevent users from clicking it.</p>
<h3>Custom renderers</h3>
<p>Internally GlassBar defines a standard renderer which on Windows Vista with Aero Glass enables draws on a translucent surface and otherwise falls back to the system-defined theme. If you wish to code a custom renderer for your needs, what you have to do is:</p>
<ol>
<li>Create a class deriving from (inheriting) from one of the following classes:
<ul>
<li><a href="/blog/wp-content/uploads/class.png"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="class" src="/blog/wp-content/uploads/class-thumb.png" width="15" height="15" /></a><span style="font-family: Courier New">GlassLib.Rendering.DefaultGlassBarRenderer</span> if you wish to customize only specific parts of the default renderer (images, background etc)</li>
<li><a href="/blog/wp-content/uploads/class.png"><img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="class" src="/blog/wp-content/uploads/class-thumb.png" width="15" height="15" /></a><span style="font-family: Courier New">GlassLib.Rendering.GlassBarRenderer</span> if you wish to build one from the ground up. This requires you to implement all of the methods and properties and is unlikely to be your choice.</li>
</ul>
</li>
<li>Decide which functions or images you would like to change. You can assign any image to <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="property_thumb1" src="/blog/wp-content/uploads/property-thumb12.png" width="16" height="15" /><span style="font-family: Courier New">MainPiece, RightSecondaryStates, AnimationStrip etc.</span></li>
<li>The <img style="margin: 0px 3px 0px 0px; border: 0px" border="0" alt="method_thumb1" src="/blog/wp-content/uploads/method-thumb1.png" width="16" height="15" /><span style="font-family: courier new">DrawBarBackground </span>function is called every time the UI changes and needs to be redrawn. It is here where you can change most of the behavior of the default renderer and implement your own features.</li>
<li>Assign an instance of your custom renderer to <img style="margin: 0px 3px 0px 0px; border-width: 0px" border="0" alt="glassbar" src="/blog/wp-content/uploads/glassbar.png" width="16" height="16" /><span style="font-family: Courier New">GlassBar</span>
<ul>
<li><span style="font-family: Courier New">glassBar.Renderer = <span style="color: #0000ff">new</span> <span style="color: #2b91af">CustomRenderer</span>();</span> or to revert to default:</li>
<li><span style="font-family: Courier New">glassBar.Renderer = <span style="color: #0000ff">new</span> GlassLib.Rendering.<span style="color: #2b91af">DefaultGlassBarRenderer</span>();</span></li>
</ul>
</li>
</ol>
<h3>The test app</h3>
<p>There is a test program added to the package, <a href="file:///C:/Users/Stan/AppData/Roaming/Windows%20Live%20Writer/PostSupportingFiles/746266d3-e326-4c4e-8fb9-15492f646457/project3.png"><strong><img style="margin: 0px; border-width: 0px" border="0" alt="project_thumb1" src="/blog/wp-content/uploads/project-thumb12.png" width="16" height="15" /></strong></a><span style="font-family: courier new">GlassLibTest</span>, whose code and compiled binary you can explore and experiment with GlassBar and DWM. If you have any comments, questions, wishes or just an opinion, I would be happy to hear it.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://stoyanoff.info/blog/2008/08/27/tweak-dwm-part-2/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
