Commit 598b836c authored by llea's avatar llea

Fix compilation without -alsa

parent 379990ae
...@@ -68,13 +68,13 @@ AudioRtp::createNewSession (SipCall *ca) { ...@@ -68,13 +68,13 @@ AudioRtp::createNewSession (SipCall *ca) {
symetric = true; symetric = true;
} }
if (manager->useAlsa) { #ifdef ALSA
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, RTXThread = new AudioRtpRTX (ca, manager->audiodriver,
manager->audiodriverReadAlsa, manager, symetric); manager->audiodriverReadAlsa, manager, symetric);
} else { #else
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager, RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager,
symetric); symetric);
} #endif
if (RTXThread->start() != 0) { if (RTXThread->start() != 0) {
return -1; return -1;
...@@ -110,8 +110,9 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver, ...@@ -110,8 +110,9 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver,
this->ca = sipcall; this->ca = sipcall;
this->sym =sym; this->sym =sym;
this->audioDevice = driver; this->audioDevice = driver;
if (manager->useAlsa) #ifdef ALSA
this->audioDeviceRead = read_driver; this->audioDeviceRead = read_driver;
#endif
// TODO: Change bind address according to user settings. // TODO: Change bind address according to user settings.
InetHostAddress local_ip("0.0.0.0"); InetHostAddress local_ip("0.0.0.0");
...@@ -254,18 +255,19 @@ AudioRtpRTX::run (void) { ...@@ -254,18 +255,19 @@ AudioRtpRTX::run (void) {
// Send session // Send session
//////////////////////////// ////////////////////////////
if (!manager->mute) { if (!manager->mute) {
if (manager->useAlsa) { #ifdef ALSA
i = audioDeviceRead->readBuffer (data_from_mic, 320); i = audioDeviceRead->readBuffer (data_from_mic, 320);
} else { #else
i = audioDevice->readBuffer (data_from_mic, 320); i = audioDevice->readBuffer (data_from_mic, 320);
} #endif
} else { } else {
// When IP-phone user click on mute button, we read buffer of a // When IP-phone user click on mute button, we read buffer of a
// temp buffer to avoid delay in sound. // temp buffer to avoid delay in sound.
if (manager->useAlsa) #ifdef
i = audioDeviceRead->readBuffer (data_mute, 320); i = audioDeviceRead->readBuffer (data_mute, 320);
else #else
i = audioDevice->readBuffer (data_mute, 320); i = audioDevice->readBuffer (data_mute, 320);
#endif
} }
// TODO : return an error because no sound // TODO : return an error because no sound
......
...@@ -141,12 +141,10 @@ Manager::createSettingsPath (void) { ...@@ -141,12 +141,10 @@ Manager::createSettingsPath (void) {
void void
Manager::selectAudioDriver (void) { Manager::selectAudioDriver (void) {
if (Config::getb("Audio", "Drivers.driverOSS")) { if (Config::getb("Audio", "Drivers.driverOSS")) {
useAlsa = false;
this->audiodriver = new AudioDriversOSS (AudioDrivers::ReadWrite); this->audiodriver = new AudioDriversOSS (AudioDrivers::ReadWrite);
} }
if (Config::getb("Audio", "Drivers.driverALSA")) { if (Config::getb("Audio", "Drivers.driverALSA")) {
#ifdef ALSA #ifdef ALSA
useAlsa = true;
this->audiodriver = new AudioDriversALSA (AudioDrivers::WriteOnly); this->audiodriver = new AudioDriversALSA (AudioDrivers::WriteOnly);
this->audiodriverReadAlsa = new AudioDriversALSA (AudioDrivers::ReadOnly); this->audiodriverReadAlsa = new AudioDriversALSA (AudioDrivers::ReadOnly);
#endif #endif
......
...@@ -46,7 +46,6 @@ public: ...@@ -46,7 +46,6 @@ public:
#ifdef ALSA #ifdef ALSA
AudioDrivers *audiodriverReadAlsa; AudioDrivers *audiodriverReadAlsa;
#endif #endif
bool useAlsa;
ToneGenerator *tone; ToneGenerator *tone;
QString *DirectCall; // from -p argv QString *DirectCall; // from -p argv
bool mute; bool mute;
......
Markdown is supported
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