Skip to content

Commit

Permalink
Implemented stubs for playback module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jan 22, 2021
1 parent 25c3d61 commit 6295028
Show file tree
Hide file tree
Showing 21 changed files with 326 additions and 19 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ option(BUILD_NETWORK_MODULE "Build network module" ON)
option(BUILD_USERSCORES_MODULE "Build userscores module" ON)
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
option(BUILD_LANGUAGES_MODULE "Build languages module" ON)
option(BUILD_PLAYBACK_MODULE "Build playback module" ON)
option(BUILD_INSTRUMENTS_MODULE "Build instruments module" ON)
option(BUILD_INSPECTOR_MODULE "Build inspector module" ON)

Expand Down
1 change: 1 addition & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#cmakedefine BUILD_USERSCORES_MODULE
#cmakedefine BUILD_EXTENSIONS_MODULE
#cmakedefine BUILD_LANGUAGES_MODULE
#cmakedefine BUILD_PLAYBACK_MODULE
#cmakedefine BUILD_INSTRUMENTS_MODULE
#cmakedefine BUILD_INSPECTOR_MODULE

Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ endif()

# Scenes common
add_subdirectory(commonscene)
add_subdirectory(playback)
if (BUILD_PLAYBACK_MODULE)
add_subdirectory(playback)
endif (BUILD_PLAYBACK_MODULE)

# Notation
add_subdirectory(palette)
Expand Down
8 changes: 8 additions & 0 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@
#include "commonscene/commonscenemodule.h"
#include "palette/palettemodule.h"
#include "inspector/inspectormodule.h"
#ifdef BUILD_PLAYBACK_MODULE
#include "playback/playbackmodule.h"
#else
#include "stubs/playback/playbackstubmodule.h"
#endif
#ifdef BUILD_INSTRUMENTS_MODULE
#include "instruments/instrumentsmodule.h"
#else
Expand Down Expand Up @@ -145,7 +149,11 @@ int main(int argc, char** argv)

app.addModule(new mu::notation::NotationModule());
app.addModule(new mu::commonscene::CommonSceneModule());
#ifdef BUILD_PLAYBACK_MODULE
app.addModule(new mu::playback::PlaybackModule());
#else
app.addModule(new mu::playback::PlaybackStubModule());
#endif

#ifdef BUILD_INSTRUMENTS_MODULE
app.addModule(new mu::instruments::InstrumentsModule());
Expand Down
4 changes: 1 addition & 3 deletions src/playback/internal/playbackactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include <vector>
#include "actions/imoduleactions.h"

namespace mu {
namespace playback {
namespace mu::playback {
class PlaybackActions : public actions::IModuleActions
{
public:
Expand All @@ -35,6 +34,5 @@ class PlaybackActions : public actions::IModuleActions
static const std::vector<actions::ActionItem> m_actions;
};
}
}

#endif // MU_PLAYBACK_PLAYBACKACTIONS_H
4 changes: 1 addition & 3 deletions src/playback/internal/playbackconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

#include "../iplaybackconfiguration.h"

namespace mu {
namespace playback {
namespace mu::playback {
class PlaybackConfiguration : public IPlaybackConfiguration
{
public:
Expand All @@ -31,6 +30,5 @@ class PlaybackConfiguration : public IPlaybackConfiguration
bool isPlayHarmonyOnClick() const override;
};
}
}

#endif // MU_PLAYBACK_PLAYBACKCONFIGURATION_H
4 changes: 1 addition & 3 deletions src/playback/internal/playbackcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include "async/asyncable.h"
#include "audio/isequencer.h"

namespace mu {
namespace playback {
namespace mu::playback {
class PlaybackController : public IPlaybackController, public actions::Actionable, public async::Asyncable
{
INJECT(playback, actions::IActionsDispatcher, dispatcher)
Expand Down Expand Up @@ -70,6 +69,5 @@ class PlaybackController : public IPlaybackController, public actions::Actionabl
CursorType m_cursorType;
};
}
}

#endif // MU_PLAYBACK_PLAYBACKCONTROLLER_H
4 changes: 1 addition & 3 deletions src/playback/iplaybackconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

#include "modularity/imoduleexport.h"

namespace mu {
namespace playback {
namespace mu::playback {
class IPlaybackConfiguration : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IPlaybackConfiguration)
Expand All @@ -33,6 +32,5 @@ class IPlaybackConfiguration : MODULE_EXPORT_INTERFACE
virtual bool isPlayHarmonyOnClick() const = 0;
};
}
}

#endif // MU_PLAYBACK_IPLAYBACKCONFIGURATION_H
4 changes: 1 addition & 3 deletions src/playback/iplaybackcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

#include "notation/notationtypes.h"

namespace mu {
namespace playback {
namespace mu::playback {
class IPlaybackController : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IPlaybackController)
Expand All @@ -51,6 +50,5 @@ class IPlaybackController : MODULE_EXPORT_INTERFACE
virtual void playElementOnClick(const notation::Element* e) = 0;
};
}
}

#endif // MU_PLAYBACK_IPLAYBACKCONTROLLER_H
4 changes: 1 addition & 3 deletions src/playback/playbackmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

#include "modularity/imodulesetup.h"

namespace mu {
namespace playback {
namespace mu::playback {
class PlaybackModule : public framework::IModuleSetup
{
public:
Expand All @@ -35,6 +34,5 @@ class PlaybackModule : public framework::IModuleSetup
void onInit(const framework::IApplication::RunMode& mode) override;
};
}
}

#endif // MU_PLAYBACK_PLAYBACKMODULE_H
4 changes: 4 additions & 0 deletions src/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if (NOT BUILD_LANGUAGES_MODULE)
add_subdirectory(languages)
endif (NOT BUILD_LANGUAGES_MODULE)

if (NOT BUILD_PLAYBACK_MODULE)
add_subdirectory(playback)
endif (NOT BUILD_PLAYBACK_MODULE)

if (NOT BUILD_INSTRUMENTS_MODULE)
add_subdirectory(instruments)
endif (NOT BUILD_INSTRUMENTS_MODULE)
Expand Down
35 changes: 35 additions & 0 deletions src/stubs/playback/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2020 MuseScore BVBA and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

set(MODULE playback)

set(MODULE_QRC ${CMAKE_CURRENT_LIST_DIR}/playback.qrc)

set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml)

set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/playbackstubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/playbackstubmodule.h
${CMAKE_CURRENT_LIST_DIR}/playbackcontrollerstub.cpp
${CMAKE_CURRENT_LIST_DIR}/playbackcontrollerstub.h
${CMAKE_CURRENT_LIST_DIR}/playbackconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/playbackconfigurationstub.h
)

include(${PROJECT_SOURCE_DIR}/build/module.cmake)
6 changes: 6 additions & 0 deletions src/stubs/playback/playback.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Playback/qmldir</file>
<file>qml/MuseScore/Playback/PlaybackToolBar.qml</file>
</qresource>
</RCC>
30 changes: 30 additions & 0 deletions src/stubs/playback/playbackconfigurationstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "playbackconfigurationstub.h"

using namespace mu::playback;

bool PlaybackConfigurationStub::isPlayElementOnClick() const
{
return false;
}

bool PlaybackConfigurationStub::isPlayHarmonyOnClick() const
{
return false;
}
32 changes: 32 additions & 0 deletions src/stubs/playback/playbackconfigurationstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef MU_PLAYBACK_PLAYBACKCONFIGURATIONSTUB_H
#define MU_PLAYBACK_PLAYBACKCONFIGURATIONSTUB_H

#include "playback/iplaybackconfiguration.h"

namespace mu::playback {
class PlaybackConfigurationStub : public IPlaybackConfiguration
{
public:
bool isPlayElementOnClick() const override;
bool isPlayHarmonyOnClick() const override;
};
}

#endif // MU_PLAYBACK_PLAYBACKCONFIGURATIONSTUB_H
55 changes: 55 additions & 0 deletions src/stubs/playback/playbackcontrollerstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include "playbackcontrollerstub.h"

using namespace mu::playback;

bool PlaybackControllerStub::isPlayAllowed() const
{
return false;
}

mu::async::Notification PlaybackControllerStub::isPlayAllowedChanged() const
{
return mu::async::Notification();
}

bool PlaybackControllerStub::isPlaying() const
{
return false;
}

mu::async::Notification PlaybackControllerStub::isPlayingChanged() const
{
return mu::async::Notification();
}

float PlaybackControllerStub::playbackPosition() const
{
return 0.f;
}

mu::async::Channel<uint32_t> PlaybackControllerStub::midiTickPlayed() const
{
return mu::async::Channel<uint32_t>();
}

void PlaybackControllerStub::playElementOnClick(const mu::notation::Element*)
{
}
41 changes: 41 additions & 0 deletions src/stubs/playback/playbackcontrollerstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_PLAYBACK_PLAYBACKCONTROLLERSTUB_H
#define MU_PLAYBACK_PLAYBACKCONTROLLERSTUB_H

#include "playback/iplaybackcontroller.h"

namespace mu::playback {
class PlaybackControllerStub : public IPlaybackController
{
public:
bool isPlayAllowed() const override;
async::Notification isPlayAllowedChanged() const override;

bool isPlaying() const override;
async::Notification isPlayingChanged() const override;

float playbackPosition() const override;
async::Channel<uint32_t> midiTickPlayed() const override;

void playElementOnClick(const notation::Element* e) override;
};
}

#endif // MU_PLAYBACK_PLAYBACKCONTROLLERSTUB_H
Loading

0 comments on commit 6295028

Please sign in to comment.