Browse Source

Fix problems sent by Stephane.

tags/1.9.8
Devin Anderson 14 years ago
parent
commit
173f1629a9
2 changed files with 36 additions and 37 deletions
  1. +17
    -3
      windows/winmme/JackWinMMEInputPort.cpp
  2. +19
    -34
      windows/winmme/JackWinMMEOutputPort.cpp

+ 17
- 3
windows/winmme/JackWinMMEInputPort.cpp View File

@@ -55,7 +55,8 @@ JackWinMMEInputPort::JackWinMMEInputPort(const char *alias_name,
std::auto_ptr<JackMidiBufferWriteQueue> write_queue_ptr(write_queue); std::auto_ptr<JackMidiBufferWriteQueue> write_queue_ptr(write_queue);
sysex_buffer = new jack_midi_data_t[max_bytes]; sysex_buffer = new jack_midi_data_t[max_bytes];
char error_message[MAXERRORLENGTH]; char error_message[MAXERRORLENGTH];
MMRESULT result = midiInOpen(&handle, index, (DWORD)HandleMidiInputEvent, (DWORD)this,
MMRESULT result = midiInOpen(&handle, index, (DWORD)HandleMidiInputEvent,
(DWORD)this,
CALLBACK_FUNCTION | MIDI_IO_STATUS); CALLBACK_FUNCTION | MIDI_IO_STATUS);
if (result != MMSYSERR_NOERROR) { if (result != MMSYSERR_NOERROR) {
GetErrorString(result, error_message); GetErrorString(result, error_message);
@@ -77,7 +78,19 @@ JackWinMMEInputPort::JackWinMMEInputPort(const char *alias_name,
GetErrorString(result, error_message); GetErrorString(result, error_message);
goto unprepare_header; goto unprepare_header;
} }

MIDIINCAPS capabilities;
char *name_tmp;
result = midiInGetDevCaps(index, &capabilities, sizeof(capabilities));
if (result != MMSYSERR_NOERROR) {
WriteError("JackWinMMEInputPort [constructor]", "midiInGetDevCaps",
result);
name_tmp = driver_name;
} else {
name_tmp = capabilities.szPname;
}
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", alias_name, name_tmp,
index + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", client_name, index + 1);
jack_event = 0; jack_event = 0;
started = false; started = false;
write_queue_ptr.release(); write_queue_ptr.release();
@@ -163,7 +176,8 @@ JackWinMMEInputPort::GetName()
} }


void void
JackWinMMEInputPort::ProcessJack(JackMidiBuffer *port_buffer, jack_nframes_t frames)
JackWinMMEInputPort::ProcessJack(JackMidiBuffer *port_buffer,
jack_nframes_t frames)
{ {
write_queue->ResetMidiBuffer(port_buffer, frames); write_queue->ResetMidiBuffer(port_buffer, frames);
if (! jack_event) { if (! jack_event) {


+ 19
- 34
windows/winmme/JackWinMMEOutputPort.cpp View File

@@ -55,10 +55,10 @@ JackWinMMEOutputPort::JackWinMMEOutputPort(const char *alias_name,
thread = new JackThread(this); thread = new JackThread(this);
std::auto_ptr<JackThread> thread_ptr(thread); std::auto_ptr<JackThread> thread_ptr(thread);
char error_message[MAXERRORLENGTH]; char error_message[MAXERRORLENGTH];
MMRESULT result = midiOutOpen(&handle, index, (DWORD)HandleMessageEvent, (DWORD)this,
CALLBACK_FUNCTION);
MMRESULT result = midiOutOpen(&handle, index, (DWORD)HandleMessageEvent,
(DWORD)this, CALLBACK_FUNCTION);
if (result != MMSYSERR_NOERROR) { if (result != MMSYSERR_NOERROR) {
GetErrorString(result, error_message);
GetMMErrorString(result, error_message);
goto raise_exception; goto raise_exception;
} }
thread_queue_semaphore = CreateSemaphore(NULL, 0, max_messages, NULL); thread_queue_semaphore = CreateSemaphore(NULL, 0, max_messages, NULL);
@@ -74,8 +74,6 @@ JackWinMMEOutputPort::JackWinMMEOutputPort(const char *alias_name,
MIDIOUTCAPS capabilities; MIDIOUTCAPS capabilities;
char *name_tmp; char *name_tmp;
result = midiOutGetDevCaps(index, &capabilities, sizeof(capabilities)); result = midiOutGetDevCaps(index, &capabilities, sizeof(capabilities));
/*
Devin : FIXME
if (result != MMSYSERR_NOERROR) { if (result != MMSYSERR_NOERROR) {
WriteMMError("JackWinMMEOutputPort [constructor]", "midiOutGetDevCaps", WriteMMError("JackWinMMEOutputPort [constructor]", "midiOutGetDevCaps",
result); result);
@@ -83,12 +81,11 @@ JackWinMMEOutputPort::JackWinMMEOutputPort(const char *alias_name,
} else { } else {
name_tmp = capabilities.szPname; name_tmp = capabilities.szPname;
} }
*/
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", alias_name, driver_name,
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", alias_name, name_tmp,
index + 1); index + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", client_name, index + 1); snprintf(name, sizeof(name) - 1, "%s:playback_%d", client_name, index + 1);
thread_ptr.release(); thread_ptr.release();
thread_queue_ptr.release();
thread_queue_ptr.release();
return; return;


destroy_thread_queue_semaphore: destroy_thread_queue_semaphore:
@@ -219,6 +216,12 @@ JackWinMMEOutputPort::Execute()
return false; return false;
} }


const char *
JackWinMMEOutputPort::GetAlias()
{
return alias;
}

void void
JackWinMMEOutputPort::GetMMErrorString(MMRESULT error, LPTSTR text) JackWinMMEOutputPort::GetMMErrorString(MMRESULT error, LPTSTR text)
{ {
@@ -228,18 +231,21 @@ JackWinMMEOutputPort::GetMMErrorString(MMRESULT error, LPTSTR text)
} }
} }


const char *
JackWinMMEOutputPort::GetName()
{
return name;
}

void void
JackWinMMEOutputPort::GetOSErrorString(LPTSTR text) JackWinMMEOutputPort::GetOSErrorString(LPTSTR text)
{ {
DWORD error = GetLastError(); DWORD error = GetLastError();
/*
Devin: FIXME
if (! FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, if (! FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &text,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), text,
MAXERRORLENGTH, NULL)) { MAXERRORLENGTH, NULL)) {
snprintf(text, MAXERRORLENGTH, "Unknown OS error code '%d'", error); snprintf(text, MAXERRORLENGTH, "Unknown OS error code '%d'", error);
} }
*/
} }


void void
@@ -385,27 +391,6 @@ void
JackWinMMEOutputPort::WriteOSError(const char *jack_func, const char *os_func) JackWinMMEOutputPort::WriteOSError(const char *jack_func, const char *os_func)
{ {
char error_message[MAXERRORLENGTH]; char error_message[MAXERRORLENGTH];
// Devin : FIXME
//GetOSErrorString(result, error_message);
GetOSErrorString(error_message);
jack_error("%s - %s: %s", jack_func, os_func, error_message); jack_error("%s - %s: %s", jack_func, os_func, error_message);
} }

const char *
JackWinMMEOutputPort::GetAlias()
{
return alias;
}
const char *
JackWinMMEOutputPort::GetName()
{
return name;
}

void
JackWinMMEOutputPort::GetErrorString(MMRESULT error, LPTSTR text)
{
MMRESULT result = midiInGetErrorText(error, text, MAXERRORLENGTH);
if (result != MMSYSERR_NOERROR) {
snprintf(text, MAXERRORLENGTH, "Unknown error code '%d'", error);
}
}

Loading…
Cancel
Save