mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
8c05399e41
commit
2353a66fde
|
@ -62,7 +62,7 @@ OpenAL::OpenAL()
|
|||
connect(this, &Audio::startActive, &voiceTimer, static_cast<void (QTimer::*)(int)>(&QTimer::start));
|
||||
connect(&voiceTimer, &QTimer::timeout, this, &Audio::stopActive);
|
||||
|
||||
connect(&captureTimer, &QTimer::timeout, this, &OpenAL::doCapture);
|
||||
connect(&captureTimer, &QTimer::timeout, this, &OpenAL::doAudio);
|
||||
captureTimer.setInterval(AUDIO_FRAME_DURATION / 2);
|
||||
captureTimer.setSingleShot(false);
|
||||
captureTimer.start();
|
||||
|
@ -301,7 +301,7 @@ bool OpenAL::initInput(const QString& deviceName, uint32_t channels)
|
|||
assert(!alInDev);
|
||||
|
||||
// TODO: Try to actually detect if our audio source is stereo
|
||||
int stereoFlag = AUDIO_CHANNELS == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
||||
int stereoFlag = channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
||||
const uint32_t sampleRate = AUDIO_SAMPLE_RATE;
|
||||
const uint16_t frameDuration = AUDIO_FRAME_DURATION;
|
||||
const ALCsizei bufSize = (frameDuration * sampleRate * 4) / 1000 * channels;
|
||||
|
@ -555,7 +555,7 @@ void OpenAL::stopActive()
|
|||
/**
|
||||
* @brief Called on the captureTimer events to capture audio
|
||||
*/
|
||||
void OpenAL::doCapture()
|
||||
void OpenAL::doAudio()
|
||||
{
|
||||
QMutexLocker lock(&audioLock);
|
||||
|
||||
|
|
|
@ -104,13 +104,13 @@ protected:
|
|||
bool autoInitOutput();
|
||||
|
||||
bool initInput(const QString& deviceName, uint32_t channels);
|
||||
virtual void doAudio();
|
||||
|
||||
private:
|
||||
virtual bool initInput(const QString& deviceName);
|
||||
virtual bool initOutput(const QString& outDevDescr);
|
||||
void playMono16SoundCleanup();
|
||||
float getVolume(int16_t *buf);
|
||||
void doCapture();
|
||||
|
||||
protected:
|
||||
QThread* audioThread;
|
||||
|
|
|
@ -55,12 +55,12 @@ class OpenAL2 : public OpenAL
|
|||
public:
|
||||
OpenAL2();
|
||||
|
||||
private:
|
||||
bool initInput(const QString& deviceName);
|
||||
bool initOutput(const QString& outDevDescr);
|
||||
void cleanupOutput();
|
||||
protected:
|
||||
bool initInput(const QString& deviceName) override;
|
||||
bool initOutput(const QString& outDevDescr) override;
|
||||
void cleanupOutput() override;
|
||||
void playMono16SoundCleanup();
|
||||
void doAudio();
|
||||
void doAudio() override;
|
||||
void doInput();
|
||||
void doOutput();
|
||||
bool loadOpenALExtensions(ALCdevice* dev);
|
||||
|
|
Loading…
Reference in New Issue
Block a user