Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SetupConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ if(BUILD_CONFIGURATION STREQUAL "APP-WEB")
set(MUSE_MODULE_ACCESSIBILITY OFF)
set(MUSE_MODULE_DOCKWINDOW OFF)
set(MUSE_MODULE_MIDI OFF)
set(MUSE_MODULE_MIDIREMOTE OFF)
set(MUSE_MODULE_MUSESAMPLER OFF)
set(MUSE_MODULE_NETWORK OFF)
set(MUSE_MODULE_VST OFF)
Expand Down Expand Up @@ -212,6 +213,7 @@ if(BUILD_CONFIGURATION STREQUAL "VTEST")
set(MUSE_MODULE_LANGUAGES OFF)
set(MUSE_MODULE_LEARN OFF)
set(MUSE_MODULE_MIDI OFF)
set(MUSE_MODULE_MIDIREMOTE OFF)
set(MUSE_MODULE_MPE OFF)
set(MUSE_MODULE_MULTIWINDOWS OFF)
set(MUSE_MODULE_MUSESAMPLER OFF)
Expand Down Expand Up @@ -280,6 +282,7 @@ if(BUILD_CONFIGURATION STREQUAL "UTEST")
set(MUSE_MODULE_INTERACTIVE OFF)
set(MUSE_MODULE_LEARN OFF)
set(MUSE_MODULE_MIDI OFF)
set(MUSE_MODULE_MIDIREMOTE OFF)
set(MUSE_MODULE_MPE_QML OFF)
set(MUSE_MODULE_MULTIWINDOWS OFF)
set(MUSE_MODULE_MUSESAMPLER OFF)
Expand Down
1 change: 1 addition & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ add_to_link_if_exists(muse::interactive)
add_to_link_if_exists(muse::languages)
add_to_link_if_exists(muse::learn)
add_to_link_if_exists(muse::midi)
add_to_link_if_exists(muse::midiremote)
add_to_link_if_exists(muse::mpe)
add_to_link_if_exists(muse::multiwindows)
add_to_link_if_exists(muse::musesampler)
Expand Down
7 changes: 7 additions & 0 deletions src/app/appfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
#include "framework/stubs/midi/midistubmodule.h"
#endif

#ifdef MUSE_MODULE_MIDIREMOTE
#include "framework/midiremote/midiremotemodule.h"
#else
#include "framework/stubs/midiremote/midiremotestubmodule.h"
#endif

#ifdef MUSE_MODULE_MPE
#include "framework/mpe/mpemodule.h"
#else
Expand Down Expand Up @@ -298,6 +304,7 @@ std::shared_ptr<muse::IApplication> AppFactory::newGuiApp(const CmdOptions& opti
app->addModule(new muse::interactive::InteractiveModule());
#endif
app->addModule(new muse::midi::MidiModule());
app->addModule(new muse::midiremote::MidiRemoteModule());
app->addModule(new muse::mpe::MpeModule());

#ifdef MUSE_MODULE_MUSESAMPLER
Expand Down
4 changes: 4 additions & 0 deletions src/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ if (MUSE_MODULE_MIDI)
add_subdirectory(midi)
endif()

if (MUSE_MODULE_MIDIREMOTE)
add_subdirectory(midiremote)
endif()

if (MUSE_MODULE_MPE)
add_subdirectory(mpe)
endif()
Expand Down
21 changes: 20 additions & 1 deletion src/framework/audio/common/audiotypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,26 @@ enum class AudioFxCategory {
FxRestoration,
FxReverb,
FxSurround,
FxTools
FxTools,
FxOther,
};

static const std::unordered_map<AudioFxCategory, String> AUDIO_FX_CATEGORY_TO_STRING_MAP {
{ AudioFxCategory::FxEqualizer, u"EQ" },
{ AudioFxCategory::FxAnalyzer, u"Analyzer" },
{ AudioFxCategory::FxDelay, u"Delay" },
{ AudioFxCategory::FxDistortion, u"Distortion" },
{ AudioFxCategory::FxDynamics, u"Dynamics" },
{ AudioFxCategory::FxFilter, u"Filter" },
{ AudioFxCategory::FxGenerator, u"Generator" },
{ AudioFxCategory::FxMastering, u"Mastering" },
{ AudioFxCategory::FxModulation, u"Modulation" },
{ AudioFxCategory::FxPitchShift, u"Pitch Shift" },
{ AudioFxCategory::FxRestoration, u"Restoration" },
{ AudioFxCategory::FxReverb, u"Reverb" },
{ AudioFxCategory::FxSurround, u"Surround" },
{ AudioFxCategory::FxTools, u"Tools" },
{ AudioFxCategory::FxOther, u"Fx" },
};

using AudioFxCategories = std::set<AudioFxCategory>;
Expand Down
17 changes: 13 additions & 4 deletions src/framework/audio/common/audioutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef MUSE_AUDIO_AUDIOUTILS_H
#define MUSE_AUDIO_AUDIOUTILS_H
#pragma once

#include "audiotypes.h"
#include "soundfonttypes.h"
Expand Down Expand Up @@ -92,6 +91,18 @@ inline String audioSourceCategoryName(const AudioInputParams& params)
return String::fromStdString(params.resourceMeta.id);
}

inline AudioFxCategories audioFxCategoriesFromString(const String& str)
{
StringList list = str.split('|');

AudioFxCategories result;
for (const String& name : list) {
result.insert(muse::key(AUDIO_FX_CATEGORY_TO_STRING_MAP, name, AudioFxCategory::FxOther));
}

return result;
}

inline bool isOnlineAudioResource(const AudioResourceMeta& meta)
{
const String& attr = meta.attributeVal(u"isOnline");
Expand Down Expand Up @@ -119,5 +130,3 @@ inline samples_t minSamplesToReserve(RenderMode mode)
return 1024;
}
}

#endif // MUSE_AUDIO_AUDIOUTILS_H
12 changes: 8 additions & 4 deletions src/framework/audio/engine/ifxprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MUSE_AUDIO_IAUDIOPROCESSOR_H
#define MUSE_AUDIO_IAUDIOPROCESSOR_H

#pragma once

#include <memory>

Expand All @@ -33,17 +33,21 @@ class IFxProcessor
virtual ~IFxProcessor() = default;

virtual AudioFxType type() const = 0;

virtual const AudioFxParams& params() const = 0;
virtual async::Channel<audio::AudioFxParams> paramsChanged() const = 0;

virtual void setOutputSpec(const OutputSpec& spec) = 0;

virtual bool active() const = 0;
virtual void setActive(bool active) = 0;

virtual void setPlaying(bool playing) = 0;

virtual bool shouldProcessDuringSilence() const = 0;

virtual void process(float* buffer, unsigned int sampleCount, muse::audio::msecs_t playbackPosition = 0) = 0;
};

using IFxProcessorPtr = std::shared_ptr<IFxProcessor>;
}

#endif // MUSE_AUDIO_IAUDIOPROCESSOR_H
2 changes: 2 additions & 0 deletions src/framework/audio/engine/ifxresolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class IFxResolver : MODULE_GLOBAL_INTERFACE
const OutputSpec& outputSpec) = 0;
virtual std::vector<IFxProcessorPtr> resolveMasterFxList(const AudioFxChain& fxChain, const OutputSpec& outputSpec) = 0;
virtual AudioResourceMetaList resolveResources() const = 0;

virtual void refresh() = 0;
virtual void clearAllFx() = 0;
};
Expand All @@ -55,6 +56,7 @@ class IFxResolver : MODULE_GLOBAL_INTERFACE
virtual std::vector<IFxProcessorPtr> resolveFxList(const TrackId trackId, const AudioFxChain& fxChain,
const OutputSpec& outputSpec) = 0;
virtual AudioResourceMetaList resolveAvailableResources() const = 0;

virtual void registerResolver(const AudioFxType type, IResolverPtr resolver) = 0;
virtual void clearAllFx() = 0;
};
Expand Down
16 changes: 2 additions & 14 deletions src/framework/audio/engine/internal/fx/abstractfxresolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ std::vector<IFxProcessorPtr> AbstractFxResolver::resolveFxList(const TrackId tra
FxMap& fxMap = m_tracksFxMap[trackId];
updateTrackFxMap(fxMap, trackId, fxChain, outputSpec);

std::vector<IFxProcessorPtr> result;

for (const auto& pair : fxMap) {
result.emplace_back(pair.second);
}

return result;
return muse::values(fxMap);
}

std::vector<IFxProcessorPtr> AbstractFxResolver::resolveMasterFxList(const AudioFxChain& fxChain, const OutputSpec& outputSpec)
Expand All @@ -56,13 +50,7 @@ std::vector<IFxProcessorPtr> AbstractFxResolver::resolveMasterFxList(const Audio

updateMasterFxMap(fxChain, outputSpec);

std::vector<IFxProcessorPtr> result;

for (const auto& pair : m_masterFxMap) {
result.emplace_back(pair.second);
}

return result;
return muse::values(m_masterFxMap);
}

void AbstractFxResolver::refresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class AbstractFxResolver : public IFxResolver::IResolver
public:
std::vector<IFxProcessorPtr> resolveFxList(const TrackId trackId, const AudioFxChain& fxChain, const OutputSpec& outputSpec) override;
std::vector<IFxProcessorPtr> resolveMasterFxList(const AudioFxChain& fxChain, const OutputSpec& outputSpec) override;

void refresh() override;
void clearAllFx() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,15 @@ void ReverbProcessor::setActive(bool active)
m_params.active = active;
}

void ReverbProcessor::setPlaying(bool)
{
}

bool ReverbProcessor::shouldProcessDuringSilence() const
{
return false;
}

void ReverbProcessor::process(float* buffer, unsigned int sampleCount, muse::audio::msecs_t)
{
if (m_processor._blockSize != static_cast<int>(sampleCount)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class ReverbProcessor : public IFxProcessor
bool active() const override;
void setActive(bool active) override;

void setPlaying(bool playing) override;

bool shouldProcessDuringSilence() const override;

void process(float* buffer, unsigned int sampleCount, muse::audio::msecs_t playbackPosition = 0) override;

private:
Expand Down
33 changes: 23 additions & 10 deletions src/framework/audio/engine/internal/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ samples_t Mixer::process(float* outBuffer, samples_t samplesPerChannel)
size_t outBufferSize = samplesPerChannel * m_outputSpec.audioChannelCount;
std::fill(outBuffer, outBuffer + outBufferSize, 0.f);

if (m_isIdle && m_tracksToProcessWhenIdle.empty() && m_isSilence) {
if (m_isIdle && m_tracksToProcessWhenIdle.empty() && (m_isSilence && !m_shouldProcessMasterFxDuringSilence)) {
notifyNoAudioSignal();
return 0;
}
Expand Down Expand Up @@ -248,20 +248,15 @@ samples_t Mixer::process(float* outBuffer, samples_t samplesPerChannel)
writeTrackToAuxBuffers(trackBuffer.data(), channel->outputParams().auxSends, samplesPerChannel);
}

if (m_masterParams.muted || samplesPerChannel == 0 || m_isSilence) {
if (m_masterParams.muted || samplesPerChannel == 0 || (m_isSilence && !m_shouldProcessMasterFxDuringSilence)) {
notifyNoAudioSignal();
return 0;
}

processAuxChannels(outBuffer, samplesPerChannel);

for (IFxProcessorPtr& fxProcessor : m_masterFxProcessors) {
if (fxProcessor->active()) {
fxProcessor->process(outBuffer, samplesPerChannel, playbackPosition());
}
}

processMasterFx(outBuffer, samplesPerChannel);
completeOutput(outBuffer, samplesPerChannel);

notifyAboutAudioSignalChanges();

return samplesPerChannel;
Expand Down Expand Up @@ -364,6 +359,10 @@ void Mixer::setIsActive(bool arg)
aux.channel->setIsActive(arg);
}
}

for (IFxProcessorPtr& fx : m_masterFxProcessors) {
fx->setPlaying(arg);
}
}

void Mixer::addClock(IClockPtr clock)
Expand Down Expand Up @@ -397,13 +396,18 @@ void Mixer::setMasterOutputParams(const AudioOutputParams& params)

m_masterFxProcessors.clear();
m_masterFxProcessors = fxResolver()->resolveMasterFxList(params.fxChain, m_outputSpec);
m_shouldProcessMasterFxDuringSilence = false;

for (IFxProcessorPtr& fx : m_masterFxProcessors) {
fx->setOutputSpec(m_outputSpec);
fx->paramsChanged().onReceive(this, [this](const AudioFxParams& fxParams) {
m_masterParams.fxChain.insert_or_assign(fxParams.chainOrder, fxParams);
m_masterOutputParamsChanged.send(m_masterParams);
});
}, async::Asyncable::Mode::SetReplace);

if (!m_shouldProcessMasterFxDuringSilence && fx->shouldProcessDuringSilence()) {
m_shouldProcessMasterFxDuringSilence = true;
}
}

AudioOutputParams resultParams = params;
Expand Down Expand Up @@ -556,6 +560,15 @@ void Mixer::processAuxChannels(float* buffer, samples_t samplesPerChannel)
}
}

void Mixer::processMasterFx(float* buffer, samples_t samplesPerChannel)
{
for (IFxProcessorPtr& fxProcessor : m_masterFxProcessors) {
if (fxProcessor->active()) {
fxProcessor->process(buffer, samplesPerChannel, playbackPosition());
}
}
}

void Mixer::completeOutput(float* buffer, samples_t samplesPerChannel)
{
IF_ASSERT_FAILED(buffer) {
Expand Down
6 changes: 5 additions & 1 deletion src/framework/audio/engine/internal/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ class Mixer : public AbstractAudioSource, public IGetPlaybackPosition, public as
// IAudioSource
void setOutputSpec(const OutputSpec& spec) override;
unsigned int audioChannelsCount() const override;
samples_t process(float* outBuffer, samples_t samplesPerChannel) override;

void setIsActive(bool arg) override;

samples_t process(float* outBuffer, samples_t samplesPerChannel) override;

private:
using TracksData = std::map<TrackId, std::vector<float> >;

Expand All @@ -87,6 +89,7 @@ class Mixer : public AbstractAudioSource, public IGetPlaybackPosition, public as
void prepareAuxBuffers(size_t outBufferSize);
void writeTrackToAuxBuffers(const float* trackBuffer, const AuxSendsParams& auxSends, samples_t samplesPerChannel);
void processAuxChannels(float* buffer, samples_t samplesPerChannel);
void processMasterFx(float* buffer, samples_t samplesPerChannel);
void completeOutput(float* buffer, samples_t samplesPerChannel);

bool useMultithreading() const;
Expand Down Expand Up @@ -119,6 +122,7 @@ class Mixer : public AbstractAudioSource, public IGetPlaybackPosition, public as
mutable AudioSignalsNotifier m_audioSignalNotifier;

bool m_isSilence = false;
bool m_shouldProcessMasterFxDuringSilence = false;
bool m_isIdle = false;
};

Expand Down
4 changes: 4 additions & 0 deletions src/framework/audio/engine/internal/mixerchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ void MixerChannel::setIsActive(bool arg)
if (m_audioSource) {
m_audioSource->setIsActive(arg);
}

for (IFxProcessorPtr& fx : m_fxProcessors) {
fx->setPlaying(arg);
}
}

void MixerChannel::setOutputSpec(const OutputSpec& spec)
Expand Down
17 changes: 11 additions & 6 deletions src/framework/autobot/internal/autobotinteractive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,24 @@ void AutobotInteractive::raise(const UriQuery& uri)
m_real->raise(uri);
}

void AutobotInteractive::close(const UriQuery& uri)
async::Promise<Ret> AutobotInteractive::close(const UriQuery& uri)
{
m_real->close(uri);
return m_real->close(uri);
}

void AutobotInteractive::close(const Uri& uri)
async::Promise<Ret> AutobotInteractive::close(const Uri& uri)
{
m_real->close(uri);
return m_real->close(uri);
}

void AutobotInteractive::closeAllDialogs()
Ret AutobotInteractive::closeSync(const UriQuery& uri)
{
m_real->closeAllDialogs();
return m_real->closeSync(uri);
}

Ret AutobotInteractive::closeAllDialogsSync()
{
return m_real->closeAllDialogsSync();
}

ValCh<Uri> AutobotInteractive::currentUri() const
Expand Down
Loading
Loading