Category Archives: Music

C++ (chew slowly)

I spent a some time on the weekend looking at Rosegarden for Windows for the first time in a while.  I’ve been meaning to get the device allocation working correctly with RtMidi and get the MIDI recording also working but it’s slightly more challenging when you have to pass stuff back from it’s own thread rather than having access to all the nice Driver level features we’ve built into Rosegarden.

Rosegarden has the concept of a Studio – originally this was designed around the idea of device templates and the autoload document in Logic Audio – so essentially you can set up your external MIDI and audio devices once and then save it all to your autoload file and every time you hit ‘New Composition’ you get a fresh canvas with all you devices all set up and raring to go.   In my original design I’d also expanded the idea of the Studio to encompass audio placement eventually so that you’d be able to mimic acoustics of virtual instruments and such like – so being able to place MIDI and audio instruments in the stereo (or more) sound field and have consistent effects.  However it just became a layer in the end whereby we could try and put sensible names onto MIDI instruments and provide something approaching a consistent interface across audio and MIDI.   Perhaps in this regard it wasn’t such a good idea simply copying the Logic Audio model because to be honest it wasn’t a very elegant solution – I just didn’t know any better.

Have a look at Albeton if you want to see a way that this can be addressed for recording purposes.

Anyway – I digress – Rosegarden has a Studio concept which is an abstraction of MIDI and Audio devices and I need to tie up my outgoing and incoming MIDI events to the Studio model if I’m to make Rosegarden understand what the events are and where they come from.  So I have to jump through a few hoops to make the MappedStudio (as it’s known at the sequencer level) available to the MidiThread.  At this point I got a great remind of how hokey C++ syntax is – as my RtMidi event callback is a static method I have to declare any data structures that it wants to use also as static.  As I’ve been used to the wonderful world of C# for a long time now I tried to write:

static public MyStructure m_myStructure;

In the class definition.  Forgetting of course that my scope definitions are section based in C++.  Then for the life of me could I remember how to initialise this static public structure in the code and where?  No – first I tried in the header (of course no joy), then in the body but of course I got the naming convention wrong.  Eventually I got my definitions correct after a lot of fiddling and probably some swearing and of course waiting for the rebuilds (don’t forget the linker errors) but it demonstrates to me just why I moved on around 2004 and tried another language or two after being mired in C++ land for a while.  It can all drive you insane and I’m just now thinking that I’ve not even started to think about debugging the undoubted mistakes I’ve made in memory management with the changes I’ve made.

So bear it in mind, C++ is wonderful for connecting across the seemingly impassable chasms of disparate functionality and fixing holes between APIs but it takes a bit of your soul with you every time you lose your temper.  So take small bites, chew slowly and keep topped up with plenty of fluids.  It’s going to get warm and shouty out there.

To Kickstart or not to Kickstart?

A long long time ago I was quite heavily involved in developing a piece of open source software called Rosegarden (the history of which is pretty well documented). It was, and still is, a piece of software that helps you compose, record and create music and it originally came into being during a final year University project that Chris and Andy did back way before when there was a Linux – back when everyone still thought Macs were just for accountants or graphic designers.

I got involved in the first steps of Rosegarden under Linux in 1995 and that snowballed into working on it full time for a while during the early 2000s. I’ve not been involved with the project in any big capacity since about 2006 but I’m pleased to say that the project is still going strong under the watchful eye of D. Michael McIntyre who has been the self-appointed custodian of all things Rosegarden since the rest of us swanned off to have children and do real jobs and have all the fun you can’t have when you’re sweating over an open source cookpot.

Rosegarden is now, what, about 18 years old? About to come of age or already there. Perhaps it’s coming to the end of the road, perhaps it just needs a nudge in the right direction? I’m keen to see it continue and I’ve been doing a small amount of work on a Windows version but the days when we could sit around throwing days and weeks and coding challenges are way behind us. Challenges need to be bite-sized, or life-sized, and Rosegarden might be just too much of a monster to continue. The last time I looked there were over 200k lines of code in there.

So the question is – where to now? And from a quick search I can see that Rosegarden is not the only Open Source audio project thinking the same thing. The question being is there any incentive to continue? Is there a will and if there’s a will – what is the way?

I’m ambivalent about Kickstarter for software projects because I’m not really sure who it benefits the most. For example I love the idea of Light Table maybe because that’s because I’m working on something similar myself (which, like Light Table, will be paid software) but I don’t want to take people’s money up front for it. However for a project such as Rosegarden – where there already is a popular piece of software there already and it’s looking for a way to survive – is this a more valid way for a project to fund itself? If so how should it be structured to attract and retain developers? Who decides who gets paid and how? To me the accountabilty and governance of a Kickstarter software project is still something of a mystery and perhaps we will see a backlash occuring at some point if and when projects fail to deliver? From the Kickstarter guidelines it is suggested that a project should ‘under promise and over deliver’. Perception is everything and with some big ticket Kickstarter projects currently running who is to say what the perception will be in a year’s time for crowd funding?

For Rosegarden perhaps nothing needs to be done other than a holiday for developers and a dose of enthusiasm. However structure always helps any development be it open source, commercial or both. Without vision and leadership things will drift and what helps to keep everyone sweet is an occasional pay day too. So – to Kickstart or not to Kickstart?