I am just getting started with Jack and linux-based audio. Currently working on a project in C++ where I am going to need to build Jack MIDI clients, however, the Jack API seems to be for C.
I have used JackCPP header wrappers for creating audio clients, however, they are only for the audio i/o libraries.
Is there anything out there for using Jack's midiport.h in C++? Or, any other way to create a MIDI client to talk to Jack?
Thanks!
Simple Jack MIDI Client in C++?
Moderators: MattKingUSA, khz
- autostatic
- Established Member
- Posts: 1994
- Joined: Wed Dec 09, 2009 5:26 pm
- Location: Beverwijk, The Netherlands
- Has thanked: 32 times
- Been thanked: 104 times
- Contact:
Re: Simple Jack MIDI Client in C++?
Hello suprafly, did you also take a look at Jack2? That implementation is written in C++ instead of C.suprafly wrote:I am just getting started with Jack and linux-based audio. Currently working on a project in C++ where I am going to need to build Jack MIDI clients, however, the Jack API seems to be for C.
You could take a look at RtMidi: http://www.music.mcgill.ca/~gary/rtmidi/suprafly wrote:Is there anything out there for using Jack's midiport.h in C++? Or, any other way to create a MIDI client to talk to Jack?
Best,
Jeremy
-
brummer
Re: Simple Jack MIDI Client in C++?
you could use jack headers in C or C++ independent if you use jackd or jackdmp, because:
If you like you could have a look at our implementation here :
http://sourceforge.net/apps/trac/guitar ... x_jack.cpp
Isn't a simple client, but maybe it's helpful for you.
And here is our midi engine:
http://sourceforge.net/apps/trac/guitar ... e_midi.cpp
Code: Select all
#ifdef __cplusplus
extern "C" {
#endifhttp://sourceforge.net/apps/trac/guitar ... x_jack.cpp
Isn't a simple client, but maybe it's helpful for you.
And here is our midi engine:
http://sourceforge.net/apps/trac/guitar ... e_midi.cpp
Re: Simple Jack MIDI Client in C++?
Thanks for the help guys. I have a follow up question, probably very simple.
I am taking midisine.c from the example clients and attempting to compile it in C++. It creates the object file but when it comes to compiling the executable it gives me this:
Any ides why I am getting an undefined reference?
I am taking midisine.c from the example clients and attempting to compile it in C++. It creates the object file but when it comes to compiling the executable it gives me this:
Code: Select all
simple.o: In function `process(unsigned int, void*)':
simple.cpp:(.text+0xca): undefined reference to `jack_port_get_buffer'
simple.cpp:(.text+0xe2): undefined reference to `jack_port_get_buffer'
simple.cpp:(.text+0xf9): undefined reference to `jack_midi_get_event_count'
simple.cpp:(.text+0x135): undefined reference to `jack_midi_event_get'
simple.cpp:(.text+0x17f): undefined reference to `jack_midi_event_get'
simple.cpp:(.text+0x22d): undefined reference to `jack_midi_event_get'
simple.o: In function `main':
simple.cpp:(.text+0x395): undefined reference to `jack_client_open'
simple.cpp:(.text+0x3d9): undefined reference to `jack_get_sample_rate'
simple.cpp:(.text+0x417): undefined reference to `jack_set_process_callback'
simple.cpp:(.text+0x42d): undefined reference to `jack_set_sample_rate_callback'
simple.cpp:(.text+0x464): undefined reference to `jack_port_register'
simple.cpp:(.text+0x48c): undefined reference to `jack_port_register'
simple.cpp:(.text+0x49f): undefined reference to `jack_activate'
- raboof
- Established Member
- Posts: 1865
- Joined: Tue Apr 08, 2008 11:58 am
- Location: Deventer, NL
- Has thanked: 52 times
- Been thanked: 80 times
- Contact:
Re: Simple Jack MIDI Client in C++?
I'm guessing you failed to link in libjack. How are you building this binary?suprafly wrote:simple.cpp:(.text+0xca): undefined reference to `jack_port_get_buffer'[/code]
Any ides why I am getting an undefined reference?
Re: Simple Jack MIDI Client in C++?
A simple Makefile which compiles the binary with g++. What is the line for linking libjack?
- raboof
- Established Member
- Posts: 1865
- Joined: Tue Apr 08, 2008 11:58 am
- Location: Deventer, NL
- Has thanked: 52 times
- Been thanked: 80 times
- Contact:
Re: Simple Jack MIDI Client in C++?
Could you paste the Makefile? iirc something like '-ljack' while linking should do it.suprafly wrote:A simple Makefile which compiles the binary with g++. What is the line for linking libjack?
-
brummer
Re: Simple Jack MIDI Client in C++?
try this one
regards brummer
Code: Select all
g++ `pkg-config --libs jack` midisine.c -o midisine