Browse Source

Correct ALSA driver Attach method: internal driver may have changed the buffer_size and sample_rate values.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1691 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.68
sletz 17 years ago
parent
commit
0df7fe2aca
4 changed files with 22 additions and 5 deletions
  1. +4
    -0
      ChangeLog
  2. +7
    -0
      common/JackAudioDriver.cpp
  3. +2
    -2
      common/JackAudioDriver.h
  4. +9
    -3
      linux/alsa/JackAlsaDriver.cpp

+ 4
- 0
ChangeLog View File

@@ -13,6 +13,10 @@ Tom Szilagyi
Jackdmp changes log
---------------------------

2007-11-01 Stephane Letz <letz@grame.fr>

* Correct ALSA driver Attach method: internal driver may have changed the buffer_size and sample_rate values.

2007-10-31 Stephane Letz <letz@grame.fr>

* Server and user directory related code moved in a JackTools file.


+ 7
- 0
common/JackAudioDriver.cpp View File

@@ -57,6 +57,13 @@ int JackAudioDriver::SetBufferSize(jack_nframes_t buffer_size)
return 0;
}

int JackAudioDriver::SetSampleRate(jack_nframes_t sample_rate)
{
fEngineControl->fSampleRate = sample_rate;
fEngineControl->fPeriodUsecs = jack_time_t(1000000.f / fEngineControl->fSampleRate * fEngineControl->fBufferSize); // in microsec
return 0;
}

int JackAudioDriver::Open(jack_nframes_t nframes,
jack_nframes_t samplerate,
int capturing,


+ 2
- 2
common/JackAudioDriver.h View File

@@ -79,8 +79,8 @@ class EXPORT JackAudioDriver : public JackDriver
virtual int Detach();
virtual int Write();

// sets up fEngineControl and fGraphManager, always succeeds
virtual int SetBufferSize(jack_nframes_t buffer_size);
virtual int SetBufferSize(jack_nframes_t buffer_size);
virtual int SetSampleRate(jack_nframes_t sample_rate);

virtual void NotifyXRun(jack_time_t callback_usecs); // XRun notification sent by the driver



+ 9
- 3
linux/alsa/JackAlsaDriver.cpp View File

@@ -2074,15 +2074,21 @@ int JackAlsaDriver::Attach()
JackPort* port;
int port_index;
unsigned long port_flags;

char buf[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];

port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;

assert(fCaptureChannels < PORT_NUM);
assert(fPlaybackChannels < PORT_NUM);
port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;

alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;
if (alsa_driver->has_hw_monitoring)
port_flags |= JackPortCanMonitor;
// ALSA driver may have changed the values
JackAudioDriver::SetBufferSize(alsa_driver->frames_per_cycle);
JackAudioDriver::SetSampleRate(alsa_driver->frame_rate);

JackLog("JackAudioDriver::Attach fBufferSize %ld fSampleRate %ld\n", fEngineControl->fBufferSize, fEngineControl->fSampleRate);



Loading…
Cancel
Save