Skip to content

Commit

Permalink
Merge pull request #15843 from RomanPudashkin/update_4.0.1
Browse files Browse the repository at this point in the history
update_4.0.1
  • Loading branch information
RomanPudashkin committed Jan 12, 2023
2 parents 76500c3 + 7273044 commit 9b70a8c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/engraving/libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5144,6 +5144,8 @@ void Score::undoRemoveStaff(Staff* staff)

staff->undoUnlink();

mu::remove_if(systemObjectStaves, [staff](Staff* s){ return s == staff; });

undo(new RemoveStaff(staff));
}

Expand Down
6 changes: 4 additions & 2 deletions src/framework/vst/internal/vstaudioclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,11 @@ void VstAudioClient::extractInputSamples(const audio::samples_t& sampleCount, co
return;
}

Steinberg::Vst::AudioBusBuffers& bus = m_processData.inputs[0];

for (unsigned int i = 0; i < sampleCount; ++i) {
for (audio::audioch_t s = 0; s < m_audioChannelsCount; ++s) {
m_processData.inputs[0].channelBuffers32[s][i] = sourceBuffer[i * m_audioChannelsCount + s];
for (audio::audioch_t s = 0; s < bus.numChannels; ++s) {
bus.channelBuffers32[s][i] = sourceBuffer[i * m_audioChannelsCount + s];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/framework/vst/internal/vstmodulesrepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void VstModulesRepository::removePluginModule(const audio::AudioResourceId& reso
std::lock_guard lock(m_mutex);

auto search = m_modules.find(resourceId);
if (search != m_modules.end()) {
if (search == m_modules.end()) {
return;
}

Expand Down
12 changes: 2 additions & 10 deletions src/framework/vst/internal/vstplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ void VstPlugin::unload()
m_module = nullptr;
m_pluginProvider = nullptr;
m_classInfo = ClassInfo();
m_pluginView = nullptr;
m_isLoaded = false;
m_unloadingCompleted.notify();
}, threadSecurer()->mainThreadId());
Expand Down Expand Up @@ -176,25 +175,18 @@ void VstPlugin::stateBufferFromString(VstMemoryStream& buffer, char* strData, co
buffer.seek(0, Steinberg::IBStream::kIBSeekSet, nullptr);
}

PluginViewPtr VstPlugin::view() const
PluginViewPtr VstPlugin::createView() const
{
ONLY_MAIN_THREAD(threadSecurer);

std::lock_guard lock(m_mutex);

if (m_pluginView) {
return m_pluginView;
}

auto controller = m_pluginProvider->getController();

if (!controller) {
return nullptr;
}

m_pluginView = owned(controller->createView(PluginEditorViewType::kEditor));

return m_pluginView;
return owned(controller->createView(PluginEditorViewType::kEditor));
}

PluginProviderPtr VstPlugin::provider() const
Expand Down
3 changes: 1 addition & 2 deletions src/framework/vst/internal/vstplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class VstPlugin : public async::Asyncable
const audio::AudioResourceId& resourceId() const;
const std::string& name() const;

PluginViewPtr view() const;
PluginViewPtr createView() const;
PluginProviderPtr provider() const;
bool isAbleForInput() const;

Expand All @@ -77,7 +77,6 @@ class VstPlugin : public async::Asyncable

PluginModulePtr m_module = nullptr;
PluginProviderPtr m_pluginProvider = nullptr;
mutable PluginViewPtr m_pluginView = nullptr;
ClassInfo m_classInfo;

Steinberg::FUnknownPtr<VstComponentHandler> m_componentHandlerPtr = nullptr;
Expand Down
21 changes: 19 additions & 2 deletions src/framework/vst/view/abstractvsteditorview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,22 @@ AbstractVstEditorView::AbstractVstEditorView(QWidget* parent)
}

AbstractVstEditorView::~AbstractVstEditorView()
{
deinit();
}

void AbstractVstEditorView::deinit()
{
if (m_view) {
m_view->setFrame(nullptr);
m_view->removed();
m_view = nullptr;
}

if (m_pluginPtr) {
m_pluginPtr->loadingCompleted().resetOnNotify(this);
m_pluginPtr->refreshConfig();
m_pluginPtr = nullptr;
}
}

Expand Down Expand Up @@ -108,11 +115,14 @@ void AbstractVstEditorView::wrapPluginView()

void AbstractVstEditorView::attachView(VstPluginPtr pluginPtr)
{
if (!pluginPtr || !pluginPtr->view()) {
if (!pluginPtr) {
return;
}

m_view = pluginPtr->view();
m_view = pluginPtr->createView();
if (!m_view) {
return;
}

if (m_view->isPlatformTypeSupported(currentPlatformUiType()) != Steinberg::kResultTrue) {
return;
Expand Down Expand Up @@ -165,6 +175,13 @@ void AbstractVstEditorView::showEvent(QShowEvent* ev)
TopLevelDialog::showEvent(ev);
}

void AbstractVstEditorView::closeEvent(QCloseEvent* ev)
{
deinit();

TopLevelDialog::closeEvent(ev);
}

bool AbstractVstEditorView::event(QEvent* ev)
{
if (ev && ev->spontaneous() && ev->type() == QEvent::ShortcutOverride) {
Expand Down
3 changes: 3 additions & 0 deletions src/framework/vst/view/abstractvsteditorview.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ class AbstractVstEditorView : public uicomponents::TopLevelDialog, public Steinb
void moveViewToMainWindowCenter();

void showEvent(QShowEvent* ev) override;
void closeEvent(QCloseEvent* ev) override;
bool event(QEvent* ev) override;

void deinit();

FIDString currentPlatformUiType() const;

VstPluginPtr m_pluginPtr = nullptr;
Expand Down

0 comments on commit 9b70a8c

Please sign in to comment.