avoid untested use of 2 jack weak symbols
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 21 Mar 2011 16:58:16 +0000 (16:58 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 21 Mar 2011 16:58:16 +0000 (16:58 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9175 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audioengine.cc
libs/ardour/port.cc

index 1c74dd13c74214b1e26f92d308f7c0818d0cb036..44da01defd3d59dcdae7bd48641dea4c3bb4f689 100644 (file)
@@ -648,8 +648,25 @@ AudioEngine::jack_bufsize_callback (pframes_t nframes)
        _usecs_per_cycle = (int) floor ((((double) nframes / frame_rate())) * 1000000.0);
        last_monitor_check = 0;
 
-        _raw_buffer_sizes[DataType::AUDIO] = jack_port_type_get_buffer_size (_priv_jack, JACK_DEFAULT_AUDIO_TYPE);
-        _raw_buffer_sizes[DataType::MIDI] = jack_port_type_get_buffer_size (_priv_jack, JACK_DEFAULT_MIDI_TYPE);
+        if (jack_port_type_get_buffer_size) {
+                _raw_buffer_sizes[DataType::AUDIO] = jack_port_type_get_buffer_size (_priv_jack, JACK_DEFAULT_AUDIO_TYPE);
+                _raw_buffer_sizes[DataType::MIDI] = jack_port_type_get_buffer_size (_priv_jack, JACK_DEFAULT_MIDI_TYPE);
+        } else {
+
+                /* Old version of JACK.
+                   
+                   These crude guesses, see below where we try to get the right answers.
+                   
+                   Note that our guess for MIDI deliberatey tries to overestimate
+                   by a little. It would be nicer if we could get the actual
+                   size from a port, but we have to use this estimate in the 
+                   event that there are no MIDI ports currently. If there are
+                   the value will be adjusted below.
+                */
+                
+                _raw_buffer_sizes[DataType::AUDIO] = nframes * sizeof (Sample);
+                _raw_buffer_sizes[DataType::MIDI] = nframes * 4 - (nframes/2);
+        }
 
        boost::shared_ptr<Ports> p = ports.reader();
 
index bc802aa81e39373c3e0c2ed862ed5196fdfa5966..647f470325d9bdf828ae16120afa6a27ae37d67e 100644 (file)
@@ -129,7 +129,11 @@ Port::get_connections (std::vector<std::string> & c) const
                                ++n;
                        }
                         
-                       jack_free (jc);
+                        if (jack_free) {
+                                jack_free (jc);
+                        } else {
+                                free (jc);
+                        }
                }
        }
 
@@ -471,12 +475,19 @@ Port::physically_connected () const
                        jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]);
                         
                        if (port && (jack_port_flags (port) & JackPortIsPhysical)) {
-                               jack_free (jc);
+                                if (jack_free) {
+                                        jack_free (jc);
+                                } else {
+                                        free (jc);
+                                }
                                return true;
                        }
                }
-                
-               jack_free (jc);
+                if (jack_free) {
+                        jack_free (jc);
+                } else {
+                        free (jc);
+                }
        }
 
        return false;