Add enums to AudioBackend class for getting standard error and device name strings
[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 SampleRateNotSupportedError:
59                 return _("Sample rate is not supported");
60         case RequestedInputLatencyNotSupportedError:
61                 return _("Requested input latency is not supported");
62         case RequestedOutputLatencyNotSupportedError:
63                 return _("Requested output latency is not supported");
64         case PeriodSizeNotSupportedError:
65                 return _("Period size is not supported");
66         case PeriodCountNotSupportedError:
67                 return _("Period count is not supported");
68         case DeviceConfigurationNotSupportedError:
69                 return _("Device configuration not supported");
70         case InputChannelCountNotSupportedError:
71                 return _("Input channel count configuration not supported");
72         case OutputChannelCountNotSupportedError:
73                 return _("Output channel count configuration not supported");
74         case AquireRealtimePermissionError:
75                 return _("Unable to aquire realtime permissions");
76         case SettingAudioThreadPriorityError:
77                 return _("Setting audio device thread priorities failed");
78         case SettingMIDIThreadPriorityError:
79                 return _("Setting MIDI device thread priorities failed");
80         }
81         return std::string();
82 }
83
84 std::string
85 AudioBackend::get_standard_device_name (StandardDeviceName device_name)
86 {
87         switch (device_name) {
88         case DeviceNone:
89                 return _("None");
90         case DeviceDefault:
91                 return _("Default");
92         }
93         return std::string();
94 }
95
96 } // namespace ARDOUR