Jack2  1.9.13
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 const char *
52 JackWinMMEPort::GetDeviceName()
53 {
54  return device_name;
55 }
56 
57 void
58 JackWinMMEPort::GetOSErrorString(LPTSTR text)
59 {
60  DWORD error = GetLastError();
61  if (! FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,
62  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), text,
63  MAXERRORLENGTH, NULL)) {
64  snprintf(text, MAXERRORLENGTH, "Unknown OS error code '%ld'", error);
65  }
66 }
67 
68 void
69 JackWinMMEPort::WriteOSError(const char *jack_func, const char *os_func)
70 {
71  char error_message[MAXERRORLENGTH];
72  GetOSErrorString(error_message);
73  jack_error("%s - %s: %s", jack_func, os_func, error_message);
74 }
75 
SERVER_EXPORT void jack_error(const char *fmt,...)
Definition: JackError.cpp:92