fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / audio_backend.cc
1 /*
2     Copyright (C) 2015 Tim Mayberry
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "ardour/audio_backend.h"
21
22 #include "pbd/i18n.h"
23
24 namespace ARDOUR {
25
26 std::string
27 AudioBackend::get_error_string (ErrorCode error_code)
28 {
29         switch (error_code) {
30         case NoError: // to stop compiler warning
31                 return _("No Error occurred");
32         case BackendInitializationError:
33                 return _("Failed to initialize audio backend");
34         case BackendDeinitializationError:
35                 return _("Failed to deinitialize audio backend");
36         case BackendReinitializationError:
37                 return _("Failed to reinitialize audio backend");
38         case AudioDeviceOpenError:
39                 return _("Failed to open audio device");
40         case AudioDeviceCloseError:
41                 return _("Failed to close audio device");
42         case AudioDeviceInvalidError:
43                 return _("Audio device not valid");
44         case AudioDeviceNotAvailableError:
45                 return _("Audio device unavailable");
46         case AudioDeviceNotConnectedError:
47                 return _("Audio device not connected");
48         case AudioDeviceReservationError:
49                 return _("Failed to request and reserve audio device");
50         case AudioDeviceIOError:
51                 return _("Audio device Input/Output error");
52         case MidiDeviceOpenError:
53                 return _("Failed to open MIDI device");
54         case MidiDeviceCloseError:
55                 return _("Failed to close MIDI device");
56         case MidiDeviceNotAvailableError:
57                 return _("MIDI device unavailable");
58         case MidiDeviceNotConnectedError:
59                 return _("MIDI device not connected");
60         case MidiDeviceIOError:
61                 return _("MIDI device Input/Output error");
62         case SampleFormatNotSupportedError:
63                 return _("Sample format is not supported");
64         case SampleRateNotSupportedError:
65                 return _("Sample rate is not supported");
66         case RequestedInputLatencyNotSupportedError:
67                 return _("Requested input latency is not supported");
68         case RequestedOutputLatencyNotSupportedError:
69                 return _("Requested output latency is not supported");
70         case PeriodSizeNotSupportedError:
71                 return _("Period size is not supported");
72         case PeriodCountNotSupportedError:
73                 return _("Period count is not supported");
74         case DeviceConfigurationNotSupportedError:
75                 return _("Device configuration not supported");
76         case ChannelCountNotSupportedError:
77                 return _("Channel count configuration not supported");
78         case InputChannelCountNotSupportedError:
79                 return _("Input channel count configuration not supported");
80         case OutputChannelCountNotSupportedError:
81                 return _("Output channel count configuration not supported");
82         case AquireRealtimePermissionError:
83                 return _("Unable to aquire realtime permissions");
84         case SettingAudioThreadPriorityError:
85                 return _("Setting audio device thread priorities failed");
86         case SettingMIDIThreadPriorityError:
87                 return _("Setting MIDI device thread priorities failed");
88         case ProcessThreadStartError:
89                 return _("Failed to start process thread");
90         case FreewheelThreadStartError:
91                 return _("Failed to start freewheel thread");
92         case PortRegistrationError:
93                 return _("Failed to register audio/midi ports");
94         case PortReconnectError:
95                 return _("Failed to re-connect audio/midi ports");
96         case OutOfMemoryError:
97                 return _("Out Of Memory Error");
98         }
99         return _("Could not reconnect to Audio/MIDI engine");
100 }
101
102 std::string
103 AudioBackend::get_standard_device_name (StandardDeviceName device_name)
104 {
105         switch (device_name) {
106         case DeviceNone:
107                 return _("None");
108         case DeviceDefault:
109                 return _("Default");
110         }
111         return std::string();
112 }
113
114 } // namespace ARDOUR