Reinterpret the return value of AudioBackend::start as AudioBackend::ErrorCode
This will allow backends to return a more meaningful error message. Eventually an error code could be returned by AudioEngine::start and the GUI can then use AudioBackend::get_error_string to convert the error into a translated error message directly, or it may be desirable to define its own error messages. The reasons for not doing that right now is that this is a workable solution with the least change required.
This commit is contained in:
parent
9a7f96f15a
commit
d85ab8af89
|
@ -99,6 +99,8 @@ class LIBARDOUR_API AudioEngine : public SessionHandlePtr, public PortManager
|
|||
pframes_t samples_since_cycle_start ();
|
||||
bool get_sync_offset (pframes_t& offset) const;
|
||||
|
||||
std::string get_last_backend_error () const { return _last_backend_error_string; }
|
||||
|
||||
int create_process_thread (boost::function<void()> func);
|
||||
int join_process_threads ();
|
||||
bool in_process_thread ();
|
||||
|
@ -280,6 +282,8 @@ class LIBARDOUR_API AudioEngine : public SessionHandlePtr, public PortManager
|
|||
bool _started_for_latency;
|
||||
bool _in_destructor;
|
||||
|
||||
std::string _last_backend_error_string;
|
||||
|
||||
Glib::Threads::Thread* _hw_reset_event_thread;
|
||||
gint _hw_reset_request_count;
|
||||
Glib::Threads::Cond _hw_reset_condition;
|
||||
|
|
|
@ -835,8 +835,12 @@ AudioEngine::start (bool for_latency)
|
|||
|
||||
_processed_frames = 0;
|
||||
last_monitor_check = 0;
|
||||
|
||||
if (_backend->start (for_latency)) {
|
||||
|
||||
int error_code = _backend->start (for_latency);
|
||||
|
||||
if (error_code != 0) {
|
||||
_last_backend_error_string =
|
||||
AudioBackend::get_error_string((AudioBackend::ErrorCode)error_code);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user