mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-25 06:40:58 -04:00
started conversion of VOIP code (from Joss) into a plugin. Unfinished!
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4945 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8f0f6a9f3e
commit
fc15899f0f
23 changed files with 10288 additions and 0 deletions
76
plugins/VOIP/audiodevicehelper.cpp
Normal file
76
plugins/VOIP/audiodevicehelper.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
#include "audiodevicehelper.h"
|
||||
#include <iostream>
|
||||
|
||||
AudioDeviceHelper::AudioDeviceHelper()
|
||||
{
|
||||
}
|
||||
|
||||
QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
|
||||
QAudioFormat fmt;
|
||||
fmt.setFrequency(16000);
|
||||
fmt.setChannels(1);
|
||||
fmt.setSampleSize(16);
|
||||
fmt.setSampleType(QAudioFormat::SignedInt);
|
||||
fmt.setByteOrder(QAudioFormat::LittleEndian);
|
||||
fmt.setCodec("audio/pcm");
|
||||
|
||||
QAudioDeviceInfo it, dev;
|
||||
|
||||
dev = QAudioDeviceInfo::defaultInputDevice();
|
||||
if (dev.deviceName() != "pulse") {
|
||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) {
|
||||
if(it.deviceName() == "pulse") {
|
||||
dev = it;
|
||||
qDebug("Ok.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dev.deviceName() == "null") {
|
||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) {
|
||||
if(it.deviceName() != "null") {
|
||||
dev = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cerr << "input device : " << dev.deviceName().toStdString() << std::endl;
|
||||
return new QAudioInput(dev, fmt);
|
||||
}
|
||||
QAudioInput* AudioDeviceHelper::getPreferedInputDevice() {
|
||||
return AudioDeviceHelper::getDefaultInputDevice();
|
||||
}
|
||||
|
||||
QAudioOutput* AudioDeviceHelper::getDefaultOutputDevice() {
|
||||
QAudioFormat fmt;
|
||||
fmt.setFrequency(16000);
|
||||
fmt.setChannels(1);
|
||||
fmt.setSampleSize(16);
|
||||
fmt.setSampleType(QAudioFormat::SignedInt);
|
||||
fmt.setByteOrder(QAudioFormat::LittleEndian);
|
||||
fmt.setCodec("audio/pcm");
|
||||
|
||||
QAudioDeviceInfo it, dev;
|
||||
dev = QAudioDeviceInfo::defaultOutputDevice();
|
||||
if (dev.deviceName() != "pulse") {
|
||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
|
||||
if(it.deviceName() == "pulse") {
|
||||
dev = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dev.deviceName() == "null") {
|
||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
|
||||
if(it.deviceName() != "null") {
|
||||
dev = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cerr << "output device : " << dev.deviceName().toStdString() << std::endl;
|
||||
return new QAudioOutput(dev, fmt);
|
||||
}
|
||||
QAudioOutput* AudioDeviceHelper::getPreferedOutputDevice() {
|
||||
return AudioDeviceHelper::getDefaultOutputDevice();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue