| @@ -3,6 +3,7 @@ | |||
| --------------------------- | |||
| Dmitry Baikov | |||
| Gabriel M. Beddingfield | |||
| Steven Chamberlain | |||
| Thom Johansen | |||
| Thibault LeMeur | |||
| @@ -21,12 +22,24 @@ Torben Hohn | |||
| Paul Davis | |||
| Peter L Jones | |||
| Devin Anderson | |||
| Josh Green | |||
| Josh Green | |||
| Mario Lang | |||
| --------------------------- | |||
| Jackdmp changes log | |||
| --------------------------- | |||
| 2010-01-29 Gabriel M. Beddingfield <gabriel@teuton.org> | |||
| * Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF. | |||
| 2009-12-15 Stephane Letz <letz@grame.fr> | |||
| * Shared memory manager was calling abort in case of fatal error, now return an error in caller. | |||
| 2009-12-13 Stephane Letz <letz@grame.fr> | |||
| * Mario Lang alsa_io time calculation overflow patch. | |||
| 2009-12-10 Stephane Letz <letz@grame.fr> | |||
| @@ -68,8 +68,8 @@ namespace Jack | |||
| fprintf(file, buffer); | |||
| fprintf(file, "\n unset multiplot\n"); | |||
| fprintf(file, "set output 'AdapterTiming1.pdf\n"); | |||
| fprintf(file, "set terminal pdf\n"); | |||
| fprintf(file, "set output 'AdapterTiming1.svg\n"); | |||
| fprintf(file, "set terminal svg\n"); | |||
| fprintf(file, "set multiplot\n"); | |||
| fprintf(file, "set grid\n"); | |||
| @@ -80,8 +80,10 @@ namespace Jack | |||
| fprintf(file, "plot "); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 2 title \"Consumer interrupt period\" with lines,"); | |||
| fprintf(file, buffer); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 3 title \"Producer interrupt period\" with lines"); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 3 title \"Producer interrupt period\" with lines\n"); | |||
| fprintf(file, buffer); | |||
| fprintf(file, "unset multiplot\n"); | |||
| fprintf(file, "unset output\n"); | |||
| fclose(file); | |||
| @@ -100,8 +102,8 @@ namespace Jack | |||
| fprintf(file, buffer); | |||
| fprintf(file, "\n unset multiplot\n"); | |||
| fprintf(file, "set output 'AdapterTiming2.pdf\n"); | |||
| fprintf(file, "set terminal pdf\n"); | |||
| fprintf(file, "set output 'AdapterTiming2.svg\n"); | |||
| fprintf(file, "set terminal svg\n"); | |||
| fprintf(file, "set multiplot\n"); | |||
| fprintf(file, "set grid\n"); | |||
| @@ -112,8 +114,10 @@ namespace Jack | |||
| fprintf(file, "plot "); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 4 title \"Ratio 1\" with lines,"); | |||
| fprintf(file, buffer); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 5 title \"Ratio 2\" with lines"); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 5 title \"Ratio 2\" with lines\n"); | |||
| fprintf(file, buffer); | |||
| fprintf(file, "unset multiplot\n"); | |||
| fprintf(file, "unset output\n"); | |||
| fclose(file); | |||
| @@ -132,8 +136,8 @@ namespace Jack | |||
| fprintf(file, buffer); | |||
| fprintf(file, "\n unset multiplot\n"); | |||
| fprintf(file, "set output 'AdapterTiming3.pdf\n"); | |||
| fprintf(file, "set terminal pdf\n"); | |||
| fprintf(file, "set output 'AdapterTiming3.svg\n"); | |||
| fprintf(file, "set terminal svg\n"); | |||
| fprintf(file, "set multiplot\n"); | |||
| fprintf(file, "set grid\n"); | |||
| @@ -144,8 +148,10 @@ namespace Jack | |||
| fprintf(file, "plot "); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 6 title \"Frames position in consumer ringbuffer\" with lines,"); | |||
| fprintf(file, buffer); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 7 title \"Frames position in producer ringbuffer\" with lines"); | |||
| sprintf(buffer, "\"JackAudioAdapter.log\" using 7 title \"Frames position in producer ringbuffer\" with lines\n"); | |||
| fprintf(file, buffer); | |||
| fprintf(file, "unset multiplot\n"); | |||
| fprintf(file, "unset output\n"); | |||
| fclose(file); | |||
| } | |||
| @@ -121,7 +121,7 @@ void JackDebugClient::CheckClient(const char* function_name) const | |||
| *fStream << "!!! ERROR !!! : Accessing a client '" << fClientName << "' already closed " << "from " << function_name << endl; | |||
| *fStream << "This is likely to cause crash !'" << endl; | |||
| #ifdef __APPLE__ | |||
| Debugger(); | |||
| // Debugger(); | |||
| #endif | |||
| } | |||
| } | |||
| @@ -167,7 +167,7 @@ int JackDriver::Open(jack_nframes_t buffer_size, | |||
| int JackDriver::Close() | |||
| { | |||
| if (fClientControl.fRefNum > 0) { | |||
| if (fClientControl.fRefNum >= 0) { | |||
| jack_log("JackDriver::Close"); | |||
| fGraphManager->DirectDisconnect(fClientControl.fRefNum, fClientControl.fRefNum); // Disconnect driver from itself for sync | |||
| fClientControl.fActive = false; | |||
| @@ -95,7 +95,7 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| std::ofstream fStream1("Timing1.plot", std::ios_base::ate); | |||
| if (!fStream1.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open Timing1.log file"); | |||
| jack_error("JackEngineProfiling::Save cannot open Timing1.plot file"); | |||
| } else { | |||
| fStream1 << "set grid\n"; | |||
| @@ -104,21 +104,22 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| fStream1 << "set ylabel \"usec\"\n"; | |||
| fStream1 << "plot \"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines \n"; | |||
| fStream1 << "set output 'Timing1.pdf\n"; | |||
| fStream1 << "set terminal pdf\n"; | |||
| fStream1 << "set output 'Timing1.svg\n"; | |||
| fStream1 << "set terminal svg\n"; | |||
| fStream1 << "set grid\n"; | |||
| fStream1 << "set title \"Audio driver timing\"\n"; | |||
| fStream1 << "set xlabel \"audio cycles\"\n"; | |||
| fStream1 << "set ylabel \"usec\"\n"; | |||
| fStream1 << "plot \"JackEngineProfiling.log\" using 1 title \"Audio period\" with lines \n"; | |||
| fStream1 << "unset output\n"; | |||
| } | |||
| // Driver end date | |||
| std::ofstream fStream2("Timing2.plot", std::ios_base::ate); | |||
| if (!fStream2.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open Timing2.log file"); | |||
| jack_error("JackEngineProfiling::Save cannot open Timing2.plot file"); | |||
| } else { | |||
| fStream2 << "set grid\n"; | |||
| @@ -127,14 +128,15 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| fStream2 << "set ylabel \"usec\"\n"; | |||
| fStream2 << "plot \"JackEngineProfiling.log\" using 2 title \"Driver end date\" with lines \n"; | |||
| fStream2 << "set output 'Timing2.pdf\n"; | |||
| fStream2 << "set terminal pdf\n"; | |||
| fStream2 << "set output 'Timing2.svg\n"; | |||
| fStream2 << "set terminal svg\n"; | |||
| fStream2 << "set grid\n"; | |||
| fStream2 << "set title \"Driver end date\"\n"; | |||
| fStream2 << "set xlabel \"audio cycles\"\n"; | |||
| fStream2 << "set ylabel \"usec\"\n"; | |||
| fStream2 << "plot \"JackEngineProfiling.log\" using 2 title \"Driver end date\" with lines \n"; | |||
| fStream2 << "unset output\n"; | |||
| } | |||
| // Clients end date | |||
| @@ -142,7 +144,7 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| std::ofstream fStream3("Timing3.plot", std::ios_base::ate); | |||
| if (!fStream3.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open Timing3.log file"); | |||
| jack_error("JackEngineProfiling::Save cannot open Timing3.plot file"); | |||
| } else { | |||
| fStream3 << "set multiplot\n"; | |||
| @@ -170,8 +172,8 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| } | |||
| fStream3 << "\n unset multiplot\n"; | |||
| fStream3 << "set output 'Timing3.pdf\n"; | |||
| fStream3 << "set terminal pdf\n"; | |||
| fStream3 << "set output 'Timing3.svg\n"; | |||
| fStream3 << "set terminal svg\n"; | |||
| fStream3 << "set multiplot\n"; | |||
| fStream3 << "set grid\n"; | |||
| @@ -196,6 +198,8 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| fStream3 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) - 1 << " title \"" << fIntervalTable[i].fName << "\" with lines,"; | |||
| } | |||
| } | |||
| fStream3 << "\nunset multiplot\n"; | |||
| fStream3 << "unset output\n"; | |||
| } | |||
| } | |||
| @@ -204,7 +208,7 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| std::ofstream fStream4("Timing4.plot", std::ios_base::ate); | |||
| if (!fStream4.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open Timing4.log file"); | |||
| jack_error("JackEngineProfiling::Save cannot open Timing4.plot file"); | |||
| } else { | |||
| fStream4 << "set multiplot\n"; | |||
| @@ -222,8 +226,8 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| } | |||
| fStream4 << "\n unset multiplot\n"; | |||
| fStream4 << "set output 'Timing4.pdf\n"; | |||
| fStream4 << "set terminal pdf\n"; | |||
| fStream4 << "set output 'Timing4.svg\n"; | |||
| fStream4 << "set terminal svg\n"; | |||
| fStream4 << "set multiplot\n"; | |||
| fStream4 << "set grid\n"; | |||
| @@ -238,6 +242,8 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| fStream4 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) << " title \"" << fIntervalTable[i].fName << "\" with lines,"; | |||
| } | |||
| } | |||
| fStream4 << "\nunset multiplot\n"; | |||
| fStream4 << "unset output\n"; | |||
| } | |||
| } | |||
| @@ -246,7 +252,7 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| std::ofstream fStream5("Timing5.plot", std::ios_base::ate); | |||
| if (!fStream5.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open Timing5.log file"); | |||
| jack_error("JackEngineProfiling::Save cannot open Timing5.plot file"); | |||
| } else { | |||
| fStream5 << "set multiplot\n"; | |||
| @@ -264,8 +270,8 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| } | |||
| fStream5 << "\n unset multiplot\n"; | |||
| fStream5 << "set output 'Timing5.pdf\n"; | |||
| fStream5 << "set terminal pdf\n"; | |||
| fStream5 << "set output 'Timing5.svg\n"; | |||
| fStream5 << "set terminal svg\n"; | |||
| fStream5 << "set multiplot\n"; | |||
| fStream5 << "set grid\n"; | |||
| @@ -280,8 +286,47 @@ JackEngineProfiling::~JackEngineProfiling() | |||
| fStream5 << "\"JackEngineProfiling.log\" using " << ((i + 1) * 7) + 1 << " title \"" << fIntervalTable[i].fName << "\" with lines,"; | |||
| } | |||
| } | |||
| fStream5 << "\nunset multiplot\n"; | |||
| fStream5 << "unset output\n"; | |||
| } | |||
| } | |||
| std::ofstream fStream6("Timings.html", std::ios_base::ate); | |||
| if (!fStream6.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open Timings.html file"); | |||
| } else { | |||
| fStream6 << "<?xml version='1.0' encoding='utf-8'?>\n"; | |||
| fStream6 << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"; | |||
| fStream6 << "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; | |||
| fStream6 << "<html xmlns='http://www.w3.org/1999/xhtml' lang='en'>\n"; | |||
| fStream6 << " <head>\n"; | |||
| fStream6 << " <title>JACK engine profiling</title>\n"; | |||
| fStream6 << " <!-- assuming that images are 600px wide -->\n"; | |||
| fStream6 << " <style media='all' type='text/css'>\n"; | |||
| fStream6 << " .center { margin-left:auto ; margin-right: auto; width: 650px; height: 550px }\n"; | |||
| fStream6 << " </style>\n"; | |||
| fStream6 << " </head>\n"; | |||
| fStream6 << " <body>\n"; | |||
| fStream6 << " <h2 style='text-align:center'>JACK engine profiling</h2>\n"; | |||
| fStream6 << " <div class='center'><object class='center' type='image/svg+xml' data='Timing1.svg'>Timing1</object></div>"; | |||
| fStream6 << " <div class='center'><object class='center' type='image/svg+xml' data='Timing2.svg'>Timing2</object></div>"; | |||
| fStream6 << " <div class='center'><object class='center' type='image/svg+xml' data='Timing3.svg'>Timing3</object></div>"; | |||
| fStream6 << " <div class='center'><object class='center' type='image/svg+xml' data='Timing4.svg'>Timing4</object></div>"; | |||
| fStream6 << " <div class='center'><object class='center' type='image/svg+xml' data='Timing5.svg'>Timing5</object></div>"; | |||
| fStream6 << " </body>\n"; | |||
| fStream6 << "</html>\n"; | |||
| } | |||
| std::ofstream fStream7("generate_timings", std::ios_base::ate); | |||
| if (!fStream7.is_open()) { | |||
| jack_error("JackEngineProfiling::Save cannot open generate_timings file"); | |||
| } else { | |||
| fStream7 << "gnuplot -persist Timing1.plot \n"; | |||
| fStream7 << "gnuplot -persist Timing2.plot\n"; | |||
| fStream7 << "gnuplot -persist Timing3.plot\n"; | |||
| fStream7 << "gnuplot -persist Timing4.plot\n"; | |||
| fStream7 << "gnuplot -persist Timing5.plot\n"; | |||
| } | |||
| } | |||
| bool JackEngineProfiling::CheckClient(const char* name, int cur_point) | |||
| @@ -103,6 +103,9 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_ | |||
| } catch (int n) { | |||
| jack_error("Map shared memory segments exception %d", n); | |||
| goto error; | |||
| } catch (...) { | |||
| jack_error("Unknown error..."); | |||
| goto error; | |||
| } | |||
| SetupDriverSync(false); | |||
| @@ -17,8 +17,6 @@ along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| //#define HAVE_CELT 1 | |||
| #ifdef WIN32 | |||
| #include <malloc.h> | |||
| #endif | |||
| @@ -34,30 +34,20 @@ extern "C" | |||
| * Note: More documentation can be found in jack/types.h. | |||
| */ | |||
| /************************************************************* | |||
| * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function | |||
| * added to the JACK API after the 0.116.2 release. | |||
| *************************************************************/ | |||
| #ifndef JACK_WEAK_EXPORT | |||
| #ifdef __GNUC__ | |||
| /* JACK_WEAK_EXPORT needs to be a macro which | |||
| expands into a compiler directive. If non-null, the directive | |||
| must tell the compiler to arrange for weak linkage of | |||
| the symbol it used with. For this to work full may | |||
| require linker arguments in the client as well. | |||
| */ | |||
| #define JACK_WEAK_EXPORT __attribute__((weak)) | |||
| #else | |||
| /* Add other things here for non-gcc platforms */ | |||
| #endif | |||
| #endif | |||
| /** | |||
| * @defgroup ClientFunctions Creating & manipulating clients | |||
| * @{ | |||
| */ | |||
| /************************************************************* | |||
| * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function | |||
| * added to the JACK API after the 0.116.2 release. | |||
| * | |||
| * Functions that predate this release are marked with | |||
| * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile | |||
| * time in a variety of ways. The default definition is empty, | |||
| * so that these symbols get normal linkage. If you wish to | |||
| * use all JACK symbols with weak linkage, include | |||
| * <jack/weakjack.h> before jack.h. | |||
| *************************************************************/ | |||
| #include <jack/weakmacros.h> | |||
| /** | |||
| * Call this function to get version of the JACK, in form of several numbers | |||
| * | |||
| @@ -75,7 +65,7 @@ jack_get_version( | |||
| int *major_ptr, | |||
| int *minor_ptr, | |||
| int *micro_ptr, | |||
| int *proto_ptr); | |||
| int *proto_ptr) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Call this function to get version of the JACK, in form of a string | |||
| @@ -84,7 +74,7 @@ jack_get_version( | |||
| * | |||
| */ | |||
| const char * | |||
| jack_get_version_string(); | |||
| jack_get_version_string() JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Open an external client session with a JACK server. This interface | |||
| @@ -121,7 +111,7 @@ jack_get_version_string(); | |||
| */ | |||
| jack_client_t * jack_client_open (const char *client_name, | |||
| jack_options_t options, | |||
| jack_status_t *status, ...); | |||
| jack_status_t *status, ...) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN | |||
| @@ -129,20 +119,20 @@ jack_client_t * jack_client_open (const char *client_name, | |||
| * | |||
| * @deprecated Please use jack_client_open(). | |||
| */ | |||
| jack_client_t * jack_client_new (const char *client_name); | |||
| jack_client_t * jack_client_new (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
| /** | |||
| * Disconnects an external client from a JACK server. | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_client_close (jack_client_t *client); | |||
| int jack_client_close (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the maximum number of characters in a JACK client name | |||
| * including the final NULL character. This value is a constant. | |||
| */ | |||
| int jack_client_name_size (void); | |||
| int jack_client_name_size (void) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return pointer to actual client name. This is useful when @ref | |||
| @@ -150,7 +140,7 @@ int jack_client_name_size (void); | |||
| * JackNameNotUnique status was returned. In that case, the actual | |||
| * name will differ from the @a client_name requested. | |||
| */ | |||
| char * jack_get_client_name (jack_client_t *client); | |||
| char * jack_get_client_name (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Load an internal client into the Jack server. | |||
| @@ -175,14 +165,14 @@ char * jack_get_client_name (jack_client_t *client); | |||
| */ | |||
| int jack_internal_client_new (const char *client_name, | |||
| const char *load_name, | |||
| const char *load_init); | |||
| const char *load_init) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
| /** | |||
| * Remove an internal client from a JACK server. | |||
| * | |||
| * @deprecated Please use jack_internal_client_load(). | |||
| */ | |||
| void jack_internal_client_close (const char *client_name); | |||
| void jack_internal_client_close (const char *client_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
| /** | |||
| * Tell the Jack server that the program is ready to start processing | |||
| @@ -190,7 +180,7 @@ void jack_internal_client_close (const char *client_name); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_activate (jack_client_t *client); | |||
| int jack_activate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the Jack server to remove this @a client from the process | |||
| @@ -199,18 +189,18 @@ int jack_activate (jack_client_t *client); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_deactivate (jack_client_t *client); | |||
| int jack_deactivate (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return pid of client. If not available, 0 will be returned. | |||
| */ | |||
| int jack_get_client_pid (const char *name); | |||
| int jack_get_client_pid (const char *name) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the pthread ID of the thread running the JACK client side | |||
| * code. | |||
| */ | |||
| pthread_t jack_client_thread_id (jack_client_t *); | |||
| pthread_t jack_client_thread_id (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -221,7 +211,7 @@ pthread_t jack_client_thread_id (jack_client_t *); | |||
| * | |||
| * @return 1 if JACK is running realtime, 0 otherwise | |||
| */ | |||
| int jack_is_realtime (jack_client_t *client); | |||
| int jack_is_realtime (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @defgroup NonCallbackAPI The non-callback API | |||
| @@ -234,7 +224,7 @@ int jack_is_realtime (jack_client_t *client); | |||
| * | |||
| * @deprecated Please use jack_cycle_wait() and jack_cycle_signal() functions. | |||
| */ | |||
| jack_nframes_t jack_thread_wait (jack_client_t*, int status); | |||
| jack_nframes_t jack_thread_wait (jack_client_t*, int status) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Wait until this JACK client should process data. | |||
| @@ -243,7 +233,7 @@ jack_nframes_t jack_thread_wait (jack_client_t*, int status); | |||
| * | |||
| * @return the number of frames of data to process | |||
| */ | |||
| jack_nframes_t jack_cycle_wait (jack_client_t* client); | |||
| jack_nframes_t jack_cycle_wait (jack_client_t* client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Signal next clients in the graph. | |||
| @@ -251,7 +241,7 @@ jack_nframes_t jack_cycle_wait (jack_client_t* client); | |||
| * @param client - pointer to a JACK client structure | |||
| * @param status - if non-zero, calling thread should exit | |||
| */ | |||
| void jack_cycle_signal (jack_client_t* client, int status); | |||
| void jack_cycle_signal (jack_client_t* client, int status) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the Jack server to call @a thread_callback in the RT thread. | |||
| @@ -269,7 +259,7 @@ void jack_cycle_signal (jack_client_t* client, int status); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_set_process_thread(jack_client_t* client, JackThreadCallback thread_callback, void *arg); | |||
| int jack_set_process_thread(jack_client_t* client, JackThreadCallback thread_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -294,7 +284,7 @@ int jack_set_process_thread(jack_client_t* client, JackThreadCallback thread_cal | |||
| */ | |||
| int jack_set_thread_init_callback (jack_client_t *client, | |||
| JackThreadInitCallback thread_init_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @param client pointer to JACK client structure. | |||
| @@ -346,7 +336,7 @@ void jack_on_shutdown (jack_client_t *client, | |||
| * jack_on_info_shutdown() will. | |||
| */ | |||
| void jack_on_info_shutdown (jack_client_t *client, | |||
| JackInfoShutdownCallback shutdown_callback, void *arg); | |||
| JackInfoShutdownCallback shutdown_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the Jack server to call @a process_callback whenever there is | |||
| @@ -367,7 +357,7 @@ void jack_on_info_shutdown (jack_client_t *client, | |||
| */ | |||
| int jack_set_process_callback (jack_client_t *client, | |||
| JackProcessCallback process_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the Jack server to call @a freewheel_callback | |||
| @@ -387,7 +377,7 @@ int jack_set_process_callback (jack_client_t *client, | |||
| */ | |||
| int jack_set_freewheel_callback (jack_client_t *client, | |||
| JackFreewheelCallback freewheel_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell JACK to call @a bufsize_callback whenever the size of the the | |||
| @@ -410,7 +400,7 @@ int jack_set_freewheel_callback (jack_client_t *client, | |||
| */ | |||
| int jack_set_buffer_size_callback (jack_client_t *client, | |||
| JackBufferSizeCallback bufsize_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the Jack server to call @a srate_callback whenever the system | |||
| @@ -427,7 +417,7 @@ int jack_set_buffer_size_callback (jack_client_t *client, | |||
| */ | |||
| int jack_set_sample_rate_callback (jack_client_t *client, | |||
| JackSampleRateCallback srate_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the JACK server to call @a client_registration_callback whenever a | |||
| @@ -444,7 +434,7 @@ int jack_set_sample_rate_callback (jack_client_t *client, | |||
| */ | |||
| int jack_set_client_registration_callback (jack_client_t *, | |||
| JackClientRegistrationCallback | |||
| registration_callback, void *arg); | |||
| registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the JACK server to call @a registration_callback whenever a | |||
| @@ -460,8 +450,8 @@ int jack_set_client_registration_callback (jack_client_t *, | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_set_port_registration_callback (jack_client_t *, | |||
| JackPortRegistrationCallback | |||
| registration_callback, void *arg); | |||
| JackPortRegistrationCallback | |||
| registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the JACK server to call @a connect_callback whenever a | |||
| @@ -477,8 +467,8 @@ int jack_set_client_registration_callback (jack_client_t *, | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_set_port_connect_callback (jack_client_t *, | |||
| JackPortConnectCallback | |||
| connect_callback, void *arg); | |||
| JackPortConnectCallback | |||
| connect_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the JACK server to call @a rename_callback whenever a | |||
| @@ -494,8 +484,8 @@ int jack_set_port_connect_callback (jack_client_t *, | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_set_port_rename_callback (jack_client_t *, | |||
| JackPortRenameCallback | |||
| rename_callback, void *arg); | |||
| JackPortRenameCallback | |||
| rename_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the JACK server to call @a graph_callback whenever the | |||
| @@ -512,7 +502,7 @@ int jack_set_port_rename_callback (jack_client_t *, | |||
| */ | |||
| int jack_set_graph_order_callback (jack_client_t *, | |||
| JackGraphOrderCallback graph_callback, | |||
| void *); | |||
| void *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Tell the JACK server to call @a xrun_callback whenever there is a | |||
| @@ -528,7 +518,7 @@ int jack_set_graph_order_callback (jack_client_t *, | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_set_xrun_callback (jack_client_t *, | |||
| JackXRunCallback xrun_callback, void *arg); | |||
| JackXRunCallback xrun_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -561,7 +551,7 @@ int jack_set_xrun_callback (jack_client_t *, | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_set_freewheel(jack_client_t* client, int onoff); | |||
| int jack_set_freewheel(jack_client_t* client, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Change the buffer size passed to the @a process_callback. | |||
| @@ -578,13 +568,13 @@ int jack_set_freewheel(jack_client_t* client, int onoff); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes); | |||
| int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the sample rate of the jack system, as set by the user when | |||
| * jackd was started. | |||
| */ | |||
| jack_nframes_t jack_get_sample_rate (jack_client_t *); | |||
| jack_nframes_t jack_get_sample_rate (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the current maximum size that will ever be passed to the @a | |||
| @@ -595,7 +585,7 @@ jack_nframes_t jack_get_sample_rate (jack_client_t *); | |||
| * | |||
| * @see jack_set_buffer_size_callback() | |||
| */ | |||
| jack_nframes_t jack_get_buffer_size (jack_client_t *); | |||
| jack_nframes_t jack_get_buffer_size (jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Old-style interface to become the timebase for the entire JACK | |||
| @@ -607,7 +597,7 @@ jack_nframes_t jack_get_buffer_size (jack_client_t *); | |||
| * | |||
| * @return ENOSYS, function not implemented. | |||
| */ | |||
| int jack_engine_takeover_timebase (jack_client_t *); | |||
| int jack_engine_takeover_timebase (jack_client_t *) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
| /** | |||
| * @return the current CPU load estimated by JACK. This is a running | |||
| @@ -615,7 +605,7 @@ int jack_engine_takeover_timebase (jack_client_t *); | |||
| * all clients as a percentage of the real time available per cycle | |||
| * determined by the buffer size and sample rate. | |||
| */ | |||
| float jack_cpu_load (jack_client_t *client); | |||
| float jack_cpu_load (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -654,7 +644,7 @@ jack_port_t * jack_port_register (jack_client_t *client, | |||
| const char *port_name, | |||
| const char *port_type, | |||
| unsigned long flags, | |||
| unsigned long buffer_size); | |||
| unsigned long buffer_size) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Remove the port from the client, disconnecting any existing | |||
| @@ -662,7 +652,7 @@ jack_port_t * jack_port_register (jack_client_t *client, | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_port_unregister (jack_client_t *, jack_port_t *); | |||
| int jack_port_unregister (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * This returns a pointer to the memory area associated with the | |||
| @@ -683,7 +673,7 @@ int jack_port_unregister (jack_client_t *, jack_port_t *); | |||
| * Caching output ports is DEPRECATED in Jack 2.0, due to some new optimization (like "pipelining"). | |||
| * Port buffers have to be retrieved in each callback for proper functionning. | |||
| */ | |||
| void * jack_port_get_buffer (jack_port_t *, jack_nframes_t); | |||
| void * jack_port_get_buffer (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the full name of the jack_port_t (including the @a | |||
| @@ -691,7 +681,7 @@ void * jack_port_get_buffer (jack_port_t *, jack_nframes_t); | |||
| * | |||
| * @see jack_port_name_size(). | |||
| */ | |||
| const char * jack_port_name (const jack_port_t *port); | |||
| const char * jack_port_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the short name of the jack_port_t (not including the @a | |||
| @@ -699,35 +689,35 @@ const char * jack_port_name (const jack_port_t *port); | |||
| * | |||
| * @see jack_port_name_size(). | |||
| */ | |||
| const char * jack_port_short_name (const jack_port_t *port); | |||
| const char * jack_port_short_name (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the @ref JackPortFlags of the jack_port_t. | |||
| */ | |||
| int jack_port_flags (const jack_port_t *port); | |||
| int jack_port_flags (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the @a port type, at most jack_port_type_size() characters | |||
| * including a final NULL. | |||
| */ | |||
| const char * jack_port_type (const jack_port_t *port); | |||
| const char * jack_port_type (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the @a port type id. | |||
| */ | |||
| jack_port_type_id_t jack_port_type_id (const jack_port_t *port); | |||
| jack_port_type_id_t jack_port_type_id (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return TRUE if the jack_port_t belongs to the jack_client_t. | |||
| */ | |||
| int jack_port_is_mine (const jack_client_t *, const jack_port_t *port); | |||
| int jack_port_is_mine (const jack_client_t *, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return number of connections to or from @a port. | |||
| * | |||
| * @pre The calling client must own @a port. | |||
| */ | |||
| int jack_port_connected (const jack_port_t *port); | |||
| int jack_port_connected (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return TRUE if the locally-owned @a port is @b directly connected | |||
| @@ -736,7 +726,7 @@ int jack_port_connected (const jack_port_t *port); | |||
| * @see jack_port_name_size() | |||
| */ | |||
| int jack_port_connected_to (const jack_port_t *port, | |||
| const char *port_name); | |||
| const char *port_name) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return a null-terminated array of full port names to which the @a | |||
| @@ -749,7 +739,7 @@ int jack_port_connected_to (const jack_port_t *port, | |||
| * | |||
| * @see jack_port_name_size(), jack_port_get_all_connections() | |||
| */ | |||
| const char ** jack_port_get_connections (const jack_port_t *port); | |||
| const char ** jack_port_get_connections (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return a null-terminated array of full port names to which the @a | |||
| @@ -771,7 +761,7 @@ const char ** jack_port_get_connections (const jack_port_t *port); | |||
| * @see jack_port_name_size() | |||
| */ | |||
| const char ** jack_port_get_all_connections (const jack_client_t *client, | |||
| const jack_port_t *port); | |||
| const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * | |||
| @@ -780,7 +770,7 @@ const char ** jack_port_get_all_connections (const jack_client_t *client, | |||
| * turned out to serve essentially no purpose in real-life | |||
| * JACK clients. | |||
| */ | |||
| int jack_port_tie (jack_port_t *src, jack_port_t *dst); | |||
| int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
| /** | |||
| * | |||
| @@ -789,7 +779,7 @@ int jack_port_tie (jack_port_t *src, jack_port_t *dst); | |||
| * turned out to serve essentially no purpose in real-life | |||
| * JACK clients. | |||
| */ | |||
| int jack_port_untie (jack_port_t *port); | |||
| int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
| /** | |||
| * @return the time (in frames) between data being available or | |||
| @@ -801,7 +791,7 @@ int jack_port_untie (jack_port_t *port); | |||
| * connector and the corresponding frames being readable from the | |||
| * port. | |||
| */ | |||
| jack_nframes_t jack_port_get_latency (jack_port_t *port); | |||
| jack_nframes_t jack_port_get_latency (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * The maximum of the sum of the latencies in every | |||
| @@ -809,7 +799,7 @@ jack_nframes_t jack_port_get_latency (jack_port_t *port); | |||
| * ports with the @ref JackPortIsTerminal flag set. | |||
| */ | |||
| jack_nframes_t jack_port_get_total_latency (jack_client_t *, | |||
| jack_port_t *port); | |||
| jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * The port latency is zero by default. Clients that control | |||
| @@ -821,7 +811,7 @@ jack_nframes_t jack_port_get_total_latency (jack_client_t *, | |||
| * to an external digital converter, the latency setting should | |||
| * include both buffering by the audio interface *and* the converter. | |||
| */ | |||
| void jack_port_set_latency (jack_port_t *, jack_nframes_t); | |||
| void jack_port_set_latency (jack_port_t *, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Request a complete recomputation of a port's total latency. This | |||
| @@ -834,7 +824,7 @@ void jack_port_set_latency (jack_port_t *, jack_nframes_t); | |||
| * @return zero for successful execution of the request. non-zero | |||
| * otherwise. | |||
| */ | |||
| int jack_recompute_total_latency (jack_client_t*, jack_port_t* port); | |||
| int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Request a complete recomputation of all port latencies. This | |||
| @@ -849,7 +839,7 @@ int jack_recompute_total_latency (jack_client_t*, jack_port_t* port); | |||
| * @return zero for successful execution of the request. non-zero | |||
| * otherwise. | |||
| */ | |||
| int jack_recompute_total_latencies (jack_client_t*); | |||
| int jack_recompute_total_latencies (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Modify a port's short name. May be called at any time. If the | |||
| @@ -858,7 +848,7 @@ int jack_recompute_total_latencies (jack_client_t*); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_port_set_name (jack_port_t *port, const char *port_name); | |||
| int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Set @a alias as an alias for @a port. May be called at any time. | |||
| @@ -873,7 +863,7 @@ int jack_port_set_name (jack_port_t *port, const char *port_name); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_port_set_alias (jack_port_t *port, const char *alias); | |||
| int jack_port_set_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Remove @a alias as an alias for @a port. May be called at any time. | |||
| @@ -883,20 +873,20 @@ int jack_port_set_alias (jack_port_t *port, const char *alias); | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_port_unset_alias (jack_port_t *port, const char *alias); | |||
| int jack_port_unset_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Get any aliases known for @port. | |||
| * | |||
| * @return the number of aliases discovered for the port | |||
| */ | |||
| int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]); | |||
| int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * If @ref JackPortCanMonitor is set for this @a port, turn input | |||
| * monitoring on or off. Otherwise, do nothing. | |||
| */ | |||
| int jack_port_request_monitor (jack_port_t *port, int onoff); | |||
| int jack_port_request_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * If @ref JackPortCanMonitor is set for this @a port_name, turn input | |||
| @@ -907,7 +897,7 @@ int jack_port_request_monitor (jack_port_t *port, int onoff); | |||
| * @see jack_port_name_size() | |||
| */ | |||
| int jack_port_request_monitor_by_name (jack_client_t *client, | |||
| const char *port_name, int onoff); | |||
| const char *port_name, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * If @ref JackPortCanMonitor is set for a port, this function turns | |||
| @@ -916,12 +906,12 @@ int jack_port_request_monitor_by_name (jack_client_t *client, | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code | |||
| */ | |||
| int jack_port_ensure_monitor (jack_port_t *port, int onoff); | |||
| int jack_port_ensure_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return TRUE if input monitoring has been requested for @a port. | |||
| */ | |||
| int jack_port_monitoring_input (jack_port_t *port); | |||
| int jack_port_monitoring_input (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Establish a connection between two ports. | |||
| @@ -942,7 +932,7 @@ int jack_port_monitoring_input (jack_port_t *port); | |||
| */ | |||
| int jack_connect (jack_client_t *, | |||
| const char *source_port, | |||
| const char *destination_port); | |||
| const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Remove a connection between two ports. | |||
| @@ -959,7 +949,7 @@ int jack_connect (jack_client_t *, | |||
| */ | |||
| int jack_disconnect (jack_client_t *, | |||
| const char *source_port, | |||
| const char *destination_port); | |||
| const char *destination_port) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Perform the same function as jack_disconnect() using port handles | |||
| @@ -970,7 +960,7 @@ int jack_disconnect (jack_client_t *, | |||
| * while generic connection clients (e.g. patchbays) would use | |||
| * jack_disconnect(). | |||
| */ | |||
| int jack_port_disconnect (jack_client_t *, jack_port_t *); | |||
| int jack_port_disconnect (jack_client_t *, jack_port_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the maximum number of characters in a full JACK port name | |||
| @@ -980,13 +970,13 @@ int jack_port_disconnect (jack_client_t *, jack_port_t *); | |||
| * with a colon (:) followed by its short name and a NULL | |||
| * character. | |||
| */ | |||
| int jack_port_name_size(void); | |||
| int jack_port_name_size(void) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the maximum number of characters in a JACK port type name | |||
| * including the final NULL character. This value is a constant. | |||
| */ | |||
| int jack_port_type_size(void); | |||
| int jack_port_type_size(void) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -1014,20 +1004,20 @@ int jack_port_type_size(void); | |||
| const char ** jack_get_ports (jack_client_t *, | |||
| const char *port_name_pattern, | |||
| const char *type_name_pattern, | |||
| unsigned long flags); | |||
| unsigned long flags) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return address of the jack_port_t named @a port_name. | |||
| * | |||
| * @see jack_port_name_size() | |||
| */ | |||
| jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name); | |||
| jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return address of the jack_port_t of a @a port_id. | |||
| */ | |||
| jack_port_t * jack_port_by_id (jack_client_t *client, | |||
| jack_port_id_t port_id); | |||
| jack_port_id_t port_id) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -1044,7 +1034,7 @@ jack_port_t * jack_port_by_id (jack_client_t *client, | |||
| * @return the estimated time in frames that has passed since the JACK | |||
| * server began the current process cycle. | |||
| */ | |||
| jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *); | |||
| jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the estimated current time in frames. | |||
| @@ -1052,7 +1042,7 @@ jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *); | |||
| * callback). The return value can be compared with the value of | |||
| * jack_last_frame_time to relate time in other threads to JACK time. | |||
| */ | |||
| jack_nframes_t jack_frame_time (const jack_client_t *); | |||
| jack_nframes_t jack_frame_time (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the precise time at the start of the current process cycle. | |||
| @@ -1068,17 +1058,17 @@ jack_nframes_t jack_frame_time (const jack_client_t *); | |||
| * If an xrun occurs, clients must check this value again, as time | |||
| * may have advanced in a non-linear way (e.g. cycles may have been skipped). | |||
| */ | |||
| jack_nframes_t jack_last_frame_time (const jack_client_t *client); | |||
| jack_nframes_t jack_last_frame_time (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the estimated time in microseconds of the specified frame time | |||
| */ | |||
| jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t); | |||
| jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return the estimated time in frames for the specified system time. | |||
| */ | |||
| jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t); | |||
| jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @return return JACK's current system time in microseconds, | |||
| @@ -1086,7 +1076,7 @@ jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t); | |||
| * | |||
| * The value returned is guaranteed to be monotonic, but not linear. | |||
| */ | |||
| jack_time_t jack_get_time(); | |||
| jack_time_t jack_get_time() JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -1103,7 +1093,7 @@ jack_time_t jack_get_time(); | |||
| * | |||
| * @param msg error message text (no newline at end). | |||
| */ | |||
| extern void (*jack_error_callback)(const char *msg); | |||
| extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Set the @ref jack_error_callback for error message display. | |||
| @@ -1112,7 +1102,7 @@ extern void (*jack_error_callback)(const char *msg); | |||
| * The JACK library provides two built-in callbacks for this purpose: | |||
| * default_jack_error_callback() and silent_jack_error_callback(). | |||
| */ | |||
| void jack_set_error_function (void (*func)(const char *)); | |||
| void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Display JACK info message. | |||
| @@ -1122,7 +1112,7 @@ void jack_set_error_function (void (*func)(const char *)); | |||
| * | |||
| * @param msg info message text (no newline at end). | |||
| */ | |||
| extern void (*jack_info_callback)(const char *msg); | |||
| extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Set the @ref jack_info_callback for info message display. | |||
| @@ -1131,7 +1121,7 @@ extern void (*jack_info_callback)(const char *msg); | |||
| * The JACK library provides two built-in callbacks for this purpose: | |||
| * default_jack_info_callback() and silent_jack_info_callback(). | |||
| */ | |||
| void jack_set_info_function (void (*func)(const char *)); | |||
| void jack_set_info_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -1142,7 +1132,7 @@ void jack_set_info_function (void (*func)(const char *)); | |||
| * Developers are strongly encouraged to use this function instead of the standard "free" function in new code. | |||
| * | |||
| */ | |||
| void jack_free(void* ptr); | |||
| void jack_free(void* ptr) JACK_OPTIONAL_WEAK_EXPORT; | |||
| #ifdef __cplusplus | |||
| @@ -27,7 +27,7 @@ extern "C" { | |||
| #include <jack/types.h> | |||
| #include <stdlib.h> | |||
| #include <jack/weakmacros.h> | |||
| /** Type for raw event data contained in @ref jack_midi_event_t. */ | |||
| typedef unsigned char jack_midi_data_t; | |||
| @@ -53,7 +53,7 @@ typedef struct _jack_midi_event | |||
| * @return number of events inside @a port_buffer | |||
| */ | |||
| jack_nframes_t | |||
| jack_midi_get_event_count(void* port_buffer); | |||
| jack_midi_get_event_count(void* port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** Get a MIDI event from an event port buffer. | |||
| @@ -70,7 +70,7 @@ jack_midi_get_event_count(void* port_buffer); | |||
| int | |||
| jack_midi_event_get(jack_midi_event_t *event, | |||
| void *port_buffer, | |||
| jack_nframes_t event_index); | |||
| jack_nframes_t event_index) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** Clear an event buffer. | |||
| @@ -82,7 +82,7 @@ jack_midi_event_get(jack_midi_event_t *event, | |||
| * @param port_buffer Port buffer to clear (must be an output port buffer). | |||
| */ | |||
| void | |||
| jack_midi_clear_buffer(void *port_buffer); | |||
| jack_midi_clear_buffer(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** Get the size of the largest event that can be stored by the port. | |||
| @@ -93,7 +93,7 @@ jack_midi_clear_buffer(void *port_buffer); | |||
| * @param port_buffer Port buffer to check size of. | |||
| */ | |||
| size_t | |||
| jack_midi_max_event_size(void* port_buffer); | |||
| jack_midi_max_event_size(void* port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** Allocate space for an event to be written to an event port buffer. | |||
| @@ -112,9 +112,9 @@ jack_midi_max_event_size(void* port_buffer); | |||
| * NULL on error (ie not enough space). | |||
| */ | |||
| jack_midi_data_t* | |||
| jack_midi_event_reserve(void *port_buffer, | |||
| jack_midi_event_reserve(void *port_buffer, | |||
| jack_nframes_t time, | |||
| size_t data_size); | |||
| size_t data_size) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** Write an event into an event port buffer. | |||
| @@ -130,10 +130,10 @@ jack_midi_event_reserve(void *port_buffer, | |||
| * @return 0 on success, ENOBUFS if there's not enough space in buffer for event. | |||
| */ | |||
| int | |||
| jack_midi_event_write(void *port_buffer, | |||
| jack_nframes_t time, | |||
| jack_midi_event_write(void *port_buffer, | |||
| jack_nframes_t time, | |||
| const jack_midi_data_t *data, | |||
| size_t data_size); | |||
| size_t data_size) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** Get the number of events that could not be written to @a port_buffer. | |||
| @@ -145,7 +145,7 @@ jack_midi_event_write(void *port_buffer, | |||
| * @returns Number of events that could not be written to @a port_buffer. | |||
| */ | |||
| jack_nframes_t | |||
| jack_midi_get_lost_event_count(void *port_buffer); | |||
| jack_midi_get_lost_event_count(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -26,6 +26,7 @@ extern "C" | |||
| #endif | |||
| #include <jack/systemdeps.h> | |||
| #include <jack/weakmacros.h> | |||
| /** @file thread.h | |||
| * | |||
| @@ -45,7 +46,7 @@ extern "C" | |||
| * Otherwise returns -1. | |||
| */ | |||
| int jack_client_real_time_priority (jack_client_t*); | |||
| int jack_client_real_time_priority (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * @returns if JACK is running with realtime scheduling, this returns | |||
| @@ -53,7 +54,7 @@ int jack_client_real_time_priority (jack_client_t*); | |||
| * is subject to realtime scheduling. Otherwise returns -1. | |||
| */ | |||
| int jack_client_max_real_time_priority (jack_client_t*); | |||
| int jack_client_max_real_time_priority (jack_client_t*) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Attempt to enable realtime scheduling for a thread. On some | |||
| @@ -65,7 +66,7 @@ int jack_client_max_real_time_priority (jack_client_t*); | |||
| * @returns 0, if successful; EPERM, if the calling process lacks | |||
| * required realtime privileges; otherwise some other error number. | |||
| */ | |||
| int jack_acquire_real_time_scheduling (pthread_t thread, int priority); | |||
| int jack_acquire_real_time_scheduling (pthread_t thread, int priority) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Create a thread for JACK or one of its clients. The thread is | |||
| @@ -88,7 +89,7 @@ int jack_client_create_thread (jack_client_t* client, | |||
| int priority, | |||
| int realtime, /* boolean */ | |||
| void *(*start_routine)(void*), | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Drop realtime scheduling for a thread. | |||
| @@ -97,7 +98,7 @@ int jack_client_create_thread (jack_client_t* client, | |||
| * | |||
| * @returns 0, if successful; otherwise an error number. | |||
| */ | |||
| int jack_drop_real_time_scheduling (pthread_t thread); | |||
| int jack_drop_real_time_scheduling (pthread_t thread) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Stop the thread, waiting for the thread handler to terminate. | |||
| @@ -106,7 +107,7 @@ int jack_drop_real_time_scheduling (pthread_t thread); | |||
| * | |||
| * @returns 0, if successful; otherwise an error number. | |||
| */ | |||
| int jack_client_stop_thread(jack_client_t* client, pthread_t thread); | |||
| int jack_client_stop_thread(jack_client_t* client, pthread_t thread) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Cancel the thread then waits for the thread handler to terminate. | |||
| @@ -115,7 +116,7 @@ int jack_client_stop_thread(jack_client_t* client, pthread_t thread); | |||
| * | |||
| * @returns 0, if successful; otherwise an error number. | |||
| */ | |||
| int jack_client_kill_thread(jack_client_t* client, pthread_t thread); | |||
| int jack_client_kill_thread(jack_client_t* client, pthread_t thread) JACK_OPTIONAL_WEAK_EXPORT; | |||
| #ifndef WIN32 | |||
| @@ -142,7 +143,7 @@ int jack_client_stop_thread(jack_client_t* client, pthread_t thread); | |||
| * @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) JACK_OPTIONAL_WEAK_EXPORT; | |||
| #endif | |||
| @@ -26,6 +26,7 @@ extern "C" { | |||
| #endif | |||
| #include <jack/types.h> | |||
| #include <jack/weakmacros.h> | |||
| /** | |||
| * @defgroup TransportControl Transport and Timebase control | |||
| @@ -48,7 +49,7 @@ extern "C" { | |||
| * | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_release_timebase (jack_client_t *client); | |||
| int jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Register (or unregister) as a slow-sync client, one that cannot | |||
| @@ -72,7 +73,7 @@ int jack_release_timebase (jack_client_t *client); | |||
| */ | |||
| int jack_set_sync_callback (jack_client_t *client, | |||
| JackSyncCallback sync_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Set the timeout value for slow-sync clients. | |||
| @@ -92,7 +93,7 @@ int jack_set_sync_callback (jack_client_t *client, | |||
| * @return 0 on success, otherwise a non-zero error code. | |||
| */ | |||
| int jack_set_sync_timeout (jack_client_t *client, | |||
| jack_time_t timeout); | |||
| jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Register as timebase master for the JACK subsystem. | |||
| @@ -122,7 +123,7 @@ int jack_set_sync_timeout (jack_client_t *client, | |||
| int jack_set_timebase_callback (jack_client_t *client, | |||
| int conditional, | |||
| JackTimebaseCallback timebase_callback, | |||
| void *arg); | |||
| void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Reposition the transport to a new frame number. | |||
| @@ -141,7 +142,7 @@ int jack_set_timebase_callback (jack_client_t *client, | |||
| * @return 0 if valid request, non-zero otherwise. | |||
| */ | |||
| int jack_transport_locate (jack_client_t *client, | |||
| jack_nframes_t frame); | |||
| jack_nframes_t frame) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Query the current transport state and position. | |||
| @@ -159,7 +160,7 @@ int jack_transport_locate (jack_client_t *client, | |||
| * @return Current transport state. | |||
| */ | |||
| jack_transport_state_t jack_transport_query (const jack_client_t *client, | |||
| jack_position_t *pos); | |||
| jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Return an estimate of the current transport frame, | |||
| @@ -168,7 +169,7 @@ jack_transport_state_t jack_transport_query (const jack_client_t *client, | |||
| * | |||
| * @param client the JACK client structure | |||
| */ | |||
| jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client); | |||
| jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Request a new transport position. | |||
| @@ -187,7 +188,7 @@ jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client); | |||
| * @return 0 if valid request, EINVAL if position structure rejected. | |||
| */ | |||
| int jack_transport_reposition (jack_client_t *client, | |||
| jack_position_t *pos); | |||
| jack_position_t *pos) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Start the JACK transport rolling. | |||
| @@ -200,7 +201,7 @@ int jack_transport_reposition (jack_client_t *client, | |||
| * | |||
| * @param client the JACK client structure. | |||
| */ | |||
| void jack_transport_start (jack_client_t *client); | |||
| void jack_transport_start (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Stop the JACK transport. | |||
| @@ -210,7 +211,7 @@ void jack_transport_start (jack_client_t *client); | |||
| * | |||
| * @param client the JACK client structure. | |||
| */ | |||
| void jack_transport_stop (jack_client_t *client); | |||
| void jack_transport_stop (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Gets the current transport info structure (deprecated). | |||
| @@ -225,7 +226,7 @@ void jack_transport_stop (jack_client_t *client); | |||
| * @pre Must be called from the process thread. | |||
| */ | |||
| void jack_get_transport_info (jack_client_t *client, | |||
| jack_transport_info_t *tinfo); | |||
| jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /** | |||
| * Set the transport info structure (deprecated). | |||
| @@ -235,7 +236,7 @@ void jack_get_transport_info (jack_client_t *client, | |||
| * a ::JackTimebaseCallback. | |||
| */ | |||
| void jack_set_transport_info (jack_client_t *client, | |||
| jack_transport_info_t *tinfo); | |||
| jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT; | |||
| /*@}*/ | |||
| @@ -0,0 +1,52 @@ | |||
| /* | |||
| Copyright (C) 2010 Paul Davis | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU Lesser General Public License as published by | |||
| the Free Software Foundation; either version 2.1 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| 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 | |||
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| */ | |||
| #ifndef __weakjack_h__ | |||
| #define __weakjack_h__ | |||
| #ifndef JACK_OPTIONAL_WEAK_EXPORT | |||
| /* JACK_OPTIONAL_WEAK_EXPORT needs to be a macro which | |||
| expands into a compiler directive. If non-null, the directive | |||
| must tell the compiler to arrange for weak linkage of | |||
| the symbol it used with. For this to work fully may | |||
| require linker arguments for the client as well. | |||
| */ | |||
| #ifdef __GNUC__ | |||
| #define JACK_OPTIONAL_WEAK_EXPORT __attribute__((__weak__)) | |||
| #else | |||
| /* Add other things here for non-gcc platforms */ | |||
| #endif | |||
| #endif | |||
| #ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT | |||
| /* JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT needs to be a macro | |||
| which expands into a compiler directive. If non-null, the directive | |||
| must tell the compiler to arrange for weak linkage of the | |||
| symbol it is used with AND optionally to mark the symbol | |||
| as deprecated. For this to work fully may require | |||
| linker arguments for the client as well. | |||
| */ | |||
| #ifdef __GNUC__ | |||
| #define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT __attribute__((__weak__,__deprecated__)) | |||
| #else | |||
| /* Add other things here for non-gcc platforms */ | |||
| #endif | |||
| #endif | |||
| #endif /* weakjack */ | |||
| @@ -0,0 +1,61 @@ | |||
| /* | |||
| Copyright (C) 2010 Paul Davis | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU Lesser General Public License as published by | |||
| the Free Software Foundation; either version 2.1 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| 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 | |||
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| */ | |||
| #ifndef __weakmacros_h__ | |||
| #define __weakmacros_h__ | |||
| /************************************************************* | |||
| * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function | |||
| * added to the JACK API after the 0.116.2 release. | |||
| * | |||
| * Functions that predate this release are marked with | |||
| * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile | |||
| * time in a variety of ways. The default definition is empty, | |||
| * so that these symbols get normal linkage. If you wish to | |||
| * use all JACK symbols with weak linkage, include | |||
| * <jack/weakjack.h> before jack.h. | |||
| *************************************************************/ | |||
| #ifndef JACK_WEAK_EXPORT | |||
| #ifdef __GNUC__ | |||
| /* JACK_WEAK_EXPORT needs to be a macro which | |||
| expands into a compiler directive. If non-null, the directive | |||
| must tell the compiler to arrange for weak linkage of | |||
| the symbol it used with. For this to work full may | |||
| require linker arguments in the client as well. | |||
| */ | |||
| #define JACK_WEAK_EXPORT __attribute__((weak)) | |||
| #else | |||
| /* Add other things here for non-gcc platforms */ | |||
| #endif | |||
| #endif | |||
| #ifndef JACK_OPTIONAL_WEAK_EXPORT | |||
| #define JACK_OPTIONAL_WEAK_EXPORT | |||
| #endif | |||
| #ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT | |||
| #ifdef __GNUC__ | |||
| #define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT __attribute__((__deprecated__)) | |||
| #else | |||
| /* Add other things here for non-gcc platforms */ | |||
| #endif /* __GNUC__ */ | |||
| #endif | |||
| #endif /* __weakmacros_h__ */ | |||
| @@ -42,6 +42,7 @@ $Id: net_driver.c,v 1.17 2006/04/16 20:16:10 torbenh Exp $ | |||
| #ifdef WIN32 | |||
| #include <winsock.h> | |||
| #include <malloc.h> | |||
| #define socklen_t int | |||
| #else | |||
| #include <sys/socket.h> | |||
| #include <netinet/in.h> | |||
| @@ -49,7 +50,9 @@ $Id: net_driver.c,v 1.17 2006/04/16 20:16:10 torbenh Exp $ | |||
| #include "netjack.h" | |||
| //#include "config.h" | |||
| #ifdef __linux__ | |||
| #include "config.h" | |||
| #endif | |||
| #if HAVE_SAMPLERATE | |||
| #include <samplerate.h> | |||
| @@ -92,7 +95,7 @@ int netjack_wait( netjack_driver_state_t *netj ) | |||
| jacknet_packet_header *pkthdr; | |||
| if( !netj->next_deadline_valid ) { | |||
| netj->next_deadline = jack_get_time() + netj->deadline_offset; | |||
| netj->next_deadline = jack_get_time() + netj->period_usecs; | |||
| netj->next_deadline_valid = 1; | |||
| } | |||
| @@ -165,7 +168,7 @@ int netjack_wait( netjack_driver_state_t *netj ) | |||
| netj->packet_data_valid = 1; | |||
| int want_deadline; | |||
| if( netj->jitter_val != 0 ) | |||
| if( netj->jitter_val != 0 ) | |||
| want_deadline = netj->jitter_val; | |||
| else if( netj->latency < 4 ) | |||
| want_deadline = -netj->period_usecs/2; | |||
| @@ -174,23 +177,23 @@ int netjack_wait( netjack_driver_state_t *netj ) | |||
| if( netj->deadline_goodness != MASTER_FREEWHEELS ) { | |||
| if( netj->deadline_goodness < want_deadline ) { | |||
| netj->deadline_offset -= netj->period_usecs/100; | |||
| netj->next_deadline -= netj->period_usecs/100; | |||
| //jack_log( "goodness: %d, Adjust deadline: --- %d\n", netj->deadline_goodness, (int) netj->period_usecs*netj->latency/100 ); | |||
| } | |||
| if( netj->deadline_goodness > want_deadline ) { | |||
| netj->deadline_offset += netj->period_usecs/100; | |||
| netj->next_deadline += netj->period_usecs/100; | |||
| //jack_log( "goodness: %d, Adjust deadline: +++ %d\n", netj->deadline_goodness, (int) netj->period_usecs*netj->latency/100 ); | |||
| } | |||
| } | |||
| if( netj->deadline_offset < (netj->period_usecs*70/100) ) { | |||
| jack_error( "master is forcing deadline_offset to below 70%% of period_usecs... increase latency setting on master" ); | |||
| netj->deadline_offset = (netj->period_usecs*90/100); | |||
| } | |||
| // if( netj->next_deadline < (netj->period_usecs*70/100) ) { | |||
| // jack_error( "master is forcing deadline_offset to below 70%% of period_usecs... increase latency setting on master" ); | |||
| // netj->deadline_offset = (netj->period_usecs*90/100); | |||
| // } | |||
| netj->next_deadline = jack_get_time() + netj->deadline_offset; | |||
| netj->next_deadline += netj->period_usecs; | |||
| } else { | |||
| netj->time_to_deadline = 0; | |||
| netj->next_deadline = jack_get_time() + netj->deadline_offset; | |||
| netj->next_deadline += netj->period_usecs; | |||
| // bah... the packet is not there. | |||
| // either | |||
| // - it got lost. | |||
| @@ -581,7 +584,13 @@ netjack_startup( netjack_driver_state_t *netj ) | |||
| struct sockaddr_in address; | |||
| // Now open the socket, and wait for the first packet to arrive... | |||
| netj->sockfd = socket (AF_INET, SOCK_DGRAM, 0); | |||
| #ifdef WIN32 | |||
| u_long parm = 1; | |||
| DWORD bufsize = 262144; | |||
| //ioctlsocket( netj->sockfd, FIONBIO, &parm ); | |||
| setsockopt( netj->sockfd, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize) ); | |||
| setsockopt( netj->sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&bufsize, sizeof(bufsize) ); | |||
| if (netj->sockfd == INVALID_SOCKET) | |||
| #else | |||
| if (netj->sockfd == -1) | |||
| @@ -705,7 +714,7 @@ netjack_startup( netjack_driver_state_t *netj ) | |||
| netj->period_usecs = | |||
| (jack_time_t) floor ((((float) netj->period_size) / (float)netj->sample_rate) | |||
| * 1000000.0f); | |||
| if( netj->latency == 0 ) | |||
| netj->deadline_offset = 50*netj->period_usecs; | |||
| else | |||
| @@ -716,7 +725,7 @@ netjack_startup( netjack_driver_state_t *netj ) | |||
| // TODO: this is a hack. But i dont want to change the packet header. | |||
| netj->resample_factor = (netj->resample_factor * netj->period_size * 1024 / netj->sample_rate / 8)&(~1); | |||
| netj->resample_factor_up = (netj->resample_factor_up * netj->period_size * 1024 / netj->sample_rate / 8)&(~1); | |||
| netj->net_period_down = netj->resample_factor; | |||
| netj->net_period_up = netj->resample_factor_up; | |||
| } else { | |||
| @@ -26,7 +26,9 @@ | |||
| * | |||
| */ | |||
| //#include "config.h" | |||
| #ifdef __linux__ | |||
| #include "config.h" | |||
| #endif | |||
| #ifdef __APPLE__ | |||
| #define _DARWIN_C_SOURCE | |||
| @@ -52,6 +54,7 @@ | |||
| #include <winsock2.h> | |||
| #define socklen_t int | |||
| #include <malloc.h> | |||
| #define socklen_t int | |||
| #else | |||
| #include <sys/socket.h> | |||
| #include <netinet/in.h> | |||
| @@ -127,7 +130,7 @@ int get_sample_size (int bitdepth) | |||
| if (bitdepth == 16) | |||
| return sizeof (int16_t); | |||
| //JN: why? is this for buffer sizes before or after encoding? | |||
| //JN: if the former, why not int16_t, if the latter, shouldn't it depend on -c N? | |||
| //JN: if the former, why not int16_t, if the latter, shouldn't it depend on -c N? | |||
| if( bitdepth == CELT_MODE ) | |||
| return sizeof( unsigned char ); | |||
| return sizeof (int32_t); | |||
| @@ -70,7 +70,7 @@ jack_ringbuffer_create (size_t sz) | |||
| int power_of_two; | |||
| jack_ringbuffer_t *rb; | |||
| if ((rb = malloc (sizeof (jack_ringbuffer_t))) == NULL) { | |||
| if ((rb = (jack_ringbuffer_t *) malloc (sizeof (jack_ringbuffer_t))) == NULL) { | |||
| return NULL; | |||
| } | |||
| @@ -81,7 +81,7 @@ jack_ringbuffer_create (size_t sz) | |||
| rb->size_mask -= 1; | |||
| rb->write_ptr = 0; | |||
| rb->read_ptr = 0; | |||
| if ((rb->buf = malloc (rb->size)) == NULL) { | |||
| if ((rb->buf = (char *) malloc (rb->size)) == NULL) { | |||
| free (rb); | |||
| return NULL; | |||
| } | |||
| @@ -18,23 +18,23 @@ | |||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| * | |||
| */ | |||
| /* This module provides a set of abstract shared memory interfaces | |||
| * with support using both System V and POSIX shared memory | |||
| * implementations. The code is divided into three sections: | |||
| * | |||
| * - common (interface-independent) code | |||
| * - POSIX implementation | |||
| * - System V implementation | |||
| * | |||
| * The implementation used is determined by whether USE_POSIX_SHM was | |||
| * set in the ./configure step. | |||
| */ | |||
| /* This module provides a set of abstract shared memory interfaces | |||
| * with support using both System V and POSIX shared memory | |||
| * implementations. The code is divided into three sections: | |||
| * | |||
| * - common (interface-independent) code | |||
| * - POSIX implementation | |||
| * - System V implementation | |||
| * | |||
| * The implementation used is determined by whether USE_POSIX_SHM was | |||
| * set in the ./configure step. | |||
| */ | |||
| #include "JackConstants.h" | |||
| #ifdef WIN32 | |||
| #include <process.h> | |||
| #include <process.h> | |||
| #include <stdio.h> | |||
| #else | |||
| @@ -145,23 +145,22 @@ static int semid = -1; | |||
| #ifdef WIN32 | |||
| static void | |||
| semaphore_init () {} | |||
| static int | |||
| semaphore_init () {return 0;} | |||
| static void | |||
| semaphore_add (int value) {} | |||
| static int | |||
| semaphore_add (int value) {return 0;} | |||
| #else | |||
| /* all semaphore errors are fatal -- issue message, but do not return */ | |||
| static void | |||
| semaphore_error (char *msg) | |||
| { | |||
| jack_error ("Fatal JACK semaphore error: %s (%s)", | |||
| jack_error ("JACK semaphore error: %s (%s)", | |||
| msg, strerror (errno)); | |||
| abort (); | |||
| } | |||
| static void | |||
| static int | |||
| semaphore_init () | |||
| { | |||
| key_t semkey = JACK_SEMAPHORE_KEY; | |||
| @@ -180,21 +179,26 @@ semaphore_init () | |||
| sbuf.sem_op = 1; | |||
| sbuf.sem_flg = 0; | |||
| if (semop(semid, &sbuf, 1) == -1) { | |||
| semaphore_error ("semop"); | |||
| semaphore_error ("semop"); | |||
| return -1; | |||
| } | |||
| } else if (errno == EEXIST) { | |||
| if ((semid = semget(semkey, 0, 0)) == -1) { | |||
| semaphore_error ("semget"); | |||
| semaphore_error ("semget"); | |||
| return -1; | |||
| } | |||
| } else { | |||
| semaphore_error ("semget creation"); | |||
| semaphore_error ("semget creation"); | |||
| return -1; | |||
| } | |||
| } | |||
| return 0; | |||
| } | |||
| static inline void | |||
| static inline int | |||
| semaphore_add (int value) | |||
| { | |||
| struct sembuf sbuf; | |||
| @@ -202,20 +206,26 @@ semaphore_add (int value) | |||
| sbuf.sem_num = 0; | |||
| sbuf.sem_op = value; | |||
| sbuf.sem_flg = SEM_UNDO; | |||
| if (semop(semid, &sbuf, 1) == -1) { | |||
| semaphore_error ("semop"); | |||
| return -1; | |||
| } | |||
| return 0; | |||
| } | |||
| #endif | |||
| static void | |||
| static int | |||
| jack_shm_lock_registry (void) | |||
| { | |||
| if (semid == -1) | |||
| semaphore_init (); | |||
| if (semid == -1) { | |||
| if (semaphore_init () < 0) | |||
| return -1; | |||
| } | |||
| semaphore_add (-1); | |||
| return semaphore_add (-1); | |||
| } | |||
| static void | |||
| @@ -297,7 +307,10 @@ jack_server_initialize_shm (int new_registry) | |||
| if (jack_shm_header) | |||
| return 0; /* already initialized */ | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| rc = jack_access_registry (®istry_info); | |||
| @@ -353,7 +366,11 @@ jack_initialize_shm (const char *server_name) | |||
| jack_set_server_prefix (server_name); | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| if ((rc = jack_access_registry (®istry_info)) == 0) { | |||
| if ((rc = jack_shm_validate_registry ()) != 0) { | |||
| jack_error ("Incompatible shm registry, " | |||
| @@ -412,15 +429,20 @@ jack_release_shm_entry (jack_shm_registry_index_t index) | |||
| sizeof (jack_shm_registry[index].id)); | |||
| } | |||
| void | |||
| int | |||
| jack_release_shm_info (jack_shm_registry_index_t index) | |||
| { | |||
| /* must NOT have the registry locked */ | |||
| if (jack_shm_registry[index].allocator == GetPID()) { | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| jack_release_shm_entry (index); | |||
| jack_shm_unlock_registry (); | |||
| } | |||
| return 0; | |||
| } | |||
| /* Claim server_name for this process. | |||
| @@ -440,7 +462,10 @@ jack_register_server (const char *server_name, int new_registry) | |||
| if (jack_server_initialize_shm (new_registry)) | |||
| return ENOMEM; | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| /* See if server_name already registered. Since server names | |||
| * are per-user, we register the unique server prefix string. | |||
| @@ -493,11 +518,14 @@ jack_register_server (const char *server_name, int new_registry) | |||
| } | |||
| /* release server_name registration */ | |||
| void | |||
| int | |||
| jack_unregister_server (const char *server_name /* unused */) | |||
| { | |||
| int i; | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| for (i = 0; i < MAX_SERVERS; i++) { | |||
| if (jack_shm_header->server[i].pid == GetPID()) { | |||
| @@ -506,7 +534,8 @@ jack_unregister_server (const char *server_name /* unused */) | |||
| } | |||
| } | |||
| jack_shm_unlock_registry (); | |||
| jack_shm_unlock_registry (); | |||
| return 0; | |||
| } | |||
| /* called for server startup and termination */ | |||
| @@ -517,7 +546,10 @@ jack_cleanup_shm () | |||
| int destroy; | |||
| jack_shm_info_t copy; | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| for (i = 0; i < MAX_SHM_ID; i++) { | |||
| jack_shm_registry_t* r; | |||
| @@ -741,7 +773,10 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si) | |||
| int rc = -1; | |||
| char name[SHM_NAME_MAX+1]; | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| if ((registry = jack_get_free_shm_info ()) == NULL) { | |||
| jack_error ("shm registry full"); | |||
| @@ -780,7 +815,7 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si) | |||
| close (shm_fd); | |||
| registry->size = size; | |||
| strncpy (registry->id, name, sizeof (registry->id)); | |||
| registry->allocator = getpid(); | |||
| registry->allocator = GetPID(); | |||
| si->index = registry->index; | |||
| si->ptr.attached_at = MAP_FAILED; /* not attached */ | |||
| rc = 0; /* success */ | |||
| @@ -936,7 +971,10 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si) | |||
| int rc = -1; | |||
| char name[SHM_NAME_MAX+1]; | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| if ((registry = jack_get_free_shm_info ()) == NULL) { | |||
| jack_error ("shm registry full"); | |||
| @@ -1133,7 +1171,10 @@ jack_shmalloc (const char* name_not_used, jack_shmsize_t size, | |||
| int rc = -1; | |||
| jack_shm_registry_t* registry; | |||
| jack_shm_lock_registry (); | |||
| if (jack_shm_lock_registry () < 0) { | |||
| jack_error ("jack_shm_lock_registry fails..."); | |||
| return -1; | |||
| } | |||
| if ((registry = jack_get_free_shm_info ())) { | |||
| @@ -115,33 +115,33 @@ extern "C" | |||
| * indicating where the shared memory has been | |||
| * attached to the address space. | |||
| */ | |||
| typedef struct _jack_shm_info { | |||
| jack_shm_registry_index_t index; /* offset into the registry */ | |||
| uint32_t size; | |||
| union { | |||
| void *attached_at; /* address where attached */ | |||
| char ptr_size[8]; | |||
| } ptr; /* a "pointer" that has the same 8 bytes size when compling in 32 or 64 bits */ | |||
| char ptr_size[8]; | |||
| } ptr; /* a "pointer" that has the same 8 bytes size when compling in 32 or 64 bits */ | |||
| } | |||
| POST_PACKED_STRUCTURE jack_shm_info_t; | |||
| /* utility functions used only within JACK */ | |||
| void jack_shm_copy_from_registry (jack_shm_info_t*, | |||
| jack_shm_registry_index_t); | |||
| void jack_shm_copy_to_registry (jack_shm_info_t*, | |||
| jack_shm_registry_index_t*); | |||
| void jack_release_shm_info (jack_shm_registry_index_t); | |||
| char* jack_shm_addr (jack_shm_info_t* si); | |||
| int jack_release_shm_info (jack_shm_registry_index_t); | |||
| char* jack_shm_addr (jack_shm_info_t* si); | |||
| // here begin the API | |||
| // here begin the API | |||
| int jack_register_server (const char *server_name, int new_registry); | |||
| void jack_unregister_server (const char *server_name); | |||
| int jack_unregister_server (const char *server_name); | |||
| int jack_initialize_shm (const char *server_name); | |||
| int jack_initialize_shm_server (void); | |||
| int jack_initialize_shm_client (void); | |||
| int jack_initialize_shm_server (void); | |||
| int jack_initialize_shm_client (void); | |||
| int jack_cleanup_shm (void); | |||
| int jack_shmalloc (const char *shm_name, jack_shmsize_t size, | |||
| @@ -149,7 +149,7 @@ extern "C" | |||
| void jack_release_shm (jack_shm_info_t*); | |||
| void jack_destroy_shm (jack_shm_info_t*); | |||
| int jack_attach_shm (jack_shm_info_t*); | |||
| int jack_attach_shm_read (jack_shm_info_t*); | |||
| int jack_attach_shm_read (jack_shm_info_t*); | |||
| int jack_resize_shm (jack_shm_info_t*, jack_shmsize_t size); | |||
| #ifdef __cplusplus | |||
| @@ -10,11 +10,15 @@ def set_options(opt): | |||
| opt.add_option('--enable-pkg-config-dbus-service-dir', action='store_true', default=False, help='force D-Bus service install dir to be one returned by pkg-config') | |||
| def configure(conf): | |||
| if not conf.check_cfg(package='dbus-1', atleast_version='1.0.0', args='--cflags --libs'): | |||
| conf.env['BUILD_JACKDBUS'] = False | |||
| if not conf.check_cfg(package='dbus-1', atleast_version='1.0.0', args='--cflags --libs') or not conf.is_defined('HAVE_DBUS_1'): | |||
| print Logs.colors.RED + 'WARNING !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL | |||
| return | |||
| dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir') | |||
| if not dbus_dir: | |||
| print Logs.colors.RED + 'WARNING !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL | |||
| return | |||
| dbus_dir = dbus_dir.strip() | |||
| @@ -31,15 +35,13 @@ def configure(conf): | |||
| if conf.is_defined('HAVE_EXPAT'): | |||
| conf.env['LIB_EXPAT'] = ['expat'] | |||
| else: | |||
| print Logs.colors.RED + 'WARNING !! jackdbus will not be built because of expat is missing' + Logs.colors.NORMAL | |||
| return | |||
| conf.env['BUILD_JACKDBUS1'] = conf.is_defined('HAVE_EXPAT') and conf.is_defined('HAVE_DBUS_1') | |||
| conf.env['BUILD_JACKDBUS'] = True | |||
| def build(bld): | |||
| if bld.env['BUILD_JACKDBUS1'] != True: | |||
| return | |||
| obj = bld.new_task_gen('cc', 'program') | |||
| if bld.env['IS_LINUX']: | |||
| sysdeps_dbus_include = ['../linux', '../posix'] | |||
| @@ -184,7 +184,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ | |||
| } | |||
| /* set the buffer time */ | |||
| buffer_time = 1000000*period*nperiods/rate; | |||
| buffer_time = 1000000*(uint64_t)period*nperiods/rate; | |||
| err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); | |||
| if (err < 0) { | |||
| printf("Unable to set buffer time %i for playback: %s\n", 1000000*period*nperiods/rate, snd_strerror(err)); | |||
| @@ -199,7 +199,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ | |||
| printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size ); | |||
| } | |||
| /* set the period time */ | |||
| period_time = 1000000*period/rate; | |||
| period_time = 1000000*(uint64_t)period/rate; | |||
| err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); | |||
| if (err < 0) { | |||
| printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err)); | |||
| @@ -183,7 +183,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ | |||
| } | |||
| /* set the buffer time */ | |||
| buffer_time = 1000000*period*nperiods/rate; | |||
| buffer_time = 1000000*(uint64_t)period*nperiods/rate; | |||
| err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); | |||
| if (err < 0) { | |||
| printf("Unable to set buffer time %i for playback: %s\n", 1000000*period*nperiods/rate, snd_strerror(err)); | |||
| @@ -198,7 +198,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ | |||
| printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size ); | |||
| } | |||
| /* set the period time */ | |||
| period_time = 1000000*period/rate; | |||
| period_time = 1000000*(uint64_t)period/rate; | |||
| err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); | |||
| if (err < 0) { | |||
| printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err)); | |||
| @@ -106,9 +106,9 @@ def main(): | |||
| print "Usage: %s [command] [command] ..." % os.path.basename(sys.argv[0]) | |||
| print "Commands:" | |||
| print " exit - exit jack dbus service (stops jack server if currently running)" | |||
| print " status - check whether jack server is started, return value is 0 if runing and 1 otherwise" | |||
| print " status - check whether jack server is started, return value is 0 if running and 1 otherwise" | |||
| print " start - start jack server if not currently started" | |||
| print " stop - stop jack server if currenly started" | |||
| print " stop - stop jack server if currently started" | |||
| print " sm - switch master to currently selected driver" | |||
| print " dl - get list of available drivers" | |||
| print " dg - get currently selected driver" | |||
| @@ -34,6 +34,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include <string.h> | |||
| #include <signal.h> | |||
| #ifdef __linux__ | |||
| #include "config.h" | |||
| #endif | |||
| #ifdef WIN32 | |||
| #include <winsock2.h> | |||
| #define socklen_t int | |||
| @@ -754,7 +758,7 @@ main (int argc, char *argv[]) | |||
| if (statecopy_netxruns != state_netxruns) { | |||
| statecopy_netxruns = state_netxruns; | |||
| printf ("%s: at frame %06d -> total netxruns %d (%d%%) queue time= %d\n", | |||
| client_name, | |||
| client_name, | |||
| state_currentframe, | |||
| statecopy_netxruns, | |||
| 100*statecopy_netxruns/state_currentframe, | |||
| @@ -49,10 +49,11 @@ def configure(conf): | |||
| e = conf.check_cc(lib='readline', define_name="HAVE_READLINE") | |||
| if conf.is_defined('HAVE_READLINE'): | |||
| conf.env['LIB_READLINE'] = ['readline'] | |||
| # define_name="HAVE_READLINE" has no effect, LIB_READLINE is defined if readline is available | |||
| #if conf.is_defined('HAVE_READLINE'): | |||
| # conf.env['LIB_READLINE'] = ['readline'] | |||
| conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = conf.is_defined('HAVE_READLINE') and conf.is_defined('HAVE_NCURSES') | |||
| conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = bool(conf.env['LIB_READLINE']) and bool(conf.env['LIB_NCURSES']) | |||
| conf.env['BUILD_EXAMPLE_CLIENT_REC'] = conf.is_defined('HAVE_SNDFILE') | |||
| @@ -2,7 +2,7 @@ | |||
| # encoding: utf-8 | |||
| def configure(conf): | |||
| conf.check_cfg(package='alsa', atleast_version='1.0.0', args='--cflags --libs') | |||
| conf.check_cfg(package='alsa', atleast_version='1.0.18', args='--cflags --libs') | |||
| conf.env['BUILD_DRIVER_ALSA'] = conf.is_defined('HAVE_ALSA') | |||
| conf. check_cfg(package='libfreebob', atleast_version='1.0.0', args='--cflags --libs') | |||
| @@ -1268,9 +1268,9 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing, | |||
| if (capturing && inchannels > 0) { | |||
| size = sizeof(AudioStreamBasicDescription); | |||
| err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &srcFormat, &size); | |||
| err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &srcFormat, &size); | |||
| if (err1 != noErr) { | |||
| jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input"); | |||
| jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output"); | |||
| printError(err1); | |||
| goto error; | |||
| } | |||
| @@ -1288,9 +1288,8 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing, | |||
| PrintStreamDesc(&srcFormat); | |||
| err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &srcFormat, sizeof(AudioStreamBasicDescription)); | |||
| if (err1 != noErr) { | |||
| jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input"); | |||
| jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output"); | |||
| printError(err1); | |||
| goto error; | |||
| } | |||
| @@ -1299,9 +1298,9 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing, | |||
| if (playing && outchannels > 0) { | |||
| size = sizeof(AudioStreamBasicDescription); | |||
| err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &dstFormat, &size); | |||
| err1 = AudioUnitGetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &dstFormat, &size); | |||
| if (err1 != noErr) { | |||
| jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output"); | |||
| jack_error("Error calling AudioUnitGetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input"); | |||
| printError(err1); | |||
| goto error; | |||
| } | |||
| @@ -1319,9 +1318,8 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing, | |||
| PrintStreamDesc(&dstFormat); | |||
| err1 = AudioUnitSetProperty(fAUHAL, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &dstFormat, sizeof(AudioStreamBasicDescription)); | |||
| if (err1 != noErr) { | |||
| jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Output"); | |||
| jack_error("Error calling AudioUnitSetProperty - kAudioUnitProperty_StreamFormat kAudioUnitScope_Input"); | |||
| printError(err1); | |||
| goto error; | |||
| } | |||
| @@ -0,0 +1,840 @@ | |||
| /* | |||
| Copyright (C) 2006 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifdef WIN32 | |||
| #pragma warning (disable : 4786) | |||
| #endif | |||
| #include <stdio.h> | |||
| #include <string.h> | |||
| #include <assert.h> | |||
| #include <process.h> | |||
| #include "JackRouter.h" | |||
| #include "profport.h" | |||
| /* | |||
| 08/07/2007 SL : USe jack_client_open instead of jack_client_new (automatic client renaming). | |||
| 09/08/2007 SL : Add JackRouter.ini parameter file. | |||
| 09/20/2007 SL : Better error report in DllRegisterServer (for Vista). | |||
| 09/27/2007 SL : Add AUDO_CONNECT property in JackRouter.ini file. | |||
| 10/10/2007 SL : Use ASIOSTInt32LSB instead of ASIOSTInt16LSB. | |||
| */ | |||
| //------------------------------------------------------------------------------------------ | |||
| // extern | |||
| void getNanoSeconds(ASIOTimeStamp *time); | |||
| // local | |||
| double AsioSamples2double (ASIOSamples* samples); | |||
| static const double twoRaisedTo32 = 4294967296.; | |||
| static const double twoRaisedTo32Reciprocal = 1. / twoRaisedTo32; | |||
| //------------------------------------------------------------------------------------------ | |||
| // on windows, we do the COM stuff. | |||
| #if WINDOWS | |||
| #include "windows.h" | |||
| #include "mmsystem.h" | |||
| #include "psapi.h" | |||
| using namespace std; | |||
| // class id. | |||
| // {838FE50A-C1AB-4b77-B9B6-0A40788B53F3} | |||
| CLSID IID_ASIO_DRIVER = { 0x838fe50a, 0xc1ab, 0x4b77, { 0xb9, 0xb6, 0xa, 0x40, 0x78, 0x8b, 0x53, 0xf3 } }; | |||
| CFactoryTemplate g_Templates[1] = { | |||
| {L"ASIOJACK", &IID_ASIO_DRIVER, JackRouter::CreateInstance} | |||
| }; | |||
| int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]); | |||
| CUnknown* JackRouter::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr) | |||
| { | |||
| return (CUnknown*)new JackRouter(pUnk,phr); | |||
| }; | |||
| STDMETHODIMP JackRouter::NonDelegatingQueryInterface(REFIID riid, void ** ppv) | |||
| { | |||
| if (riid == IID_ASIO_DRIVER) { | |||
| return GetInterface(this, ppv); | |||
| } | |||
| return CUnknown::NonDelegatingQueryInterface(riid, ppv); | |||
| } | |||
| // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |||
| // Register ASIO Driver | |||
| // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |||
| extern LONG RegisterAsioDriver(CLSID,char *,char *,char *,char *); | |||
| extern LONG UnregisterAsioDriver(CLSID,char *,char *); | |||
| // | |||
| // Server registration, called on REGSVR32.EXE "the dllname.dll" | |||
| // | |||
| HRESULT _stdcall DllRegisterServer() | |||
| { | |||
| LONG rc; | |||
| char errstr[128]; | |||
| rc = RegisterAsioDriver (IID_ASIO_DRIVER,"JackRouter.dll","JackRouter","JackRouter","Apartment"); | |||
| if (rc) { | |||
| memset(errstr,0,128); | |||
| sprintf(errstr,"Register Server failed ! (%d)",rc); | |||
| MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"JackRouter",MB_OK); | |||
| return -1; | |||
| } | |||
| return S_OK; | |||
| } | |||
| // | |||
| // Server unregistration | |||
| // | |||
| HRESULT _stdcall DllUnregisterServer() | |||
| { | |||
| LONG rc; | |||
| char errstr[128]; | |||
| rc = UnregisterAsioDriver (IID_ASIO_DRIVER,"JackRouter.dll","JackRouter"); | |||
| if (rc) { | |||
| memset(errstr,0,128); | |||
| sprintf(errstr,"Unregister Server failed ! (%d)",rc); | |||
| MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"JackRouter",MB_OK); | |||
| return -1; | |||
| } | |||
| return S_OK; | |||
| } | |||
| // Globals | |||
| list<pair<string, string> > JackRouter::fConnections; | |||
| bool JackRouter::fFirstActivate = true; | |||
| //------------------------------------------------------------------------------------------ | |||
| //------------------------------------------------------------------------------------------ | |||
| JackRouter::JackRouter (LPUNKNOWN pUnk, HRESULT *phr) | |||
| : CUnknown("ASIOJACK", pUnk, phr) | |||
| //------------------------------------------------------------------------------------------ | |||
| #else | |||
| // when not on windows, we derive from AsioDriver | |||
| JackRouter::JackRouter() : AsioDriver() | |||
| #endif | |||
| { | |||
| long i; | |||
| fSamplePosition = 0; | |||
| fActive = false; | |||
| fStarted = false; | |||
| fTimeInfoMode = false; | |||
| fTcRead = false; | |||
| fClient = NULL; | |||
| fAutoConnectIn = true; | |||
| fAutoConnectOut = true; | |||
| for (i = 0; i < kNumInputs; i++) { | |||
| fInputBuffers[i] = 0; | |||
| fInputPorts[i] = 0; | |||
| fInMap[i] = 0; | |||
| } | |||
| for (i = 0; i < kNumOutputs; i++) { | |||
| fOutputBuffers[i] = 0; | |||
| fOutputPorts[i] = 0; | |||
| fOutMap[i] = 0; | |||
| } | |||
| fCallbacks = 0; | |||
| fActiveInputs = fActiveOutputs = 0; | |||
| fToggle = 0; | |||
| fBufferSize = 512; | |||
| fSampleRate = 44100; | |||
| printf("Constructor\n"); | |||
| // Use "jackrouter.ini" parameters if available | |||
| HMODULE handle = LoadLibrary("JackRouter.dll"); | |||
| if (handle) { | |||
| // Get JackRouter.dll path | |||
| char dllName[512]; | |||
| string confPath; | |||
| DWORD res = GetModuleFileName(handle, dllName, 512); | |||
| // Compute .ini file path | |||
| string fullPath = dllName; | |||
| int lastPos = fullPath.find_last_of(PATH_SEP); | |||
| string dllFolder = fullPath.substr(0, lastPos); | |||
| confPath = dllFolder + PATH_SEP + "JackRouter.ini"; | |||
| // Get parameters | |||
| kNumInputs = get_private_profile_int("IO", "input", 2, confPath.c_str()); | |||
| kNumOutputs = get_private_profile_int("IO", "output", 2, confPath.c_str()); | |||
| fAutoConnectIn = get_private_profile_int("AUTO_CONNECT", "input", 1, confPath.c_str()); | |||
| fAutoConnectOut = get_private_profile_int("AUTO_CONNECT", "output", 1, confPath.c_str()); | |||
| FreeLibrary(handle); | |||
| } else { | |||
| printf("LoadLibrary error\n"); | |||
| } | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| JackRouter::~JackRouter() | |||
| { | |||
| stop (); | |||
| disposeBuffers (); | |||
| printf("Destructor\n"); | |||
| jack_client_close(fClient); | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| #include <windows.h> | |||
| #include <stdio.h> | |||
| #include <tchar.h> | |||
| #include "psapi.h" | |||
| static bool GetEXEName(DWORD dwProcessID, char* name) | |||
| { | |||
| DWORD aProcesses [1024], cbNeeded, cProcesses; | |||
| unsigned int i; | |||
| // Enumerate all processes | |||
| if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded)) | |||
| return false; | |||
| // Calculate how many process identifiers were returned. | |||
| cProcesses = cbNeeded / sizeof(DWORD); | |||
| TCHAR szEXEName[MAX_PATH]; | |||
| // Loop through all process to find the one that matches | |||
| // the one we are looking for | |||
| for (i = 0; i < cProcesses; i++) { | |||
| if (aProcesses [i] == dwProcessID) { | |||
| // Get a handle to the process | |||
| HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | | |||
| PROCESS_VM_READ, FALSE, dwProcessID); | |||
| // Get the process name | |||
| if (NULL != hProcess) { | |||
| HMODULE hMod; | |||
| DWORD cbNeeded; | |||
| if(EnumProcessModules(hProcess, &hMod, | |||
| sizeof(hMod), &cbNeeded)) { | |||
| //Get the name of the exe file | |||
| GetModuleBaseName(hProcess, hMod, szEXEName, | |||
| sizeof(szEXEName)/sizeof(TCHAR)); | |||
| int len = strlen((char*)szEXEName) - 4; // remove ".exe" | |||
| strncpy(name, (char*)szEXEName, len); | |||
| name[len] = '\0'; | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| static inline float ClipFloat(float sample) | |||
| { | |||
| return (sample < -1.0f) ? -1.0f : (sample > 1.0f) ? 1.0f : sample; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| void JackRouter::shutdown(void* arg) | |||
| { | |||
| JackRouter* driver = (JackRouter*)arg; | |||
| /* | |||
| //exit(1); | |||
| char errstr[128]; | |||
| memset(errstr,0,128); | |||
| sprintf(errstr,"JACK server has quitted"); | |||
| MessageBox(0,(LPCTSTR)errstr,(LPCTSTR)"JackRouter",MB_OK); | |||
| */ | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| int JackRouter::process(jack_nframes_t nframes, void* arg) | |||
| { | |||
| JackRouter* driver = (JackRouter*)arg; | |||
| int i,j; | |||
| int pos = (driver->fToggle) ? 0 : driver->fBufferSize ; | |||
| for (i = 0; i < driver->fActiveInputs; i++) { | |||
| #ifdef LONG_SAMPLE | |||
| float* buffer = (float*)jack_port_get_buffer(driver->fInputPorts[i], nframes); | |||
| long* in = driver->fInputBuffers[i] + pos; | |||
| for (j = 0; j < nframes; j++) { | |||
| in[j] = buffer[j] * float(0x7fffffff); | |||
| } | |||
| #else | |||
| memcpy(driver->fInputBuffers[i] + pos, | |||
| jack_port_get_buffer(driver->fInputPorts[i], nframes), | |||
| nframes * sizeof(float)); | |||
| #endif | |||
| } | |||
| driver->bufferSwitch(); | |||
| for (i = 0; i < driver->fActiveOutputs; i++) { | |||
| #ifdef LONG_SAMPLE | |||
| float* buffer = (float*)jack_port_get_buffer(driver->fOutputPorts[i], nframes); | |||
| long* out = driver->fOutputBuffers[i] + pos; | |||
| float gain = 1.f/float(0x7fffffff); | |||
| for (j = 0; j < nframes; j++) { | |||
| buffer[j] = out[j] * gain; | |||
| } | |||
| #else | |||
| memcpy(jack_port_get_buffer(driver->fOutputPorts[i], nframes), | |||
| driver->fOutputBuffers[i] + pos, | |||
| nframes * sizeof(float)); | |||
| #endif | |||
| } | |||
| return 0; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| void JackRouter::getDriverName(char *name) | |||
| { | |||
| strcpy (name, "JackRouter"); | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| long JackRouter::getDriverVersion() | |||
| { | |||
| return 0x00000001L; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| void JackRouter::getErrorMessage(char *string) | |||
| { | |||
| strcpy (string, fErrorMessage); | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOBool JackRouter::init(void* sysRef) | |||
| { | |||
| char name[MAX_PATH]; | |||
| sysRef = sysRef; | |||
| if (fActive) | |||
| return true; | |||
| HANDLE win = (HANDLE)sysRef; | |||
| int my_pid = _getpid(); | |||
| if (!GetEXEName(my_pid, name)) { // If getting the .exe name fails, takes a generic one. | |||
| _snprintf(name, sizeof(name) - 1, "JackRouter_%d", my_pid); | |||
| } | |||
| if (fClient) { | |||
| printf("Error: jack client still present...\n"); | |||
| return true; | |||
| } | |||
| fClient = jack_client_open(name, JackNullOption, NULL); | |||
| if (fClient == NULL) { | |||
| strcpy (fErrorMessage, "Open error: is jack server running?"); | |||
| printf("Open error: is jack server running?\n"); | |||
| return false; | |||
| } | |||
| fBufferSize = jack_get_buffer_size(fClient); | |||
| fSampleRate = jack_get_sample_rate(fClient); | |||
| jack_set_process_callback(fClient, process, this); | |||
| jack_on_shutdown(fClient, shutdown, this); | |||
| fInputLatency = fBufferSize; // typically | |||
| fOutputLatency = fBufferSize * 2; | |||
| fMilliSeconds = (long)((double)(fBufferSize * 1000) / fSampleRate); | |||
| // Typically fBufferSize * 2; try to get 1 by offering direct buffer | |||
| // access, and using asioPostOutput for lower latency | |||
| printf("Init ASIO Jack\n"); | |||
| fActive = true; | |||
| return true; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::start() | |||
| { | |||
| if (fCallbacks) { | |||
| fSamplePosition = 0; | |||
| fTheSystemTime.lo = fTheSystemTime.hi = 0; | |||
| fToggle = 0; | |||
| fStarted = true; | |||
| printf("Start ASIO Jack\n"); | |||
| if (jack_activate(fClient) == 0) { | |||
| if (fFirstActivate) { | |||
| AutoConnect(); | |||
| fFirstActivate = false; | |||
| } else { | |||
| RestoreConnections(); | |||
| } | |||
| return ASE_OK; | |||
| } else { | |||
| return ASE_NotPresent; | |||
| } | |||
| } | |||
| return ASE_NotPresent; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::stop() | |||
| { | |||
| fStarted = false; | |||
| printf("Stop ASIO Jack\n"); | |||
| SaveConnections(); | |||
| jack_deactivate(fClient); | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getChannels(long *numInputChannels, long *numOutputChannels) | |||
| { | |||
| *numInputChannels = kNumInputs; | |||
| *numOutputChannels = kNumOutputs; | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getLatencies(long *_inputLatency, long *_outputLatency) | |||
| { | |||
| *_inputLatency = fInputLatency; | |||
| *_outputLatency = fOutputLatency; | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity) | |||
| { | |||
| *minSize = *maxSize = *preferredSize = fBufferSize; // allow this size only | |||
| *granularity = 0; | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::canSampleRate(ASIOSampleRate sampleRate) | |||
| { | |||
| return (sampleRate == fSampleRate) ? ASE_OK : ASE_NoClock; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getSampleRate(ASIOSampleRate *sampleRate) | |||
| { | |||
| *sampleRate = fSampleRate; | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::setSampleRate(ASIOSampleRate sampleRate) | |||
| { | |||
| return (sampleRate == fSampleRate) ? ASE_OK : ASE_NoClock; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getClockSources(ASIOClockSource *clocks, long *numSources) | |||
| { | |||
| // Internal | |||
| if (clocks && numSources) { | |||
| clocks->index = 0; | |||
| clocks->associatedChannel = -1; | |||
| clocks->associatedGroup = -1; | |||
| clocks->isCurrentSource = ASIOTrue; | |||
| strcpy(clocks->name, "Internal"); | |||
| *numSources = 1; | |||
| return ASE_OK; | |||
| } else { | |||
| return ASE_InvalidParameter; | |||
| } | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::setClockSource(long index) | |||
| { | |||
| if (!index) { | |||
| fAsioTime.timeInfo.flags |= kClockSourceChanged; | |||
| return ASE_OK; | |||
| } else { | |||
| return ASE_NotPresent; | |||
| } | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) | |||
| { | |||
| tStamp->lo = fTheSystemTime.lo; | |||
| tStamp->hi = fTheSystemTime.hi; | |||
| if (fSamplePosition >= twoRaisedTo32) { | |||
| sPos->hi = (unsigned long)(fSamplePosition * twoRaisedTo32Reciprocal); | |||
| sPos->lo = (unsigned long)(fSamplePosition - (sPos->hi * twoRaisedTo32)); | |||
| } else { | |||
| sPos->hi = 0; | |||
| sPos->lo = (unsigned long)fSamplePosition; | |||
| } | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::getChannelInfo(ASIOChannelInfo *info) | |||
| { | |||
| if (info->channel < 0 || (info->isInput ? info->channel >= kNumInputs : info->channel >= kNumOutputs)) | |||
| return ASE_InvalidParameter; | |||
| #ifdef LONG_SAMPLE | |||
| info->type = ASIOSTInt32LSB; | |||
| #else | |||
| info->type = ASIOSTFloat32LSB; | |||
| #endif | |||
| info->channelGroup = 0; | |||
| info->isActive = ASIOFalse; | |||
| long i; | |||
| char buf[32]; | |||
| if (info->isInput) { | |||
| for (i = 0; i < fActiveInputs; i++) { | |||
| if (fInMap[i] == info->channel) { | |||
| info->isActive = ASIOTrue; | |||
| //_snprintf(buf, sizeof(buf) - 1, "Jack::In%d ", info->channel); | |||
| //strcpy(info->name, buf); | |||
| //strcpy(info->name, jack_port_name(fInputPorts[i])); | |||
| break; | |||
| } | |||
| } | |||
| _snprintf(buf, sizeof(buf) - 1, "In%d ", info->channel); | |||
| strcpy(info->name, buf); | |||
| } else { | |||
| for (i = 0; i < fActiveOutputs; i++) { | |||
| if (fOutMap[i] == info->channel) { //NOT USED !! | |||
| info->isActive = ASIOTrue; | |||
| //_snprintf(buf, sizeof(buf) - 1, "Jack::Out%d ", info->channel); | |||
| //strcpy(info->name, buf); | |||
| //strcpy(info->name, jack_port_name(fOutputPorts[i])); | |||
| break; | |||
| } | |||
| } | |||
| _snprintf(buf, sizeof(buf) - 1, "Out%d ", info->channel); | |||
| strcpy(info->name, buf); | |||
| } | |||
| return ASE_OK; | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| ASIOError JackRouter::createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, | |||
| long bufferSize, ASIOCallbacks *callbacks) | |||
| { | |||
| ASIOBufferInfo *info = bufferInfos; | |||
| long i; | |||
| bool notEnoughMem = false; | |||
| char buf[256]; | |||
| fActiveInputs = 0; | |||
| fActiveOutputs = 0; | |||
| for (i = 0; i < numChannels; i++, info++) { | |||
| if (info->isInput) { | |||
| if (info->channelNum < 0 || info->channelNum >= kNumInputs) | |||
| goto error; | |||
| fInMap[fActiveInputs] = info->channelNum; | |||
| #ifdef LONG_SAMPLE | |||
| fInputBuffers[fActiveInputs] = new long[fBufferSize * 2]; // double buffer | |||
| #else | |||
| fInputBuffers[fActiveInputs] = new float[fBufferSize * 2]; // double buffer | |||
| #endif | |||
| if (fInputBuffers[fActiveInputs]) { | |||
| info->buffers[0] = fInputBuffers[fActiveInputs]; | |||
| info->buffers[1] = fInputBuffers[fActiveInputs] + fBufferSize; | |||
| } else { | |||
| info->buffers[0] = info->buffers[1] = 0; | |||
| notEnoughMem = true; | |||
| } | |||
| _snprintf(buf, sizeof(buf) - 1, "in%d", fActiveInputs + 1); | |||
| fInputPorts[fActiveInputs] | |||
| = jack_port_register(fClient, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput,0); | |||
| if (fInputPorts[fActiveInputs] == NULL) | |||
| goto error; | |||
| fActiveInputs++; | |||
| if (fActiveInputs > kNumInputs) { | |||
| error: | |||
| disposeBuffers(); | |||
| return ASE_InvalidParameter; | |||
| } | |||
| } else { // output | |||
| if (info->channelNum < 0 || info->channelNum >= kNumOutputs) | |||
| goto error; | |||
| fOutMap[fActiveOutputs] = info->channelNum; | |||
| #ifdef LONG_SAMPLE | |||
| fOutputBuffers[fActiveOutputs] = new long[fBufferSize * 2]; // double buffer | |||
| #else | |||
| fOutputBuffers[fActiveOutputs] = new float[fBufferSize * 2]; // double buffer | |||
| #endif | |||
| if (fOutputBuffers[fActiveOutputs]) { | |||
| info->buffers[0] = fOutputBuffers[fActiveOutputs]; | |||
| info->buffers[1] = fOutputBuffers[fActiveOutputs] + fBufferSize; | |||
| } else { | |||
| info->buffers[0] = info->buffers[1] = 0; | |||
| notEnoughMem = true; | |||
| } | |||
| _snprintf(buf, sizeof(buf) - 1, "out%d", fActiveOutputs + 1); | |||
| fOutputPorts[fActiveOutputs] | |||
| = jack_port_register(fClient, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput,0); | |||
| if (fOutputPorts[fActiveOutputs] == NULL) | |||
| goto error; | |||
| fActiveOutputs++; | |||
| if (fActiveOutputs > kNumOutputs) { | |||
| fActiveOutputs--; | |||
| disposeBuffers(); | |||
| return ASE_InvalidParameter; | |||
| } | |||
| } | |||
| } | |||
| if (notEnoughMem) { | |||
| disposeBuffers(); | |||
| return ASE_NoMemory; | |||
| } | |||
| this->fCallbacks = callbacks; | |||
| if (callbacks->asioMessage (kAsioSupportsTimeInfo, 0, 0, 0)) { | |||
| fTimeInfoMode = true; | |||
| fAsioTime.timeInfo.speed = 1.; | |||
| fAsioTime.timeInfo.systemTime.hi = fAsioTime.timeInfo.systemTime.lo = 0; | |||
| fAsioTime.timeInfo.samplePosition.hi = fAsioTime.timeInfo.samplePosition.lo = 0; | |||
| fAsioTime.timeInfo.sampleRate = fSampleRate; | |||
| fAsioTime.timeInfo.flags = kSystemTimeValid | kSamplePositionValid | kSampleRateValid; | |||
| fAsioTime.timeCode.speed = 1.; | |||
| fAsioTime.timeCode.timeCodeSamples.lo = fAsioTime.timeCode.timeCodeSamples.hi = 0; | |||
| fAsioTime.timeCode.flags = kTcValid | kTcRunning ; | |||
| } else { | |||
| fTimeInfoMode = false; | |||
| } | |||
| return ASE_OK; | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| ASIOError JackRouter::disposeBuffers() | |||
| { | |||
| long i; | |||
| fCallbacks = 0; | |||
| stop(); | |||
| for (i = 0; i < fActiveInputs; i++) { | |||
| delete[] fInputBuffers[i]; | |||
| jack_port_unregister(fClient, fInputPorts[i]); | |||
| } | |||
| fActiveInputs = 0; | |||
| for (i = 0; i < fActiveOutputs; i++) { | |||
| delete[] fOutputBuffers[i]; | |||
| jack_port_unregister(fClient, fOutputPorts[i]); | |||
| } | |||
| fActiveOutputs = 0; | |||
| return ASE_OK; | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| ASIOError JackRouter::controlPanel() | |||
| { | |||
| return ASE_NotPresent; | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| ASIOError JackRouter::future(long selector, void* opt) // !!! check properties | |||
| { | |||
| ASIOTransportParameters* tp = (ASIOTransportParameters*)opt; | |||
| switch (selector) | |||
| { | |||
| case kAsioEnableTimeCodeRead: fTcRead = true; return ASE_SUCCESS; | |||
| case kAsioDisableTimeCodeRead: fTcRead = false; return ASE_SUCCESS; | |||
| case kAsioSetInputMonitor: return ASE_SUCCESS; // for testing!!! | |||
| case kAsioCanInputMonitor: return ASE_SUCCESS; // for testing!!! | |||
| case kAsioCanTimeInfo: return ASE_SUCCESS; | |||
| case kAsioCanTimeCode: return ASE_SUCCESS; | |||
| } | |||
| return ASE_NotPresent; | |||
| } | |||
| //-------------------------------------------------------------------------------------------------------- | |||
| // private methods | |||
| //-------------------------------------------------------------------------------------------------------- | |||
| //--------------------------------------------------------------------------------------------- | |||
| void JackRouter::bufferSwitch() | |||
| { | |||
| if (fStarted && fCallbacks) { | |||
| getNanoSeconds(&fTheSystemTime); // latch system time | |||
| fSamplePosition += fBufferSize; | |||
| if (fTimeInfoMode) { | |||
| bufferSwitchX (); | |||
| } else { | |||
| fCallbacks->bufferSwitch (fToggle, ASIOFalse); | |||
| } | |||
| fToggle = fToggle ? 0 : 1; | |||
| } | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| // asio2 buffer switch | |||
| void JackRouter::bufferSwitchX () | |||
| { | |||
| getSamplePosition (&fAsioTime.timeInfo.samplePosition, &fAsioTime.timeInfo.systemTime); | |||
| long offset = fToggle ? fBufferSize : 0; | |||
| if (fTcRead) { | |||
| // Create a fake time code, which is 10 minutes ahead of the card's sample position | |||
| // Please note that for simplicity here time code will wrap after 32 bit are reached | |||
| fAsioTime.timeCode.timeCodeSamples.lo = fAsioTime.timeInfo.samplePosition.lo + 600.0 * fSampleRate; | |||
| fAsioTime.timeCode.timeCodeSamples.hi = 0; | |||
| } | |||
| fCallbacks->bufferSwitchTimeInfo (&fAsioTime, fToggle, ASIOFalse); | |||
| fAsioTime.timeInfo.flags &= ~(kSampleRateChanged | kClockSourceChanged); | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| ASIOError JackRouter::outputReady() | |||
| { | |||
| return ASE_NotPresent; | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| double AsioSamples2double(ASIOSamples* samples) | |||
| { | |||
| double a = (double)(samples->lo); | |||
| if (samples->hi) | |||
| a += (double)(samples->hi) * twoRaisedTo32; | |||
| return a; | |||
| } | |||
| //--------------------------------------------------------------------------------------------- | |||
| void getNanoSeconds(ASIOTimeStamp* ts) | |||
| { | |||
| double nanoSeconds = (double)((unsigned long)timeGetTime ()) * 1000000.; | |||
| ts->hi = (unsigned long)(nanoSeconds / twoRaisedTo32); | |||
| ts->lo = (unsigned long)(nanoSeconds - (ts->hi * twoRaisedTo32)); | |||
| } | |||
| //------------------------------------------------------------------------ | |||
| void JackRouter::SaveConnections() | |||
| { | |||
| const char** connections; | |||
| int i; | |||
| for (i = 0; i < fActiveInputs; ++i) { | |||
| if (fInputPorts[i] && (connections = jack_port_get_connections(fInputPorts[i])) != 0) { | |||
| for (int j = 0; connections[j]; j++) { | |||
| fConnections.push_back(make_pair(connections[j], jack_port_name(fInputPorts[i]))); | |||
| } | |||
| jack_free(connections); | |||
| } | |||
| } | |||
| for (i = 0; i < fActiveOutputs; ++i) { | |||
| if (fOutputPorts[i] && (connections = jack_port_get_connections(fOutputPorts[i])) != 0) { | |||
| for (int j = 0; connections[j]; j++) { | |||
| fConnections.push_back(make_pair(jack_port_name(fOutputPorts[i]), connections[j])); | |||
| } | |||
| jack_free(connections); | |||
| } | |||
| } | |||
| } | |||
| //------------------------------------------------------------------------ | |||
| void JackRouter::RestoreConnections() | |||
| { | |||
| list<pair<string, string> >::const_iterator it; | |||
| for (it = fConnections.begin(); it != fConnections.end(); it++) { | |||
| pair<string, string> connection = *it; | |||
| jack_connect(fClient, connection.first.c_str(), connection.second.c_str()); | |||
| } | |||
| fConnections.clear(); | |||
| } | |||
| //------------------------------------------------------------------------------------------ | |||
| void JackRouter::AutoConnect() | |||
| { | |||
| const char** ports; | |||
| if ((ports = jack_get_ports(fClient, NULL, NULL, JackPortIsPhysical | JackPortIsOutput)) == NULL) { | |||
| printf("Cannot find any physical capture ports\n"); | |||
| } else { | |||
| if (fAutoConnectIn) { | |||
| for (int i = 0; i < fActiveInputs; i++) { | |||
| if (!ports[i]) { | |||
| printf("source port is null i = %ld\n", i); | |||
| break; | |||
| } else if (jack_connect(fClient, ports[i], jack_port_name(fInputPorts[i])) != 0) { | |||
| printf("Cannot connect input ports\n"); | |||
| } | |||
| } | |||
| } | |||
| jack_free(ports); | |||
| } | |||
| if ((ports = jack_get_ports(fClient, NULL, NULL, JackPortIsPhysical | JackPortIsInput)) == NULL) { | |||
| printf("Cannot find any physical playback ports"); | |||
| } else { | |||
| if (fAutoConnectOut) { | |||
| for (int i = 0; i < fActiveOutputs; i++) { | |||
| if (!ports[i]){ | |||
| printf("destination port is null i = %ld\n", i); | |||
| break; | |||
| } else if (jack_connect(fClient, jack_port_name(fOutputPorts[i]), ports[i]) != 0) { | |||
| printf("Cannot connect output ports\n"); | |||
| } | |||
| } | |||
| } | |||
| jack_free(ports); | |||
| } | |||
| } | |||
| @@ -0,0 +1,9 @@ | |||
| LIBRARY JackRouter | |||
| DESCRIPTION 'ASIO Jack Driver' | |||
| PROTMODE | |||
| EXPORTS | |||
| DllMain | |||
| DllGetClassObject | |||
| DllCanUnloadNow | |||
| DllRegisterServer | |||
| DllUnregisterServer | |||
| @@ -0,0 +1,163 @@ | |||
| # Microsoft Developer Studio Project File - Name="JackRouter" - Package Owner=<4> | |||
| # Microsoft Developer Studio Generated Build File, Format Version 6.00 | |||
| # ** DO NOT EDIT ** | |||
| # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 | |||
| CFG=JackRouter - Win32 Debug | |||
| !MESSAGE This is not a valid makefile. To build this project using NMAKE, | |||
| !MESSAGE use the Export Makefile command and run | |||
| !MESSAGE | |||
| !MESSAGE NMAKE /f "JackRouter.mak". | |||
| !MESSAGE | |||
| !MESSAGE You can specify a configuration when running NMAKE | |||
| !MESSAGE by defining the macro CFG on the command line. For example: | |||
| !MESSAGE | |||
| !MESSAGE NMAKE /f "JackRouter.mak" CFG="JackRouter - Win32 Debug" | |||
| !MESSAGE | |||
| !MESSAGE Possible choices for configuration are: | |||
| !MESSAGE | |||
| !MESSAGE "JackRouter - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") | |||
| !MESSAGE "JackRouter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") | |||
| !MESSAGE | |||
| # Begin Project | |||
| # PROP AllowPerConfigDependencies 0 | |||
| # PROP Scc_ProjName "" | |||
| # PROP Scc_LocalPath "" | |||
| CPP=cl.exe | |||
| MTL=midl.exe | |||
| RSC=rc.exe | |||
| !IF "$(CFG)" == "JackRouter - Win32 Release" | |||
| # PROP BASE Use_MFC 0 | |||
| # PROP BASE Use_Debug_Libraries 0 | |||
| # PROP BASE Output_Dir "Release" | |||
| # PROP BASE Intermediate_Dir "Release" | |||
| # PROP BASE Target_Dir "" | |||
| # PROP Use_MFC 0 | |||
| # PROP Use_Debug_Libraries 0 | |||
| # PROP Output_Dir "Release" | |||
| # PROP Intermediate_Dir "Release" | |||
| # PROP Ignore_Export_Lib 0 | |||
| # PROP Target_Dir "" | |||
| # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c | |||
| # ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\..\ASIOSDK2\common" /I "..\..\common" /I "..\..\common\jack" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c | |||
| # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | |||
| # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 | |||
| # ADD BASE RSC /l 0x409 /d "NDEBUG" | |||
| # ADD RSC /l 0x409 /d "NDEBUG" | |||
| BSC32=bscmake.exe | |||
| # ADD BASE BSC32 /nologo | |||
| # ADD BSC32 /nologo | |||
| LINK32=link.exe | |||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 | |||
| # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /dll /machine:I386 | |||
| !ELSEIF "$(CFG)" == "JackRouter - Win32 Debug" | |||
| # PROP BASE Use_MFC 0 | |||
| # PROP BASE Use_Debug_Libraries 1 | |||
| # PROP BASE Output_Dir "Debug" | |||
| # PROP BASE Intermediate_Dir "Debug" | |||
| # PROP BASE Target_Dir "" | |||
| # PROP Use_MFC 0 | |||
| # PROP Use_Debug_Libraries 1 | |||
| # PROP Output_Dir "Debug" | |||
| # PROP Intermediate_Dir "Debug" | |||
| # PROP Ignore_Export_Lib 0 | |||
| # PROP Target_Dir "" | |||
| # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c | |||
| # ADD CPP /nologo /G5 /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\..\ASIOSDK2\common" /I "..\..\common" /I "..\..\common\jack" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /GZ /c | |||
| # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 | |||
| # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 | |||
| # ADD BASE RSC /l 0x409 /d "_DEBUG" | |||
| # ADD RSC /l 0x409 /d "_DEBUG" | |||
| BSC32=bscmake.exe | |||
| # ADD BASE BSC32 /nologo | |||
| # ADD BSC32 /nologo | |||
| LINK32=link.exe | |||
| # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept | |||
| # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/JackRouter_debug.dll" /pdbtype:sept | |||
| !ENDIF | |||
| # Begin Target | |||
| # Name "JackRouter - Win32 Release" | |||
| # Name "JackRouter - Win32 Debug" | |||
| # Begin Group "Source Files" | |||
| # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" | |||
| # Begin Source File | |||
| SOURCE=..\..\..\..\..\ASIOSDK2\common\combase.cpp | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\..\..\..\..\ASIOSDK2\common\dllentry.cpp | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=.\JackRouter.cpp | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=.\JackRouter.def | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=.\profport.cpp | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\..\..\..\..\ASIOSDK2\common\register.cpp | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=.\resource.rc | |||
| # End Source File | |||
| # End Group | |||
| # Begin Group "Header Files" | |||
| # PROP Default_Filter "h;hpp;hxx;hm;inl" | |||
| # Begin Source File | |||
| SOURCE=..\..\..\common\asio.h | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\..\Common\Asiodrvr.h | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\asiosmpl.h | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\..\..\common\asiosys.h | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\..\..\common\combase.h | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\..\..\common\iasiodrv.h | |||
| # End Source File | |||
| # End Group | |||
| # Begin Group "Resource Files" | |||
| # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" | |||
| # End Group | |||
| # Begin Source File | |||
| SOURCE=.\Psapi.Lib | |||
| # End Source File | |||
| # Begin Source File | |||
| SOURCE=..\Release\bin\libjack.lib | |||
| # End Source File | |||
| # End Target | |||
| # End Project | |||
| @@ -0,0 +1,29 @@ | |||
| Microsoft Developer Studio Workspace File, Format Version 6.00 | |||
| # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! | |||
| ############################################################################### | |||
| Project: "JackRouter"=".\JackRouter.dsp" - Package Owner=<4> | |||
| Package=<5> | |||
| {{{ | |||
| }}} | |||
| Package=<4> | |||
| {{{ | |||
| }}} | |||
| ############################################################################### | |||
| Global: | |||
| Package=<5> | |||
| {{{ | |||
| }}} | |||
| Package=<3> | |||
| {{{ | |||
| }}} | |||
| ############################################################################### | |||
| @@ -0,0 +1,174 @@ | |||
| /* | |||
| Copyright (C) 2006 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef _asiosmpl_ | |||
| #define _asiosmpl_ | |||
| #include "asiosys.h" | |||
| // Globals | |||
| static int kBlockFrames = 256; | |||
| static int kNumInputs = 4; | |||
| static int kNumOutputs = 4; | |||
| #if WINDOWS | |||
| #include "jack.h" | |||
| #include "rpc.h" | |||
| #include "rpcndr.h" | |||
| #ifndef COM_NO_WINDOWS_H | |||
| #include <windows.h> | |||
| #include "ole2.h" | |||
| #endif | |||
| #include "combase.h" | |||
| #include "iasiodrv.h" | |||
| #define MAX_PORTS 32 | |||
| #define LONG_SAMPLE 1 | |||
| #define PATH_SEP "\\" | |||
| #include <list> | |||
| #include <string> | |||
| class JackRouter : public IASIO, public CUnknown | |||
| { | |||
| public: | |||
| JackRouter(LPUNKNOWN pUnk, HRESULT *phr); | |||
| ~JackRouter(); | |||
| DECLARE_IUNKNOWN | |||
| //STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { \ | |||
| // return GetOwner()->QueryInterface(riid,ppv); \ | |||
| //}; \ | |||
| //STDMETHODIMP_(ULONG) AddRef() { \ | |||
| // return GetOwner()->AddRef(); \ | |||
| //}; \ | |||
| //STDMETHODIMP_(ULONG) Release() { \ | |||
| // return GetOwner()->Release(); \ | |||
| //}; | |||
| // Factory method | |||
| static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); | |||
| // IUnknown | |||
| virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject); | |||
| #else | |||
| #include "asiodrvr.h" | |||
| //--------------------------------------------------------------------------------------------- | |||
| class JackRouter : public AsioDriver | |||
| { | |||
| public: | |||
| JackRouter(); | |||
| ~JackRouter(); | |||
| #endif | |||
| static int process(jack_nframes_t nframes, void* arg); | |||
| static void shutdown(void* arg); | |||
| ASIOBool init(void* sysRef); | |||
| void getDriverName(char *name); // max 32 bytes incl. terminating zero | |||
| long getDriverVersion(); | |||
| void getErrorMessage(char *string); // max 128 bytes incl. | |||
| ASIOError start(); | |||
| ASIOError stop(); | |||
| ASIOError getChannels(long *numInputChannels, long *numOutputChannels); | |||
| ASIOError getLatencies(long *inputLatency, long *outputLatency); | |||
| ASIOError getBufferSize(long *minSize, long *maxSize, | |||
| long *preferredSize, long *granularity); | |||
| ASIOError canSampleRate(ASIOSampleRate sampleRate); | |||
| ASIOError getSampleRate(ASIOSampleRate *sampleRate); | |||
| ASIOError setSampleRate(ASIOSampleRate sampleRate); | |||
| ASIOError getClockSources(ASIOClockSource *clocks, long *numSources); | |||
| ASIOError setClockSource(long index); | |||
| ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp); | |||
| ASIOError getChannelInfo(ASIOChannelInfo *info); | |||
| ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, | |||
| long bufferSize, ASIOCallbacks *callbacks); | |||
| ASIOError disposeBuffers(); | |||
| ASIOError controlPanel(); | |||
| ASIOError future(long selector, void *opt); | |||
| ASIOError outputReady(); | |||
| void bufferSwitch(); | |||
| long getMilliSeconds() {return fMilliSeconds;} | |||
| static bool fFirstActivate; | |||
| static std::list<std::pair<std::string, std::string> > fConnections; // Connections list | |||
| private: | |||
| void bufferSwitchX(); | |||
| double fSamplePosition; | |||
| ASIOCallbacks* fCallbacks; | |||
| ASIOTime fAsioTime; | |||
| ASIOTimeStamp fTheSystemTime; | |||
| #ifdef LONG_SAMPLE | |||
| long* fInputBuffers[MAX_PORTS * 2]; | |||
| long* fOutputBuffers[MAX_PORTS * 2]; | |||
| #else | |||
| float* fInputBuffers[MAX_PORTS * 2]; | |||
| float* fOutputBuffers[MAX_PORTS * 2]; | |||
| #endif | |||
| long fInMap[MAX_PORTS]; | |||
| long fOutMap[MAX_PORTS]; | |||
| long fInputLatency; | |||
| long fOutputLatency; | |||
| long fActiveInputs; | |||
| long fActiveOutputs; | |||
| long fToggle; | |||
| long fMilliSeconds; | |||
| bool fActive, fStarted; | |||
| bool fTimeInfoMode, fTcRead; | |||
| char fErrorMessage[128]; | |||
| bool fAutoConnectIn; | |||
| bool fAutoConnectOut; | |||
| // Jack part | |||
| jack_client_t* fClient; | |||
| jack_port_t* fInputPorts[MAX_PORTS]; | |||
| jack_port_t* fOutputPorts[MAX_PORTS]; | |||
| long fBufferSize; | |||
| ASIOSampleRate fSampleRate; | |||
| void AutoConnect(); | |||
| void SaveConnections(); | |||
| void RestoreConnections(); | |||
| }; | |||
| #endif | |||
| @@ -0,0 +1,3 @@ | |||
| This folder contains the sources for ASIO/JACK bridge ASIO driver called "JackRouter". The included project is a Microsoft VC++ 6 one. | |||
| It requires some files (combase.cpp, dllentry.cpp, register.cpp) that are part on the ASIO driver SDK. The produced "JackRouter.dll" file | |||
| has to be registered in the system using the "regsvr32" tool. | |||
| @@ -0,0 +1,315 @@ | |||
| /* | |||
| History : | |||
| 01-28-02 : Change the location of temporary files created in write_private_profile_string | |||
| now done in TmpDirectory. | |||
| 01-29-02 : Correct bug when the '=' character is not present. | |||
| 06-18-02 : Return default value if file does not exist, new write_private_profile_int function. | |||
| */ | |||
| /***** Routines to read profile strings -- by Joseph J. Graf ******/ | |||
| /***** corrections and improvements -- by D. Fober - Grame ******/ | |||
| /* | |||
| corrections: buffer sizes control | |||
| improvements: behavior more similar to windows | |||
| */ | |||
| #include <stdio.h> | |||
| #include <string.h> | |||
| #include <stdlib.h> | |||
| #include <errno.h> | |||
| #include <string> | |||
| #include <ctype.h> | |||
| #include "profport.h" /* function prototypes in here */ | |||
| #ifndef WIN32 | |||
| static int read_line (FILE *fp, char *bp, int size); | |||
| static int read_section(FILE *fp, char *section); | |||
| static int read_entry (FILE *fp, char *entry, char *buff, int size); | |||
| static char * read_value (char *buff); | |||
| static int read_int_value (char *buff, int def); | |||
| static char * read_file (char *file); | |||
| static char * str_search (char * buff, char * str, int stopCond); | |||
| /***************************************************************** | |||
| * Function: read_line() | |||
| * Arguments: <FILE *> fp - a pointer to the file to be read from | |||
| * <char *> bp - a pointer to the copy buffer | |||
| * <int> size - size of the copy buffer | |||
| * Returns: the line length if successful -1 otherwise | |||
| ******************************************************************/ | |||
| static int read_line(FILE *fp, char *bp, int size) | |||
| { | |||
| char c = '\0'; | |||
| int i = 0, limit = size-2; | |||
| /* Read one line from the source file */ | |||
| while (((c = getc(fp)) != '\n') && (i < limit)) { | |||
| if (c == EOF) { | |||
| if (!i) return -1; | |||
| else break; | |||
| } | |||
| bp[i++] = c; | |||
| } | |||
| bp[i] = '\0'; | |||
| return i; | |||
| } | |||
| static int read_section (FILE *fp, char *section) | |||
| { | |||
| char buff[MAX_LINE_LENGTH]; | |||
| char t_section[MAX_LINE_LENGTH]; | |||
| int n, slen; | |||
| sprintf(t_section,"[%s]", section); /* Format the section name */ | |||
| slen = strlen (t_section); | |||
| /* Move through file 1 line at a time until a section is matched or EOF */ | |||
| do { | |||
| n = read_line(fp, buff, MAX_LINE_LENGTH); | |||
| if (n == -1) | |||
| return 0; | |||
| } while (strncmp (buff,t_section, slen)); | |||
| return 1; | |||
| } | |||
| static int read_entry (FILE *fp, char *entry, char *buff, int size) | |||
| { | |||
| int n, elen = strlen (entry); | |||
| do { | |||
| n = read_line(fp, buff, size); | |||
| if (n == -1) | |||
| return 0; | |||
| else if (*buff == '[') | |||
| return 0; | |||
| } while (strncmp (buff, entry, elen)); | |||
| return 1; | |||
| } | |||
| #define isBlank(c) ((c == ' ') || (c == '\t')) | |||
| static char * read_value (char *buff) | |||
| { | |||
| char * eq = strrchr (buff,'='); /* Parse out the equal sign */ | |||
| if (eq) { | |||
| eq++; | |||
| while (*eq && isBlank(*eq)) | |||
| eq++; | |||
| // return *eq ? eq : 0; | |||
| return eq; | |||
| } | |||
| return eq; | |||
| } | |||
| #define isSignedDigit(c) (isdigit(c) || (c == '+') || (c == '-')) | |||
| static int read_int_value (char *buff, int def) | |||
| { | |||
| char * val = read_value (buff); | |||
| char value[20]; int i; | |||
| if (!*val) return def; | |||
| for (i = 0; isSignedDigit(*val) && (i <= 10); i++ ) | |||
| value[i] = *val++; | |||
| value[i] = '\0'; | |||
| return value[0] ? atoi(value) : def; | |||
| } | |||
| static char * read_file (char *file) | |||
| { | |||
| FILE *fd = fopen (file,"r"); | |||
| int size; char * buff = 0; | |||
| if (!fd) return 0; | |||
| if (fseek (fd, 0, SEEK_END) == -1) goto err; | |||
| size = ftell (fd); | |||
| if (size < 0) goto err; | |||
| if (fseek (fd, 0, SEEK_SET) == -1) goto err; | |||
| buff = (char *) malloc (size+1); | |||
| if (buff) { | |||
| *buff = 0; | |||
| fread (buff, 1, size, fd); | |||
| buff[size] = 0; | |||
| } | |||
| err: | |||
| fclose (fd); | |||
| return buff; | |||
| } | |||
| static char * str_search (char * buff, char * str, int stopCond) | |||
| { | |||
| char *ptr = buff; | |||
| int len = strlen (str); | |||
| while (*ptr && strncmp (ptr, str, len)) { | |||
| while (*ptr && (*ptr++ != '\n')) | |||
| ; | |||
| if (*ptr == stopCond) | |||
| return 0; | |||
| } | |||
| return *ptr ? ptr : 0; | |||
| } | |||
| /************************************************************************** | |||
| * Function: get_private_profile_int() | |||
| * Arguments: <char *> section - the name of the section to search for | |||
| * <char *> entry - the name of the entry to find the value of | |||
| * <int> def - the default value in the event of a failed read | |||
| * <char *> file_name - the name of the .ini file to read from | |||
| * Returns: the value located at entry | |||
| ***************************************************************************/ | |||
| int get_private_profile_int(char *section, | |||
| char *entry, int def, char *file_name) | |||
| { | |||
| FILE *fp = fopen(file_name,"r"); | |||
| char buff[MAX_LINE_LENGTH]; | |||
| if( !fp ) return def; /* Return default value if file does not exist */ | |||
| if (!read_section (fp, section)) goto err; | |||
| if (!read_entry (fp, entry, buff, MAX_LINE_LENGTH)) goto err; | |||
| def = read_int_value (buff, def); | |||
| err: | |||
| fclose (fp); | |||
| return def; | |||
| } | |||
| /************************************************************************** | |||
| * Function: get_private_profile_string() | |||
| * Arguments: <char *> section - the name of the section to search for | |||
| * <char *> entry - the name of the entry to find the value of | |||
| * <char *> def - default string in the event of a failed read | |||
| * <char *> buffer - a pointer to the buffer to copy into | |||
| * <int> buffer_len - the max number of characters to copy | |||
| * <char *> file_name - the name of the .ini file to read from | |||
| * Returns: the number of characters copied into the supplied buffer | |||
| ***************************************************************************/ | |||
| int get_private_profile_string(char *section, char *entry, char *def, | |||
| char *buffer, int buffer_len, char *file_name) | |||
| { | |||
| FILE *fp = fopen (file_name,"r"); | |||
| char buff[MAX_LINE_LENGTH]; | |||
| char *val; | |||
| if( !fp ) goto err; /* Return default value if file does not exist */ | |||
| if (!read_section (fp, section)) goto err; | |||
| if (!read_entry (fp, entry, buff, MAX_LINE_LENGTH)) goto err; | |||
| val = read_value (buff); | |||
| if(val) def = val; | |||
| err: | |||
| if (fp) fclose (fp); | |||
| if (def) { | |||
| strncpy (buffer, def, buffer_len - 1); | |||
| buffer[buffer_len] = '\0'; | |||
| } | |||
| else buffer[buffer_len] = '\0'; | |||
| return strlen (buffer); | |||
| } | |||
| /*************************************************************************** | |||
| * Function: write_private_profile_string() | |||
| * Arguments: <char *> section - the name of the section to search for | |||
| * <char *> entry - the name of the entry to find the value of | |||
| * <char *> buffer - pointer to the buffer that holds the string | |||
| * <char *> file_name - the name of the .ini file to read from | |||
| * Returns: TRUE if successful, otherwise FALSE | |||
| ***************************************************************************/ | |||
| int write_private_profile_string(char *section, | |||
| char *entry, char *buffer, char *file_name) | |||
| { | |||
| char * content = read_file(file_name); | |||
| FILE * fd = fopen(file_name,"w"); | |||
| char t_section[MAX_LINE_LENGTH], *ptr; | |||
| int ret = 0; | |||
| if (!fd) goto end; | |||
| if (!content) { | |||
| fprintf (fd, "[%s]\n%s = %s\n", section, entry, buffer); | |||
| ret = 1; | |||
| goto end; | |||
| } | |||
| sprintf(t_section,"[%s]",section); /* Format the section name */ | |||
| ptr = str_search (content, t_section, 0); /* look for the section start */ | |||
| if (!ptr) { | |||
| /* no such section: add the new section at end of file */ | |||
| fprintf (fd, "%s\n[%s]\n%s = %s\n", content, section, entry, buffer); | |||
| } | |||
| else { | |||
| char * eptr; | |||
| eptr = str_search (ptr, entry, '['); | |||
| if (!eptr) { | |||
| /* no such entry: looks for next section */ | |||
| eptr = str_search (++ptr, "[", 0); | |||
| if (!eptr) { | |||
| /* section is the last one */ | |||
| fprintf (fd, "%s\n%s = %s\n", content, entry, buffer); | |||
| } | |||
| else { | |||
| while (*ptr && (*ptr != '\n')) ptr++; | |||
| *ptr = 0; | |||
| fprintf (fd, "%s\n%s = %s", content, entry, buffer); | |||
| *ptr = '\n'; | |||
| fprintf (fd, "%s", ptr); | |||
| } | |||
| } | |||
| else { | |||
| *eptr++ = 0; | |||
| fprintf (fd, "%s%s = %s", content, entry, buffer); | |||
| while (*eptr && (*eptr != '\n')) eptr++; | |||
| if (eptr) fprintf (fd, "%s", eptr); | |||
| } | |||
| } | |||
| ret = 1; | |||
| end: | |||
| if (content) free(content); | |||
| if (fd) fclose(fd); | |||
| return 0; | |||
| } | |||
| /*************************************************************************** | |||
| * Function: write_private_profile_int() | |||
| * Arguments: <char *> section - the name of the section to search for | |||
| * <char *> entry - the name of the entry to find the value of | |||
| * <int> buffer - the value to be written | |||
| * <char *> file_name - the name of the .ini file to read from | |||
| * Returns: TRUE if successful, otherwise FALSE | |||
| ***************************************************************************/ | |||
| int write_private_profile_int(char *section, | |||
| char *entry, int val, char *file_name) | |||
| { | |||
| char buffer [64]; | |||
| sprintf(buffer, "%d", val); | |||
| return write_private_profile_string (section,entry, buffer, file_name); | |||
| } | |||
| #endif // #ifndef WIN32 | |||
| /************************************************************************** | |||
| * Function: get_private_profile_float() | |||
| * Arguments: <char *> section - the name of the section to search for | |||
| * <char *> entry - the name of the entry to find the value of | |||
| * <float> def - the default value in the event of a failed read | |||
| * <char *> file_name - the name of the .ini file to read from | |||
| * Returns: the value located at entry | |||
| * Warning: The float value to be read must not contain more than 100 digits. | |||
| * Author: CD, 15/11/2006. | |||
| ***************************************************************************/ | |||
| #define maxFloatLen 100 | |||
| float get_private_profile_float (char * section, char * entry, float def, char * file_name) | |||
| { | |||
| float result = def; | |||
| char buffer[ maxFloatLen ], *endptr; | |||
| if ( get_private_profile_string(section, entry, "", buffer, maxFloatLen, file_name) > 0 ) | |||
| { | |||
| result = (float)strtod(buffer, &endptr); | |||
| if ((result==0) && (endptr==buffer)) | |||
| result = def; | |||
| } | |||
| return result; | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| /****************************************************************************** | |||
| PORTABLE ROUTINES FOR WRITING PRIVATE PROFILE STRINGS -- by Joseph J. Graf | |||
| Header file containing prototypes and compile-time configuration. | |||
| [09/05/02] D. Fober - Windows definitions added | |||
| ******************************************************************************/ | |||
| #ifndef __profport__ | |||
| #define __profport__ | |||
| #define MAX_LINE_LENGTH 1024 | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #ifdef WIN32 | |||
| #include "Windows.h" | |||
| #define get_private_profile_int GetPrivateProfileInt | |||
| #define get_private_profile_string GetPrivateProfileString | |||
| #define write_private_profile_string WritePrivateProfileString | |||
| #define write_private_profile_int WritePrivateProfileInt | |||
| #else | |||
| int get_private_profile_int (char * section, char * entry, int def, char * file_name); | |||
| int get_private_profile_string (char * section, char * entry, char * def, char * buffer, int buffer_len, char * file_name); | |||
| int write_private_profile_string (char * section, char * entry, char * buffer, char * file_name); | |||
| int write_private_profile_int (char * section, char * entry, int val, char * file_name); | |||
| #endif | |||
| float get_private_profile_float (char * section, char * entry, float def, char * file_name); | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif //__profport__ | |||
| @@ -0,0 +1,95 @@ | |||
| /* | |||
| psapi.h - Include file for PSAPI.DLL APIs | |||
| Written by Mumit Khan <khan@nanotech.wisc.edu> | |||
| This file is part of a free library for the Win32 API. | |||
| NOTE: This strictly does not belong in the Win32 API since it's | |||
| really part of Platform SDK. However,GDB needs it and we might | |||
| as well provide it here. | |||
| This library is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |||
| */ | |||
| #ifndef _PSAPI_H | |||
| #define _PSAPI_H | |||
| #if __GNUC__ >=3 | |||
| #pragma GCC system_header | |||
| #endif | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #ifndef RC_INVOKED | |||
| typedef struct _MODULEINFO { | |||
| LPVOID lpBaseOfDll; | |||
| DWORD SizeOfImage; | |||
| LPVOID EntryPoint; | |||
| } MODULEINFO,*LPMODULEINFO; | |||
| typedef struct _PSAPI_WS_WATCH_INFORMATION { | |||
| LPVOID FaultingPc; | |||
| LPVOID FaultingVa; | |||
| } PSAPI_WS_WATCH_INFORMATION,*PPSAPI_WS_WATCH_INFORMATION; | |||
| typedef struct _PROCESS_MEMORY_COUNTERS { | |||
| DWORD cb; | |||
| DWORD PageFaultCount; | |||
| DWORD PeakWorkingSetSize; | |||
| DWORD WorkingSetSize; | |||
| DWORD QuotaPeakPagedPoolUsage; | |||
| DWORD QuotaPagedPoolUsage; | |||
| DWORD QuotaPeakNonPagedPoolUsage; | |||
| DWORD QuotaNonPagedPoolUsage; | |||
| DWORD PagefileUsage; | |||
| DWORD PeakPagefileUsage; | |||
| } PROCESS_MEMORY_COUNTERS,*PPROCESS_MEMORY_COUNTERS; | |||
| /* Grouped by application,not in alphabetical order. */ | |||
| BOOL WINAPI EnumProcesses(DWORD *,DWORD,DWORD *); | |||
| BOOL WINAPI EnumProcessModules(HANDLE,HMODULE *,DWORD,LPDWORD); | |||
| DWORD WINAPI GetModuleBaseNameA(HANDLE,HMODULE,LPSTR,DWORD); | |||
| DWORD WINAPI GetModuleBaseNameW(HANDLE,HMODULE,LPWSTR,DWORD); | |||
| DWORD WINAPI GetModuleFileNameExA(HANDLE,HMODULE,LPSTR,DWORD); | |||
| DWORD WINAPI GetModuleFileNameExW(HANDLE,HMODULE,LPWSTR,DWORD); | |||
| BOOL WINAPI GetModuleInformation(HANDLE,HMODULE,LPMODULEINFO,DWORD); | |||
| BOOL WINAPI EmptyWorkingSet(HANDLE); | |||
| BOOL WINAPI QueryWorkingSet(HANDLE,PVOID,DWORD); | |||
| BOOL WINAPI InitializeProcessForWsWatch(HANDLE); | |||
| BOOL WINAPI GetWsChanges(HANDLE,PPSAPI_WS_WATCH_INFORMATION,DWORD); | |||
| DWORD WINAPI GetMappedFileNameW(HANDLE,LPVOID,LPWSTR,DWORD); | |||
| DWORD WINAPI GetMappedFileNameA(HANDLE,LPVOID,LPSTR,DWORD); | |||
| BOOL WINAPI EnumDeviceDrivers(LPVOID *,DWORD,LPDWORD); | |||
| DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID,LPSTR,DWORD); | |||
| DWORD WINAPI GetDeviceDriverBaseNameW(LPVOID,LPWSTR,DWORD); | |||
| DWORD WINAPI GetDeviceDriverFileNameA(LPVOID,LPSTR,DWORD); | |||
| DWORD WINAPI GetDeviceDriverFileNameW(LPVOID,LPWSTR,DWORD); | |||
| BOOL WINAPI GetProcessMemoryInfo(HANDLE,PPROCESS_MEMORY_COUNTERS,DWORD); | |||
| #endif /* not RC_INVOKED */ | |||
| #ifdef UNICODE | |||
| #define GetModuleBaseName GetModuleBaseNameW | |||
| #define GetModuleFileNameEx GetModuleFileNameExW | |||
| #define GetMappedFilenameEx GetMappedFilenameExW | |||
| #define GetDeviceDriverBaseName GetDeviceDriverBaseNameW | |||
| #define GetDeviceDriverFileName GetDeviceDriverFileNameW | |||
| #else | |||
| #define GetModuleBaseName GetModuleBaseNameA | |||
| #define GetModuleFileNameEx GetModuleFileNameExA | |||
| #define GetMappedFilenameEx GetMappedFilenameExA | |||
| #define GetDeviceDriverBaseName GetDeviceDriverBaseNameA | |||
| #define GetDeviceDriverFileName GetDeviceDriverFileNameA | |||
| #endif | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* _PSAPI_H */ | |||
| @@ -0,0 +1,15 @@ | |||
| //{{NO_DEPENDENCIES}} | |||
| // Microsoft Developer Studio generated include file. | |||
| // Used by resource.rc | |||
| // | |||
| // Next default values for new objects | |||
| // | |||
| #ifdef APSTUDIO_INVOKED | |||
| #ifndef APSTUDIO_READONLY_SYMBOLS | |||
| #define _APS_NEXT_RESOURCE_VALUE 102 | |||
| #define _APS_NEXT_COMMAND_VALUE 40001 | |||
| #define _APS_NEXT_CONTROL_VALUE 1000 | |||
| #define _APS_NEXT_SYMED_VALUE 101 | |||
| #endif | |||
| #endif | |||
| @@ -0,0 +1,109 @@ | |||
| //Microsoft Developer Studio generated resource script. | |||
| // | |||
| #include "resource.h" | |||
| #define APSTUDIO_READONLY_SYMBOLS | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| // | |||
| // Generated from the TEXTINCLUDE 2 resource. | |||
| // | |||
| #include "afxres.h" | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| #undef APSTUDIO_READONLY_SYMBOLS | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| // French (France) resources | |||
| #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) | |||
| #ifdef _WIN32 | |||
| LANGUAGE LANG_FRENCH, SUBLANG_FRENCH | |||
| #pragma code_page(1252) | |||
| #endif //_WIN32 | |||
| #ifndef _MAC | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| // | |||
| // Version | |||
| // | |||
| VS_VERSION_INFO VERSIONINFO | |||
| FILEVERSION 0,2,0,0 | |||
| PRODUCTVERSION 0,2,0,0 | |||
| FILEFLAGSMASK 0x3fL | |||
| #ifdef _DEBUG | |||
| FILEFLAGS 0x1L | |||
| #else | |||
| FILEFLAGS 0x0L | |||
| #endif | |||
| FILEOS 0x40004L | |||
| FILETYPE 0x2L | |||
| FILESUBTYPE 0x0L | |||
| BEGIN | |||
| BLOCK "StringFileInfo" | |||
| BEGIN | |||
| BLOCK "040c04b0" | |||
| BEGIN | |||
| VALUE "Comments", "\0" | |||
| VALUE "CompanyName", "Grame\0" | |||
| VALUE "FileDescription", "JackRouter ASIO driver\0" | |||
| VALUE "FileVersion", "0, 2, 0, 0\0" | |||
| VALUE "InternalName", "JackRouter\0" | |||
| VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0" | |||
| VALUE "LegalTrademarks", "\0" | |||
| VALUE "OriginalFilename", "JackRouter.dll\0" | |||
| VALUE "PrivateBuild", "\0" | |||
| VALUE "ProductName", "JackRouter\0" | |||
| VALUE "ProductVersion", "0, 2, 0, 0\0" | |||
| VALUE "SpecialBuild", "\0" | |||
| END | |||
| END | |||
| BLOCK "VarFileInfo" | |||
| BEGIN | |||
| VALUE "Translation", 0x40c, 1200 | |||
| END | |||
| END | |||
| #endif // !_MAC | |||
| #ifdef APSTUDIO_INVOKED | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| // | |||
| // TEXTINCLUDE | |||
| // | |||
| 1 TEXTINCLUDE DISCARDABLE | |||
| BEGIN | |||
| "resource.h\0" | |||
| END | |||
| 2 TEXTINCLUDE DISCARDABLE | |||
| BEGIN | |||
| "#include ""afxres.h""\r\n" | |||
| "\0" | |||
| END | |||
| 3 TEXTINCLUDE DISCARDABLE | |||
| BEGIN | |||
| "\r\n" | |||
| "\0" | |||
| END | |||
| #endif // APSTUDIO_INVOKED | |||
| #endif // French (France) resources | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| #ifndef APSTUDIO_INVOKED | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| // | |||
| // Generated from the TEXTINCLUDE 3 resource. | |||
| // | |||
| ///////////////////////////////////////////////////////////////////////////// | |||
| #endif // not APSTUDIO_INVOKED | |||
| @@ -73,7 +73,7 @@ | |||
| <_><src>..\Release\bin\portaudio_x86.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack\jack_net.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack\jack_netone.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack\jack_netsource.exe</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack_netsource.exe</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack\jack_dummy.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack\jack_loopback.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></> | |||
| <_><src>..\Release\bin\jack\jack_winmme.dll</><dest>inst</><custom>jack</><ifexist>overnewer</><recurs>0</></> | |||
| @@ -1,113 +1,110 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |||
| <CodeBlocks_project_file> | |||
| <FileVersion major="1" minor="6" /> | |||
| <Project> | |||
| <Option title="jack_netsource" /> | |||
| <Option pch_mode="2" /> | |||
| <Option compiler="gcc" /> | |||
| <Build> | |||
| <Target title="Win32 Release"> | |||
| <Option output="Release\bin\jack_netsource" prefix_auto="1" extension_auto="1" /> | |||
| <Option object_output="Release\" /> | |||
| <Option type="1" /> | |||
| <Option compiler="gcc" /> | |||
| <Compiler> | |||
| <Add option="-O2" /> | |||
| <Add option="-Wall" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add directory="Release\bin" /> | |||
| </Linker> | |||
| </Target> | |||
| <Target title="Win32 Debug"> | |||
| <Option output="Debug\bin\jack_netsource" prefix_auto="1" extension_auto="1" /> | |||
| <Option object_output="Debug\" /> | |||
| <Option type="1" /> | |||
| <Option compiler="gcc" /> | |||
| <Compiler> | |||
| <Add option="-Wall" /> | |||
| <Add option="-g" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add directory="Debug\bin" /> | |||
| </Linker> | |||
| </Target> | |||
| <Target title="Win32 Profiling"> | |||
| <Option output="Release\bin\jack_netsource" prefix_auto="1" extension_auto="1" /> | |||
| <Option object_output="Release\" /> | |||
| <Option type="1" /> | |||
| <Option compiler="gcc" /> | |||
| <Compiler> | |||
| <Add option="-O2" /> | |||
| <Add option="-Wall" /> | |||
| <Add option="-DJACK_MONITOR" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add directory="Release\bin" /> | |||
| </Linker> | |||
| </Target> | |||
| </Build> | |||
| <Compiler> | |||
| <Add option="-Wall" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add library="kernel32" /> | |||
| <Add library="user32" /> | |||
| <Add library="gdi32" /> | |||
| <Add library="winspool" /> | |||
| <Add library="comdlg32" /> | |||
| <Add library="advapi32" /> | |||
| <Add library="shell32" /> | |||
| <Add library="ole32" /> | |||
| <Add library="oleaut32" /> | |||
| <Add library="uuid" /> | |||
| <Add library="odbc32" /> | |||
| <Add library="odbccp32" /> | |||
| <Add library="libjack" /> | |||
| <Add library="libsamplerate-0" /> | |||
| <Add library="ws2_32" /> | |||
| <Add directory="Release\bin" /> | |||
| </Linker> | |||
| <Unit filename="..\common\netjack_packet.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="..\example-clients\netsource.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="getopt.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="getopt1.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="jack_netsource.rc"> | |||
| <Option compilerVar="WINDRES" /> | |||
| </Unit> | |||
| <Extensions> | |||
| <code_completion /> | |||
| <envvars /> | |||
| <debugger /> | |||
| <AutoVersioning> | |||
| <Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" /> | |||
| <Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" /> | |||
| <Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" /> | |||
| </AutoVersioning> | |||
| </Extensions> | |||
| </Project> | |||
| </CodeBlocks_project_file> | |||
| <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | |||
| <CodeBlocks_project_file> | |||
| <FileVersion major="1" minor="6" /> | |||
| <Project> | |||
| <Option title="jack_netsource" /> | |||
| <Option pch_mode="2" /> | |||
| <Option compiler="gcc" /> | |||
| <Build> | |||
| <Target title="Win32 Release"> | |||
| <Option output="Release\bin\jack_netsource" prefix_auto="1" extension_auto="1" /> | |||
| <Option object_output="Release\" /> | |||
| <Option type="1" /> | |||
| <Option compiler="gcc" /> | |||
| <Compiler> | |||
| <Add option="-O2" /> | |||
| <Add option="-Wall" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add directory="Release\bin" /> | |||
| </Linker> | |||
| </Target> | |||
| <Target title="Win32 Debug"> | |||
| <Option output="Debug\bin\jack_netsource" prefix_auto="1" extension_auto="1" /> | |||
| <Option object_output="Debug\" /> | |||
| <Option type="1" /> | |||
| <Option compiler="gcc" /> | |||
| <Compiler> | |||
| <Add option="-Wall" /> | |||
| <Add option="-g" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add directory="Debug\bin" /> | |||
| </Linker> | |||
| </Target> | |||
| <Target title="Win32 Profiling"> | |||
| <Option output="Release\bin\jack_netsource" prefix_auto="1" extension_auto="1" /> | |||
| <Option object_output="Release\" /> | |||
| <Option type="1" /> | |||
| <Option compiler="gcc" /> | |||
| <Compiler> | |||
| <Add option="-O2" /> | |||
| <Add option="-Wall" /> | |||
| <Add option="-DJACK_MONITOR" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add directory="Release\bin" /> | |||
| </Linker> | |||
| </Target> | |||
| </Build> | |||
| <Compiler> | |||
| <Add option="-Wall" /> | |||
| <Add directory="..\example-clients" /> | |||
| <Add directory="..\windows" /> | |||
| <Add directory="..\common\jack" /> | |||
| <Add directory="..\common" /> | |||
| </Compiler> | |||
| <Linker> | |||
| <Add library="kernel32" /> | |||
| <Add library="user32" /> | |||
| <Add library="gdi32" /> | |||
| <Add library="winspool" /> | |||
| <Add library="comdlg32" /> | |||
| <Add library="advapi32" /> | |||
| <Add library="shell32" /> | |||
| <Add library="ole32" /> | |||
| <Add library="oleaut32" /> | |||
| <Add library="uuid" /> | |||
| <Add library="odbc32" /> | |||
| <Add library="odbccp32" /> | |||
| <Add library="libjack" /> | |||
| <Add library="libsamplerate-0" /> | |||
| <Add library="ws2_32" /> | |||
| <Add directory="Release\bin" /> | |||
| </Linker> | |||
| <Unit filename="..\common\netjack_packet.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="..\example-clients\netsource.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="getopt.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Unit filename="getopt1.c"> | |||
| <Option compilerVar="CC" /> | |||
| </Unit> | |||
| <Extensions> | |||
| <code_completion /> | |||
| <envvars /> | |||
| <debugger /> | |||
| <AutoVersioning> | |||
| <Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="100" /> | |||
| <Settings autoincrement="1" date_declarations="1" do_auto_increment="0" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" /> | |||
| <Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" /> | |||
| </AutoVersioning> | |||
| </Extensions> | |||
| </Project> | |||
| </CodeBlocks_project_file> | |||
| @@ -1,48 +0,0 @@ | |||
| // Generated by ResEdit 1.4.3 | |||
| // Copyright (C) 2006-2008 | |||
| // http://www.resedit.net | |||
| #include "resource.h" | |||
| #include "afxres.h" | |||
| // | |||
| // Version Information resources | |||
| // | |||
| LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT | |||
| 1 VERSIONINFO | |||
| FILEVERSION 1,9,5,0 | |||
| PRODUCTVERSION 1,9,5,0 | |||
| FILEOS VOS_UNKNOWN | |||
| FILETYPE VFT_APP | |||
| BEGIN | |||
| BLOCK "StringFileInfo" | |||
| BEGIN | |||
| BLOCK "040c04b0" | |||
| BEGIN | |||
| VALUE "Comments", "\0" | |||
| VALUE "CompanyName", "Grame\0" | |||
| VALUE "FileDescription", "JackNetOne netsource for Windows\0" | |||
| VALUE "FileVersion", "1, 9, 5, 0\0" | |||
| VALUE "InternalName", "netsource\0" | |||
| VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0" | |||
| VALUE "LegalTrademarks", "\0" | |||
| VALUE "OriginalFilename", "jack_netsource.exe\0" | |||
| VALUE "PrivateBuild", "\0" | |||
| VALUE "ProductName", "jack_netsource\0" | |||
| VALUE "ProductVersion", "1, 9, 5, 0\0" | |||
| VALUE "SpecialBuild", "\0" | |||
| END | |||
| END | |||
| BLOCK "VarFileInfo" | |||
| BEGIN | |||
| VALUE "Translation", 1036, 1200 | |||
| END | |||
| END | |||
| // | |||
| // Icon resources | |||
| // | |||
| LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT | |||
| IDI_ICON1 ICON ".\\Setup\\src\\jack.ico" | |||
| @@ -112,6 +112,8 @@ def configure(conf): | |||
| conf.sub_config('linux') | |||
| if Options.options.dbus: | |||
| conf.sub_config('dbus') | |||
| if conf.env['BUILD_JACKDBUS'] != True: | |||
| conf.fatal('jackdbus was explicitly requested but cannot be built') | |||
| conf.sub_config('example-clients') | |||
| if conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs'): | |||
| @@ -136,7 +138,6 @@ def configure(conf): | |||
| conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen | |||
| conf.env['BUILD_WITH_PROFILE'] = Options.options.profile | |||
| conf.env['BUILD_WITH_32_64'] = Options.options.mixed | |||
| conf.env['BUILD_JACKDBUS'] = Options.options.dbus | |||
| conf.env['BUILD_CLASSIC'] = Options.options.classic | |||
| conf.env['BUILD_DEBUG'] = Options.options.debug | |||
| @@ -203,8 +204,9 @@ def configure(conf): | |||
| display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS']) | |||
| if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']: | |||
| print Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues!' + Logs.colors.NORMAL | |||
| print Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL | |||
| print Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL | |||
| if conf.env['IS_LINUX']: | |||
| display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True) | |||
| display_feature('Build with FireWire (FreeBob) support', conf.env['BUILD_DRIVER_FREEBOB'] == True) | |||