git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3438 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.2
| @@ -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, | |||
| @@ -38,20 +38,20 @@ namespace Jack | |||
| JackAudioAdapter* adapter = static_cast<JackAudioAdapter*>(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(); | |||
| @@ -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 | |||
| @@ -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 | |||
| @@ -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 | |||
| /* @} */ | |||