Add a couple of error codes to AudioBackend::ErrorCode
[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 "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 AudioDeviceOpenError:
37                 return _("Failed to open audio device");
38         case AudioDeviceCloseError:
39                 return _("Failed to close audio device");
40         case AudioDeviceNotAvailableError:
41                 return _("Audio device unavailable");
42         case AudioDeviceNotConnectedError:
43                 return _("Audio device not connected");
44         case AudioDeviceReservationError:
45                 return _("Failed to request and reserve audio device");
46         case AudioDeviceIOError:
47                 return _("Audio device Input/Output error");
48         case MidiDeviceOpenError:
49                 return _("Failed to open MIDI device");
50         case MidiDeviceCloseError:
51                 return _("Failed to close MIDI device");
52         case MidiDeviceNotAvailableError:
53                 return _("MIDI device unavailable");
54         case MidiDeviceNotConnectedError:
55                 return _("MIDI device not connected");
56         case MidiDeviceIOError:
57                 return _("MIDI device Input/Output error");
58         case SampleFormatNotSupportedError:
59                 return _("Sample format is not supported");
60         case SampleRateNotSupportedError:
61                 return _("Sample rate is not supported");
62         case RequestedInputLatencyNotSupportedError:
63                 return _("Requested input latency is not supported");
64         case RequestedOutputLatencyNotSupportedError:
65                 return _("Requested output latency is not supported");
66         case PeriodSizeNotSupportedError:
67                 return _("Period size is not supported");
68         case PeriodCountNotSupportedError:
69                 return _("Period count is not supported");
70         case DeviceConfigurationNotSupportedError:
71                 return _("Device configuration not supported");
72         case ChannelCountNotSupportedError:
73                 return _("Channel count configuration not supported");
74         case InputChannelCountNotSupportedError:
75                 return _("Input channel count configuration not supported");
76         case OutputChannelCountNotSupportedError:
77                 return _("Output channel count configuration not supported");
78         case AquireRealtimePermissionError:
79                 return _("Unable to aquire realtime permissions");
80         case SettingAudioThreadPriorityError:
81                 return _("Setting audio device thread priorities failed");
82         case SettingMIDIThreadPriorityError:
83                 return _("Setting MIDI device thread priorities failed");
84         }
85         return _("Could not reconnect to Audio/MIDI engine");
86 }
87
88 std::string
89 AudioBackend::get_standard_device_name (StandardDeviceName device_name)
90 {
91         switch (device_name) {
92         case DeviceNone:
93                 return _("None");
94         case DeviceDefault:
95                 return _("Default");
96         }
97         return std::string();
98 }
99
100 } // namespace ARDOUR