Skip to content

Commit

Permalink
update audio plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
CrSjimo committed Jul 25, 2024
1 parent e964856 commit afb5b6b
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 222 deletions.
18 changes: 9 additions & 9 deletions src/plugins/audioplugin/audio/audioclip/audioclipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

namespace Audio {

void AudioClipInterfacePrivate::handleEntityGainChanged(double gainDecibel) const {
void AudioClipInterfacePrivate::handleGainChanged(double gainDecibel) const {
audioClipContext->controlMixer()->setGain(talcs::Decibels::decibelsToGain(gainDecibel));
}
void AudioClipInterfacePrivate::handleEntityPanChanged(double pan) const {
void AudioClipInterfacePrivate::handlePanChanged(double pan) const {
audioClipContext->controlMixer()->setPan(static_cast<float>(pan));
}
void AudioClipInterfacePrivate::handleEntityMuteChanged(bool isMute) const {
void AudioClipInterfacePrivate::handleMuteChanged(bool isMute) const {
audioClipContext->controlMixer()->setSilentFlags(isMute ? -1 : 0);
}
void AudioClipInterfacePrivate::handleStartChanged(int start) const {
Expand Down Expand Up @@ -60,13 +60,13 @@ namespace Audio {
d->trackInterface = trackInterface;

connect(entity->control(), &QDspx::BusControlEntity::gainChanged, this, [=](double gainDecibel) {
d->handleEntityGainChanged(gainDecibel);
d->handleGainChanged(gainDecibel);
});
connect(entity->control(), &QDspx::BusControlEntity::panChanged, this, [=](double pan) {
d->handleEntityPanChanged(pan);
d->handlePanChanged(pan);
});
connect(entity->control(), &QDspx::BusControlEntity::muteChanged, this, [=](bool isMuted) {
d->handleEntityMuteChanged(isMuted);
d->handleMuteChanged(isMuted);
});

connect(entity->time(), &QDspx::ClipTimeEntity::startChanged, this, [=](int start) {
Expand All @@ -86,9 +86,9 @@ namespace Audio {
d->handlePathChanged(path);
});

d->handleEntityGainChanged(entity->control()->gain());
d->handleEntityPanChanged(entity->control()->pan());
d->handleEntityMuteChanged(entity->control()->mute());
d->handleGainChanged(entity->control()->gain());
d->handlePanChanged(entity->control()->pan());
d->handleMuteChanged(entity->control()->mute());
d->handleStartChanged(entity->time()->start());
d->handleClipStartChanged(entity->time()->clipStart());
d->handleClipLenChanged(entity->time()->clipLength());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace Audio {

TrackInterface *trackInterface;

void handleEntityGainChanged(double gainDecibel) const;
void handleEntityPanChanged(double pan) const;
void handleEntityMuteChanged(bool isMute) const;
void handleGainChanged(double gainDecibel) const;
void handlePanChanged(double pan) const;
void handleMuteChanged(bool isMute) const;

void handleStartChanged(int start) const;
void handleClipStartChanged(int clipStart) const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "audiocontextinterface.h"
#include "audiocontextinterface_p.h"

#include <TalcsCore/PositionableMixerAudioSource.h>
#include <TalcsCore/Decibels.h>
#include <TalcsFormat/FormatManager.h>
#include <TalcsDevice/AudioDevice.h>
#include <TalcsDspx/DspxProjectContext.h>
Expand All @@ -22,7 +24,17 @@ namespace Audio {
Q_Q(AudioContextInterface);
projectAddOn = projectAddOn_;
projectContext = projectAddOn->projectContext();

auto model = q->windowHandle()->doc()->dataModel().model();
QObject::connect(model->master()->control(), &QDspx::BusControlEntity::gainChanged, q, [=] (double gainDecibel) {
handleGainChanged(gainDecibel);
});
QObject::connect(model->master()->control(), &QDspx::BusControlEntity::panChanged, q, [=] (double pan) {
handlePanChanged(pan);
});
QObject::connect(model->master()->control(), &QDspx::BusControlEntity::muteChanged, q, [=] (bool isMuted) {
handleMuteChanged(isMuted);
});
QObject::connect(model->tracks(), &QDspx::TrackListEntity::inserted, q, [=](int index, const QVector<QDspx::TrackEntity *> &trackEntities) {
DEVICE_LOCKER;
for (auto trackEntity : trackEntities) {
Expand All @@ -40,14 +52,24 @@ namespace Audio {
}
});

// TODO connect doc signals

handleGainChanged(model->master()->control()->gain());
handlePanChanged(model->master()->control()->pan());
handleMuteChanged(model->master()->control()->mute());
for (int i = 0; i < model->tracks()->size(); i++) {
auto trackEntity = model->tracks()->at(i);
handleTrackInserted(i, trackEntity);
}


}
void AudioContextInterfacePrivate::handleGainChanged(double gainDecibel) const {
projectContext->masterControlMixer()->setGain(talcs::Decibels::decibelsToGain(gainDecibel));
}
void AudioContextInterfacePrivate::handlePanChanged(double pan) const {
projectContext->masterControlMixer()->setPan(static_cast<float>(pan));
}
void AudioContextInterfacePrivate::handleMuteChanged(bool isMuted) const {
projectContext->masterControlMixer()->setSilentFlags(isMuted ? -1 : 0);
}
void AudioContextInterfacePrivate::handleTrackInserted(int index, QDspx::TrackEntity *trackEntity) {
Q_Q(AudioContextInterface);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ namespace Audio {

void init(Internal::ProjectAddOn *projectAddOn);

void handleGainChanged(double gainDecibel) const;
void handlePanChanged(double pan) const;
void handleMuteChanged(bool isMuted) const;

void handleTrackInserted(int index, QDspx::TrackEntity *trackEntity);
void handleTrackAboutToRemove(int index, QDspx::TrackEntity *trackEntity);
void handleTrackMoved(int index, int count, int dest) const;
Expand Down
14 changes: 0 additions & 14 deletions src/plugins/audioplugin/audio/format/formatentry.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions src/plugins/audioplugin/audio/format/formatentry.h

This file was deleted.

72 changes: 0 additions & 72 deletions src/plugins/audioplugin/audio/format/formatmanager.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions src/plugins/audioplugin/audio/format/formatmanager.h

This file was deleted.

21 changes: 0 additions & 21 deletions src/plugins/audioplugin/audio/format/formatmanager_p.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/plugins/audioplugin/audio/iaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Audio {
Q_D(const IAudio);
return isVST ? d->vstOutputSystemInterface : d->outputSystemInterface;
}
FormatManager *IAudio::formatManager() const {
talcs::FormatManager *IAudio::formatManager() const {
Q_D(const IAudio);
return d->formatManager;
}
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/audioplugin/audio/iaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

#include <QObject>

namespace talcs {
class FormatManager;
}

namespace Audio {

namespace Internal {
class AudioPlugin;
}
class OutputSystemInterface;

class FormatManager;

class IAudioPrivate;

class AUDIO_EXPORT IAudio : public QObject {
Expand All @@ -26,7 +28,7 @@ namespace Audio {

OutputSystemInterface *outputSystemInterface(bool isVST) const;

FormatManager *formatManager() const;
talcs::FormatManager *formatManager() const;

private:
explicit IAudio(QObject *parent = nullptr);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/audioplugin/audio/iaudio_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Audio {
IAudio *q_ptr;
OutputSystemInterface *outputSystemInterface;
OutputSystemInterface *vstOutputSystemInterface;
FormatManager *formatManager;
talcs::FormatManager *formatManager;
};
}

Expand Down
Loading

0 comments on commit afb5b6b

Please sign in to comment.