mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
provide details about session-creation failure.
This commit is contained in:
parent
ebfd0782e1
commit
56eae394cc
2 changed files with 18 additions and 6 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "libardour-config.h"
|
#include "libardour-config.h"
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
@ -139,6 +140,17 @@ class WindowsVSTPlugin;
|
||||||
|
|
||||||
extern void setup_enum_writer ();
|
extern void setup_enum_writer ();
|
||||||
|
|
||||||
|
class LIBARDOUR_API SessionException: public std::exception {
|
||||||
|
public:
|
||||||
|
explicit SessionException(const std::string msg) : _message(msg) {}
|
||||||
|
virtual ~SessionException() throw() {}
|
||||||
|
|
||||||
|
virtual const char* what() const throw() { return _message.c_str(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _message;
|
||||||
|
};
|
||||||
|
|
||||||
class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager
|
class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -315,12 +315,12 @@ Session::Session (AudioEngine &eng,
|
||||||
#endif
|
#endif
|
||||||
if (ensure_engine (sr)) {
|
if (ensure_engine (sr)) {
|
||||||
destroy ();
|
destroy ();
|
||||||
throw failed_constructor ();
|
throw SessionException (_("Cannot connect to audio/midi engine"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (create (mix_template, bus_profile)) {
|
if (create (mix_template, bus_profile)) {
|
||||||
destroy ();
|
destroy ();
|
||||||
throw failed_constructor ();
|
throw SessionException (_("Session initialization failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if a mix template was provided, then ::create() will
|
/* if a mix template was provided, then ::create() will
|
||||||
|
|
@ -336,7 +336,7 @@ Session::Session (AudioEngine &eng,
|
||||||
|
|
||||||
if (!mix_template.empty()) {
|
if (!mix_template.empty()) {
|
||||||
if (load_state (_current_snapshot_name)) {
|
if (load_state (_current_snapshot_name)) {
|
||||||
throw failed_constructor ();
|
throw SessionException (_("Failed to load template/snapshot state"));
|
||||||
}
|
}
|
||||||
store_recent_templates (mix_template);
|
store_recent_templates (mix_template);
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +347,7 @@ Session::Session (AudioEngine &eng,
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (load_state (_current_snapshot_name)) {
|
if (load_state (_current_snapshot_name)) {
|
||||||
throw failed_constructor ();
|
throw SessionException (_("Failed to load state"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to get sample rate from XML state so that we
|
/* try to get sample rate from XML state so that we
|
||||||
|
|
@ -364,13 +364,13 @@ Session::Session (AudioEngine &eng,
|
||||||
|
|
||||||
if (ensure_engine (sr)) {
|
if (ensure_engine (sr)) {
|
||||||
destroy ();
|
destroy ();
|
||||||
throw failed_constructor ();
|
throw SessionException (_("Cannot connect to audio/midi engine"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (post_engine_init ()) {
|
if (post_engine_init ()) {
|
||||||
destroy ();
|
destroy ();
|
||||||
throw failed_constructor ();
|
throw SessionException (_("Cannot configure audio/midi engine with session parameters"));
|
||||||
}
|
}
|
||||||
|
|
||||||
store_recent_sessions (_name, _path);
|
store_recent_sessions (_name, _path);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue