levon Posted March 8, 2008 Report Share Posted March 8, 2008 Hi, have had a search and cant find anything similar to this.so heres what i want to do.have a Midi keyboard plugged into my Midibox. the midi box monitors the incoming notes. when a button is pressed on the midibox, it stores all notes into an array. but it needs to take into account the buttons that have been let go. Im thinking, if i have an array, with 128 bytes in each, each address number is the same as the midi note number it references. ie, note 00 is in Midi_Buffer[0] and note 24 in Midi_Buffer[24] etc. then when a midi note ON is received, it stores it in the array address, and midi note OFF deletes it. just wanted to share my idea, and see if anyone had any other ideas.,Levon Quote Link to comment Share on other sites More sharing options...
stryd_one Posted March 8, 2008 Report Share Posted March 8, 2008 Didn't I already cover this in the chatroom? Quote Link to comment Share on other sites More sharing options...
nILS Posted March 8, 2008 Report Share Posted March 8, 2008 Yeah, this'll work, but... What does it do? It stores the notes. And then? Quote Link to comment Share on other sites More sharing options...
levon Posted March 9, 2008 Author Report Share Posted March 9, 2008 Hey Stryd, sorry for got to mention your idea, but ive been expanding on it. stryd suggested that i have one array that records the midi on notes, and another that records the midi off notes, then compares the two. Nils, im making a sort of sustain pedal. so it will play each note that is stored once another button is pressed.ok, n00b question, im fairly new to C, but have used python in the past.when im trying to write to the array, but i get an error message on compile.im defining it at the start withconst unsigned char midi_buffer[128]; and on this line midi_buffer[evnt0] = evnt0; it has the error message "error: assignment of read-only location"How do i write to an entry in the array? ive searched the net for C tutorials and they write an entry to an array this way.thanks, Levon Quote Link to comment Share on other sites More sharing options...
ptitjes Posted March 9, 2008 Report Share Posted March 9, 2008 when im trying to write to the array, but i get an error message on compile.im defining it at the start withconst unsigned char midi_buffer[128]; and on this line midi_buffer[evnt0] = evnt0; it has the error message "error: assignment of read-only location"How do i write to an entry in the array? ive searched the net for C tutorials and they write an entry to an array this way.The const keyword means constant! So yes you try to write in a read-only location :)Best regards, Didier. Quote Link to comment Share on other sites More sharing options...
levon Posted March 9, 2008 Author Report Share Posted March 9, 2008 / feels stupid :(thanks :D Quote Link to comment Share on other sites More sharing options...
stryd_one Posted March 9, 2008 Report Share Posted March 9, 2008 Hey Stryd, sorry for got to mention your idea, but ive been expanding on it.Actually this is totally different :) This way will be easier on the CPU but is way memory heavy in comparison. There were a few other tips I gave you regarding the timing of the other method, so that the core is doing work when it's not timing specific, that should overcome any problems though. This way will be way easier to code though, so go with this unless you need more RAM later :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.