mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 22:27:13 +02:00
remove AudioClient dependency on Recorder
This commit is contained in:
parent
eebb21656e
commit
343b09c855
5 changed files with 15 additions and 17 deletions
|
@ -490,9 +490,12 @@ void MyAvatar::startRecording() {
|
|||
if (!_recorder) {
|
||||
_recorder = RecorderPointer(new Recorder(this));
|
||||
}
|
||||
DependencyManager::get<AudioClient>()->setRecorder(_recorder);
|
||||
_recorder->startRecording();
|
||||
// connect to AudioClient's signal so we get input audio
|
||||
auto audioClient = DependencyManager::get<AudioClient>();
|
||||
connect(audioClient.data(), &AudioClient::inputReceived, _recorder.data(),
|
||||
&Recorder::recordAudio, Qt::BlockingQueuedConnection);
|
||||
|
||||
_recorder->startRecording();
|
||||
}
|
||||
|
||||
void MyAvatar::stopRecording() {
|
||||
|
@ -504,6 +507,10 @@ void MyAvatar::stopRecording() {
|
|||
return;
|
||||
}
|
||||
if (_recorder) {
|
||||
// stop grabbing audio from the AudioClient
|
||||
auto audioClient = DependencyManager::get<AudioClient>();
|
||||
disconnect(audioClient.data(), 0, _recorder.data(), 0);
|
||||
|
||||
_recorder->stopRecording();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -685,10 +685,6 @@ void AudioClient::handleAudioInput() {
|
|||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
if (_recorder && _recorder.data()->isRecording()) {
|
||||
_recorder.data()->record(reinterpret_cast<char*>(networkAudioSamples), numNetworkBytes);
|
||||
}
|
||||
|
||||
if (audioMixer && audioMixer->getActiveSocket()) {
|
||||
glm::vec3 headPosition = _positionGetter();
|
||||
glm::quat headOrientation = _orientationGetter();
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#include <RingBufferHistory.h>
|
||||
#include <StDev.h>
|
||||
|
||||
#include "Recorder.h"
|
||||
|
||||
#include "AudioIOStats.h"
|
||||
#include "AudioNoiseGate.h"
|
||||
|
||||
|
@ -112,8 +110,6 @@ public:
|
|||
|
||||
float getInputRingBufferMsecsAvailable() const;
|
||||
float getAudioOutputMsecsUnplayed() const;
|
||||
|
||||
void setRecorder(RecorderPointer recorder) { _recorder = recorder; }
|
||||
|
||||
int getOutputBufferSize() { return _outputBufferSizeFrames; }
|
||||
|
||||
|
@ -273,8 +269,6 @@ private:
|
|||
|
||||
AudioOutputIODevice _audioOutputIODevice;
|
||||
|
||||
WeakRecorderPointer _recorder;
|
||||
|
||||
AudioIOStats _stats;
|
||||
|
||||
AudioNoiseGate _inputGate;
|
||||
|
|
|
@ -136,7 +136,6 @@ void Recorder::record() {
|
|||
}
|
||||
}
|
||||
|
||||
void Recorder::record(char* samples, int size) {
|
||||
QByteArray byteArray(samples, size);
|
||||
_recording->addAudioPacket(byteArray);
|
||||
void Recorder::recordAudio(const QByteArray& audioByteArray) {
|
||||
_recording->addAudioPacket(audioByteArray);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ typedef QSharedPointer<Recorder> RecorderPointer;
|
|||
typedef QWeakPointer<Recorder> WeakRecorderPointer;
|
||||
|
||||
/// Records a recording
|
||||
class Recorder {
|
||||
class Recorder : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Recorder(AvatarData* avatar);
|
||||
|
||||
|
@ -40,7 +41,8 @@ public slots:
|
|||
void stopRecording();
|
||||
void saveToFile(const QString& file);
|
||||
void record();
|
||||
void record(char* samples, int size);
|
||||
void recordAudio(const QByteArray& audioArray);
|
||||
|
||||
|
||||
private:
|
||||
QElapsedTimer _timer;
|
||||
|
|
Loading…
Reference in a new issue