diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-03-21 16:58:16 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-03-21 16:58:16 +0000 |
commit | 80b654691ae9b4144d14003c8417117a168b69aa (patch) | |
tree | 0e470fd5f48da1a40a3cc776e54fe4a027df1c7e | |
parent | feb120c80340db0baeb1c6cc36e43d38234c4f0d (diff) |
avoid untested use of 2 jack weak symbols
git-svn-id: svn://localhost/ardour2/branches/3.0@9175 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/audioengine.cc | 21 | ||||
-rw-r--r-- | libs/ardour/port.cc | 19 |
2 files changed, 34 insertions, 6 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 1c74dd13c7..44da01defd 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -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(); diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index bc802aa81e..647f470325 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -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; |