diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 262135b1..fa7b4f22 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -219,11 +219,12 @@ extern "C" thread_routine routine, void *arg); EXPORT int jack_drop_real_time_scheduling (pthread_t thread); - + EXPORT int jack_client_stop_thread (jack_client_t* client, pthread_t thread); EXPORT int jack_client_kill_thread (jack_client_t* client, pthread_t thread); +#ifndef WIN32 EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc); - +#endif EXPORT char * jack_get_internal_client_name (jack_client_t *client, jack_intclient_t intclient); EXPORT jack_intclient_t jack_internal_client_handle (jack_client_t *client, @@ -1760,8 +1761,8 @@ EXPORT int jack_client_max_real_time_priority(jack_client_t* ext_client) JackEngineControl* control = GetEngineControl(); return (control->fRealTime) ? control->fMaxClientPriority : -1; } -} - +} + EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority) { JackEngineControl* control = GetEngineControl(); @@ -1793,10 +1794,12 @@ EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread) return JackThread::KillImp(thread); } +#ifndef WIN32 EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc) { JackGlobals::fJackThreadCreator = jtc; } +#endif // intclient.h EXPORT int jack_internal_client_new (const char *client_name, diff --git a/common/JackAudioAdapter.cpp b/common/JackAudioAdapter.cpp index 6c3f1245..0bf82dff 100644 --- a/common/JackAudioAdapter.cpp +++ b/common/JackAudioAdapter.cpp @@ -38,20 +38,20 @@ namespace Jack JackAudioAdapter* adapter = static_cast(arg); float* inputBuffer[adapter->fAudioAdapter->GetInputs()]; float* outputBuffer[adapter->fAudioAdapter->GetOutputs()]; - - // Always clear output + + // Always clear output for (int i = 0; i < adapter->fAudioAdapter->GetInputs(); i++) { inputBuffer[i] = (float*)jack_port_get_buffer(adapter->fCapturePortList[i], frames); memset(inputBuffer[i], 0, frames * sizeof(float)); } - + if (adapter->fAudioAdapter->IsRunning()) { for (int i = 0; i < adapter->fAudioAdapter->GetOutputs(); i++) { outputBuffer[i] = (float*)jack_port_get_buffer(adapter->fPlaybackPortList[i], frames); } adapter->fAudioAdapter->PullAndPush(inputBuffer, outputBuffer, frames); - } - + } + return 0; } @@ -73,13 +73,13 @@ namespace Jack //JackAudioAdapter ********************************************************* - JackAudioAdapter::JackAudioAdapter (jack_client_t* jack_client, JackAudioAdapterInterface* audio_io, const JSList* params, bool system) + JackAudioAdapter::JackAudioAdapter (jack_client_t* jack_client, JackAudioAdapterInterface* audio_io, const JSList* params, bool system) :fJackClient(jack_client), fAudioAdapter(audio_io) { const JSList* node; const jack_driver_param_t* param; fAutoConnect = false; - + for (node = params; node; node = jack_slist_next(node)) { param = (const jack_driver_param_t*) node->data; switch (param->character) { @@ -89,7 +89,7 @@ namespace Jack } } } - + JackAudioAdapter::~JackAudioAdapter() { // When called, Close has already been used for the client, thus ports are already unregistered. @@ -108,11 +108,11 @@ namespace Jack delete[] fCapturePortList; delete[] fPlaybackPortList; } - + void JackAudioAdapter::ConnectPorts() { const char **ports; - + ports = jack_get_ports(fJackClient, NULL, NULL, JackPortIsPhysical | JackPortIsInput); if (ports != NULL) { for (int i = 0; i < fAudioAdapter->GetInputs() && ports[i]; i++) { @@ -120,7 +120,7 @@ namespace Jack } free(ports); } - + ports = jack_get_ports(fJackClient, NULL, NULL, JackPortIsPhysical | JackPortIsOutput); if (ports != NULL) { for (int i = 0; i < fAudioAdapter->GetOutputs() && ports[i]; i++) { @@ -140,7 +140,7 @@ namespace Jack char name[32]; jack_log("JackAudioAdapter::Open fCaptureChannels %d fPlaybackChannels %d", fAudioAdapter->GetInputs(), fAudioAdapter->GetOutputs()); fAudioAdapter->Create(); - + //jack ports fCapturePortList = new jack_port_t*[fAudioAdapter->GetInputs()]; fPlaybackPortList = new jack_port_t*[fAudioAdapter->GetOutputs()]; @@ -168,7 +168,7 @@ namespace Jack goto fail; if ( jack_activate ( fJackClient ) < 0 ) goto fail; - + if (fAutoConnect) ConnectPorts(); diff --git a/common/JackGlobals.cpp b/common/JackGlobals.cpp index 219da5d6..599523db 100644 --- a/common/JackGlobals.cpp +++ b/common/JackGlobals.cpp @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License -along with this program; if not, write to the Free Software +along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -32,6 +32,8 @@ JackMutex* JackGlobals::fOpenMutex = new JackMutex(); bool JackGlobals::fServerRunning = false; JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {}; -jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create; +#ifndef WIN32 +jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create; +#endif } // end of namespace diff --git a/common/JackGlobals.h b/common/JackGlobals.h index 53d0591c..8495c062 100644 --- a/common/JackGlobals.h +++ b/common/JackGlobals.h @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License -along with this program; if not, write to the Free Software +along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -36,8 +36,10 @@ struct JackGlobals { static JackMutex* fOpenMutex; static bool fServerRunning; static JackClient* fClientTable[]; - static jack_thread_creator_t fJackThreadCreator; - +#ifndef WIN32 + static jack_thread_creator_t fJackThreadCreator; +#endif + }; } // end of namespace diff --git a/common/jack/thread.h b/common/jack/thread.h index 460eb0a7..c09c6ca2 100644 --- a/common/jack/thread.h +++ b/common/jack/thread.h @@ -33,15 +33,15 @@ extern "C" * clients. These interfaces hide some system variations in the * handling of realtime scheduling and associated privileges. */ - + /** * @defgroup ClientThreads Creating and managing client threads * @{ */ - + /** * @returns if JACK is running with realtime scheduling, this returns - * the priority that any JACK-created client threads will run at. + * the priority that any JACK-created client threads will run at. * Otherwise returns -1. */ @@ -114,8 +114,10 @@ int jack_client_stop_thread(jack_client_t* client, pthread_t thread); * @param thread POSIX thread ID. * * @returns 0, if successful; otherwise an error number. - */ + */ int jack_client_kill_thread(jack_client_t* client, pthread_t thread); + +#ifndef WIN32 typedef int (*jack_thread_creator_t)(pthread_t*, const pthread_attr_t*, @@ -127,18 +129,20 @@ int jack_client_stop_thread(jack_client_t* client, pthread_t thread); * are created by something other than pthread_create(). After * it is used, any threads that JACK needs for the client will * will be created by calling the function passed to this - * function. + * function. * * No normal application/client should consider calling this. * The specific case for which it was created involves running * win32/x86 plugins under Wine on Linux, where it is necessary * that all threads that might call win32 functions are known * to Wine. - * + * * @param creator a function that creates a new thread - * + * */ -void jack_set_thread_creator (jack_thread_creator_t creator); +void jack_set_thread_creator (jack_thread_creator_t creator); + +#endif /* @} */