-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
702 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 CrSjimo * | ||
* * | ||
* This file is part of TALCS. * | ||
* * | ||
* TALCS is free software: you can redistribute it and/or modify it under the * | ||
* terms of the GNU Lesser General Public License as published by the Free * | ||
* Software Foundation, either version 3 of the License, or (at your option) * | ||
* any later version. * | ||
* * | ||
* TALCS is distributed in the hope that it will be useful, but WITHOUT ANY * | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * | ||
* more details. * | ||
* * | ||
* You should have received a copy of the GNU Lesser General Public License * | ||
* along with TALCS. If not, see <https://www.gnu.org/licenses/>. * | ||
******************************************************************************/ | ||
|
||
#include "AbstractOutputContext.h" | ||
#include "AbstractOutputContext_p.h" | ||
|
||
#include <TalcsCore/MixerAudioSource.h> | ||
#include <TalcsDevice/AudioSourcePlayback.h> | ||
|
||
namespace talcs { | ||
|
||
AbstractOutputContext::AbstractOutputContext(QObject *parent) : QObject(parent), d_ptr(new AbstractOutputContextPrivate) { | ||
Q_D(AbstractOutputContext); | ||
d->q_ptr = this; | ||
|
||
d->preMixer = std::make_unique<MixerAudioSource>(); | ||
d->controlMixer = std::make_unique<MixerAudioSource>(); | ||
d->playback = std::make_unique<AudioSourcePlayback>(d->controlMixer.get(), false, false); | ||
|
||
d->controlMixer->addSource(d->preMixer.get()); | ||
} | ||
|
||
AbstractOutputContext::~AbstractOutputContext() = default; | ||
|
||
AudioDevice *AbstractOutputContext::device() const { | ||
Q_D(const AbstractOutputContext); | ||
return d->device; | ||
} | ||
|
||
AudioSourcePlayback *AbstractOutputContext::playback() const { | ||
Q_D(const AbstractOutputContext); | ||
return d->playback.get(); | ||
} | ||
|
||
MixerAudioSource *AbstractOutputContext::controlMixer() const { | ||
Q_D(const AbstractOutputContext); | ||
return d->controlMixer.get(); | ||
} | ||
|
||
MixerAudioSource *AbstractOutputContext::preMixer() const { | ||
Q_D(const AbstractOutputContext); | ||
return d->preMixer.get(); | ||
} | ||
|
||
void AbstractOutputContext::setDevice(AudioDevice *device) { | ||
Q_D(AbstractOutputContext); | ||
d->device = device; | ||
emit deviceChanged(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 CrSjimo * | ||
* * | ||
* This file is part of TALCS. * | ||
* * | ||
* TALCS is free software: you can redistribute it and/or modify it under the * | ||
* terms of the GNU Lesser General Public License as published by the Free * | ||
* Software Foundation, either version 3 of the License, or (at your option) * | ||
* any later version. * | ||
* * | ||
* TALCS is distributed in the hope that it will be useful, but WITHOUT ANY * | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * | ||
* more details. * | ||
* * | ||
* You should have received a copy of the GNU Lesser General Public License * | ||
* along with TALCS. If not, see <https://www.gnu.org/licenses/>. * | ||
******************************************************************************/ | ||
|
||
#ifndef TALCS_ABSTRACTOUTPUTCONTEXT_H | ||
#define TALCS_ABSTRACTOUTPUTCONTEXT_H | ||
|
||
#include <QObject> | ||
|
||
#include <TalcsDevice/TalcsDeviceGlobal.h> | ||
|
||
namespace talcs { | ||
|
||
class AudioDevice; | ||
class AudioSourcePlayback; | ||
|
||
class MixerAudioSource; | ||
|
||
class AbstractOutputContextPrivate; | ||
|
||
class TALCSDEVICE_EXPORT AbstractOutputContext : public QObject { | ||
Q_OBJECT | ||
Q_DECLARE_PRIVATE(AbstractOutputContext) | ||
public: | ||
~AbstractOutputContext() override; | ||
|
||
AudioDevice *device() const; | ||
AudioSourcePlayback *playback() const; | ||
MixerAudioSource *controlMixer() const; | ||
MixerAudioSource *preMixer() const; | ||
|
||
signals: | ||
void bufferSizeChanged(qint64 bufferSize); | ||
void sampleRateChanged(double sampleRate); | ||
void deviceChanged(); | ||
|
||
protected: | ||
explicit AbstractOutputContext(QObject *parent = nullptr); | ||
|
||
void setDevice(AudioDevice *device); | ||
|
||
private: | ||
QScopedPointer<AbstractOutputContextPrivate> d_ptr; | ||
|
||
}; | ||
|
||
} // talcs | ||
|
||
#endif //TALCS_ABSTRACTOUTPUTCONTEXT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 CrSjimo * | ||
* * | ||
* This file is part of TALCS. * | ||
* * | ||
* TALCS is free software: you can redistribute it and/or modify it under the * | ||
* terms of the GNU Lesser General Public License as published by the Free * | ||
* Software Foundation, either version 3 of the License, or (at your option) * | ||
* any later version. * | ||
* * | ||
* TALCS is distributed in the hope that it will be useful, but WITHOUT ANY * | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * | ||
* more details. * | ||
* * | ||
* You should have received a copy of the GNU Lesser General Public License * | ||
* along with TALCS. If not, see <https://www.gnu.org/licenses/>. * | ||
******************************************************************************/ | ||
|
||
#ifndef TALCS_ABSTRACTOUTPUTCONTEXT_P_H | ||
#define TALCS_ABSTRACTOUTPUTCONTEXT_P_H | ||
|
||
#include <memory> | ||
|
||
#include <TalcsDevice/AbstractOutputContext.h> | ||
|
||
namespace talcs { | ||
class AbstractOutputContextPrivate { | ||
Q_DECLARE_PUBLIC(AbstractOutputContext) | ||
public: | ||
AbstractOutputContext *q_ptr; | ||
|
||
std::unique_ptr<MixerAudioSource> preMixer; | ||
std::unique_ptr<MixerAudioSource> controlMixer; | ||
std::unique_ptr<AudioSourcePlayback> playback; | ||
AudioDevice *device = nullptr; | ||
}; | ||
} | ||
|
||
#endif //TALCS_ABSTRACTOUTPUTCONTEXT_P_H |
Oops, something went wrong.