Not like I don't have 100 unfinished projects already. But I recently come across a mario paint composer by unfungames.com. I remember playing mario paint back on the Snes. So I gave it a whirl. Turns out they wrote it in macromedia director. and it sucks. It does what its suppose to but the interface is buggy and it just doesn't work right. So I come across mario sequencer. its in Japanese it works ok, but it lacks all the features that would make it worth while.

So I decided I would attempt to make my own. I know using directSound with a secondary audio buffer you can alter the pitch of a wav file. no problem there. I drew the staff already using gdi+, no problem there. but then the problem comes with how do I loop through the objects added to the staff?

Here is my idea. I'm just not sure the performance will be worth the time. Any suggestions would be appreciated.

I used 20px gaps vertically and 40px gaps horizontally. I figure i create a "note" class that holds its point to be drawn on the staff. and when you click to add a note it will check the point you clicked and move it to the next even 40px interval for x and 20px interval for y causing it to snap to the staff. I the note class a frequency variable that is automatically set depending on its postiton.Y property. and give it a int property that represnets its Icon and corrisponding sound.

on Paint i loop through all the objects i created and draw them (sounds slow but idk what else to do)

then on playback I will use a timer to control tempo and loop through the objects getting their position.X property and if the match the current line to be played then play its sound with its frequency altering information using a secondary buffer.

any suggestions on this? can anyone think of a better way to handle this? I was thinking of creating a multidimensional array to hold the note data. But I'm really unsure of if that would make a difference.

this is really disappointing. Well I found if I draw part of the staff to an image in memory and draw the image its actually faster than manually drawing the entire staff every time. But its still dirty. I have lots of stuff going on so I'm in no hurry. Maybe someone will have some ideas on this eventually.

Not sure how far you have got with this as this is an old post.

Anyway have you tried setting your staff gdi as the background of a panel and creating a custom NoteControl for each note. Then all you need to worry about is painting the note in its control.

The position of each note on the staff is then managed by setting the location property of the NoteControl objects. This also has the advantage of allowing each note to be repositioned by handling the mouse events for the NoteControl objects.

Since the panel already has a control collection and you know that the only controls in it are NoteControl objects you might be able to iterate through this to do the play back.

Hope this helps.

commented: Great! +9

If speed and quality of the drawing is an issue, you might be better moving over to Managed DirectX.

Other than that, nick's post is the best logical way I can think of atm.

The staff is drawn dynamically. Because bar numbers and the high and low staff bars that are only drawn when a
note is present. I didn't want to use the
notes as controls as that adds a huge over head for each note and there could be hundreds. But it's on the back burner for now. Thanks for the help. I will try both suggestions
and get back to you. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.