Skip to content

Commit

Permalink
Remove warning, renaming.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Sep 10, 2012
1 parent d3d4945 commit 50e793e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 61 deletions.
2 changes: 1 addition & 1 deletion common/JackControlAPI.cpp
Expand Up @@ -1111,7 +1111,7 @@ SERVER_EXPORT bool jackctl_parameter_has_enum_constraint(jackctl_parameter *para
SERVER_EXPORT uint32_t jackctl_parameter_get_enum_constraints_count(jackctl_parameter *parameter_ptr)
{
if (!parameter_ptr) {
return NULL;
return 0;
}

if (!jackctl_parameter_has_enum_constraint(parameter_ptr))
Expand Down
10 changes: 5 additions & 5 deletions common/JackNetTool.cpp
Expand Up @@ -855,11 +855,11 @@ namespace Jack
memset(buffer, 0, fPeriodSize * sizeof(sample_t));
}
int res = opus_custom_encode_float(fOpusEncoder[port_index], buffer, fPeriodSize, fCompressedBuffer[port_index], fCompressedMaxSizeByte);
if (res <0 || res >= 65535) {
fCompressedSizesByte[port_index] = 0;
} else {
fCompressedSizesByte[port_index] = res;
}
if (res <0 || res >= 65535) {
fCompressedSizesByte[port_index] = 0;
} else {
fCompressedSizesByte[port_index] = res;
}
}

// All ports active
Expand Down
10 changes: 0 additions & 10 deletions common/JackServerGlobals.cpp
Expand Up @@ -100,9 +100,7 @@ bool JackServerGlobals::Init()
int client_timeout = 0; /* msecs; if zero, use period size. */
int realtime_priority = 10;
int verbose_aux = 0;
int do_mlock = 1;
unsigned int port_max = 128;
int do_unlock = 0;
int temporary = 0;

int opt = 0;
Expand Down Expand Up @@ -233,14 +231,6 @@ bool JackServerGlobals::Init()
port_max = (unsigned int)atol(optarg);
break;

case 'm':
do_mlock = 0;
break;

case 'u':
do_unlock = 1;
break;

case 'v':
verbose_aux = 1;
break;
Expand Down
10 changes: 0 additions & 10 deletions common/Jackdmp.cpp
Expand Up @@ -223,8 +223,6 @@ int main(int argc, char** argv)
char* master_driver_name = NULL;
char** master_driver_args = NULL;
int master_driver_nargs = 1;
int do_mlock = 1;
int do_unlock = 0;
int loopback = 0;
bool show_version = false;
jackctl_sigmask_t * sigmask;
Expand Down Expand Up @@ -303,14 +301,6 @@ int main(int argc, char** argv)
}
break;

case 'm':
do_mlock = 0;
break;

case 'u':
do_unlock = 1;
break;

case 'v':
param = jackctl_get_parameter(server_parameters, "verbose");
if (param != NULL) {
Expand Down
70 changes: 35 additions & 35 deletions macosx/coreaudio/JackCoreAudioDriver.cpp
Expand Up @@ -1388,56 +1388,56 @@ int JackCoreAudioDriver::SetupDevices(const char* capture_driver_uid,
}

/*
Return the max possible input channels in in_nChannels and output channels in out_nChannels.
Return the max possible input channels in in_maxChannels and output channels in out_maxChannels.
*/
int JackCoreAudioDriver::SetupChannels(bool capturing, bool playing, int& inchannels, int& outchannels, int& in_nChannels, int& out_nChannels, bool strict)
int JackCoreAudioDriver::SetupChannels(bool capturing, bool playing, int& inchannels, int& outchannels, int& in_maxChannels, int& out_maxChannels, bool strict)
{
OSStatus err = noErr;

if (capturing) {
err = GetTotalChannels(fDeviceID, in_nChannels, true);
err = GetTotalChannels(fDeviceID, in_maxChannels, true);
if (err != noErr) {
jack_error("SetupChannels : cannot get input channel number");
printError(err);
return -1;
} else {
jack_log("JackCoreAudioDriver::SetupChannels : max input channels : %d", in_nChannels);
jack_log("JackCoreAudioDriver::SetupChannels : max input channels : %d", in_maxChannels);
}
}

if (playing) {
err = GetTotalChannels(fDeviceID, out_nChannels, false);
err = GetTotalChannels(fDeviceID, out_maxChannels, false);
if (err != noErr) {
jack_error("Cannot get output channel number");
printError(err);
return -1;
} else {
jack_log("JackCoreAudioDriver::SetupChannels : max output channels : %d", out_nChannels);
jack_log("JackCoreAudioDriver::SetupChannels : max output channels : %d", out_maxChannels);
}
}

if (inchannels > in_nChannels) {
jack_error("This device hasn't required input channels inchannels = %d in_nChannels = %d", inchannels, in_nChannels);
if (inchannels > in_maxChannels) {
jack_error("This device hasn't required input channels inchannels = %d in_maxChannels = %d", inchannels, in_maxChannels);
if (strict) {
return -1;
}
}

if (outchannels > out_nChannels) {
jack_error("This device hasn't required output channels outchannels = %d out_nChannels = %d", outchannels, out_nChannels);
if (outchannels > out_maxChannels) {
jack_error("This device hasn't required output channels outchannels = %d out_maxChannels = %d", outchannels, out_maxChannels);
if (strict) {
return -1;
}
}

if (inchannels == -1) {
jack_log("JackCoreAudioDriver::SetupChannels : setup max in channels = %d", in_nChannels);
inchannels = in_nChannels;
jack_log("JackCoreAudioDriver::SetupChannels : setup max in channels = %d", in_maxChannels);
inchannels = in_maxChannels;
}

if (outchannels == -1) {
jack_log("JackCoreAudioDriver::SetupChannels : setup max out channels = %d", out_nChannels);
outchannels = out_nChannels;
jack_log("JackCoreAudioDriver::SetupChannels : setup max out channels = %d", out_maxChannels);
outchannels = out_maxChannels;
}

return 0;
Expand Down Expand Up @@ -1598,8 +1598,8 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
bool playing,
int inchannels,
int outchannels,
int in_nChannels,
int out_nChannels,
int in_maxChannels,
int out_maxChannels,
const vector<int>& chan_in_list,
const vector<int>& chan_out_list,
jack_nframes_t buffer_size,
Expand All @@ -1611,8 +1611,8 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
AudioDeviceID currAudioDeviceID;
UInt32 size;

jack_log("JackCoreAudioDriver::OpenAUHAL : capturing = %d playing = %d inchannels = %d outchannels = %d in_nChannels = %d out_nChannels = %d chan_in_list = %d chan_out_list = %d",
capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels, chan_in_list.size(), chan_out_list.size());
jack_log("JackCoreAudioDriver::OpenAUHAL : capturing = %d playing = %d inchannels = %d outchannels = %d in_maxChannels = %d out_maxChannels = %d chan_in_list = %d chan_out_list = %d",
capturing, playing, inchannels, outchannels, in_maxChannels, out_maxChannels, chan_in_list.size(), chan_out_list.size());

if (inchannels == 0 && outchannels == 0) {
jack_error("No input and output channels...");
Expand Down Expand Up @@ -1721,16 +1721,16 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
}

// Setup input channel map
if (capturing && inchannels > 0 && inchannels <= in_nChannels) {
SInt32 chanArr[in_nChannels];
for (int i = 0; i < in_nChannels; i++) {
if (capturing && inchannels > 0 && inchannels <= in_maxChannels) {
SInt32 chanArr[in_maxChannels];
for (int i = 0; i < in_maxChannels; i++) {
chanArr[i] = -1;
}
// Explicit mapping
if (chan_in_list.size() > 0) {
for (uint i = 0; i < chan_in_list.size(); i++) {
int chan = chan_in_list[i];
if (chan < out_nChannels) {
if (chan < out_maxChannels) {
// The wanted JACK input index for the 'chan' channel value
chanArr[chan] = i;
jack_info("Input channel = %d ==> JACK input port = %d", chan, i);
Expand All @@ -1746,7 +1746,7 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
}
}

AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap , kAudioUnitScope_Input, 1, chanArr, sizeof(SInt32) * in_nChannels);
AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap , kAudioUnitScope_Input, 1, chanArr, sizeof(SInt32) * in_maxChannels);
if (err1 != noErr) {
jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap for input");
printError(err1);
Expand All @@ -1755,16 +1755,16 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
}

// Setup output channel map
if (playing && outchannels > 0 && outchannels <= out_nChannels) {
SInt32 chanArr[out_nChannels];
for (int i = 0; i < out_nChannels; i++) {
if (playing && outchannels > 0 && outchannels <= out_maxChannels) {
SInt32 chanArr[out_maxChannels];
for (int i = 0; i < out_maxChannels; i++) {
chanArr[i] = -1;
}
// Explicit mapping
if (chan_out_list.size() > 0) {
for (uint i = 0; i < chan_out_list.size(); i++) {
int chan = chan_out_list[i];
if (chan < out_nChannels) {
if (chan < out_maxChannels) {
// The wanted JACK output index for the 'chan' channel value
chanArr[chan] = i;
jack_info("JACK output port = %d ==> output channel = %d", i, chan);
Expand All @@ -1780,7 +1780,7 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing,
}
}

err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, chanArr, sizeof(SInt32) * out_nChannels);
err1 = AudioUnitSetProperty(fAUHAL, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Output, 0, chanArr, sizeof(SInt32) * out_maxChannels);
if (err1 != noErr) {
jack_error("Error calling AudioUnitSetProperty - kAudioOutputUnitProperty_ChannelMap for output");
printError(err1);
Expand Down Expand Up @@ -2012,8 +2012,8 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,
int ac3_bitrate,
bool ac3_lfe)
{
int in_nChannels = 0;
int out_nChannels = 0;
int in_maxChannels = 0;
int out_maxChannels = 0;
char capture_driver_name[256];
char playback_driver_name[256];

Expand Down Expand Up @@ -2059,17 +2059,17 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,
goto error;
}

if (SetupChannels(capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels, !ac3_encoding) < 0) {
if (SetupChannels(capturing, playing, inchannels, outchannels, in_maxChannels, out_maxChannels, !ac3_encoding) < 0) {
goto error;
}

ParseChannelList(chan_in_list, parsed_chan_in_list, in_nChannels);
ParseChannelList(chan_in_list, parsed_chan_in_list, in_maxChannels);
if (parsed_chan_in_list.size() > 0) {
jack_info("Explicit input channel list size = %d", parsed_chan_in_list.size());
inchannels = parsed_chan_in_list.size();
}

ParseChannelList(chan_out_list, parsed_chan_out_list, out_nChannels);
ParseChannelList(chan_out_list, parsed_chan_out_list, out_maxChannels);
if (parsed_chan_out_list.size() > 0) {
jack_info("Explicit output channel list size = %d", parsed_chan_out_list.size());
outchannels = parsed_chan_out_list.size();
Expand Down Expand Up @@ -2115,7 +2115,7 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,
}

// Force real output channel number to 2
outchannels = out_nChannels = 2;
outchannels = out_maxChannels = 2;

} else {
fPlaybackChannels = outchannels;
Expand All @@ -2124,7 +2124,7 @@ int JackCoreAudioDriver::Open(jack_nframes_t buffer_size,
// Core driver may have changed the in/out values
fCaptureChannels = inchannels;

if (OpenAUHAL(capturing, playing, inchannels, outchannels, in_nChannels, out_nChannels, parsed_chan_in_list, parsed_chan_out_list, buffer_size, sample_rate) < 0) {
if (OpenAUHAL(capturing, playing, inchannels, outchannels, in_maxChannels, out_maxChannels, parsed_chan_in_list, parsed_chan_out_list, buffer_size, sample_rate) < 0) {
goto error;
}

Expand Down

0 comments on commit 50e793e

Please sign in to comment.