Home AMX General Discussion

Buffer too slow(?) for midi data...

funkfunk Junior MemberPosts: 18
I'm fairly new to AMX programming in combination with midi. I'm using an AXB-Midi connected to a NI-3000 to control a yamaha 01v96 v2 mixer.
All is well when I control the mixer by midi , but when I operate the mixer itself, the databuffer in my program seems to 'miss' some incomming data.

This is what happens:
- When you control the fader on the mixer, it sends constant updates of it's value ($B0,nFader,nValue). When you stop moving the fader, the sending of data stops.
- My program contains a buffer array (midi_data[40]) for this incoming data.
- I see ALL the data coming into the NI-3000 in NetLinx Studio's Device Notification
- BUT, only about a fourth is captured by the buffer, and therefore my onscreen data does not correspond with the actual mixer (e.g. the fader is at zero while the 'on screen' is still halfway) which causes problems etc. etc.

Took me a while to figure out why my program didn't work well. But I don't understand why this happens and how to solve it. Are buffers just too slow...?? HELP

Comments

  • Chip MoodyChip Moody Junior Member Posts: 727
    It depends on a lot of things, especially how the code is handling the buffer, but... I'm thinking that 40 bytes is a pretty small buffer for MIDI data - have you tried upping that to something more significant? If you're working in the Netlinx universe, you can make that buffer pretty freakin' big.

    I'm guessing your 40-character buffer is simply overflowing...

    Cool username, BTW. :)

    - Chip
  • Roman BiasRoman Bias Junior Member Posts: 33
    We've got a working module for it. We use INTEGERS. We've got a bi directional module. When you control the faders on the mixer you see it on your touchpanel. When you use the faders on the touchpanel you see the faders move onb the mixer :). So use an integer array and make a function that check if there is data from the mixer then update the slider and then check for updates.
  • funkfunk Junior Member Posts: 18
    Thanks guys!

    The buffer size was the problem in this case. I 'assumed' that with a bufferoverflow, I would lose the data at the end of the array, but that the incoming data would still flow in fine. I assumend wrong :)

    Now I have to figure out how to handle these LOADS of data. Setting two faders to zero and back to -90 gives me a array with a length of about 660... but that's a different story.

    P.S. Any change of providing me with the module for inspiration ? ;)
Sign In or Register to comment.