Last night my brother introduced me to SoundSnap.com, and I decided to add some audio clips to the WPF Disciples blogroll viewer app. This is just too much fun! 🙂
The app now has two tracks running in the background: the sound of the ocean and some nice calm music. When you move items in the Panel3D, it plays a subtle sound that makes it feel like something physical is happening. Also, when you open a blogger’s bio or blog, it plays a sound that represents a Web browser being opened. I spent a while picking out the right sounds, and adjusting the volume levels so that they are not tacky. Hopefully my tastes are good!
The one interesting part about how this works is the way that the sound plays when you move items in the panel. Here is the way I achieved that in XAML:
That snippet takes advantage of the fact that Panel3D has an IsItemsMoving dependency property that is set to true when you call MoveItems() and is set to false when the call completes later on. For this trick to work, the MediaElement’s DataContext must be set to the Panel3D instance so that it can bind to the panel correctly.
If my audio files were .WAV files, instead of .MP3, I could have used the SoundPlayerAction instead of this tricky approach.
Here is a video showing this app in action, in case you do not have Visual Studio 2008 or .NET Framework 3.5 installed:
Download the source code here: WPF Disciples 3D Blogroll Viewer with Audio (source code)
Download the executable here: WPF Disciples 3D Blogroll Viewer with Audio (binaries)
NOTE: Be sure to change the file extension from .DOC to .ZIP and then decompress the file. This is a workaround for a limitation imposed by WordPress.
You are so totally the Man!!!
Love how you have run away with this 3D Panel and taken it to new heights!!
Thank you for sharing with us mortals.
Ha Ha, thats weird and cool all at the same time, I like it
Thanks guys. I like it too. 🙂
I love it 😀
Josh, one little question. Does your application works without Microsoft Windows Player installed? I have little application, and sounds doesn’t appear if microsoft windows player doesn’t installed.
Good point. The latest WMP must be installed. 😀