Commit ccdfe513 authored by sletz's avatar sletz
Browse files

Cleanup.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4212 0c269be4-1314-0410-8aa9-9f06e86f4224
parent e97dcccf
......@@ -138,14 +138,13 @@ int JackAudioDriver::Attach()
// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port ");
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register monitor port for %s", name);
return -1;
} else {
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
range.min = range.max = fEngineControl->fBufferSize;
port->SetLatencyRange(JackCaptureLatency, &range);
fMonitorPortList[i] = port_index;
......
......@@ -42,12 +42,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackLockedEngine.h"
#include "JackPosixThread.h"
#include "JackCompilerDeps.h"
#include "hammerfall.h"
#include "hdsp.h"
#include "ice1712.h"
#include "usx2y.h"
#include "generic.h"
#include "memops.h"
#include "JackServerGlobals.h"
namespace Jack
......@@ -75,7 +69,7 @@ int JackAlsaDriver::Attach()
{
JackPort* port;
int port_index;
unsigned long port_flags;
unsigned long port_flags = (unsigned long)CaptureDriverFlags;
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
jack_latency_range_t range;
......@@ -83,8 +77,6 @@ int JackAlsaDriver::Attach()
assert(fCaptureChannels < DRIVER_PORT_NUM);
assert(fPlaybackChannels < DRIVER_PORT_NUM);
port_flags = (unsigned long)CaptureDriverFlags;
alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;
if (alsa_driver->has_hw_monitoring)
......@@ -94,10 +86,10 @@ int JackAlsaDriver::Attach()
JackAudioDriver::SetBufferSize(alsa_driver->frames_per_cycle);
JackAudioDriver::SetSampleRate(alsa_driver->frame_rate);
jack_log("JackAudioDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
jack_log("JackAlsaDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
for (int i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:capture_%u", fAliasName, i + 1);
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
......@@ -108,13 +100,13 @@ int JackAlsaDriver::Attach()
range.min = range.max = alsa_driver->frames_per_cycle + alsa_driver->capture_frame_latency;
port->SetLatencyRange(JackCaptureLatency, &range);
fCapturePortList[i] = port_index;
jack_log("JackAudioDriver::Attach fCapturePortList[i] %ld ", port_index);
jack_log("JackAlsaDriver::Attach fCapturePortList[i] %ld ", port_index);
}
port_flags = (unsigned long)PlaybackDriverFlags;
for (int i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fAliasName, i + 1);
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
......@@ -128,11 +120,11 @@ int JackAlsaDriver::Attach()
port->SetLatencyRange(JackPlaybackLatency, &range);
fPlaybackPortList[i] = port_index;
jack_log("JackAudioDriver::Attach fPlaybackPortList[i] %ld ", port_index);
jack_log("JackAlsaDriver::Attach fPlaybackPortList[i] %ld ", port_index);
// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port ");
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error ("ALSA: cannot register monitor port for %s", name);
......@@ -388,8 +380,7 @@ int JackAlsaDriver::Write()
void JackAlsaDriver::ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread)
{
int chn;
for (chn = 0; chn < fCaptureChannels; chn++) {
for (int chn = 0; chn < fCaptureChannels; chn++) {
if (fGraphManager->GetConnectionsNum(fCapturePortList[chn]) > 0) {
jack_default_audio_sample_t* buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[chn], orig_nframes);
alsa_driver_read_from_channel((alsa_driver_t *)fDriver, chn, buf + nread, contiguous);
......@@ -399,8 +390,7 @@ void JackAlsaDriver::ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t
void JackAlsaDriver::MonitorInputAux()
{
int chn;
for (chn = 0; chn < fCaptureChannels; chn++) {
for (int chn = 0; chn < fCaptureChannels; chn++) {
JackPort* port = fGraphManager->GetPort(fCapturePortList[chn]);
if (port->MonitoringInput()) {
((alsa_driver_t *)fDriver)->input_monitor_mask |= (1 << chn);
......@@ -410,8 +400,7 @@ void JackAlsaDriver::MonitorInputAux()
void JackAlsaDriver::ClearOutputAux()
{
int chn;
for (chn = 0; chn < fPlaybackChannels; chn++) {
for (int chn = 0; chn < fPlaybackChannels; chn++) {
jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], fEngineControl->fBufferSize);
memset(buf, 0, sizeof (jack_default_audio_sample_t) * fEngineControl->fBufferSize);
......@@ -425,13 +414,10 @@ void JackAlsaDriver::SetTimetAux(jack_time_t time)
void JackAlsaDriver::WriteOutputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten)
{
int chn;
jack_default_audio_sample_t* buf;
for (chn = 0; chn < fPlaybackChannels; chn++) {
// Ouput ports
for (int chn = 0; chn < fPlaybackChannels; chn++) {
// Output ports
if (fGraphManager->GetConnectionsNum(fPlaybackPortList[chn]) > 0) {
buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], orig_nframes);
jack_default_audio_sample_t* buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], orig_nframes);
alsa_driver_write_to_channel(((alsa_driver_t *)fDriver), chn, buf + nwritten, contiguous);
// Monitor ports
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[chn]) > 0) {
......
......@@ -55,7 +55,7 @@ static void PrintStreamDesc(AudioStreamBasicDescription *inDesc)
jack_log(" Bytes per Frame:%ld", inDesc->mBytesPerFrame);
jack_log(" Channels per Frame:%ld", inDesc->mChannelsPerFrame);
jack_log(" Bits per Channel:%ld", inDesc->mBitsPerChannel);
jack_log("- - - - - - - - - - - - - - - - - - - -\n");
jack_log("- - - - - - - - - - - - - - - - - - - -");
}
static void printError(OSStatus err)
......@@ -1580,11 +1580,11 @@ int JackCoreAudioDriver::Attach()
err = AudioDeviceGetPropertyInfo(fDeviceID, i + 1, true, kAudioDevicePropertyChannelName, &size, &isWritable);
if (err != noErr)
jack_log("AudioDeviceGetPropertyInfo kAudioDevicePropertyChannelName error ");
jack_log("AudioDeviceGetPropertyInfo kAudioDevicePropertyChannelName error");
if (err == noErr && size > 0) {
err = AudioDeviceGetProperty(fDeviceID, i + 1, true, kAudioDevicePropertyChannelName, &size, channel_name);
if (err != noErr)
jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error ");
jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error");
snprintf(alias, sizeof(alias) - 1, "%s:%s:out_%s%u", fAliasName, fCaptureDriverName, channel_name, i + 1);
} else {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%u", fAliasName, fCaptureDriverName, i + 1);
......@@ -1602,10 +1602,10 @@ int JackCoreAudioDriver::Attach()
UInt32 value2 = 0;
err = AudioDeviceGetProperty(fDeviceID, 0, true, kAudioDevicePropertyLatency, &size, &value1);
if (err != noErr)
jack_log("AudioDeviceGetProperty kAudioDevicePropertyLatency error ");
jack_log("AudioDeviceGetProperty kAudioDevicePropertyLatency error");
err = AudioDeviceGetProperty(fDeviceID, 0, true, kAudioDevicePropertySafetyOffset, &size, &value2);
if (err != noErr)
jack_log("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error ");
jack_log("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error");
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
......@@ -1618,11 +1618,11 @@ int JackCoreAudioDriver::Attach()
err = AudioDeviceGetPropertyInfo(fDeviceID, i + 1, false, kAudioDevicePropertyChannelName, &size, &isWritable);
if (err != noErr)
jack_log("AudioDeviceGetPropertyInfo kAudioDevicePropertyChannelName error ");
jack_log("AudioDeviceGetPropertyInfo kAudioDevicePropertyChannelName error");
if (err == noErr && size > 0) {
err = AudioDeviceGetProperty(fDeviceID, i + 1, false, kAudioDevicePropertyChannelName, &size, channel_name);
if (err != noErr)
jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error ");
jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error");
snprintf(alias, sizeof(alias) - 1, "%s:%s:in_%s%u", fAliasName, fPlaybackDriverName, channel_name, i + 1);
} else {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%u", fAliasName, fPlaybackDriverName, i + 1);
......@@ -1640,10 +1640,10 @@ int JackCoreAudioDriver::Attach()
UInt32 value2 = 0;
err = AudioDeviceGetProperty(fDeviceID, 0, false, kAudioDevicePropertyLatency, &size, &value1);
if (err != noErr)
jack_log("AudioDeviceGetProperty kAudioDevicePropertyLatency error ");
jack_log("AudioDeviceGetProperty kAudioDevicePropertyLatency error");
err = AudioDeviceGetProperty(fDeviceID, 0, false, kAudioDevicePropertySafetyOffset, &size, &value2);
if (err != noErr)
jack_log("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error ");
jack_log("AudioDeviceGetProperty kAudioDevicePropertySafetyOffset error");
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
......@@ -1654,14 +1654,13 @@ int JackCoreAudioDriver::Attach()
// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port ");
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register monitor port for %s", name);
return -1;
} else {
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
range.min = range.max = fEngineControl->fBufferSize;
port->SetLatencyRange(JackCaptureLatency, &range);
fMonitorPortList[i] = port_index;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment