Browse Source

Improve port alias management in Windows JackRouter.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4720 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.9.5
sletz 13 years ago
parent
commit
cf16257461
6 changed files with 42 additions and 67 deletions
  1. +0
    -43
      common/JackDriverLoader.cpp
  2. +2
    -0
      common/JackPort.cpp
  3. +36
    -18
      windows/JackRouter/JackRouter.cpp
  4. +1
    -1
      windows/JackRouter/JackRouter.h
  5. +2
    -4
      windows/JackWinServerLaunch.cpp
  6. +1
    -1
      windows/portaudio/JackPortAudioDriver.cpp

+ 0
- 43
common/JackDriverLoader.cpp View File

@@ -499,28 +499,6 @@ JSList * jack_drivers_load(JSList * drivers)
goto error;
}

/*
char* driver_dir = locate_application_driver_dir();
snprintf(dll_filename, sizeof(dll_filename), "%s/*.dll", driver_dir);
file = (HANDLE)FindFirstFile(dll_filename, &filedata);

if (file == INVALID_HANDLE_VALUE) {
jack_error("Drivers not found near application");

// Now try system; location
free(driver_dir);
driver_dir = locate_system_driver_dir();
snprintf(dll_filename, sizeof(dll_filename), "%s/*.dll", driver_dir);
file = (HANDLE)FindFirstFile(dll_filename, &filedata);

if (file == INVALID_HANDLE_VALUE) {
jack_error("Drivers not found in system location");
free(driver_dir);
return NULL;
}
}
*/

do {
/* check the filename is of the right format */
if (strncmp ("jack_", filedata.cFileName, 5) != 0) {
@@ -650,27 +628,6 @@ JSList* jack_internals_load(JSList * internals)
goto error;
}

/*
char* driver_dir = locate_application_driver_dir();
snprintf(dll_filename, sizeof(dll_filename), "%s/*.dll", driver_dir);
file = (HANDLE)FindFirstFile(dll_filename, &filedata);

if (file == INVALID_HANDLE_VALUE) {
jack_error("Drivers not found near application");

// Now try system; location
free(driver_dir);
driver_dir = locate_system_driver_dir();
snprintf(dll_filename, sizeof(dll_filename), "%s/*.dll", driver_dir);
file = (HANDLE)FindFirstFile(dll_filename, &filedata);

if (file == INVALID_HANDLE_VALUE) {
jack_error("Drivers not found in system location");
free(driver_dir);
return NULL;
}
}
*/
do {

ptr = strrchr (filedata.cFileName, '.');


+ 2
- 0
common/JackPort.cpp View File

@@ -49,6 +49,8 @@ bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type
fPlaybackLatency.min = fPlaybackLatency.max = 0;
fCaptureLatency.min = fCaptureLatency.max = 0;
fTied = NO_PORT;
fAlias1[0] = '\0';
fAlias2[0] = '\0';
// DB: At this point we do not know current buffer size in frames,
// but every time buffer will be returned to any user,
// it will be called with either ClearBuffer or MixBuffers


+ 36
- 18
windows/JackRouter/JackRouter.cpp View File

@@ -141,7 +141,7 @@ HRESULT _stdcall DllUnregisterServer()
// Globals
list<pair<string, string> > JackRouter::fConnections;
bool JackRouter::fFirstActivate = true;
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
@@ -172,6 +172,7 @@ JackRouter::JackRouter() : AsioDriver()
fBufferSize = 512;
fSampleRate = 44100;
fFloatSample = true; // float by default
fFirstActivate = true;
printf("Constructor\n");
@@ -198,9 +199,9 @@ JackRouter::JackRouter() : AsioDriver()
fAutoConnectIn = get_private_profile_int("AUTO_CONNECT", "input", 1, confPath.c_str());
fAutoConnectOut = get_private_profile_int("AUTO_CONNECT", "output", 1, confPath.c_str());
fFloatSample = get_private_profile_int("IO", "float-sample", 1, confPath.c_str());
fFloatSample = get_private_profile_int("IO", "float-sample", 0, confPath.c_str());
fAliasSystem = get_private_profile_int("AUTO_CONNECT", "alias", 1, confPath.c_str());
fAliasSystem = get_private_profile_int("AUTO_CONNECT", "alias", 0, confPath.c_str());
FreeLibrary(handle);
@@ -569,6 +570,13 @@ ASIOError JackRouter::getChannelInfo(ASIOChannelInfo *info)
long i;
char buf[32];
char* aliases[2];
aliases[0] = (char*)malloc(jack_port_name_size());
aliases[1] = (char*)malloc(jack_port_name_size());
if (!aliases[0] || !aliases[1])
return ASE_NoMemory;
if (info->isInput) {
for (i = 0; i < fActiveInputs; i++) {
if (fInMap[i] == info->channel) {
@@ -578,13 +586,13 @@ ASIOError JackRouter::getChannelInfo(ASIOChannelInfo *info)
}
jack_port_t* port = fInputPorts[i];
char* aliases[2];
// A alias on system is wanted
if (fAliasSystem && jack_port_get_aliases(port, aliases) == 2) {
strncpy(info->name, aliases[1], 32);
if (fAliasSystem && jack_port_get_aliases(port, aliases) == 1) {
strncpy(info->name, aliases[0], 32);
//strcpy(info->name, "toto");
} else {
_snprintf(buf, sizeof(buf) - 1, "In%d ", info->channel);
_snprintf(buf, sizeof(buf) - 1, "In%d", info->channel);
strcpy(info->name, buf);
}
@@ -597,17 +605,20 @@ ASIOError JackRouter::getChannelInfo(ASIOChannelInfo *info)
}
jack_port_t* port = fOutputPorts[i];
char* aliases[2];
// A alias on system is wanted
if (fAliasSystem && jack_port_get_aliases(port, aliases) == 2) {
strncpy(info->name, aliases[1], 32);
if (fAliasSystem && jack_port_get_aliases(port, aliases) == 1) {
strncpy(info->name, aliases[0], 32);
//strcpy(info->name, "toto");
} else {
_snprintf(buf, sizeof(buf) - 1, "Out%d ", info->channel);
_snprintf(buf, sizeof(buf) - 1, "Out%d", info->channel);
strcpy(info->name, buf);
}
}
free(aliases[0]);
free(aliases[1]);
return ASE_OK;
}
@@ -856,10 +867,17 @@ void JackRouter::RestoreConnections()
void JackRouter::AutoConnect()
{
const char** ports;
char* aliases[2];
aliases[0] = (char*)malloc(jack_port_name_size());
aliases[1] = (char*)malloc(jack_port_name_size());
if (!aliases[0] || !aliases[1])
return;
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++) {
/*
@@ -878,11 +896,10 @@ void JackRouter::AutoConnect()
printf("Cannot connect input ports\n");
} else if (fAliasSystem) {
jack_port_t* input_port = jack_port_by_name(fClient, ports[ASIO_channel]);
if (input_port) {
char* aliases[2];
if (input_port) {
if (jack_port_get_aliases(input_port, aliases) == 2) {
jack_port_set_alias(fInputPorts[i], aliases[1]);
}
jack_port_set_alias(fInputPorts[i], aliases[1]);
}
}
}
}
@@ -912,14 +929,15 @@ void JackRouter::AutoConnect()
} else if (fAliasSystem) {
jack_port_t* output_port = jack_port_by_name(fClient, ports[ASIO_channel]);
if (output_port) {
char* aliases[2];
if (jack_port_get_aliases(output_port, aliases) == 2) {
if (jack_port_get_aliases(output_port, aliases) == 2) {
jack_port_set_alias(fOutputPorts[i], aliases[1]);
}
}
}
}
}
}
free(aliases[0]);
free(aliases[1]);
jack_free(ports);
}
}


+ 1
- 1
windows/JackRouter/JackRouter.h View File

@@ -121,7 +121,7 @@ public:
void bufferSwitch();
long getMilliSeconds() {return fMilliSeconds;}
static bool fFirstActivate;
bool fFirstActivate;
static std::list<std::pair<std::string, std::string> > fConnections; // Connections list
private:


+ 2
- 4
windows/JackWinServerLaunch.cpp View File

@@ -38,7 +38,6 @@ static char*
find_path_to_jackdrc(char *path_to_jackdrc)
{
char user_jackdrc[1024];
char *ptr = NULL;
char *ret = NULL;

user_jackdrc[0] = user_jackdrc[1] = 0; // Initialise
@@ -103,7 +102,6 @@ static int start_server_aux(const char* server_name)
char buffer [MAX_PATH];
char filename [MAX_PATH];
char curr_wd [MAX_PATH];
char temp_wd [MAX_PATH];

curr_wd[0] = '\0';
if (find_path_to_jackdrc(filename))
@@ -121,13 +119,13 @@ static int start_server_aux(const char* server_name)

fgets(filename, MAX_PATH, fp);
_strlwr(filename);
if (p = strstr(filename, ".exe")) {
if ((p = strstr(filename, ".exe"))) {
p += 4;
*p = '\0';
pos = (size_t)(p - filename);
fseek(fp, 0, SEEK_SET);

if (command = (char*)malloc(pos+1))
if ((command = (char*)malloc(pos+1)))
ret = fread(command, 1, pos, fp);

if (ret && !ferror(fp)) {


+ 1
- 1
windows/portaudio/JackPortAudioDriver.cpp View File

@@ -44,7 +44,7 @@ int JackPortAudioDriver::Render(const void* inputBuffer, void* outputBuffer,
driver->fInputBuffer = (jack_default_audio_sample_t**)inputBuffer;
driver->fOutputBuffer = (jack_default_audio_sample_t**)outputBuffer;

MMCSSAcquireRealTime(GetCurrentThread());
//MMCSSAcquireRealTime(GetCurrentThread());

if (statusFlags) {
if (statusFlags & paOutputUnderflow)


Loading…
Cancel
Save