drumstick  2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
sequencererror.cpp
Go to the documentation of this file.
1 /*
2  MIDI Sequencer C++ library
3  Copyright (C) 2006-2023, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3 of the License, or
8  (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 extern "C" {
20  #include <alsa/asoundlib.h>
21 }
23 
29 namespace drumstick { namespace ALSA {
30 
36 SequencerError::SequencerError(QString const& s, int rc):
37  m_location(s), m_errCode(rc) { }
38 
39 const char *SequencerError::what() const noexcept
40 {
41  return snd_strerror(m_errCode);
42 }
43 
45 {
46  return QString(what());
47 }
48 
50 {
51  return m_errCode;
52 }
53 
54 const QString &SequencerError::location() const
55 {
56  return m_location;
57 }
58 
61 } // namespace ALSA
62 } // namespace drumstick
QString qstrError() const
Gets the human readable error message from the error code.
int code() const
Gets the numeric error code.
SequencerError(QString const &s, int rc)
Constructor.
const QString & location() const
Gets the location of the error code as provided in the constructor.
virtual const char * what() const noexcept override
Retrieve a human readable error message.
Drumstick common.
Definition: alsaclient.cpp:68
SequencerError Exception class.