[specimen] [specimen-svn] r64 - in trunk: . src

Eric Dantan Rzewnicki eric at zhevny.com
Tue Sep 11 14:30:00 CDT 2007


On Tue, Sep 11, 2007 at 01:08:29PM -0500, svn at zhevny.com wrote:
> Author: iuso
> Date: 2007-09-11 13:08:29 -0500 (Tue, 11 Sep 2007)
> New Revision: 64
> 
> Modified:
>    trunk/configure.ac
>    trunk/src/jackdriver.c
> Log:
> Added configure check and ifdefs for latest JACK MIDI (>= 0.105.0). Specimen will now compile and run with three different JACK MIDI APIs! Woo! [Re]named the macros for 0.105.0, 0.102.27, and 0.102.0 to HAVE_JACK_MIDI, HAVE_OLD_JACK_MIDI, and HAVE_OLDEST_JACK_MIDI.

heh! this is just getting silly, isn't it. ;) probably I should have
used HAVE_JACK_MIDI_01020, _010227, etc, etc. but, oh well.

I hope the jack midi api doesn't change again. Are any other projects
bothering to support the different versions? I suppose at some point in
the future the api will be final and we can clean out all that junk.

> 
> Modified: trunk/configure.ac
> ===================================================================
> --- trunk/configure.ac	2007-09-09 08:29:49 UTC (rev 63)
> +++ trunk/configure.ac	2007-09-11 18:08:29 UTC (rev 64)
> @@ -90,13 +90,18 @@
>  # jack
>  PKG_CHECK_MODULES(JACK, jack >= 0.99.0, HAVE_JACK="yes", config_error="yes")
>  if test "x$HAVE_JACK" = xyes ; then
> -  PKG_CHECK_MODULES(JACK_MIDI, jack >= 0.102.27, HAVE_JACK_MIDI="yes", config_error="no")
> -    if test "x$HAVE_JACK_MIDI" = xyes; then
> -      AC_DEFINE([HAVE_JACK_MIDI], [], [Define if we have jack midi support.])
> +  PKG_CHECK_MODULES(JACK_MIDI, jack >= 0.105.0, HAVE_JACK_MIDI="yes", config_error="no")
> +  if test "x$HAVE_JACK_MIDI" = xyes; then
> +    AC_DEFINE([HAVE_JACK_MIDI], [], [Define if we have jack midi support.])
> +  else
> +    PKG_CHECK_MODULES(OLD_JACK_MIDI, jack >= 0.102.27, HAVE_OLD_JACK_MIDI="yes", config_error="no")
> +    if test "x$HAVE_OLD_JACK_MIDI" = xyes; then
> +      AC_DEFINE([HAVE_OLD_JACK_MIDI], [], [Define if we have old jack midi support.])
>      else
> -      PKG_CHECK_MODULES(OLD_JACK_MIDI, jack >= 0.102.0, HAVE_OLD_JACK_MIDI="yes", config_error="no")
> -      if test "x$HAVE_OLD_JACK_MIDI" = xyes; then
> -        AC_DEFINE([HAVE_OLD_JACK_MIDI], [], [Define if we have old jack midi support.])
> +      PKG_CHECK_MODULES(OLDEST_JACK_MIDI, jack >= 0.102.0, HAVE_OLDEST_JACK_MIDI="yes", config_error="no")
> +      if test "x$HAVE_OLDEST_JACK_MIDI" = xyes; then
> +        AC_DEFINE([HAVE_OLDEST_JACK_MIDI], [], [Define if we have oldest jack midi support.])
> +      fi
>      fi 
>    fi
>  fi
> @@ -138,8 +143,10 @@
>  fi
>  echo -n "      Jack midi support: "
>  if test "x$HAVE_JACK_MIDI" = xyes; then
> +    echo "yes with jack >= 0.105.0"
> +elif test "x$HAVE_OLD_JACK_MIDI" = xyes; then
>      echo "yes with jack >= 0.102.27"
> -elif test "x$HAVE_OLD_JACK_MIDI" = xyes; then
> +elif test "x$HAVE_OLDEST_JACK_MIDI" = xyes; then
>      echo "yes with jack >= 0.102.0 and < 0.102.27"
>  else
>      echo "no"
> 
> Modified: trunk/src/jackdriver.c
> ===================================================================
> --- trunk/src/jackdriver.c	2007-09-09 08:29:49 UTC (rev 63)
> +++ trunk/src/jackdriver.c	2007-09-11 18:08:29 UTC (rev 64)
> @@ -3,9 +3,9 @@
>  #include <string.h>
>  #include <jack/jack.h>
>  #include <config.h>
> -#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI
> +#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI || defined HAVE_OLDEST_JACK_MIDI
>  #include <jack/midiport.h>
> -#endif
> +#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI || HAVE_OLDEST_JACK_MIDI */
>  #include <jack/transport.h>
>  #include <gtk/gtk.h>
>  #include <pthread.h>
> @@ -27,7 +27,7 @@
>  static GtkWidget*      config_frame;
>  static jack_port_t*    lport;
>  static jack_port_t*    rport;
> -#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI
> +#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI || defined HAVE_OLDEST_JACK_MIDI
>  static jack_port_t*    midiport;
>  #endif
>  static jack_client_t*  client;
> @@ -41,7 +41,7 @@
>  typedef jack_default_audio_sample_t jack_sample_t;
>  
>  
> -#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI
> +#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI || defined HAVE_OLDEST_JACK_MIDI
>  static void map_control(unsigned char chan, int param, float value, Tick tick)
>  {
>      static struct
> @@ -67,7 +67,7 @@
>  	    mixer_direct_control(chan, map[i].param, 
>  				 value * map[i].scale + map[i].bias, tick);
>  }
> -#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI */
> +#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI || HAVE_OLDEST_JACK_MIDI */
>  
>  
>  static int process (jack_nframes_t frames, void* arg)
> @@ -78,18 +78,19 @@
>       jack_position_t pos;
>       
>       /* MIDI data */
> -#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI
> +#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI || defined HAVE_OLDEST_JACK_MIDI
>       void* midi_buf = jack_port_get_buffer(midiport, frames);
>       jack_midi_event_t jack_midi_event;
>       jack_nframes_t event_index = 0;
>  #ifdef HAVE_JACK_MIDI
> +     jack_nframes_t event_count = jack_midi_get_event_count(midi_buf);
> +#elif HAVE_OLD_JACK_MIDI
>       jack_nframes_t event_count = jack_midi_get_event_count(midi_buf, frames);
> +#elif HAVE_OLDEST_JACK_MIDI
> +     jack_nframes_t event_count = jack_midi_port_get_info(midi_buf, frames)->event_count;
>  #endif /* HAVE_JACK_MIDI */
> -#ifdef HAVE_OLD_JACK_MIDI
> -     jack_nframes_t event_count = jack_midi_port_get_info(midi_buf, frames)->event_count;
> -#endif /* HAVE_OLD_JACK_MIDI */
>       unsigned char* midi_data;
> -#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI */
> +#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI || HAVE_OLDEST_JACK_MIDI */
>  
>       /* transport state info */
>       static jack_transport_state_t last_state = JackTransportStopped;
> @@ -121,11 +122,15 @@
>       }
>       last_state = new_state;
>  
> -#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI
> +#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI || defined HAVE_OLDEST_JACK_MIDI
>       /* send the JACK MIDI events to the mixer */
>       while (event_index < event_count) {
>         
> +#ifdef HAVE_JACK_MIDI
> +         jack_midi_event_get(&jack_midi_event, midi_buf,event_index);
> +#else
>           jack_midi_event_get(&jack_midi_event, midi_buf,event_index, frames);
> +#endif /* HAVE_JACK_MIDI */
>  	  midi_data = jack_midi_event.buffer;
>  	  
>  	  /* TODO: handle 14-bit controllers and RPNs and NRPNs */
> @@ -158,7 +163,7 @@
>  	  
>            event_index++;
>       }
> -#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI */
> +#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI || HAVE_OLDEST_JACK_MIDI */
>  
>       mixer_mixdown (buffer, frames);
>       for (i = 0; i < frames; i++)
> @@ -289,11 +294,11 @@
>       rport =
>  	  jack_port_register (client, "out_right", JACK_DEFAULT_AUDIO_TYPE,
>  			      JackPortIsOutput, 0);
> -#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI
> +#if defined HAVE_JACK_MIDI || defined HAVE_OLD_JACK_MIDI || defined HAVE_OLDEST_JACK_MIDI
>       midiport =
>  	  jack_port_register (client, "midi_input", JACK_DEFAULT_MIDI_TYPE,
>  			      JackPortIsInput, 0);
> -#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI */
> +#endif /* HAVE_JACK_MIDI || HAVE_OLD_JACK_MIDI || HAVE_OLDEST_JACK_MIDI */
>  
>       rate = jack_get_sample_rate (client);
>       driver_set_samplerate (rate);
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 
> _______________________________________________
> specimen-svn mailing list
> specimen-svn at zhevny.com
> http://zhevny.com/mailman/listinfo/specimen-svn

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Specimen mailing list