summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2011-11-21 11:39:10 +0000
committersletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2011-11-21 11:39:10 +0000
commitd6bd4ee67e1d4059455b1ad303897b23ddd0afb4 (patch)
treef5498f27cca0c3f0ff34d02f05574c8f7624b44b
parent8b99f0704989d3ecc21895b7567d4685ebaffbec (diff)
downloadjack2-d6bd4ee67e1d4059455b1ad303897b23ddd0afb4.tar.gz
John Emmas third auto-launch server on Windows patch.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4591 0c269be4-1314-0410-8aa9-9f06e86f4224
-rw-r--r--ChangeLog4
-rw-r--r--common/JackGlobals.cpp2
-rw-r--r--common/JackGlobals.h1
-rw-r--r--windows/JackSystemDeps_os.h4
-rw-r--r--windows/JackWinSemaphore.cpp3
-rw-r--r--windows/JackWinServerLaunch.cpp25
6 files changed, 28 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 41ef4208..c8a5fc26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,10 @@ John Emmas
Jackdmp changes log
---------------------------
+2011-11-21 Stephane Letz <letz@grame.fr>
+
+ * John Emmas third auto-launch server on Windows patch.
+
2011-11-07 Stephane Letz <letz@grame.fr>
* John Emmas first auto-launch server on Windows patch.
diff --git a/common/JackGlobals.cpp b/common/JackGlobals.cpp
index dc40392b..62426e12 100644
--- a/common/JackGlobals.cpp
+++ b/common/JackGlobals.cpp
@@ -53,7 +53,7 @@ void JackGlobals::CheckContext(const char* name)
/* Convert it to local time representation. */
loctime = localtime (&curtime);
strftime(buffer, 256, "%I-%M", loctime);
- sprintnf(provstr, sizeof(provstr), "JackAPICall-%s.log", buffer);
+ snprintf(provstr, sizeof(provstr), "JackAPICall-%s.log", buffer);
JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate);
JackGlobals::fStream->is_open();
}
diff --git a/common/JackGlobals.h b/common/JackGlobals.h
index 36d73c38..43dabd12 100644
--- a/common/JackGlobals.h
+++ b/common/JackGlobals.h
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __JackGlobals__
#include "JackPlatformPlug.h"
+#include "JackSystemDeps.h"
#include "JackConstants.h"
#ifdef __CLIENTDEBUG__
diff --git a/windows/JackSystemDeps_os.h b/windows/JackSystemDeps_os.h
index 2f8f941d..b2085fef 100644
--- a/windows/JackSystemDeps_os.h
+++ b/windows/JackSystemDeps_os.h
@@ -49,5 +49,9 @@
#define JACK_DEBUG false
#endif
+#if defined(_MSC_VER)
+#define snprintf _snprintf
+#endif
+
#endif
diff --git a/windows/JackWinSemaphore.cpp b/windows/JackWinSemaphore.cpp
index 5ca4b047..884d9f00 100644
--- a/windows/JackWinSemaphore.cpp
+++ b/windows/JackWinSemaphore.cpp
@@ -30,7 +30,7 @@ void JackWinSemaphore::BuildName(const char* client_name, const char* server_nam
{
char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
JackTools::RewriteName(client_name, ext_client_name);
- snprintf(res, size, "jack_pipe.%s_%s", server_name, ext_client_name);
+ _snprintf(res, size, "jack_pipe.%s_%s", server_name, ext_client_name);
}
bool JackWinSemaphore::Signal()
@@ -158,4 +158,3 @@ void JackWinSemaphore::Destroy()
} // end of namespace
-
diff --git a/windows/JackWinServerLaunch.cpp b/windows/JackWinServerLaunch.cpp
index 4a0d35c9..d90674ad 100644
--- a/windows/JackWinServerLaunch.cpp
+++ b/windows/JackWinServerLaunch.cpp
@@ -45,10 +45,7 @@ find_path_to_jackdrc(char *path_to_jackdrc)
if (S_OK == SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, user_jackdrc))
{
- int fh;
-
// The above call should have given us the path to the user's home folder
- char* pos;
char ch = user_jackdrc[strlen(user_jackdrc)-1];
if (('/' != ch) && ('\\' != ch))
@@ -165,9 +162,10 @@ static int start_server_aux(const char* server_name)
strncpy(arguments, "jackd.exe -S -d " JACK_DEFAULT_DRIVER, 255);
}
- int buffer_termination;
+ int buffer_termination;
+ bool verbose_mode = false;
argv = (char**)malloc(255);
- pos = 0;
+ pos = 0;
while (1) {
/* insert -T and -n server_name in front of arguments */
@@ -215,6 +213,9 @@ static int start_server_aux(const char* server_name)
strcpy(argv[i], buffer);
pos += (result + 1);
++i;
+
+ if ((0 == strcmp(buffer, "-v")) || (0 == strcmp(buffer, "--verbose")))
+ verbose_mode = true;
}
}
@@ -238,8 +239,17 @@ static int start_server_aux(const char* server_name)
}
#endif
- ret = _spawnv(_P_DETACH, command, argv);
- Sleep(2500); // Give the server time to launch
+ if (verbose_mode) {
+ // Launch the server with a console... (note that
+ // if the client is a console app, the server might
+ // also use the client's console)
+ ret = _spawnv(_P_NOWAIT, command, argv);
+ } else {
+ // Launch the server silently... (without a console)
+ ret = _spawnv(_P_DETACH, command, argv);
+ }
+
+ Sleep(2500); // Give it some time to launch
if ((-1) == ret)
fprintf(stderr, "Execution of JACK server (command = \"%s\") failed: %s\n", command, strerror(errno));
@@ -305,4 +315,3 @@ int try_start_server(jack_varargs_t* va, jack_options_t options, jack_status_t*
return 0;
}
-