Controlling a C++ Application with a Max GUI


    Apr 29 2006 | 7:50 pm
    Hi, I am creating a simple composition tool using microsoft visual C++ 6.0. The aim is to be able to write and recall simple loops and settings etc. I aim to control the program using a GUI made in max/MSP as I have been informed that it is possible for the 2 programmes to communicate. I have no idea if this is actually possible or how to do it. Does anybody have any suggestions?
    Many Thanks
    Andy

    • Apr 29 2006 | 8:23 pm
      Probably the best way is to use sockets. Basically, you'll be transferring data on localhost (127.0.0.1) and sending UDP or TCP/IP packets. The simplest is to use UDP / OSC. There's a nice library called OSCPack for doing this. http://www.audiomulch.com/~rossb/code/oscpack/
      best, wes
    • Apr 29 2006 | 8:55 pm
      i have to say: this is the very first time i have ever heard of someone using max just for the gui!
    • Apr 30 2006 | 12:35 pm
      Its for a university assignment. The project is to be written in C++ but due to the small amount of time to both learn and implement the language it has been advised that max can be used (as I have much more experience wirh max) to create a GUI to contol the app. Seems a tad strange to me too.
    • Apr 30 2006 | 1:46 pm
    • Apr 30 2006 | 8:16 pm
      Would it be an option to embed the C++ application inside a custom external object?
      Seems the easiest way to go. At least to me. It does mean learning the API, but the docs are pretty good. Things like talking to a buffer~ from inside an MSP external are quite reasonable to do.
      Good luck, P.
      -------------- http://www.bek.no/~pcastine/Litter/ ------------- Peter Castine +--> Litter Power & Litter Bundle for Jitter
      iCE: Sequencing, Recording & |home | chez nous| Interface Building for |bei uns | i nostri| Max/MSP Extremely cool http://www.castine.de http://www.dspaudio.com/
    • Apr 30 2006 | 8:43 pm
      If I was you, I'd just use FLTK or QT. FLTK 1.17 is very stable and simple to use. The examples that it comes with are easy to cut and paste into your own project. QT is bloated and slow and IMHO rather cumbersome. I would think this an easier option.
      wes
    • May 01 2006 | 8:40 am
      Andy Brennan wrote: > Its for a university assignment. The project is to be written in C++ > but due to the small amount of time to both learn and implement the > language it has been advised that max can be used (as I have much > more experience wirh max) to create a GUI to contol the app. Seems a > tad strange to me too.
      But then you can programm it as an external. which would be the most obvious way to combine the two languages. Thomas Grill's Flext environment for creating cross platform Pd and max externals in C++ comes in mind here.
      Stefan
      --
      [][] [][][] [][] [][][] [][][][][][][][][][][][][][][]
      Stefan Tiedje Klanggestalter Electronic Composition & Improvisation
      /~~~~~ \ /|() ()| ))))) )| | |( \ /// _/)/ ))))) ___/ ///
      -------------------------x---- --_____-----------|----------- --(_|_ ----|-----|-----()---- -- _|_)----|-----()----------- ----------()------------x-----
      14, Av. Pr. Franklin Roosevelt, 94320 Thiais, France Phone at CCMIX +33-1-57 42 91 09
    • May 01 2006 | 5:22 pm
      Upon discussion with a fellow student it seems that the method advised was to use MIDI. The tutor is quite elusive though so I cannot confirm. Would this make any more sense?
    • May 01 2006 | 5:49 pm
      Basically you have 4 options:
      Don't use Max - Not that bad but will take some work if you've never used a GUI library in C++ before
      Compile an external with you C++ code - difficulty of this depends on how your ocde is organized and what it's doing. Basically if it can straightforwardly fit into the MaxMSP framework, then this is the best way to go. Otherwise, it will take alot of time
      Use sockets to communicate - Using something like OSC pack is extremelt flexible (you can send strings, floats, ints, whatever) and can be coded up in < a few hours. The advantages of OSC over MIDI or many. Probably the most important is the arbitrary nature of the messages. This means your messaging protocol can be built into the communicaiton between max and your app and you don;t have to write some kind of schema for turning MIDI into action.
      Use MIDI - never done this in C++, but is probably not too difficult however you have to setup a protocol to determine what the MIDI does.
      wes