marcos_ee Posted March 17, 2023 Report Posted March 17, 2023 (edited) Hello, Could someone please tell me where APP_MIDI_NotifyPackage is used or assigned to its default handler, MIOS32_MIDI_Receive_Handler, in any of the projects? The only reference I found was in the main.c of the programming model, however, most tutorial apps, projects like Midibox SEQ, and LoopA, all of them had this function declared, but without assignment to a receive handler, as it is the case in the programming model where TASK_MIDI_Hooks assigns/registers it at line #257. The following from LoopA app.c: ///////////////////////////////////////////////////////////////////////////// // This hook is called when a MIDI package has been received ///////////////////////////////////////////////////////////////////////////// void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package) { // -> MIDI Router MIDI_ROUTER_Receive(port, midi_package); // -> MIDI Port Handler (used for MIDI monitor function) MIDI_PORT_NotifyMIDIRx(port, midi_package); /// -> MIDI file recorder /// MID_FILE_Receive(port, midi_package); // Record midi event in loopa loopaRecord(port, midi_package); // If we are in the MIDI monitor screen, output a packet dump MIDIMonitorAddLog(1, port, midi_package); // forward to MIDI Monitor // SysEx messages have to be filtered for USB0 and UART0 to avoid data corruption // (the SysEx stream would interfere with monitor messages) u8 filter_sysex_message = (port == USB0) || (port == UART0); MIDIMON_Receive(port, midi_package, filter_sysex_message); /* Output MIDI IN activity on the frontpanel LEDs */ switch (port) { case UART0: MIOS32_BOARD_LED_Set(0x0002, ~MIOS32_BOARD_LED_Get()); break; case UART1: MIOS32_BOARD_LED_Set(0x0004, ~MIOS32_BOARD_LED_Get()); break; case UART2: MIOS32_BOARD_LED_Set(0x0008, ~MIOS32_BOARD_LED_Get()); break; } /* // Draw notes to voxel space if( midi_package.event == NoteOn && midi_package.velocity > 0) voxelNoteOn(midi_package.note, midi_package.velocity); if( midi_package.event == NoteOff || (midi_package.event == NoteOn && midi_package.velocity == 0) ) voxelNoteOff(midi_package.note); */ } Edited March 17, 2023 by marcos_ee Quote
Phatline Posted March 17, 2023 Report Posted March 17, 2023 cant say... what are you trying.to do? Quote
marcos_ee Posted March 17, 2023 Author Report Posted March 17, 2023 Well, I believe I found it. The "programming model" from main.c has to be always provided, thus the task TASK_MIDI_Hooks, which in its turn assigns/registers APP_MIDI_NotifyPackage. The separation between main (programming model) and the rest of the app modules had its pros and cons. Quote
marcos_ee Posted March 17, 2023 Author Report Posted March 17, 2023 By the way, I have been to your BLM matrix, but I couldn't see the project code. I'm trying to do an advanced ARP. and/or a pattern player. No step sequencing is involved. Any input is highly appreciated.. Quote
Phatline Posted March 17, 2023 Report Posted March 17, 2023 an arp needs the seq.c .. at least i would use it. in the seq.c i would build a simple counter 1 2 3... 1 2 3.... which only starts when aFLAG is high (aka note was pressed) ... where the max is (3) is set by a global variable which itself is set in the main.cin your UI depending on your arp steps (up dow up...upup up down)....the counters output in seq.c i would send into your arp task to trigger events.... if donewith arp stuff/or released the keypress then i would set the FLAG low, so the seq is stopped putting out triggers. i dont want to release the triggermatrix code since noone but me can understand - and the only usecase then left is thata company pirates it Quote
marcos_ee Posted March 17, 2023 Author Report Posted March 17, 2023 You're probably right. MIOS32 itself comes with plenty of tutorials and examples, yet I find it very difficult to absorb. By the way, I'm trying the Midi file player, and just implemented the TASK_MIDI_Hooks from the programming model, but only a fraction of notes (output from MIOS studio PC app) are received and the receive handler always times out on port 0x20. Any clues? Quote
Phatline Posted March 17, 2023 Report Posted March 17, 2023 i dont have a generic midicontroller code for the blm... i run my project "triggermatrix" on it which is in first case a note processor, in 2nd a sequencer, in 3rd a midigroovebox(without audio). for the blm part i used the blm-scalarcode and stripped it down, and mooved it into the main.c. when the blm-pcb gets into its final revision (aka oneside is pick and place - and a bulk order is on its way) i can provide a skeleton project... i am a bit busy... so thiswill take a while Quote
Phatline Posted March 17, 2023 Report Posted March 17, 2023 (edited) 6 minutes ago, marcos_ee said: You're probably right. MIOS32 itself comes with plenty of tutorials and examples, yet I find it very difficult to absorb. By the way, I'm trying the Midi file player, and just implemented the TASK_MIDI_Hooks from the programming model, but only a fraction of notes (output from MIOS studio PC app) are received and the receive handler always times out on port 0x20. Any clues? no clue... since my knowledge is need to know (me also having a hard time to absorb mios...coming more from a musical background then from programming...learnd c while exploring mios...) but maybe it is a midi mutex thing? combined with a buffer? Edited March 17, 2023 by Phatline Quote
marcos_ee Posted March 17, 2023 Author Report Posted March 17, 2023 Alright, thank you for the follow up. A few insights/tips on the structure of MIOS32 would be more than enough for now. I do not intend to use BLM, ENCODERS, or any external hardware at the moment. I'm just trying to make my way and see how things work altogether inside MIOS32 core. Quote
marcos_ee Posted March 17, 2023 Author Report Posted March 17, 2023 Quote but maybe it is a midi mutex thing? combined with a buffer? I guess so. I was going to ask you about the same thing. I've seen mutexes/semaphores used across the project for SD and midi out, but not midi in. I think I'll have to figure out how midi in is handled. Quote
marcos_ee Posted March 19, 2023 Author Report Posted March 19, 2023 By the way, when only one UART was enabled, is there any problem when RX and TX are both assigned to the same UART, or I should have one UART dedicated per RX/TX? Quote
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.