enable packaging for OSX native without jack; use which_page() everywhere in NSD; fix bad use of set_filename() in NSD; do not offer non-duplex devices in ardour's own audio setup dialog

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2896 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-01-11 20:33:47 +00:00
parent cec81ceb3c
commit 5c3ba06c8d
5 changed files with 104 additions and 35 deletions

View file

@ -4,6 +4,7 @@
#include <map> #include <map>
#include <glibmm.h> #include <glibmm.h>
#include <gtkmm/messagedialog.h>
#include <pbd/xml++.h> #include <pbd/xml++.h>
#ifdef __APPLE__ #ifdef __APPLE__
@ -621,10 +622,29 @@ EngineControl::enumerate_coreaudio_devices ()
// Look for the CoreAudio device name... // Look for the CoreAudio device name...
char coreDeviceName[256]; char coreDeviceName[256];
size_t nameSize; size_t nameSize;
for (int i = 0; i < numCoreDevices; i++) { for (int i = 0; i < numCoreDevices; i++) {
nameSize = sizeof (coreDeviceName); nameSize = sizeof (coreDeviceName);
/* enforce duplex devices only */
err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
0, true, kAudioDevicePropertyStreams,
&outSize, &isWritable);
if (err != noErr || outSize == 0) {
continue;
}
err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
0, false, kAudioDevicePropertyStreams,
&outSize, &isWritable);
if (err != noErr || outSize == 0) {
continue;
}
err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i], err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
0, true, kAudioDevicePropertyDeviceName, 0, true, kAudioDevicePropertyDeviceName,
&outSize, &isWritable); &outSize, &isWritable);
@ -649,6 +669,26 @@ EngineControl::enumerate_coreaudio_devices ()
delete [] coreDeviceIDs; delete [] coreDeviceIDs;
} }
if (devs.size() == 0) {
MessageDialog msg (_("\
You do not have any audio devices capable of\n\
simultaneous playback and recording.\n\n\
Please use Applications -> Utilities -> Audio MIDI Setup\n\
to create an \"aggregrate\" device, or install a suitable\n\
audio interface.\n\n\
Please send email to Apple and ask them why new Macs\n\
have no duplex audio device.\n\n\
Alternatively, if you really want just playback\n\
or recording but not both, start JACK before running\n\
Ardour and choose the relevant device then."
),
true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
msg.set_title (_("No suitable audio devices"));
msg.set_position (Gtk::WIN_POS_MOUSE);
msg.run ();
exit (1);
}
return devs; return devs;
} }
#else #else
@ -863,7 +903,7 @@ EngineControl::find_jack_servers (vector<string>& strings)
std::map<string,int> un; std::map<string,int> un;
path = getenv ("PATH"); path = getenv ("PATH");
jack_servers = scanner (path, jack_server_filter, 0, false, true); jack_servers = scanner (path, jack_server_filter, 0, false, true);
vector<string *>::iterator iter; vector<string *>::iterator iter;
@ -877,7 +917,6 @@ EngineControl::find_jack_servers (vector<string>& strings)
} }
} }
string string
EngineControl::get_device_name (const string& driver, const string& human_readable) EngineControl::get_device_name (const string& driver, const string& human_readable)
{ {

View file

@ -20,6 +20,8 @@
#include "i18n.h" #include "i18n.h"
#include "new_session_dialog.h" #include "new_session_dialog.h"
#include <pbd/error.h>
#include <ardour/recent_sessions.h> #include <ardour/recent_sessions.h>
#include <ardour/session.h> #include <ardour/session.h>
#include <ardour/profile.h> #include <ardour/profile.h>
@ -36,6 +38,7 @@
#include <gtkmm2ext/window_title.h> #include <gtkmm2ext/window_title.h>
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace PBD;
#include "opts.h" #include "opts.h"
#include "utils.h" #include "utils.h"
@ -557,40 +560,46 @@ NewSessionDialog::session_name() const
} }
*/ */
int page = m_notebook->get_current_page(); switch (which_page()) {
case NewPage:
if (page == 0 || page == 2) { case EnginePage:
/* new or audio setup pages */ /* new or audio setup pages */
return Glib::filename_from_utf8(m_name->get_text()); return Glib::filename_from_utf8(m_name->get_text());
} else { default:
if (m_treeview->get_selection()->count_selected_rows() == 0) { break;
return Glib::filename_from_utf8(str); }
}
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected(); if (m_treeview->get_selection()->count_selected_rows() == 0) {
return (*i)[recent_columns.visible_name]; return Glib::filename_from_utf8(str);
} }
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected();
return (*i)[recent_columns.visible_name];
} }
std::string std::string
NewSessionDialog::session_folder() const NewSessionDialog::session_folder() const
{ {
if (m_notebook->get_current_page() == 0) { switch (which_page()) {
case NewPage:
return Glib::filename_from_utf8(m_folder->get_filename()); return Glib::filename_from_utf8(m_folder->get_filename());
} else {
default:
if (m_treeview->get_selection()->count_selected_rows() == 0) { break;
const string filename(Glib::filename_from_utf8(m_open_filechooser->get_filename()));
return Glib::path_get_dirname(filename);
}
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected();
return (*i)[recent_columns.fullpath];
} }
if (m_treeview->get_selection()->count_selected_rows() == 0) {
const string filename(Glib::filename_from_utf8(m_open_filechooser->get_filename()));
return Glib::path_get_dirname(filename);
}
Gtk::TreeModel::iterator i = m_treeview->get_selection()->get_selected();
return (*i)[recent_columns.fullpath];
} }
bool bool
NewSessionDialog::use_session_template() const NewSessionDialog::use_session_template() const
{ {
if(m_template->get_filename().empty() && (m_notebook->get_current_page() == 0)) return false; if(m_template->get_filename().empty() && (which_page() == NewPage)) return false;
return true; return true;
} }
@ -679,7 +688,7 @@ NewSessionDialog::get_current_page()
} }
NewSessionDialog::Pages NewSessionDialog::Pages
NewSessionDialog::which_page () NewSessionDialog::which_page () const
{ {
int num = m_notebook->get_current_page(); int num = m_notebook->get_current_page();
@ -902,7 +911,7 @@ NewSessionDialog::monitor_bus_button_clicked ()
void void
NewSessionDialog::reset_template() NewSessionDialog::reset_template()
{ {
m_template->set_filename(""); m_template->unselect_all ();
} }
void void

View file

@ -92,7 +92,7 @@ public:
bool connect_outs_to_master() const; bool connect_outs_to_master() const;
bool connect_outs_to_physical() const ; bool connect_outs_to_physical() const ;
Pages which_page (); Pages which_page () const;
int get_current_page(); int get_current_page();
void set_current_page (int); void set_current_page (int);

View file

@ -1,4 +1,4 @@
#ifndef __ardour_svn_revision_h__ #ifndef __ardour_svn_revision_h__
#define __ardour_svn_revision_h__ #define __ardour_svn_revision_h__
static const char* ardour_svn_revision = "2882"; static const char* ardour_svn_revision = "2884";
#endif #endif

View file

@ -15,7 +15,7 @@ while [ $# -gt 0 ] ; do
case $1 in case $1 in
--sae) SAE=1 ; shift ;; --sae) SAE=1 ; shift ;;
--nojack) WITH_JACK= ; shift ;; --nojack) WITH_JACK= ; shift ;;
--noladpsa) WITH_LADSPA= ; shift ;; --noladspa) WITH_LADSPA= ; shift ;;
--nostrip) STRIP= ; shift ;; --nostrip) STRIP= ; shift ;;
--sysdeps) PRINT_SYSDEPS=1; shift ;; --sysdeps) PRINT_SYSDEPS=1; shift ;;
esac esac
@ -76,6 +76,8 @@ fi
if test x$WITH_JACK != x ; then if test x$WITH_JACK != x ; then
env="$env<key>ARDOUR_WITH_JACK</key><string>true</string>" env="$env<key>ARDOUR_WITH_JACK</key><string>true</string>"
else
env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin</string>"
fi fi
env="<key>LSEnvironment</key><dict><key>ARDOUR_BUNDLED</key><string>true</string>$env</dict>" env="<key>LSEnvironment</key><dict><key>ARDOUR_BUNDLED</key><string>true</string>$env</dict>"
@ -142,7 +144,12 @@ while [ true ] ; do
if ! file $file | grep -qs Mach-O ; then if ! file $file | grep -qs Mach-O ; then
continue continue
fi fi
deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)"` if test x$WITH_JACK != x ; then
deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)"`
else
# do not include libjack
deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | grep -v 'libjack\.'`
fi
echo -n "." echo -n "."
for dep in $deps ; do for dep in $deps ; do
base=`basename $dep` base=`basename $dep`
@ -198,10 +205,17 @@ fi
for exe in $executables; do for exe in $executables; do
EXE=$APPROOT/MacOS/$exe EXE=$APPROOT/MacOS/$exe
changes="" changes=""
for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do if test x$WITH_JACK != x ; then
base=`basename $lib` for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do
changes="$changes -change $lib @executable_path/../Frameworks/$base" base=`basename $lib`
done changes="$changes -change $lib @executable_path/../Frameworks/$base"
done
else
for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
base=`basename $lib`
changes="$changes -change $lib @executable_path/../Frameworks/$base"
done
fi
if test "x$changes" != "x" ; then if test "x$changes" != "x" ; then
install_name_tool $changes $EXE install_name_tool $changes $EXE
fi fi
@ -216,10 +230,17 @@ for dylib in $Frameworks/*.dylib $Frameworks/modules/*.so ; do
# change all the dependencies # change all the dependencies
changes="" changes=""
for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do if test x$WITH_JACK != x ; then
base=`basename $lib` for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}'` ; do
changes="$changes -change $lib @executable_path/../Frameworks/$base" base=`basename $lib`
done changes="$changes -change $lib @executable_path/../Frameworks/$base"
done
else
for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
base=`basename $lib`
changes="$changes -change $lib @executable_path/../Frameworks/$base"
done
fi
if test "x$changes" != x ; then if test "x$changes" != x ; then
if install_name_tool $changes $dylib ; then if install_name_tool $changes $dylib ; then