mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
win midi: don't show MessageBox on errors
This commit is contained in:
parent
1a278d6105
commit
60eef57795
@ -28,6 +28,7 @@
|
||||
#include "i_sound.h"
|
||||
#include "i_system.h"
|
||||
#include "m_misc2.h"
|
||||
#include "m_io.h"
|
||||
#include "memio.h"
|
||||
#include "mus2mid.h"
|
||||
#include "midifile.h"
|
||||
@ -154,19 +155,19 @@ static buffer_t buffer;
|
||||
|
||||
static boolean initial_playback = false;
|
||||
|
||||
// Message box for midiStream errors.
|
||||
// Check for midiStream errors.
|
||||
|
||||
static void MidiError(const char *prefix, DWORD dwError)
|
||||
{
|
||||
char szErrorBuf[MAXERRORLENGTH];
|
||||
wchar_t werror[MAXERRORLENGTH];
|
||||
MMRESULT mmr;
|
||||
|
||||
mmr = midiOutGetErrorText(dwError, (LPSTR) szErrorBuf, MAXERRORLENGTH);
|
||||
mmr = midiOutGetErrorTextW(dwError, (LPWSTR)werror, MAXERRORLENGTH);
|
||||
if (mmr == MMSYSERR_NOERROR)
|
||||
{
|
||||
char *msg = M_StringJoin(prefix, ": ", szErrorBuf, NULL);
|
||||
MessageBox(NULL, msg, "midiStream Error", MB_ICONEXCLAMATION);
|
||||
free(msg);
|
||||
char *error = ConvertWideToUtf8(werror);
|
||||
fprintf(stderr, "%s: %s.\n", prefix, error);
|
||||
free(error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ static wchar_t *ConvertUtf8ToWide(const char *str)
|
||||
return ConvertMultiByteToWide(str, CP_UTF8);
|
||||
}
|
||||
|
||||
static char *ConvertWideToUtf8(const wchar_t *wstr)
|
||||
char *ConvertWideToUtf8(const wchar_t *wstr)
|
||||
{
|
||||
return ConvertWideToMultiByte(wstr, CP_UTF8);
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ int M_access(const char *path, int mode);
|
||||
void M_MakeDirectory(const char *dir);
|
||||
char *M_getenv(const char *name);
|
||||
|
||||
#ifdef _WIN32
|
||||
char *ConvertWideToUtf8(const wchar_t *wstr);
|
||||
#endif
|
||||
|
||||
char *M_ConvertSysNativeMBToUtf8(const char *str);
|
||||
char *M_ConvertUtf8ToSysNativeMB(const char *str);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user