Commit 5413ba6a authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3443] Open audio layer using mainbuffer internal sampling rate

parent 303fde7e
......@@ -472,6 +472,8 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
_debugAlsa ("Audio: Error: Cannot set sample rate (%s)", snd_strerror (err));
return false;
}
else
_debug("Audio: Set audio rate to %d", rate);
if (dir!= 0) {
_debugAlsa ("Audio: Error: (%i) The choosen rate %d Hz is not supported by your hardware.Using %d Hz instead. ",type ,rate, exact_ivalue);
......
......@@ -32,7 +32,7 @@
#include "mainbuffer.h"
MainBuffer::MainBuffer() : _internalSamplingRate (0)
MainBuffer::MainBuffer() : _internalSamplingRate (8000)
{
mixBuffer = new SFLDataFormat[STATIC_BUFSIZE];
}
......
......@@ -2777,13 +2777,8 @@ void ManagerImpl::selectAudioDriver (void) {
numCardIn = getConfigInt(AUDIO, ALSA_CARD_ID_IN);
numCardOut = getConfigInt(AUDIO, ALSA_CARD_ID_OUT);
numCardRing = getConfigInt(AUDIO, ALSA_CARD_ID_RING);
sampleRate = getConfigInt(AUDIO, AUDIO_SAMPLE_RATE);
if (sampleRate <= 0 || sampleRate > 48000) {
sampleRate = 44100;
}
// sampleRate = getConfigInt(AUDIO, AUDIO_SAMPLE_RATE);
sampleRate = _mainBuffer.getInternalSamplingRate();
frameSize = getConfigInt(AUDIO, ALSA_FRAME_SIZE);
/* Only for the ALSA layer, we check the sound card information */
......@@ -2815,6 +2810,7 @@ void ManagerImpl::selectAudioDriver (void) {
/* Open the audio devices */
_audiodriver->openDevice(numCardIn, numCardOut, numCardRing, sampleRate, frameSize,
SFL_PCM_BOTH, alsaPlugin);
/* Notify the error if there is one */
if (_audiodriver -> getErrorMessage() != -1)
......@@ -2833,7 +2829,8 @@ void ManagerImpl::switchAudioManager (void) {
type = _audiodriver->getLayerType();
samplerate = getConfigInt(AUDIO, AUDIO_SAMPLE_RATE);
// samplerate = getConfigInt(AUDIO, AUDIO_SAMPLE_RATE);
samplerate = _mainBuffer.getInternalSamplingRate();
framesize = getConfigInt(AUDIO, ALSA_FRAME_SIZE);
_debug ("Mnager: samplerate: %i, framesize %i\n", samplerate, framesize);
......
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