Coder Social home page Coder Social logo

sendSysEx() on Mac OSX about qmidi HOT 8 OPEN

waddlesplash avatar waddlesplash commented on May 10, 2024
sendSysEx() on Mac OSX

from qmidi.

Comments (8)

LeStahL avatar LeStahL commented on May 10, 2024

Could you provide some information on your problem? Useful would be

  • steps to reproduce / minimal example
  • what did you try?

from qmidi.

waddlesplash avatar waddlesplash commented on May 10, 2024

CC @CodeforEvolution.

from qmidi.

denisgottardello avatar denisgottardello commented on May 10, 2024

Please try it
http://www.denisgottardello.it/Test01.zip
On windows and Linux no problem.
On Mac OS X sometimes works, sometimes goes to crash.

from qmidi.

LeStahL avatar LeStahL commented on May 10, 2024

You might be right - the request is made with a reference to a temporary (from your functions on_pushButton_clicked and on_pushButton_2_clicked), which is likely the cause for the crash. Those will return and the result of HexStringToByteArray(ui->lineEditNoteOn->text()) becomes invalid - and so does request.data.

Possible options:

  • Don't call sendSysEx on temporaries in your non-QMidi code.
  • Change QMidi_CoreMidi.cpp to alloc and copy the bytes, then use the completionProc of the request to free them again.

I do not have OS X available for testing, so I'm not the right person to implement such a thing ;)

from qmidi.

denisgottardello avatar denisgottardello commented on May 10, 2024

Solved by changing the code
` MIDISysexSendRequest request;
request.bytesToSend = data.length();
request.complete = false;
request.completionProc = nullptr;
request.completionRefCon = nullptr;
request.data = (Byte *)data.constData();
request.destination = fMidiPtrs->destinationId;

MIDISendSysex(&request);`

to
` MIDISysexSendRequest *request= new MIDISysexSendRequest();
request->bytesToSend = data.length();
request->complete = false;
request->completionProc = nullptr;
request->completionRefCon = nullptr;
request->data = (Byte *)data.constData();
request->destination = fMidiPtrs->destinationId;

MIDISendSysex(request);`

When can I delete the object
request
?
On compile time I have a lot of warnings. Can I add as developer or there is anyone that will improve the code?

from qmidi.

LeStahL avatar LeStahL commented on May 10, 2024

request->completionProc can be used to delete request again, after passing the pointer there with request->completionRefCon

refer to https://developer.apple.com/documentation/coremidi/midisysexsendrequest

completionProc will be called when you can delete the request.

from qmidi.

LeStahL avatar LeStahL commented on May 10, 2024

Can I add as developer

@waddlesplash would have to answer that. :)

from qmidi.

waddlesplash avatar waddlesplash commented on May 10, 2024

You can submit a pull request with this, sure. It would be best if the warnings were fixed, and of course you need to write the callback to delete the request.

from qmidi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.