Last Build Date: Mon, 06 Apr 2009 20:42:57 GMTCopyright: Keith Rome
Mon, 06 Apr 2009 20:42:57 GMT
In a few hours I will be giving a new presentation to the Atlanta MS Professionals User Group. The topic for tonight is Asynchronous UI.
I will be talking about a number of common development patterns, along with discussion of the benefits and tradeoffs of each, and demos of the more mainstream approaches. I will also be covering a very simple and elegant solution that meets most async requirements – Jeffrey Richter’s AsyncEnumerator.
In advance of tonight’s presentation, I am posting my slides and code early. You can download them from this link. They may also become available as a download for members of the MSPros user group after the session.
Also, as a raffle prize, I am donating a one-year subscription to MSDN Premium with Visual Studio 2008 Team Suite Edition. If you were to buy it from Amazon, this subscription would cost over $10,000, so be sure to show up tonight if for nothing else than to win.(image)
Thu, 19 Jun 2008 18:17:48 GMT
I ran across SoundSnap today – what a great resource for finding free sound effects and music loops. For those participating in the GGMUG Silverlight Game Development Contest, this might come in handy for you, so please check it out!
By the way, the GGMUG is a great venue to meet new people who are passionate about .NET development. If you live on the East side of town, and just can’t make it to those Alpharetta meetings held by the other user groups, then please check this new group out if you haven’t already.(image)
Mon, 09 Jun 2008 21:59:22 GMTAudio support is all too often one of the last things a developer thinks of when it comes to building a user interface. Fortunately, Silverlight offers some basic building blocks that make it fairly trivial to add event-driven sounds to our applications. I have taken the built-in functionality one step further, and created a simple run-time audio engine that makes it even easier. First, I will discuss the requirements that I had in mind when I created this engine. Second, I will discuss the ideal API for a complete solution. Third, I submit the simple effects engine that I developed in order to meet those requirements and API. Sound Effects Engine Requirements Must be able to play looping “background music” tracks. Must be able to play smaller sound effects on demand. Must support concurrent (and overlapping) sounds effects without interfering with already-playing audio. Must adequately handle the possibility of download delays when pulling down external audio files. Should cache audio files between playbacks. Should allow serving of audio from high-bandwidth CDN such as Silverlight Streaming. An Ideal Sound Effects API Should be very approachable. If possible, only a single line of code to play any audio (similar to PlaySound() API). Should support any formats supported by Silverlight. Should be efficient. Should offer download and playback completion callbacks (for chaining and synchronization). Should support aggressive background pre-caching of audio files. The SilverlightToolbox Solution To address the simplicity requirements, this sound effects engine is implemented as a single static C# class that can be easily included into any Silverlight project. It can exist in a referenced class library, or can be linked directly into the main project. To address looping background music, a single method SetBackgroundLoop() is supplied. This will begin playback of a single audio clip, and will automatically repeat it. Only one track can be played as the background loop – calling this method again will terminate the running track and start the new one. You can also pass String.Empty to stop all background music. To address typical sound effect clips. two overloads of the PlaySoundEffect() method are supplied. The simpler of the two methods will simply play a clip once it has been downloaded. The extended version allows you to specify a callback for when the clip has been downloaded and started playing, and a second callback that can be used for notification that the clip has ended. To address the scenario where multiple sound effects might be played at the same time, the engine internally maintains a queue of MediaElements. When a new sound needs to played, it pulls an unused element and puts it into service. Once the sound is finished, the element is returned to the queue. This allows Silverlight itself to handle media mixing, and by caching those MediaElements, it does so without placing undue stress on the environment. To address the issue of download delays, the startedCallback and completedCallback parameters of PlaySoundEffect() were introduced. To address caching of audio files, a WebClient is used (which in turn leverages the browser’s cache). Furthermore, the engine will reuse any downloaded file streams (and is smart enough to not re-queue the same file if it already queued for download). By using a MediaElement for playback, audio tracks are automatically supported from streaming sources and Content Delivery Networks, and can be of any type supported by Silverlight. To support chaining of audio effects, and to support synchronization of UI with audio, the PlaySoundEffect() method accepts callback events that are fired when the clip has been downloaded, and again when it has completed playback. To further help with UI synchronization, a second utility class is provided (DelayedAction) which provides a simple wrapper for BackgroundWorker that can be used to easily delay execution of a block of c[...]
Sun, 01 Jun 2008 05:30:38 GMT
As a follow-up to the previous post, I have entered Gem Blaster into a game development contest held by the Microsoft RIA Development Center Portal web site. I am happy to say that it has made it into the Finalists group of 6 games that are being showcased for the next few weeks on the RIA web site:
The final judging is done based on popularity among visitors there. They basically track number of visits to each game, as well as how long people stay there, whether they come back and revisit, etc. So if you like it, please pass the link around to your friends and ask them to check it out too.(image)