From 80b654691ae9b4144d14003c8417117a168b69aa Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 21 Mar 2011 16:58:16 +0000 Subject: avoid untested use of 2 jack weak symbols git-svn-id: svn://localhost/ardour2/branches/3.0@9175 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audioengine.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'libs/ardour/audioengine.cc') 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 p = ports.reader(); -- cgit v1.2.3