Jack2  1.9.9
JackWinMMEPort.cpp
1 /*
2 Copyright (C) 2011 Devin Anderson
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 <memory>
21 #include <stdexcept>
22 #include <stdio.h>
23 
24 #include "JackWinMMEPort.h"
25 #include "JackError.h"
26 
28 
30 // Class
32 
33 JackWinMMEPort::JackWinMMEPort()
34 {}
35 
36 JackWinMMEPort::~JackWinMMEPort()
37 {}
38 
39 const char *
40 JackWinMMEPort::GetAlias()
41 {
42  return alias;
43 }
44 
45 const char *
46 JackWinMMEPort::GetName()
47 {
48  return name;
49 }
50 
51 void
52 JackWinMMEPort::GetOSErrorString(LPTSTR text)
53 {
54  DWORD error = GetLastError();
55  if (! FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,
56  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), text,
57  MAXERRORLENGTH, NULL)) {
58  snprintf(text, MAXERRORLENGTH, "Unknown OS error code '%ld'", error);
59  }
60 }
61 
62 void
63 JackWinMMEPort::WriteOSError(const char *jack_func, const char *os_func)
64 {
65  char error_message[MAXERRORLENGTH];
66  GetOSErrorString(error_message);
67  jack_error("%s - %s: %s", jack_func, os_func, error_message);
68 }
69 
SERVER_EXPORT void jack_error(const char *fmt,...)
Definition: JackError.cpp:91