| @@ -14,7 +14,7 @@ extern "C" | |||
| { | |||
| #endif | |||
| #define MAX_SERVERS 8 /* maximum concurrent servers */ | |||
| #define MAX_SERVERS 64 /* maximum concurrent servers */ | |||
| #define MAX_SHM_ID 256 /* generally about 16 per server */ | |||
| #define JACK_SERVER_NAME_SIZE 256 /* maximum length of server name */ | |||
| #define JACK_SHM_MAGIC 0x4a41434b /* shm magic number: "JACK" */ | |||
| @@ -5,7 +5,7 @@ | |||
| <Project filename="jackd.cbp"> | |||
| <Depends filename="libjackserver.cbp" /> | |||
| </Project> | |||
| <Project filename="jack_portaudio.cbp" active="1"> | |||
| <Project filename="jack_portaudio.cbp"> | |||
| <Depends filename="libjackserver.cbp" /> | |||
| </Project> | |||
| <Project filename="jack_netdriver.cbp"> | |||
| @@ -56,7 +56,7 @@ | |||
| <Project filename="multiple_metro.cbp"> | |||
| <Depends filename="libjack.cbp" /> | |||
| </Project> | |||
| <Project filename="jack_winmme.cbp" /> | |||
| <Project filename="jack_winmme.cbp" active="1" /> | |||
| <Project filename="jack_loopback.cbp" /> | |||
| </Workspace> | |||
| </CodeBlocks_workspace_file> | |||
| @@ -52,6 +52,9 @@ JackWinMMEDriver::Attach() | |||
| latency_range.max = latency; | |||
| latency_range.min = latency; | |||
| jack_info("JackWinMMEDriver::Attach - fCaptureChannels %d", fCaptureChannels); | |||
| jack_info("JackWinMMEDriver::Attach - fPlaybackChannels %d", fPlaybackChannels); | |||
| // Inputs | |||
| for (int i = 0; i < fCaptureChannels; i++) { | |||
| JackWinMMEInputPort *input_port = input_ports[i]; | |||
| @@ -130,9 +133,13 @@ JackWinMMEDriver::Open(bool capturing, bool playing, int in_channels, | |||
| { | |||
| const char *client_name = fClientControl.fName; | |||
| int input_count = 0; | |||
| int output_count = 0; | |||
| int num_potential_inputs = midiInGetNumDevs(); | |||
| int num_potential_outputs = midiOutGetNumDevs(); | |||
| int output_count = 0; | |||
| jack_info("JackWinMMEDriver::Open - num_potential_inputs %d", num_potential_inputs); | |||
| jack_info("JackWinMMEDriver::Open - num_potential_outputs %d", num_potential_outputs); | |||
| if (num_potential_inputs) { | |||
| try { | |||
| input_ports = new JackWinMMEInputPort *[num_potential_inputs]; | |||
| @@ -175,6 +182,11 @@ JackWinMMEDriver::Open(bool capturing, bool playing, int in_channels, | |||
| output_count++; | |||
| } | |||
| } | |||
| jack_info("JackWinMMEDriver::Open - input_count %d", input_count); | |||
| jack_info("JackWinMMEDriver::Open - output_count %d", output_count); | |||
| if (! (input_count || output_count)) { | |||
| jack_error("JackWinMMEDriver::Open - no WinMME inputs or outputs " | |||
| "allocated."); | |||
| @@ -200,10 +212,25 @@ JackWinMMEDriver::Open(bool capturing, bool playing, int in_channels, | |||
| int | |||
| JackWinMMEDriver::Read() | |||
| { | |||
| jack_nframes_t buffer_size = fEngineControl->fBufferSize; | |||
| for (int i = 0; i < fCaptureChannels; i++) { | |||
| input_ports[i]->ProcessJack(GetInputBuffer(i), buffer_size); | |||
| } | |||
| return 0; | |||
| } | |||
| int | |||
| JackWinMMEDriver::Write() | |||
| { | |||
| /* | |||
| jack_nframes_t buffer_size = fEngineControl->fBufferSize; | |||
| for (int i = 0; i < fPlaybackChannels; i++) { | |||
| output_ports[i]->ProcessJack(GetOutputBuffer(i), buffer_size); | |||
| } | |||
| */ | |||
| return 0; | |||
| } | |||
| @@ -287,16 +314,6 @@ JackWinMMEDriver::Stop() | |||
| return result; | |||
| } | |||
| int | |||
| JackWinMMEDriver::Write() | |||
| { | |||
| jack_nframes_t buffer_size = fEngineControl->fBufferSize; | |||
| for (int i = 0; i < fPlaybackChannels; i++) { | |||
| output_ports[i]->ProcessJack(GetOutputBuffer(i), buffer_size); | |||
| } | |||
| return 0; | |||
| } | |||
| #ifdef __cplusplus | |||
| extern "C" | |||
| { | |||
| @@ -78,6 +78,23 @@ JackWinMMEInputPort::JackWinMMEInputPort(const char *alias_name, | |||
| goto unprepare_header; | |||
| } | |||
| MIDIINCAPS capabilities; | |||
| char *name_tmp; | |||
| result = midiInGetDevCaps(index, &capabilities, sizeof(capabilities)); | |||
| /* | |||
| Devin : FIXME | |||
| if (result != MMSYSERR_NOERROR) { | |||
| WriteMMError("JackWinMMEOutputPort [constructor]", "midiOutGetDevCaps", | |||
| result); | |||
| name_tmp = driver_name; | |||
| } else { | |||
| name_tmp = capabilities.szPname; | |||
| } | |||
| */ | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", alias_name, driver_name, | |||
| index + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:capture_%d", client_name, index + 1); | |||
| jack_event = 0; | |||
| started = false; | |||
| write_queue_ptr.release(); | |||
| @@ -147,6 +164,12 @@ JackWinMMEInputPort::GetAlias() | |||
| return alias; | |||
| } | |||
| const char * | |||
| JackWinMMEInputPort::GetName() | |||
| { | |||
| return name; | |||
| } | |||
| void | |||
| JackWinMMEInputPort::GetErrorString(MMRESULT error, LPTSTR text) | |||
| { | |||
| @@ -156,12 +179,6 @@ JackWinMMEInputPort::GetErrorString(MMRESULT error, LPTSTR text) | |||
| } | |||
| } | |||
| const char * | |||
| JackWinMMEInputPort::GetName() | |||
| { | |||
| return name; | |||
| } | |||
| void | |||
| JackWinMMEInputPort::ProcessJack(JackMidiBuffer *port_buffer, jack_nframes_t frames) | |||
| { | |||
| @@ -50,15 +50,17 @@ namespace Jack { | |||
| MMRESULT result); | |||
| char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | |||
| char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | |||
| HMIDIIN handle; | |||
| jack_midi_event_t *jack_event; | |||
| char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; | |||
| bool started; | |||
| jack_midi_data_t *sysex_buffer; | |||
| MIDIHDR sysex_header; | |||
| JackMidiAsyncQueue *thread_queue; | |||
| JackMidiBufferWriteQueue *write_queue; | |||
| bool started; | |||
| public: | |||
| JackWinMMEInputPort(const char *alias_name, const char *client_name, | |||
| @@ -88,7 +88,7 @@ JackWinMMEOutputPort::JackWinMMEOutputPort(const char *alias_name, | |||
| index + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:playback_%d", client_name, index + 1); | |||
| thread_ptr.release(); | |||
| thread_queue_ptr.release(); | |||
| thread_queue_ptr.release(); | |||
| return; | |||
| destroy_thread_queue_semaphore: | |||
| @@ -132,9 +132,15 @@ bool | |||
| JackWinMMEOutputPort::Execute() | |||
| { | |||
| for (;;) { | |||
| jack_log("JackWinMMEOutputPort::Execute TOTO"); | |||
| JackSleep(100000); | |||
| if (! Wait(thread_queue_semaphore)) { | |||
| jack_log("JackWinMMEOutputPort::Execute BREAK"); | |||
| break; | |||
| } | |||
| /* | |||
| jack_midi_event_t *event = thread_queue->DequeueEvent(); | |||
| if (! event) { | |||
| break; | |||
| @@ -214,6 +220,7 @@ JackWinMMEOutputPort::Execute() | |||
| "midiOutUnprepareHeader", result); | |||
| break; | |||
| } | |||
| */ | |||
| } | |||
| stop_execution: | |||
| return false; | |||
| @@ -358,6 +365,8 @@ JackWinMMEOutputPort::Stop() | |||
| bool | |||
| JackWinMMEOutputPort::Wait(HANDLE semaphore) | |||
| { | |||
| jack_log("JackWinMMEOutputPort::Wait %d", semaphore); | |||
| DWORD result = WaitForSingleObject(semaphore, INFINITE); | |||
| switch (result) { | |||
| case WAIT_FAILED: | |||