Browse Source

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
tags/1.9.8
sletz 13 years ago
parent
commit
d6bd4ee67e
6 changed files with 28 additions and 11 deletions
  1. +4
    -0
      ChangeLog
  2. +1
    -1
      common/JackGlobals.cpp
  3. +1
    -0
      common/JackGlobals.h
  4. +4
    -0
      windows/JackSystemDeps_os.h
  5. +1
    -2
      windows/JackWinSemaphore.cpp
  6. +17
    -8
      windows/JackWinServerLaunch.cpp

+ 4
- 0
ChangeLog View File

@@ -36,6 +36,10 @@ John Emmas
Jackdmp changes log 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> 2011-11-07 Stephane Letz <letz@grame.fr>


* John Emmas first auto-launch server on Windows patch. * John Emmas first auto-launch server on Windows patch.


+ 1
- 1
common/JackGlobals.cpp View File

@@ -53,7 +53,7 @@ void JackGlobals::CheckContext(const char* name)
/* Convert it to local time representation. */ /* Convert it to local time representation. */
loctime = localtime (&curtime); loctime = localtime (&curtime);
strftime(buffer, 256, "%I-%M", loctime); 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 = new std::ofstream(provstr, std::ios_base::ate);
JackGlobals::fStream->is_open(); JackGlobals::fStream->is_open();
} }


+ 1
- 0
common/JackGlobals.h View File

@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __JackGlobals__ #define __JackGlobals__


#include "JackPlatformPlug.h" #include "JackPlatformPlug.h"
#include "JackSystemDeps.h"
#include "JackConstants.h" #include "JackConstants.h"


#ifdef __CLIENTDEBUG__ #ifdef __CLIENTDEBUG__


+ 4
- 0
windows/JackSystemDeps_os.h View File

@@ -49,5 +49,9 @@
#define JACK_DEBUG false #define JACK_DEBUG false
#endif #endif


#if defined(_MSC_VER)
#define snprintf _snprintf
#endif

#endif #endif



+ 1
- 2
windows/JackWinSemaphore.cpp View File

@@ -30,7 +30,7 @@ void JackWinSemaphore::BuildName(const char* client_name, const char* server_nam
{ {
char ext_client_name[JACK_CLIENT_NAME_SIZE + 1]; char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
JackTools::RewriteName(client_name, ext_client_name); 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() bool JackWinSemaphore::Signal()
@@ -158,4 +158,3 @@ void JackWinSemaphore::Destroy()




} // end of namespace } // end of namespace


+ 17
- 8
windows/JackWinServerLaunch.cpp View File

@@ -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)) 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 // 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]; char ch = user_jackdrc[strlen(user_jackdrc)-1];


if (('/' != ch) && ('\\' != ch)) 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); strncpy(arguments, "jackd.exe -S -d " JACK_DEFAULT_DRIVER, 255);
} }


int buffer_termination;
int buffer_termination;
bool verbose_mode = false;
argv = (char**)malloc(255); argv = (char**)malloc(255);
pos = 0;
pos = 0;


while (1) { while (1) {
/* insert -T and -n server_name in front of arguments */ /* 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); strcpy(argv[i], buffer);
pos += (result + 1); pos += (result + 1);
++i; ++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 #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) if ((-1) == ret)
fprintf(stderr, "Execution of JACK server (command = \"%s\") failed: %s\n", command, strerror(errno)); 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; return 0;
} }


Loading…
Cancel
Save