Blog Post

PART 6A – MORE REFACTORING

Last time I said “a couple of things” needed my attention, and getting the code base inside the correct workflow was just one of them. Now that was done I could “refactor” the code base proper. “Refactoring” is a term from OO programming(well it became popular there) and really all it means is going back round the code restructuring and putting stuff in the best place for re-use and if you’re lucky improved performance as well as being more extensible and maintainable(just one place to fix each problem as it arrives).

Again there’s no real visible win here, so it can get ignored in favour of “nice-new-shiny-stuff”. But as getting everything into the correct workflow(again!) hadn’t been as unpleasant or time consuming as I’d feared I decided to take a run through the code to refactor stuff.

One part of the code base that had grown a LOT was the “note playing” – which needed to account for a whole raft of stuff like repeats, random, reverse, formant stuff etc. etc. So I dragged it all out into a callable function (called unimaginatively  “play_a_note”). It made the code more readable and very slightly improved performance(I think). But whilst coding it I noticed an opportunity to fix another of the “potential problems”.

I have some very odd loops in the test set, including some that seem to start in the wrong place, by which I mean most loops start with a kick drum “on the 1”, but some of these seemed to be offset by one or more beats: so they seemed to start “on the 2”  – which was often a hi hat, or “on the 3”- which was a snare. Why the person who recorded these loops decided to do that I have no idea but hey – all creativity is good right?  I identified a way to get Slice to “shuffle” every pad sound(slice) either forwards or backwards, so the end user could move/shuffle slice sounds across all 32 pads – so they would have an easy “fix” if they wanted it. So I added some controls in the loop section to do just that. And another “potential issue” was no more, as well as offering yet more loop-manipulation options. But was it all getting “too much”? Would users be intimidated by all the stuff you could now do?

 

Here’s a screen shot with the shuffle controls underneath the Loop grid:

part2_new_uioff

 

 

 

 

Here’s what faces me each day(yeah really, 13K lines of code…)

really_13376_lines_of_code

 

Related Posts