Posted in:

I’ve been doing some housekeeping on the NAudio solution recently, and made some long overdue improvements.

First, the build process, which was a combination of msbuild and IronPython is now in F# using FAKE. Currently I’ve done little more than a straight port of the previous build process to a FAKE script, but it will make it a lot easier going forwards to automate more of the release process. Plus it gives me an excuse to do a bit more F#.

Second, I’ve split the Windows Media project out into its own separate project on GitHub. This project is of less importance these days because you can very easily read and write WMA files using the MediaFoundationReader and MediaFoundationEncoder classes within NAudio.

Third, I ended up moving the Windows 8 and Universal assemblies and demo projects out into their own separate solution files (NAudio.Win8.sln and NAudio.Universal.sln). There were two reasons for this. First of all, ReSharper seems to get horribly confused by the number of different platforms being targeted in one solution. Secondly, VS2015 refuses to open the Windows 8 projects, demanding that they are retargeted to Windows 8.1. VS2013 however can build those projects, but can’t load the Universal ones. I see no reason for retargeting from Windows 8 to 8.1, as I want these assemblies to be useful as broadly as possible. So with separate solutions you can work on the Universal projects in VS2015 and the Win 8 projects in VS2013.

Fourth, I removed the dependency on MEF for the NAudioDemo project. This was cumbersome as the demo project had to use a special build of MEF that would work on .NET 3.5, but more seriously it confused many people who were trying to copy the code samples. For now, I’ve kept the plugin model, but instead using a very simple reflection helper method to load the plugins, making it hopefully more obvious where they are coming from:

public static IEnumerable<T> CreateAllInstancesOf<T>()
{
    return typeof (ReflectionHelper).Assembly.GetTypes()
        .Where(t => typeof (T).IsAssignableFrom(t))
        .Where(t => !t.IsAbstract && t.IsClass)
        .Select(t => (T) Activator.CreateInstance(t));
}

There are still a few more additional tasks to be done. I want to get a 1.8 build of NAudio released soon, but first I need to find out how you are supposed to add a Universal class library to a NuGet package. I think I’m supposed to put it in a uap10.0 folder based on this article, but let me know in the comments if I’m barking up the wrong tree here.

Want to get up to speed with the the fundamentals principles of digital audio and how to got about writing audio applications with NAudio? Be sure to check out my Pluralsight courses, Digital Audio Fundamentals, and Audio Programming with NAudio.