<?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>SuperMegaUltraGroovy &#187; Software Development</title>
	<atom:link href="http://supermegaultragroovy.com/category/software-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://supermegaultragroovy.com</link>
	<description>Chris Liscio&#039;s Boo-urns Log</description>
	<lastBuildDate>Fri, 13 Jan 2012 22:09:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Capo 1.2 for iOS released today</title>
		<link>http://supermegaultragroovy.com/2011/11/22/capo-1-2-for-ios-released-today/</link>
		<comments>http://supermegaultragroovy.com/2011/11/22/capo-1-2-for-ios-released-today/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 16:03:05 +0000</pubDate>
		<dc:creator>Chris Liscio</dc:creator>
				<category><![CDATA[Capo]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://supermegaultragroovy.com/?p=791</guid>
		<description><![CDATA[I&#8217;m so very happy (read: relieved) to say that Capo 1.2 for iOS has landed on the App Store. This update took far longer than I&#8217;d like, because it was really tough to get it right. See, slowing audio properly requires a lot of CPU power. On a desktop Mac, there&#8217;s plenty of power to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m so very happy (read: relieved) to say that <a href="http://capoapp.com/iphone.html">Capo 1.2 for iOS</a> has landed on the <a href="http://itunes.apple.com/app/capo/id386963803?mt=8">App Store</a>. This update took far longer than I&#8217;d like, because it was really tough to get it right.</p>

<p>See, slowing audio properly requires a lot of CPU power. On a desktop Mac, there&#8217;s plenty of power to spare these days. Unfortunately—this is not the case in the mobile world. Because Capo is both graphics- and audio-intensive, it eats up a lot of CPU power.</p>

<p>When version 1.0 released, Capo was eating up about 80% CPU while playing audio in the foreground (i.e. with graphics visible) on a 3rd Generation iPod touch, and maybe 75-80% on an iPhone 4. The CPU/RAM improvements on the iPhone 4 were offset by the increase in pixel density pushing the GPU a little harder. C&#8217;est la vie.</p>

<p>If I wanted to do anything else with the app, I&#8217;d have to fit it into approximately 20% of leftover CPU.</p>

<p><img src="http://supermegaultragroovy.com/wordpress/wp-content/uploads/2011/11/smalleffects.png" alt="" title="Capo&#039;s Effects" width="200" height="383" class="alignnone size-full wp-image-796" style="float: left; padding-right: 1.5em;" /></p>

<p>Capo&#8217;s effects are both graphics and CPU-hungry, so I had my work cut out for me to add them in the next version. This was especially challenging, because I wanted to keep the live-updating spectrums in the effects control backgrounds as I have on the desktop version. Go big or go home, right?</p>

<p>Luckily for me, there were optimizations added to the slowing engine I use, as well as some further optimization work on my part. That 20% margin increased a little bit more, so I was able to shoehorn an initial implementation of the effects UI into the mix.</p>

<p>The initial approach simply sucked—it caused various skips in the audio, and the graphics were very choppy. It was especially noticeable when you&#8217;d scroll the effects controls while they were enabled.</p>

<p>The first culprit was my effects implementations. I built my own Equalizer, but it was taking about 15% of the app&#8217;s runtime according to Instruments. I had to take care of this, and re-wrote the tight loop using NEON intrinsics. That took it down to 1.5-2%—sweet!</p>

<p>I also had to re-write my FFT-based vocal reduction to use the Accelerate version of FFT rather than the implementation I previously used. I don&#8217;t recall the specifics, but I think the result was approximately 10x faster—the performance optimization team at Apple really kicked ass with their FFT implementation!!</p>

<p>Unfortunately, there was still about 30% of runtime being allocated to my live-updating spectrum drawing. I initially implemented the spectrum drawing using Core Animation and Quartz. That had to be thrown out, and I instead re-built the live spectrum views using OpenGL ES 2. A few custom shaders and other black magic made short work of that—reducing the runtime to about half of what it was before—15-18%. It cost me the prettier anti-aliased curves, but the speed boost was worth it.</p>

<p>In the end, I&#8217;m proud of what I shipped today. I know that the progress isn&#8217;t as quick as I&#8217;d hoped on the iOS side of Capo, but I think I truly nailed this effects implementation. Because of this extended effort, Capo will continue to be the best tool for learning your music by ear on your iPhone, iPod, or iPad.</p>

<p>I can&#8217;t wait to find out what else I can shoehorn into that &#8220;last 20%&#8221; in the future&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://supermegaultragroovy.com/2011/11/22/capo-1-2-for-ios-released-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iTunes, Cocoa, and Dock Drags</title>
		<link>http://supermegaultragroovy.com/2011/07/29/itunes-cocoa-and-dock-drags/</link>
		<comments>http://supermegaultragroovy.com/2011/07/29/itunes-cocoa-and-dock-drags/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 17:41:33 +0000</pubDate>
		<dc:creator>Chris Liscio</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://supermegaultragroovy.com/?p=776</guid>
		<description><![CDATA[In my iTunes dragging post from a while back, I described a method for handling iTunes song drags on the Dock. Since iTunes 10.4 was released recently with Cocoa under the hood, I thought I should take a look at the dragging situation again. I wrote a little test application that dumped the NSPasteBoard types [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://supermegaultragroovy.com/2009/02/23/handling-dock-icon-drags-from-itunes/">iTunes dragging</a> post from a while back, I described a method for handling iTunes song drags on the Dock.</p>

<p>Since iTunes 10.4 was released recently with Cocoa under the hood, I thought I should take a look at the dragging situation again. I wrote a little test application that dumped the NSPasteBoard types coming in from a drag, and obtained the following list:</p>

<script type="text/javascript" src="https://gist.github.com/1114239.js"></script>

<p>As far as I can tell, the <code>com.apple.itunes.metadata</code> type on the pasteboard is new in iTunes 10.4. Digging deeper, I managed to dump out the NSString contents of this item on the pasteboard:</p>

<script type="text/javascript" src="https://gist.github.com/1114247.js"></script>

<p>This looks a whole lot like the information that was present in the old CorePasteboardFlavorType item. You can iterate through the list of tracks in the dictionary, and there&#8217;s your file&#8217;s location URL!</p>

<h3>Still, there&#8217;s a problem…</h3>

<p>While it&#8217;s great that we can now (slightly more) easily obtain the track&#8217;s location, it&#8217;s quite odd that the <code>com.apple.pasteboard.promised-file-url</code> item on the pasteboard isn&#8217;t enough to get the dock icon to recognize the drag as a supported file. Capo happily accepts .m4a files, but this drag is apparently not good enough for the Dock to accept it. Developers shouldn&#8217;t have to implement a service to accept song drags from iTunes.</p>

<p>Using the dictionary on the pasteboard could also be fragile over time. If someone on the iTunes team decides to manipulate the &#8220;schema&#8221; inside the dictionary in a future version of iTunes, there will be some painful transition required. Luckily for us, there appears to be some kind of versioning present in the dictionary, so we could cope with multiple versions of iTunes drag formats in the future. (Provided the schema-changer in question is smart enough to update the versioning…)</p>

<h3>What about the old solution?</h3>

<p>It still works, <em>for now</em>. There&#8217;s no need to go out and rush to fix this issue today: the old-style item on the pasteboard is still present. Going forward, you just have to add the new pasteboard item UTI, in addition to the one we declared to wrap <code>CorePasteboardType 0x6974756E</code> in your service&#8217;s NSSendTypes.</p>
]]></content:encoded>
			<wfw:commentRss>http://supermegaultragroovy.com/2011/07/29/itunes-cocoa-and-dock-drags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copying Private Frameworks using Xcode 4.x</title>
		<link>http://supermegaultragroovy.com/2011/07/06/copying-private-frameworks-using-xcode-4-x/</link>
		<comments>http://supermegaultragroovy.com/2011/07/06/copying-private-frameworks-using-xcode-4-x/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 18:47:01 +0000</pubDate>
		<dc:creator>Chris Liscio</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://supermegaultragroovy.com/blog/?p=764</guid>
		<description><![CDATA[I&#8217;ve been moving more development over to Xcode 4, which I&#8217;ve been enjoying quite a bit since I started using it shortly after it was introduced last year. Believe it or not, Capo for iOS was almost exclusively developed in Xcode 4. Unfortunately, Apple did not allow app submissions with the beta tools, so I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been moving more development over to Xcode 4, which I&#8217;ve been enjoying quite a bit since I started using it shortly after it was introduced last year.</p>

<p>Believe it or not, <a href="http://capoapp.com/iphone.html">Capo for iOS</a> was almost exclusively developed in Xcode 4. Unfortunately, Apple did not allow app submissions with the beta tools, so I was forced to bounce back and forth between Xcode 3 and 4 for Capo version 1.0. But I digress.</p>

<p>I&#8217;ve finally got around to moving the <a href="http://capoapp.com">Capo</a> project to Xcode 4 just the other day, but I hit some bumps in the process. I created a workspace containing the projects for Capo, and its companion frameworks, but couldn&#8217;t get a solid &#8216;Copy Files&#8217; build phase to work properly.</p>

<p>You see, when you drag a framework from the project navigator into your &#8216;Copy Files&#8217; build phase, it appears to use a pre-baked relative reference to the framework&#8217;s path. Unfortunately, that means the following things are baked into the path:</p>

<ul>
<li>The build configuration (Debug vs Release)</li>
<li>The derived data folder name</li>
</ul>

<p>Both of those items are moving targets, depending on what scheme/action you&#8217;re building for, and where you&#8217;re building your workspace. The derived data location for a workspace is based on a hash of the location of the workspace itself, so that could theoretically change on a separate machine, or even on the same machine between two different folders!</p>

<p>Ideally, the framework targets would be specified for the Copy Files build phase in a way that makes sense no matter what scheme you&#8217;re building, or where you&#8217;re building it on your machine. Furthermore, it&#8217;d be nice to get Debug versions of your frameworks when debugging your app, wouldn&#8217;t it?!</p>

<p>Of course, I&#8217;ve filed a bug to document this issue: <a href="rdar://9722234">rdar://9722234</a>.</p>

<p>So, my solution to the problem in the meantime is to use a script build phase. I created a script in Capo&#8217;s project directory called copyFrameworks.sh, and it looks like this:</p>

<script type="text/javascript" src="https://gist.github.com/1067954.js"></script>

<p>Be sure that you run chmod+x on that file in the terminal, so it executes.</p>

<p>Now, for my new Run Script build phase, I use this:</p>

<script type="text/javascript" src="https://gist.github.com/1067965.js"></script>

<p>That handles both the copy step, and also the subsequent removal of the frameworks&#8217; headers. Note that I don&#8217;t use the &#8220;Input Files&#8221; list in the script to specify the list of frameworks. I know it could be done, but I&#8217;ve just not gotten around to it.</p>

<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://supermegaultragroovy.com/2011/07/06/copying-private-frameworks-using-xcode-4-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diffing tip for MacVim users</title>
		<link>http://supermegaultragroovy.com/2010/09/30/diffing-tip-for-macvim-users/</link>
		<comments>http://supermegaultragroovy.com/2010/09/30/diffing-tip-for-macvim-users/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 16:38:31 +0000</pubDate>
		<dc:creator>Chris Liscio</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.supermegaultragroovy.com/blog/?p=609</guid>
		<description><![CDATA[Stick this in your ~/.bash_profile: alias mvdiff="mvim -R - &#38;>/dev/null" Now, whenever you want to view diffs of changes in your favorite SCM, it&#8217;s as simple as doing something like this: hg diff &#124; mvdiff I can&#8217;t seem to wrap my head around the fancy diff tools that are out there, and unified diffs + [...]]]></description>
			<content:encoded><![CDATA[<p>Stick this in your ~/.bash_profile:</p>

<p><pre>
alias mvdiff="mvim -R - &amp;>/dev/null"
</pre></p>

<p>Now, whenever you want to view diffs of changes in your favorite SCM, it&#8217;s as simple as doing something like this:</p>

<p><tt>
hg diff | mvdiff
</tt></p>

<p>I can&#8217;t seem to wrap my head around the fancy diff tools that are out there, and unified diffs + syntax highlighting seem to work best for my eyes.</p>

<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://supermegaultragroovy.com/2010/09/30/diffing-tip-for-macvim-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom UIButtons via Subclassing</title>
		<link>http://supermegaultragroovy.com/2010/09/22/custom-uibuttons-via-subclassing/</link>
		<comments>http://supermegaultragroovy.com/2010/09/22/custom-uibuttons-via-subclassing/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 21:28:09 +0000</pubDate>
		<dc:creator>Chris Liscio</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.supermegaultragroovy.com/blog/?p=618</guid>
		<description><![CDATA[While working on Capo for the iPhone, I had a need for UIButtons that carried custom state. For instance, the dual-state play/pause button which has highlighted variants for each state. Subclassing UIButton isn&#8217;t entirely straightforward, so I figured I&#8217;d share my approach for getting this to work. Here&#8217;s the code (Note: Requires the iOS 4.0+ [...]]]></description>
			<content:encoded><![CDATA[<p>While working on Capo for the iPhone, I had a need for UIButtons that carried custom state. For instance, the dual-state play/pause button which has highlighted variants for each state.</p>

<p>Subclassing UIButton isn&#8217;t entirely straightforward, so I figured I&#8217;d share my approach for getting this to work. Here&#8217;s the code (<strong>Note: Requires the iOS 4.0+ SDK, due to the lack of an ivar!</strong>):</p>

<script src="http://gist.github.com/592599.js"></script>

<p>There are a few things you need to know about my approach, since I hit some road-blocks while subclassing UIButton on my own.</p>

<p>For starters, you must call setImage:forState: in your chosen initializer, rather than overriding imageForState:. Things won&#8217;t work if you try and go that route. I think this is because UIButton is accessing the underlying data structure that holds its per-state UIImage instances directly.</p>

<p>Second, it&#8217;s necessary that you call layoutSubviews to get the button to update its image when you modify its state programmatically. Calling setNeedsDisplay: does nothing, because UIButton likely doesn&#8217;t do anything in drawRect:.</p>

<p>Finally, you may notice that I asserted against the UIControlStateApplication masks. This is partially because I wanted a record of why I chose the values in the .h file, and partially because I can get some kind of warning in the future if the masks go away (or change.)</p>

<p>Hopefully this helps some of you iOS developers that may be struggling with custom UIButtons!</p>
]]></content:encoded>
			<wfw:commentRss>http://supermegaultragroovy.com/2010/09/22/custom-uibuttons-via-subclassing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

