Skip to content

Commit 055725f

Browse files
Merge pull request #25754 from Eism/muse_sounds_page_4.4.4
Muse sounds page. 4.4.4
2 parents dd0c7af + 3e6c4a1 commit 055725f

33 files changed

+1372
-85
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ option(MUE_BUILD_VIDEOEXPORT_MODULE "Build videoexport module" OFF)
7474
option(MUE_BUILD_IMAGESEXPORT_MODULE "Build imagesexport module" ON)
7575
option(MUE_BUILD_INSPECTOR_MODULE "Build inspector module" ON)
7676
option(MUE_BUILD_INSTRUMENTSSCENE_MODULE "Build instruments scene module" ON)
77+
option(MUE_BUILD_MUSESOUNDS_MODULE "Build muse sounds module" ON)
7778
option(MUE_BUILD_NOTATION_MODULE "Build notation module" ON)
7879
option(MUE_BUILD_NOTATION_TESTS "Build notation tests" ON)
7980
option(MUE_BUILD_PALETTE_MODULE "Build palette module" ON)

SetupConfigure.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ if(BUILD_CONFIGURE MATCHES "VTEST")
143143
set(MUSE_MODULE_LANGUAGES OFF)
144144
set(MUSE_MODULE_LEARN OFF)
145145
set(MUSE_MODULE_MULTIINSTANCES OFF)
146+
set(MUE_BUILD_MUSESOUNDS_MODULE OFF)
146147
set(MUE_BUILD_PALETTE_MODULE OFF)
147148
set(MUE_BUILD_PLAYBACK_MODULE OFF)
148149
set(MUSE_MODULE_EXTENSIONS OFF)
@@ -265,6 +266,7 @@ def_opt(MUE_BUILD_BRAILLE_MODULE ${MUE_BUILD_BRAILLE_MODULE})
265266
def_opt(MUE_BUILD_CONVERTER_MODULE ${MUE_BUILD_CONVERTER_MODULE})
266267
def_opt(MUE_BUILD_INSPECTOR_MODULE ${MUE_BUILD_INSPECTOR_MODULE})
267268
def_opt(MUE_BUILD_INSTRUMENTSSCENE_MODULE ${MUE_BUILD_INSTRUMENTSSCENE_MODULE})
269+
def_opt(MUE_BUILD_MUSESOUNDS_MODULE ${MUE_BUILD_MUSESOUNDS_MODULE})
268270
def_opt(MUE_BUILD_NOTATION_MODULE ${MUE_BUILD_NOTATION_MODULE})
269271
def_opt(MUE_BUILD_PALETTE_MODULE ${MUE_BUILD_PALETTE_MODULE})
270272
def_opt(MUE_BUILD_PLAYBACK_MODULE ${MUE_BUILD_PLAYBACK_MODULE})

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ if (MUE_BUILD_INSTRUMENTSSCENE_MODULE)
5252
add_subdirectory(instrumentsscene)
5353
endif()
5454

55+
if (MUE_BUILD_MUSESOUNDS_MODULE)
56+
add_subdirectory(musesounds)
57+
endif()
58+
5559
if (MUE_BUILD_NOTATION_MODULE)
5660
add_subdirectory(notation)
5761
endif()

src/app/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ if (MUE_BUILD_APPSHELL_MODULE)
176176
list(APPEND LINK_LIB appshell)
177177
endif()
178178

179+
if (MUE_BUILD_MUSESOUNDS_MODULE)
180+
list(APPEND LINK_LIB musesounds)
181+
endif()
182+
179183
if (NOT CC_IS_EMSCRIPTEN)
180184
list(APPEND LINK_LIB muse::cloud)
181185
list(APPEND LINK_LIB muse::languages)

src/app/appfactory.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
#include "stubs/instrumentsscene/instrumentsscenestubmodule.h"
154154
#endif
155155

156+
#ifdef MUE_BUILD_MUSESOUNDS_MODULE
157+
#include "musesounds/musesoundsmodule.h"
158+
#endif
159+
156160
#ifdef MUE_BUILD_NOTATION_MODULE
157161
#include "notation/notationmodule.h"
158162
#else
@@ -287,6 +291,9 @@ std::shared_ptr<muse::IApplication> AppFactory::newGuiApp(const CmdOptions& opti
287291
app->addModule(new muse::languages::LanguagesModule());
288292
app->addModule(new muse::learn::LearnModule());
289293
app->addModule(new muse::mi::MultiInstancesModule());
294+
#ifdef MUE_BUILD_MUSESOUNDS_MODULE
295+
app->addModule(new mu::musesounds::MuseSoundsModule());
296+
#endif
290297
app->addModule(new mu::notation::NotationModule());
291298
app->addModule(new mu::palette::PaletteModule());
292299
app->addModule(new mu::playback::PlaybackModule());

src/appshell/qml/HomePage/HomeMenu.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ Item {
8787
model: [
8888
{ "name": "scores", "title": qsTrc("appshell", "Scores"), "icon": IconCode.MUSIC_NOTES },
8989
{ "name": "extensions", "title": qsTrc("appshell", "Plugins"), "icon": IconCode.PLUGIN },
90-
// TODO: need to implement
91-
// { "name": "audio", "title": qsTrc("appshell", "Audio"), "icon": IconCode.AUDIO },
90+
{ "name": "musesounds", "title": qsTrc("appshell", "Muse Sounds"), "icon": IconCode.PLAY },
9291
{ "name": "learn", "title": qsTrc("appshell", "Learn"), "icon": IconCode.MORTAR_BOARD }
9392
]
9493

src/appshell/qml/HomePage/HomePage.qml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import Muse.Ui 1.0
2525
import Muse.UiComponents 1.0
2626
import Muse.Dock 1.0
2727

28-
import MuseScore.Project 1.0
2928
import Muse.Cloud 1.0
3029
import Muse.Learn 1.0
30+
import MuseScore.Project 1.0
31+
import MuseScore.MuseSounds 1.0
3132

3233
DockPage {
3334
id: root
@@ -65,7 +66,7 @@ DockPage {
6566
case "scores": root.central = scoresComp; break
6667
case "plugins": root.central = extensionsComp; break // backward compatibility
6768
case "extensions": root.central = extensionsComp; break
68-
case "audio": root.central = audioComp; break
69+
case "musesounds": root.central = museSoundsComp; break
6970
case "learn": root.central = learnComp; break
7071
case "account": root.central = accountComp; break
7172
}
@@ -125,12 +126,9 @@ DockPage {
125126
}
126127

127128
Component {
128-
id: audioComp
129+
id: museSoundsComp
129130

130-
StyledTextLabel {
131-
anchors.centerIn: parent
132-
text: "Audio & VST"
133-
}
131+
MuseSoundsPage {}
134132
}
135133

136134
Component {

src/framework/cloud/qml/Muse/Cloud/CloudScoresView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ ScoresView {
217217
anchors.rightMargin: root.sideMargin
218218

219219
title: qsTrc("project", "Unable to load online scores")
220-
body: qsTrc("project", "Please check your internet connection or try again later.")
220+
body: qsTrc("global", "Please check your internet connection or try again later.")
221221
}
222222
}
223223
}

src/framework/global/serialization/json.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,11 @@ void JsonArray::resize(size_t i)
412412
array_mut(m_data).resize(i);
413413
}
414414

415+
bool JsonArray::empty() const
416+
{
417+
return array_const(m_data).size() == 0;
418+
}
419+
415420
JsonValue JsonArray::at(size_t i) const
416421
{
417422
std::shared_ptr<JsonData> d = std::make_shared<JsonData>();

src/framework/global/serialization/json.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ class JsonArray
109109
size_t size() const;
110110
void resize(size_t i);
111111

112+
bool empty() const;
113+
112114
JsonValue at(size_t i) const;
113115

114116
JsonArray& set(size_t i, bool v);

src/framework/global/types/uri.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ Uri::Uri(const std::string& str)
5050
m_path = str.substr(pathPos, pathN);
5151
}
5252

53+
Uri::Uri(const String& str)
54+
: Uri(str.toStdString())
55+
{
56+
}
57+
5358
bool Uri::isValid() const
5459
{
5560
if (m_scheme.empty()) {
@@ -86,6 +91,11 @@ UriQuery::UriQuery(const std::string& str)
8691
parceParams(str, m_params);
8792
}
8893

94+
UriQuery::UriQuery(const String& str)
95+
: UriQuery(str.toStdString())
96+
{
97+
}
98+
8999
UriQuery::UriQuery(const Uri& uri)
90100
: m_uri(uri)
91101
{

src/framework/global/types/uri.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Uri
3535
public:
3636
Uri() = default;
3737
explicit Uri(const std::string& str);
38+
explicit Uri(const muse::String& str);
3839

3940
using Scheme = std::string;
4041
static const Scheme MuseScore;
@@ -72,6 +73,7 @@ class UriQuery
7273

7374
UriQuery() = default;
7475
explicit UriQuery(const std::string& str);
76+
explicit UriQuery(const String& str);
7577
explicit UriQuery(const Uri& uri);
7678

7779
const Uri& uri() const;

src/framework/learn/internal/learnservice.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ void LearnService::refreshPlaylists()
5555
return;
5656
}
5757

58-
m_startedPlaylist = result.val;
58+
{
59+
std::lock_guard lock(m_startedPlaylistMutex);
60+
m_startedPlaylist = result.val;
61+
}
62+
5963
m_startedPlaylistChannel.send(m_startedPlaylist);
6064
};
6165

@@ -69,7 +73,10 @@ void LearnService::refreshPlaylists()
6973
return;
7074
}
7175

72-
m_advancedPlaylist = result.val;
76+
{
77+
std::lock_guard lock(m_advancedPlaylistMutex);
78+
m_advancedPlaylist = result.val;
79+
}
7380
m_advancedPlaylistChannel.send(m_advancedPlaylist);
7481
};
7582

@@ -79,6 +86,7 @@ void LearnService::refreshPlaylists()
7986

8087
Playlist LearnService::startedPlaylist() const
8188
{
89+
std::lock_guard lock(m_startedPlaylistMutex);
8290
return m_startedPlaylist;
8391
}
8492

@@ -89,6 +97,7 @@ async::Channel<Playlist> LearnService::startedPlaylistChanged() const
8997

9098
Playlist LearnService::advancedPlaylist() const
9199
{
100+
std::lock_guard lock(m_advancedPlaylistMutex);
92101
return m_advancedPlaylist;
93102
}
94103

src/framework/learn/internal/learnservice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ class LearnService : public ILearnService
5252

5353
Playlist parsePlaylist(const QJsonDocument& playlistDoc) const;
5454

55+
mutable std::mutex m_startedPlaylistMutex;
5556
Playlist m_startedPlaylist;
5657
async::Channel<Playlist> m_startedPlaylistChannel;
5758

59+
mutable std::mutex m_advancedPlaylistMutex;
5860
Playlist m_advancedPlaylist;
5961
async::Channel<Playlist> m_advancedPlaylistChannel;
6062
};

src/framework/learn/qml/Muse/Learn/internal/Playlist.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ FocusScope {
139139

140140
StyledTextLabel {
141141
width: parent.width
142-
text: qsTrc("learn", "Please check your internet connection or try again later.")
142+
text: qsTrc("global", "Please check your internet connection or try again later.")
143143
}
144144
}
145145
}

src/musesounds/CMakeLists.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-License-Identifier: GPL-3.0-only
2+
# MuseScore-CLA-applies
3+
#
4+
# MuseScore
5+
# Music Composition & Notation
6+
#
7+
# Copyright (C) 2024 MuseScore BVBA and others
8+
#
9+
# This program is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License version 3 as
11+
# published by the Free Software Foundation.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
declare_module(musesounds)
22+
23+
set(MODULE_QRC musesounds.qrc)
24+
set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml)
25+
26+
set(MODULE_SRC
27+
${CMAKE_CURRENT_LIST_DIR}/musesoundsmodule.cpp
28+
${CMAKE_CURRENT_LIST_DIR}/musesoundsmodule.h
29+
${CMAKE_CURRENT_LIST_DIR}/imusesoundsrepository.h
30+
${CMAKE_CURRENT_LIST_DIR}/imusesoundsconfiguration.h
31+
${CMAKE_CURRENT_LIST_DIR}/musesoundstypes.h
32+
33+
${CMAKE_CURRENT_LIST_DIR}/internal/musesoundsrepository.cpp
34+
${CMAKE_CURRENT_LIST_DIR}/internal/musesoundsrepository.h
35+
${CMAKE_CURRENT_LIST_DIR}/internal/musesoundsconfiguration.cpp
36+
${CMAKE_CURRENT_LIST_DIR}/internal/musesoundsconfiguration.h
37+
38+
${CMAKE_CURRENT_LIST_DIR}/view/musesoundslistmodel.cpp
39+
${CMAKE_CURRENT_LIST_DIR}/view/musesoundslistmodel.h
40+
)
41+
42+
setup_module()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0-only
3+
* MuseScore-CLA-applies
4+
*
5+
* MuseScore
6+
* Music Composition & Notation
7+
*
8+
* Copyright (C) 2024 MuseScore BVBA and others
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License version 3 as
12+
* published by the Free Software Foundation.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Public License
20+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
#pragma once
23+
24+
#include "types/string.h"
25+
26+
#include "modularity/imoduleinterface.h"
27+
28+
#include "global/types/uri.h"
29+
#include "network/networktypes.h"
30+
31+
namespace mu::musesounds {
32+
class IMuseSoundsConfiguration : MODULE_EXPORT_INTERFACE
33+
{
34+
INTERFACE_ID(IMuseSoundsConfiguration)
35+
36+
public:
37+
virtual ~IMuseSoundsConfiguration() = default;
38+
39+
virtual muse::network::RequestHeaders headers() const = 0;
40+
41+
virtual muse::UriQuery soundsUri() const = 0;
42+
virtual muse::UriQuery soundPageUri(const muse::String& soundCode) const = 0;
43+
};
44+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0-only
3+
* MuseScore-CLA-applies
4+
*
5+
* MuseScore
6+
* Music Composition & Notation
7+
*
8+
* Copyright (C) 2024 MuseScore BVBA and others
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License version 3 as
12+
* published by the Free Software Foundation.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Public License
20+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
#pragma once
23+
24+
#include "modularity/imoduleinterface.h"
25+
26+
#include "async/notification.h"
27+
#include "musesoundstypes.h"
28+
29+
namespace mu::musesounds {
30+
class IMuseSoundsRepository : MODULE_EXPORT_INTERFACE
31+
{
32+
INTERFACE_ID(IMuseSoundsRepository)
33+
34+
public:
35+
virtual ~IMuseSoundsRepository() = default;
36+
37+
virtual const SoundCatalogueInfoList& soundsCatalogueList() const = 0;
38+
virtual muse::async::Notification soundsCatalogueListChanged() const = 0;
39+
};
40+
}

0 commit comments

Comments
 (0)