Jack2 1.9.10
|
00001 /* 00002 Copyright (C) 2011 Devin Anderson 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 00018 */ 00019 00020 #include <memory> 00021 #include <stdexcept> 00022 #include <stdio.h> 00023 00024 #include "JackWinMMEPort.h" 00025 #include "JackError.h" 00026 00027 using Jack::JackWinMMEPort; 00028 00030 // Class 00032 00033 JackWinMMEPort::JackWinMMEPort() 00034 {} 00035 00036 JackWinMMEPort::~JackWinMMEPort() 00037 {} 00038 00039 const char * 00040 JackWinMMEPort::GetAlias() 00041 { 00042 return alias; 00043 } 00044 00045 const char * 00046 JackWinMMEPort::GetName() 00047 { 00048 return name; 00049 } 00050 00051 void 00052 JackWinMMEPort::GetOSErrorString(LPTSTR text) 00053 { 00054 DWORD error = GetLastError(); 00055 if (! FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 00056 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), text, 00057 MAXERRORLENGTH, NULL)) { 00058 snprintf(text, MAXERRORLENGTH, "Unknown OS error code '%ld'", error); 00059 } 00060 } 00061 00062 void 00063 JackWinMMEPort::WriteOSError(const char *jack_func, const char *os_func) 00064 { 00065 char error_message[MAXERRORLENGTH]; 00066 GetOSErrorString(error_message); 00067 jack_error("%s - %s: %s", jack_func, os_func, error_message); 00068 } 00069