Updated MIDI Module driver (now for 4.2)

In response to some queries from Max in Germany, I made some changes to the Gadgeteer driver for the MIDI module. It also now requires the 4.2 beta.

http://petebrown.codeplex.com/releases/view/85236

It’s not the recommended release just yet, but if you’re on 4.2 and using the module, definitely try it out. Overall performance is about 3x improved. Send performance is 10x improved.

Pete

1 Like

Is the performance increase simply going from v4.1 to v4.2 (in another words is the new framework that much more quicker)?

Or did you tune the code as well?

Because of how I went about it, I didn’t get to compare 4.1 to 4.2. The performance improvement is the result of several hours of manual profiling and code tuning. The single biggest improvement was from completely eliminating the DebugPrint statements.

Even those were turned off, the function call and the string concatenation to build the messages was taking something like 50% of the total execution time.

Here are the things that improved perf, roughly in order of impact:
[ul]Removed DebugPrint statements and their string contcatenation
Remove parameter validation
Turn off auto-flushing of serial on send
Compile to release mode
Changed auto-properties to regular fields
Changed MidiMessage to a struct vs. a class[/ul]

Others, like making the events into a true callback, and inlining some small function calls had almost no impact, so I removed those changes. In fact, inlining some of those small functions actually hurt performance, so the compiler is doing some optimization behind the scenes. I was happy to see that, as many of those smaller functions are ones I would have done as a macro had this been C.

Pete

Pete,

Please excuse me I’m a newbie to this Gadgeteer life. I’ve downloaded your software and connected to it as an added reference. The bit I’m stuck with is how to get the ‘image’ of your board to appear in the tool box to then drag into the Program.Gadgeteer.diagram.

Could you explain how to do this?

Thanks for your youtube videos, MIDI board design

Mike

@ SaturdayScience

The downloadable bits include a MSI which installs everything that is needed including the toolbox entry. You don’t need to manually add references, just drag the toolbox item over and the driver is referenced for you.

Pete

Pete,

I have run your msi. The only visible evidence is your folder in program files. I’ve tried dragging the dll onto tool box - got the computer says no sound.
I right clicked toolbox and browsed to the dll. Error message as below.

Sorry - I dont know what I should be doing.

Mike

Did you install gadgeteer SDK first? It is part of our software package.

Yes I installed the items in order from the Support Installation Steps. Though clearly something is amiss.

Mike

Ah - a step forwards and linked with another post.

Looking in .net gadgeteer there is a post “Empty Toolbox in 4.1 - no modules or …
SteveUKman”.

So powered up c#2010 and asked for a 4.1 project. The tool box was empty apart from Pete’s MIDI board!

As with SteveUKman’ds posting there were no GHI components in the 4.1 tool box.

GHI meets 'sliding doors’
I hope this helps someone far more knowledgable than me to pinpoint the issues.

Mike

So, not sure what the issue was. Was it something with my bits?

I have a 4.2 build of the module, but it’s not a “release” as I recall. I need to run through it and a few other things to unify. One downside is the Gadgeteer install framework doesn’t let me package up helper assemblies, so some of the samples break in the 4.2 build unless you dig up the other assemblies from the tree. I pulled them out of the main assembly for space reasons (especially on smaller boards like the Cerbuino Bee).

Pete

Pete,

Your knowledge is so much deeper than mine. All I know how to express what I have is a little like ‘Sliding doors’.

Your module installed after 4.2 but it appears in 4.1. No other Gadgeteer boards of controls appear in the 4.1 toolbox.

If I start a 4.2 project then all the Gadgeteer items are in the toolbox - but you module wont install.

As to the causes for the behaviour I would only be guessing.

Sadly it GHI have made no attempt to rectify this issue or the related one I pointed to. From this side of the pond it feels like GHI take your hard earned cash and then run for the hills.

I thank you for taking time to investigate from you end. I will revert to Arduino or Propeller solution for my little project.

Pete - thanks for your help.

Mike

It is likely that there was something wrong in the way you installed the required SDKs or a local problem with your PC.

I suggest you uninstall Visual Studio and all of the SDKS, both from Microsoft and GHI, plus your attitude, and then re-install them
in the exact order specified on http://www.ghielectronics.com/support/dotnet-micro-framework. Make
sure the you include the optional 4.1 SDK.

It’s likely because my “recommended” MSI targets 4.1 not 4.2

Completely me, not GHI.

If you go into CodePlex http://petebrown.codeplex.com and click on the “downloads” tab and then select the “MIDI MOdule for .NET Gadgeteer 4.2 Beta” I think that will work for you. If it doesn’t, I’ll do another compiler soon which will.

In September/October I got completely overtaken by the Windows 8 launch and Build, but I’ll get back to finalizing the 4.2 (and 4.3) stuff soon.

Sorry for the troubles.

Pete