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
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ Ret SoundTrackWriter::generateAudioData()

sendStepProgress(PREPARE_STEP, inputBufferOffset, inputBufferMaxOffset);

const std::thread::id thisThId = std::this_thread::get_id();
while (inputBufferOffset < inputBufferMaxOffset && !m_isAborted) {
m_source->process(m_intermBuffer.data(), m_renderStep);

Expand All @@ -163,7 +162,6 @@ Ret SoundTrackWriter::generateAudioData()

//! NOTE It is necessary for cancellation to work
//! and for information about the audio signal to be transmitted.
async::processMessages(thisThId);
rpcChannel()->process();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ using namespace muse::audio;
using namespace muse::audio::synth;
using namespace muse::mpe;

static constexpr bool FLUID_DEBUG = false;

static constexpr double FLUID_GLOBAL_VOLUME_GAIN = 4.8;
static constexpr int DEFAULT_MIDI_VOLUME = 100;
static constexpr msecs_t MIN_NOTE_LENGTH = 10;
Expand Down Expand Up @@ -90,7 +92,9 @@ Ret FluidSynth::init(const OutputSpec& spec)
LOGI() << message;
} break;
case FLUID_DBG: {
LOGD() << message;
if (FLUID_DEBUG) {
LOGD() << message;
}
} break;
}

Expand Down
11 changes: 8 additions & 3 deletions src/framework/global/thirdparty/kors_async/async/async.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,17 @@ class Async
struct Func : public ICallable
{
Call func;
Func(const Call& f = nullptr)
: func(f) {}
Func(const Call& f)
: func(f)
{
assert(func && "callback is nullptr");
}

void call(const void*) override
{
func();
if (func) {
func();
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class RpcPort
std::vector<T> m_buffer;
std::queue<T> m_pending;
std::function<void(const T&)> m_handler;
bool m_isProcessing = false;

public:

Expand All @@ -94,6 +95,19 @@ class RpcPort

assert(m_connPort);

assert(!m_isProcessing && "Recursive processing of messages is not allowed");

if (m_isProcessing) {
return;
}

struct Guard {
bool& flag;
Guard(bool& flag)
: flag(flag) { flag = true; }
~Guard() { flag = false; }
} guard { m_isProcessing };

// receive messages
m_buffer.clear();
bool ok = m_connPort->m_queue.tryPopAll(m_buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <algorithm>

#include <QItemSelectionModel>
#include <QTimer>

#include "async/async.h"
#include "translation.h"
Expand Down Expand Up @@ -425,7 +426,11 @@ bool ExportDialogModel::exportScores()
shouldDestinationFolderBeOpenedOnExport() };

std::shared_ptr<IExportProjectScenario> scenario = exportProjectScenario();
async::Async::call(nullptr, [scenario, params]() {

//! NOTE We can't use Async here
// because the async::processMessages is called deep within the functions,
// and this can't be done in Async's callback.
QTimer::singleShot(0, [scenario, params]() {
scenario->exportScores(params.notations, params.exportPath, params.selectedUnitType, params.openFolderOnExport);
});

Expand Down
Loading