Thursday, December 31, 2009

Fixing dot to note matching algorithm.

//find dots which overlap with notes in stem and are not to the right of other dots being examined
//make sure we have the same number of dots as notes
//if we find more, discard dots which overlap with other stems (alternating between top and bottom)
//if we find less, defer

Wednesday, December 30, 2009

"Intellitrace" in VS2010 is a great time-saver when debugging exceptions.

Todos:
- Combine/include all ledgers
- If a note in a stem has dots, all notes must have dots. Must improve dot matching algorithm.

Tuesday, December 29, 2009

Have slacked off with notes over the past week. Fixed a bunch of stuff, moved a bunch of code across from old project and refactored. Yay.

Feeling pretty average. Could be to do with last night's beers, tradies schnitzel, bundy draughts and 2am maccas 'Agnes burger'. Ugh.


Using 'position' instead of tick when moving through score (where position is a double in terms of beats).

Current todos:
- Set start tempo and dynamics for score. Will hard code defaults for now (done).
- Link all stems in prev/next chain and move current stem prev/next (as in beam chains etc) to new properties (done).

Changing all elements back to black after parsing and (for now) colouring notes green when they play. Playing through score, but with no noteOffs yet.

More todos:
- try/catch block in logging code,
- try/catch/logging etc around ticks and input events

Friday, December 25, 2009

- Tempo changes contain one or more UI elements (usually text) and start/(maybe) end Stems.
- Tempo changes could be in linked list and use start/end ticks instead of stems.
- Got basic tempo stuff running (I think).
- Added base class for tempo and dynamic changes

Wednesday, December 23, 2009

- Need to fix bar numbers. Done.
- Did a quick bit of research around options for timers in C#. Currently using the windows multimedia timer which I think is still as good as it gets.
- Working on playing through score which requires the score and a timer. Trying to find the right balance between refactoring old code and writing shiny code.
- Not using a Chord object atm. Hopefully won't need it.
- Added a BarParsed class to move score parsing stuff up from Bar.
- Todo if two notes have the same pitch and position, don't play the earlier noteOff.

Tuesday, December 15, 2009

Tidied up namespaces in preparation for score playback stuff.

Sunday, December 13, 2009

Finished score navigation and changing displayed page count (basic for now). Need to fix a bug with initial display.

Saturday, December 12, 2009

My ScorePanel has FirstIndex and LastIndex for tracking which lines are displayed, and the display is changed by changing these values. We know that they are changed externally if they change outside of the rendering process.

If FirstIndex changes, we add lines from start to finish and if LastIndex changes we add them backwards (ie when turning back a line/page and we know the last line but not the first).

Moving to .Net 4.0 fixed an annoying bug that caused something to hang on to fonts, but caused a new exception (also to do with fonts, but perhaps is legit).

Removing Lines from ScorePanel Children triggers another render loop. Err.

Tuesday, December 8, 2009

It turns out that calling Measure() on a child control inside ArrangeOverride() can cause an infinite layout invalidation loop. I created my own Measure() method in the child controls which I call from MeasureOverride() and from ArrangeOverride() in the scorePanel. Extra layout loops went away.

Line Forward/back working. Page forward/back and Start/End should be easy.

Thursday, December 3, 2009

Binding FirstIndex/LastIndex DPs in ScorePanel to VM. They invalidate render if changed outside of render routine.

For some reason, scorePanel renders twice on load and I don't know what triggers the 2nd one (although external code callstack looks same as the 1st).

Tuesday, December 1, 2009

someDelegate.Invoke(); is about 1.3 times slower then a direct method call, and the same as calling the delegate itself.

dynamic blah = someDelegate; blah.Invoke(); is just under 10 times slower than method call, which is close enough for me (since a loop of 10,000,000 calls takes 770ms). ((dynamic)someDelegate).Invoke(); is marginally faster and is easier to use.

Delegate blah = someDelegate; blah .DynamicInvoke(); is about 550 times slower than a method call and doesn't add any value over using a dynamic.

It looks like I'll be using dynamics.


Tidied up some stuff. That should be enough tidying for now, back to page turning stuff.