mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-08 21:17:49 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad9bc96af4 | |||
| bc1e04b116 | |||
| 101746f268 | |||
| 89986bdd65 | |||
| 7865694d75 | |||
|
f37a067174
|
@@ -21,6 +21,8 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boo AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
add_subdirectory(athena)
|
||||
endif()
|
||||
|
||||
option(AMUSE_BUILD_EDITOR "Build Amuse with editor enabled (includes VST)" ON)
|
||||
|
||||
add_library(amuse
|
||||
lib/AudioGroup.cpp
|
||||
lib/AudioGroupData.cpp
|
||||
@@ -164,10 +166,14 @@ if(TARGET boo AND NOT WINDOWS_STORE AND NOT NX)
|
||||
|
||||
# Editor
|
||||
find_package(Qt6 COMPONENTS Widgets PATHS /usr/local/opt/qt)
|
||||
if (Qt6Widgets_FOUND)
|
||||
if (Qt6Widgets_FOUND AND AMUSE_BUILD_EDITOR)
|
||||
message(STATUS "Qt6 found, amuse-gui will be built")
|
||||
add_subdirectory(Editor)
|
||||
else()
|
||||
message(STATUS "Qt6 not found, amuse-gui will not be built")
|
||||
if (NOT AMUSE_BUILD_EDITOR)
|
||||
message(STATUS "amuse-gui has been disabled and will not be built, to enable pass `-DAMUSE_BUILD_EDITOR=ON` to cmake")
|
||||
else()
|
||||
message(STATUS "Qt6 not found, amuse-gui will not be built")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -185,7 +185,7 @@ MainWindow::MainWindow(QWidget* parent)
|
||||
connect(qApp, &QApplication::focusChanged, this, &MainWindow::onFocusChanged);
|
||||
connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &MainWindow::onClipboardChanged);
|
||||
|
||||
m_voxEngine = boo::NewAudioVoiceEngine();
|
||||
m_voxEngine = boo::NewAudioVoiceEngine("amuse-gui", "Amuse Gui");
|
||||
m_voxAllocator = std::make_unique<VoiceAllocator>(*m_voxEngine);
|
||||
m_engine = std::make_unique<amuse::Engine>(*m_voxAllocator);
|
||||
m_engine->setVolume(0.7f);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QTranslator>
|
||||
#include "MainWindow.hpp"
|
||||
#include "SongGroupEditor.hpp"
|
||||
#include "boo/IApplication.hpp"
|
||||
#include <QResource>
|
||||
#include <QCommandLineParser>
|
||||
#include <logvisor/logvisor.hpp>
|
||||
@@ -34,24 +33,6 @@ static QIcon MakeAppIcon() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* This is for adapting the get*Name methods */
|
||||
class BooInterface : public boo::IApplication {
|
||||
std::vector<std::string> m_args;
|
||||
void _deletedWindow(boo::IWindow* window) override {}
|
||||
|
||||
public:
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::Qt; }
|
||||
|
||||
int run() override { return 0; }
|
||||
std::string_view getUniqueName() const override { return "amuse-gui"sv; }
|
||||
std::string_view getFriendlyName() const override { return "Amuse"sv; }
|
||||
std::string_view getProcessName() const override { return "amuse-gui"sv; }
|
||||
const std::vector<std::string>& getArgs() const override { return m_args; }
|
||||
|
||||
/* Constructors/initializers for sub-objects */
|
||||
std::shared_ptr<boo::IWindow> newWindow(std::string_view title) override { return {}; }
|
||||
};
|
||||
|
||||
MainWindow* g_MainWindow = nullptr;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
@@ -97,9 +78,6 @@ int main(int argc, char* argv[]) {
|
||||
logvisor::RegisterConsoleLogger();
|
||||
logvisor::RegisterStandardExceptions();
|
||||
|
||||
BooInterface booApp;
|
||||
boo::APP = &booApp;
|
||||
|
||||
Q_INIT_RESOURCE(translation_res);
|
||||
QTranslator translator;
|
||||
if (translator.load(QLocale(), QStringLiteral("lang"), QStringLiteral("_"), QStringLiteral(":/translations"))) {
|
||||
|
||||
@@ -641,37 +641,37 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="33"/>
|
||||
<location filename="../Common.cpp" line="25"/>
|
||||
<source>A directory at '%1/%2' could not be created.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="34"/>
|
||||
<location filename="../Common.cpp" line="26"/>
|
||||
<source>Unable to create directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="54"/>
|
||||
<location filename="../Common.cpp" line="46"/>
|
||||
<source>Launching Windows Explorer Failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="55"/>
|
||||
<location filename="../Common.cpp" line="47"/>
|
||||
<source>Could not find explorer.exe in path to launch Windows Explorer.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="83"/>
|
||||
<location filename="../Common.cpp" line="75"/>
|
||||
<source>Show in Explorer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="85"/>
|
||||
<location filename="../Common.cpp" line="77"/>
|
||||
<source>Show in Finder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Common.cpp" line="87"/>
|
||||
<location filename="../Common.cpp" line="79"/>
|
||||
<source>Show in Browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -691,329 +691,329 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="246"/>
|
||||
<location filename="../MainWindow.cpp" line="245"/>
|
||||
<source>Amuse[*]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="253"/>
|
||||
<location filename="../MainWindow.cpp" line="252"/>
|
||||
<source>%1/%2/%3[*] - Amuse</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="260"/>
|
||||
<location filename="../MainWindow.cpp" line="259"/>
|
||||
<source>%1[*] - Amuse</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="283"/>
|
||||
<location filename="../MainWindow.cpp" line="760"/>
|
||||
<source>The directory at '%1' must not be empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="284"/>
|
||||
<location filename="../MainWindow.cpp" line="761"/>
|
||||
<source>The directory at '%1' must not be empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="285"/>
|
||||
<location filename="../MainWindow.cpp" line="762"/>
|
||||
<source>Directory empty</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="288"/>
|
||||
<location filename="../MainWindow.cpp" line="287"/>
|
||||
<source>The directory at '%1' must exist for the Amuse editor.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="289"/>
|
||||
<location filename="../MainWindow.cpp" line="288"/>
|
||||
<source>Directory does not exist</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="292"/>
|
||||
<location filename="../MainWindow.cpp" line="291"/>
|
||||
<source>__amuse_test__</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="296"/>
|
||||
<location filename="../MainWindow.cpp" line="295"/>
|
||||
<source>The directory at '%1' must be writable for the Amuse editor: %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="299"/>
|
||||
<location filename="../MainWindow.cpp" line="298"/>
|
||||
<source>Unable to write to directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="371"/>
|
||||
<location filename="../MainWindow.cpp" line="370"/>
|
||||
<source>No Audio Devices Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="383"/>
|
||||
<location filename="../MainWindow.cpp" line="382"/>
|
||||
<source>Virtual MIDI-In</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="401"/>
|
||||
<location filename="../MainWindow.cpp" line="400"/>
|
||||
<source>No MIDI Devices Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="460"/>
|
||||
<location filename="../MainWindow.cpp" line="459"/>
|
||||
<source>SUSTAIN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="714"/>
|
||||
<location filename="../MainWindow.cpp" line="855"/>
|
||||
<location filename="../MainWindow.cpp" line="713"/>
|
||||
<location filename="../MainWindow.cpp" line="854"/>
|
||||
<source>Unsaved Changes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="714"/>
|
||||
<location filename="../MainWindow.cpp" line="713"/>
|
||||
<source>Save Changes in %1?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="739"/>
|
||||
<location filename="../MainWindow.cpp" line="738"/>
|
||||
<source>New Project</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="765"/>
|
||||
<location filename="../MainWindow.cpp" line="764"/>
|
||||
<source>The directory at '%1' does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="766"/>
|
||||
<location filename="../MainWindow.cpp" line="765"/>
|
||||
<source>Bad Directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="780"/>
|
||||
<location filename="../MainWindow.cpp" line="779"/>
|
||||
<source>Opening</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="780"/>
|
||||
<location filename="../MainWindow.cpp" line="883"/>
|
||||
<location filename="../MainWindow.cpp" line="964"/>
|
||||
<location filename="../MainWindow.cpp" line="1001"/>
|
||||
<location filename="../MainWindow.cpp" line="1046"/>
|
||||
<location filename="../MainWindow.cpp" line="779"/>
|
||||
<location filename="../MainWindow.cpp" line="882"/>
|
||||
<location filename="../MainWindow.cpp" line="963"/>
|
||||
<location filename="../MainWindow.cpp" line="1000"/>
|
||||
<location filename="../MainWindow.cpp" line="1045"/>
|
||||
<source>Scanning Project</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="790"/>
|
||||
<location filename="../MainWindow.cpp" line="789"/>
|
||||
<source>Opening %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="805"/>
|
||||
<location filename="../MainWindow.cpp" line="804"/>
|
||||
<source>Open Project</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="855"/>
|
||||
<location filename="../MainWindow.cpp" line="854"/>
|
||||
<source>Discard Changes in %1?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="883"/>
|
||||
<location filename="../MainWindow.cpp" line="882"/>
|
||||
<source>Reloading Samples</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="894"/>
|
||||
<location filename="../MainWindow.cpp" line="893"/>
|
||||
<source>Scanning %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="903"/>
|
||||
<location filename="../MainWindow.cpp" line="902"/>
|
||||
<source>Import Project</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="915"/>
|
||||
<location filename="../MainWindow.cpp" line="914"/>
|
||||
<source>The file at '%1' could not be interpreted as a MusyX container.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="916"/>
|
||||
<location filename="../MainWindow.cpp" line="915"/>
|
||||
<source>Unsupported MusyX Container</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="921"/>
|
||||
<location filename="../MainWindow.cpp" line="920"/>
|
||||
<source>Sample Import Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="922"/>
|
||||
<location filename="../MainWindow.cpp" line="921"/>
|
||||
<source>Amuse can import samples as WAV files for ease of editing, import original compressed data for lossless repacking, or both. Exporting the project will prefer whichever version was modified most recently.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="926"/>
|
||||
<location filename="../MainWindow.cpp" line="925"/>
|
||||
<source>Import Compressed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="926"/>
|
||||
<location filename="../MainWindow.cpp" line="925"/>
|
||||
<source>Import WAVs</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="926"/>
|
||||
<location filename="../MainWindow.cpp" line="925"/>
|
||||
<source>Import Both</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="940"/>
|
||||
<location filename="../MainWindow.cpp" line="939"/>
|
||||
<source>Raw Import Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="941"/>
|
||||
<location filename="../MainWindow.cpp" line="940"/>
|
||||
<source>Would you like to scan for all MusyX group files in this directory?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="949"/>
|
||||
<location filename="../MainWindow.cpp" line="948"/>
|
||||
<source>Project Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="949"/>
|
||||
<location filename="../MainWindow.cpp" line="948"/>
|
||||
<source>What should this project be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="964"/>
|
||||
<location filename="../MainWindow.cpp" line="1001"/>
|
||||
<location filename="../MainWindow.cpp" line="963"/>
|
||||
<location filename="../MainWindow.cpp" line="1000"/>
|
||||
<source>Importing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="972"/>
|
||||
<location filename="../MainWindow.cpp" line="1007"/>
|
||||
<location filename="../MainWindow.cpp" line="971"/>
|
||||
<location filename="../MainWindow.cpp" line="1006"/>
|
||||
<source>Importing %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1022"/>
|
||||
<location filename="../MainWindow.cpp" line="1021"/>
|
||||
<source>Import Songs</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1046"/>
|
||||
<location filename="../MainWindow.cpp" line="1045"/>
|
||||
<source>Exporting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1052"/>
|
||||
<location filename="../MainWindow.cpp" line="1051"/>
|
||||
<source>Exporting %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1067"/>
|
||||
<location filename="../MainWindow.cpp" line="1083"/>
|
||||
<location filename="../MainWindow.cpp" line="1066"/>
|
||||
<location filename="../MainWindow.cpp" line="1082"/>
|
||||
<source>Import C Headers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1068"/>
|
||||
<location filename="../MainWindow.cpp" line="1067"/>
|
||||
<source><p>Importing names from C headers depends on up-to-date, consistent names relative to the sound group data.</p><p>Headers are imported on a per-subproject basis from a single directory. Headers must be named with the form <code>&lt;subproject&gt;.h</code>.</p><p>Group, Song and SFX definitions are matched according to the following forms:<pre>#define GRP&lt;name&gt; &lt;id&gt;
|
||||
#define SNG&lt;name&gt; &lt;id&gt;
|
||||
#define SFX&lt;name> &lt;id&gt;</pre></p><p><strong>This operation cannot be undone! It is recommended to make a backup of the project directory before proceeding.</strong></p><p>Continue?</p></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1106"/>
|
||||
<location filename="../MainWindow.cpp" line="1105"/>
|
||||
<source>Export C Headers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1312"/>
|
||||
<location filename="../MainWindow.cpp" line="1311"/>
|
||||
<source>New Subproject</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1312"/>
|
||||
<location filename="../MainWindow.cpp" line="1311"/>
|
||||
<source>What should this subproject be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1332"/>
|
||||
<location filename="../MainWindow.cpp" line="1331"/>
|
||||
<source>New SFX Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1332"/>
|
||||
<location filename="../MainWindow.cpp" line="1331"/>
|
||||
<source>What should the new SFX group in %1 be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1356"/>
|
||||
<location filename="../MainWindow.cpp" line="1355"/>
|
||||
<source>New Song Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1356"/>
|
||||
<location filename="../MainWindow.cpp" line="1355"/>
|
||||
<source>What should the new Song group in %1 be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1406"/>
|
||||
<location filename="../MainWindow.cpp" line="1405"/>
|
||||
<source>New ADSR</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1406"/>
|
||||
<location filename="../MainWindow.cpp" line="1405"/>
|
||||
<source>What should the new ADSR in %1 be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1429"/>
|
||||
<location filename="../MainWindow.cpp" line="1428"/>
|
||||
<source>New Curve</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1429"/>
|
||||
<location filename="../MainWindow.cpp" line="1428"/>
|
||||
<source>What should the new Curve in %1 be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1452"/>
|
||||
<location filename="../MainWindow.cpp" line="1451"/>
|
||||
<source>New Keymap</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1452"/>
|
||||
<location filename="../MainWindow.cpp" line="1451"/>
|
||||
<source>What should the new Keymap in %1 be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1475"/>
|
||||
<location filename="../MainWindow.cpp" line="1474"/>
|
||||
<source>New Layers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1475"/>
|
||||
<location filename="../MainWindow.cpp" line="1474"/>
|
||||
<source>What should the new Layers in %1 be named?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1569"/>
|
||||
<location filename="../MainWindow.cpp" line="1568"/>
|
||||
<source>About Amuse</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1808"/>
|
||||
<location filename="../MainWindow.cpp" line="1807"/>
|
||||
<source>Export Complete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1808"/>
|
||||
<location filename="../MainWindow.cpp" line="1807"/>
|
||||
<source>%1?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -1573,7 +1573,7 @@
|
||||
<context>
|
||||
<name>QDialogButtonBox</name>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1831"/>
|
||||
<location filename="../MainWindow.cpp" line="1830"/>
|
||||
<source>OK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -1581,12 +1581,12 @@
|
||||
<context>
|
||||
<name>QMessageBox</name>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1555"/>
|
||||
<location filename="../MainWindow.cpp" line="1554"/>
|
||||
<source><h3>About Amuse</h3></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1557"/>
|
||||
<location filename="../MainWindow.cpp" line="1556"/>
|
||||
<source><p>Amuse is an alternate editor and runtime library for MusyX sound groups.</p><p>MusyX originally served as a widely-deployed audio system for developing games on the Nintendo 64, GameCube, and GameBoy Advance.</p><p>Amuse is available under the MIT license.<br>Please see <a href="https://gitlab.axiodl.com/AxioDL/amuse/blob/master/LICENSE">https://gitlab.axiodl.com/AxioDL/amuse/blob/master/LICENSE</a> for futher information.</p><p>Copyright (C) 2015-2018 Antidote / Jackoalan.</p><p>MusyX is a trademark of Factor 5, LLC.</p><p>Nintendo 64, GameCube, and GameBoy Advance are trademarks of Nintendo Co., Ltd.</p></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -2041,52 +2041,52 @@
|
||||
<context>
|
||||
<name>TreeDelegate</name>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1136"/>
|
||||
<location filename="../MainWindow.cpp" line="1135"/>
|
||||
<source>Export GameCube Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1144"/>
|
||||
<location filename="../MainWindow.cpp" line="1143"/>
|
||||
<source>Find Usages</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1152"/>
|
||||
<location filename="../MainWindow.cpp" line="1151"/>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1160"/>
|
||||
<location filename="../MainWindow.cpp" line="1159"/>
|
||||
<source>Copy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1168"/>
|
||||
<location filename="../MainWindow.cpp" line="1167"/>
|
||||
<source>Paste</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1176"/>
|
||||
<location filename="../MainWindow.cpp" line="1175"/>
|
||||
<source>Duplicate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1181"/>
|
||||
<location filename="../MainWindow.cpp" line="1180"/>
|
||||
<source>Delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1189"/>
|
||||
<location filename="../MainWindow.cpp" line="1188"/>
|
||||
<source>Rename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1218"/>
|
||||
<location filename="../MainWindow.cpp" line="1217"/>
|
||||
<source>Exporting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../MainWindow.cpp" line="1218"/>
|
||||
<location filename="../MainWindow.cpp" line="1217"/>
|
||||
<source>Exporting %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#include <nowide/stackstring.hpp>
|
||||
#endif
|
||||
|
||||
@@ -344,15 +340,11 @@ typedef struct stat Sstat;
|
||||
static inline int Stat(const char* path, Sstat* statout) { return stat(path, statout); }
|
||||
#endif
|
||||
|
||||
inline int Rename(const char* oldpath, const char* newpath) {
|
||||
#if _WIN32
|
||||
const nowide::wstackstring woldpath(oldpath);
|
||||
const nowide::wstackstring wnewpath(newpath);
|
||||
return MoveFileExW(woldpath.get(), wnewpath.get(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) == 0;
|
||||
int Rename(const char* oldpath, const char* newpath);
|
||||
#else
|
||||
return rename(oldpath, newpath);
|
||||
inline int Rename(const char* oldpath, const char* newpath) { return rename(oldpath, newpath); }
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int CompareCaseInsensitive(const char* a, const char* b) {
|
||||
#if _WIN32
|
||||
|
||||
@@ -74,8 +74,8 @@ class SongState {
|
||||
uint32_t m_curTick = 0; /**< Current playback position for this track */
|
||||
uint32_t m_loopStartTick = 0; /**< Tick to loop back to */
|
||||
/** Current pointer to tempo control, iterated over playback */
|
||||
const TempoChange* m_tempoPtr;
|
||||
uint32_t m_tempo; /**< Current tempo (beats per minute) */
|
||||
const TempoChange* m_tempoPtr = nullptr;
|
||||
uint32_t m_tempo = 0; /**< Current tempo (beats per minute) */
|
||||
|
||||
const unsigned char* m_data = nullptr; /**< Pointer to upcoming command data */
|
||||
const unsigned char* m_pitchWheelData = nullptr; /**< Pointer to upcoming pitch data */
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
#ifndef _WIN32
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#else
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include <logvisor/logvisor.hpp>
|
||||
@@ -19,10 +27,10 @@ bool Copy(const char* from, const char* to) {
|
||||
return CopyFileW(wfrom.get(), wto.get(), FALSE) != 0;
|
||||
#else
|
||||
FILE* fi = fopen(from, "rb");
|
||||
if (!fi)
|
||||
if (fi == nullptr)
|
||||
return false;
|
||||
FILE* fo = fopen(to, "wb");
|
||||
if (!fo) {
|
||||
if (fo == nullptr) {
|
||||
fclose(fi);
|
||||
return false;
|
||||
}
|
||||
@@ -32,7 +40,7 @@ bool Copy(const char* from, const char* to) {
|
||||
fwrite(buf.get(), 1, readSz, fo);
|
||||
fclose(fi);
|
||||
fclose(fo);
|
||||
struct stat theStat;
|
||||
struct stat theStat{};
|
||||
if (::stat(from, &theStat))
|
||||
return true;
|
||||
#if __APPLE__
|
||||
@@ -47,6 +55,14 @@ bool Copy(const char* from, const char* to) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
int Rename(const char* oldpath, const char* newpath) {
|
||||
const nowide::wstackstring woldpath(oldpath);
|
||||
const nowide::wstackstring wnewpath(newpath);
|
||||
return MoveFileExW(woldpath.get(), wnewpath.get(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DEFINE_ID_TYPE(type, typeName) \
|
||||
thread_local NameDB* type::CurNameDB = nullptr; \
|
||||
template <> \
|
||||
@@ -296,13 +312,16 @@ template struct SoundMacroStepDNA<athena::Endian::Little>;
|
||||
|
||||
ObjectId NameDB::generateId(Type tp) const {
|
||||
uint16_t maxMatch = 0;
|
||||
if (tp == Type::Layer)
|
||||
if (tp == Type::Layer) {
|
||||
maxMatch = 0x8000;
|
||||
else if (tp == Type::Keymap)
|
||||
} else if (tp == Type::Keymap) {
|
||||
maxMatch = 0x4000;
|
||||
for (const auto& p : m_idToString)
|
||||
if (p.first.id >= maxMatch)
|
||||
}
|
||||
for (const auto& p : m_idToString) {
|
||||
if (p.first.id >= maxMatch) {
|
||||
maxMatch = p.first.id + 1;
|
||||
}
|
||||
}
|
||||
return maxMatch;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "amuse/Common.hpp"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <lzokay.hpp>
|
||||
#include <zlib.h>
|
||||
|
||||
#if __SWITCH__
|
||||
/*-
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_ranges
|
||||
#include <ranges>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
||||
@@ -92,8 +89,8 @@ DirectoryEnumerator::DirectoryEnumerator(std::string_view path, Mode mode, bool
|
||||
|
||||
m_entries.reserve(sort.size());
|
||||
if (reverse) {
|
||||
for (auto& it : std::ranges::reverse_view(sort)) {
|
||||
m_entries.emplace_back(std::move(it.second));
|
||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it) {
|
||||
m_entries.emplace_back(std::move(it->second));
|
||||
}
|
||||
} else {
|
||||
for (auto& e : sort) {
|
||||
@@ -134,8 +131,8 @@ DirectoryEnumerator::DirectoryEnumerator(std::string_view path, Mode mode, bool
|
||||
|
||||
m_entries.reserve(m_entries.size() + sort.size());
|
||||
if (reverse) {
|
||||
for (auto& it : std::ranges::reverse_view(sort)) {
|
||||
m_entries.emplace_back(std::move(it.second));
|
||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it) {
|
||||
m_entries.emplace_back(std::move(it->second));
|
||||
}
|
||||
} else {
|
||||
for (auto& e : sort) {
|
||||
@@ -164,8 +161,8 @@ DirectoryEnumerator::DirectoryEnumerator(std::string_view path, Mode mode, bool
|
||||
|
||||
m_entries.reserve(m_entries.size() + sort.size());
|
||||
if (reverse) {
|
||||
for (auto& e : std::ranges::reverse_view(sort)) {
|
||||
m_entries.emplace_back(std::move(e.second));
|
||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it) {
|
||||
m_entries.emplace_back(std::move(it->second));
|
||||
}
|
||||
} else {
|
||||
for (auto& e : sort) {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
namespace amuse {
|
||||
|
||||
static uint16_t DecodeUnsignedValue(const unsigned char*& data) {
|
||||
uint16_t ret;
|
||||
if (data[0] & 0x80) {
|
||||
uint16_t ret = 0;
|
||||
if ((data[0] & 0x80) != 0) {
|
||||
ret = data[1] | ((data[0] & 0x7f) << 8);
|
||||
data += 2;
|
||||
} else {
|
||||
@@ -20,13 +20,13 @@ static uint16_t DecodeUnsignedValue(const unsigned char*& data) {
|
||||
}
|
||||
|
||||
static int16_t DecodeSignedValue(const unsigned char*& data) {
|
||||
int16_t ret;
|
||||
if (data[0] & 0x80) {
|
||||
ret = data[1] | ((data[0] & 0x7f) << 8);
|
||||
int16_t ret = 0;
|
||||
if ((data[0] & 0x80) != 0) {
|
||||
ret = static_cast<int16_t>(data[1] | ((data[0] & 0x7f) << 8));
|
||||
ret |= ((ret << 1) & 0x8000);
|
||||
data += 2;
|
||||
} else {
|
||||
ret = int8_t(data[0] | ((data[0] << 1) & 0x80));
|
||||
ret = static_cast<int16_t>(data[0] | ((data[0] << 1) & 0x80));
|
||||
data += 1;
|
||||
}
|
||||
return ret;
|
||||
@@ -70,9 +70,10 @@ void SongState::Header::swapFromBig() {
|
||||
m_chanMapOff = SBig(m_chanMapOff);
|
||||
m_tempoTableOff = SBig(m_tempoTableOff);
|
||||
m_initialTempo = SBig(m_initialTempo);
|
||||
if (m_initialTempo & 0x80000000) {
|
||||
for (int i = 0; i < 16; ++i)
|
||||
m_loopStartTicks[i] = SBig(m_loopStartTicks[i]);
|
||||
if ((m_initialTempo & 0x80000000) != 0u) {
|
||||
for (unsigned int& loopStartTick : m_loopStartTicks) {
|
||||
loopStartTick = SBig(loopStartTick);
|
||||
}
|
||||
m_chanMapOff2 = SBig(m_chanMapOff2);
|
||||
} else {
|
||||
m_loopStartTicks[0] = SBig(m_loopStartTicks[0]);
|
||||
@@ -85,9 +86,10 @@ void SongState::Header::swapToBig() {
|
||||
m_chanMapOff = SBig(m_chanMapOff);
|
||||
m_tempoTableOff = SBig(m_tempoTableOff);
|
||||
m_initialTempo = SBig(m_initialTempo);
|
||||
if (m_initialTempo & 0x00000080) {
|
||||
for (int i = 0; i < 16; ++i)
|
||||
m_loopStartTicks[i] = SBig(m_loopStartTicks[i]);
|
||||
if ((m_initialTempo & 0x00000080) != 0u) {
|
||||
for (unsigned int& loopStartTick : m_loopStartTicks) {
|
||||
loopStartTick = SBig(loopStartTick);
|
||||
}
|
||||
m_chanMapOff2 = SBig(m_chanMapOff2);
|
||||
} else {
|
||||
m_loopStartTicks[0] = SBig(m_loopStartTicks[0]);
|
||||
@@ -100,9 +102,10 @@ SongState::Header& SongState::Header::operator=(const Header& other) {
|
||||
m_chanMapOff = other.m_chanMapOff;
|
||||
m_tempoTableOff = other.m_tempoTableOff;
|
||||
m_initialTempo = other.m_initialTempo;
|
||||
if (SBig(m_initialTempo) & 0x80000000) {
|
||||
for (int i = 0; i < 16; ++i)
|
||||
if ((SBig(m_initialTempo) & 0x80000000) != 0u) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
m_loopStartTicks[i] = other.m_loopStartTicks[i];
|
||||
}
|
||||
m_chanMapOff2 = other.m_chanMapOff2;
|
||||
} else {
|
||||
m_loopStartTicks[0] = other.m_loopStartTicks[0];
|
||||
@@ -120,8 +123,9 @@ bool SongState::TrackRegion::indexValid(bool bigEndian) const {
|
||||
}
|
||||
|
||||
int SongState::TrackRegion::indexLoop(bool bigEndian) const {
|
||||
if ((bigEndian ? SBig(m_regionIndex) : m_regionIndex) != -2)
|
||||
if ((bigEndian ? SBig(m_regionIndex) : m_regionIndex) != -2) {
|
||||
return -1;
|
||||
}
|
||||
return (bigEndian ? SBig(m_loopToRegion) : m_loopToRegion);
|
||||
}
|
||||
|
||||
@@ -141,7 +145,6 @@ SongState::Track::Track(SongState& parent, uint8_t midiChan, uint32_t loopStart,
|
||||
: m_parent(&parent)
|
||||
, m_midiChan(midiChan)
|
||||
, m_initRegion(regions)
|
||||
, m_curRegion(nullptr)
|
||||
, m_nextRegion(regions)
|
||||
, m_loopStartTick(loopStart)
|
||||
, m_tempo(tempo) {
|
||||
@@ -157,15 +160,16 @@ void SongState::Track::setRegion(const TrackRegion* region) {
|
||||
(m_parent->m_bigEndian ? SBig(m_parent->m_regionIdx[regionIdx]) : m_parent->m_regionIdx[regionIdx]);
|
||||
|
||||
Header header = *reinterpret_cast<const Header*>(m_data);
|
||||
if (m_parent->m_bigEndian)
|
||||
if (m_parent->m_bigEndian) {
|
||||
header.swapBig();
|
||||
}
|
||||
m_data += 12;
|
||||
|
||||
m_pitchWheelData = nullptr;
|
||||
m_nextPitchTick = 0x7fffffff;
|
||||
m_nextPitchDelta = 0;
|
||||
m_pitchVal = 0;
|
||||
if (header.m_pitchOff) {
|
||||
if (header.m_pitchOff != 0u) {
|
||||
m_pitchWheelData = m_parent->m_songData + header.m_pitchOff;
|
||||
if (m_pitchWheelData[0] != 0x80 || m_pitchWheelData[1] != 0x00) {
|
||||
auto delta = DecodeDelta(m_pitchWheelData);
|
||||
@@ -178,7 +182,7 @@ void SongState::Track::setRegion(const TrackRegion* region) {
|
||||
m_nextModTick = 0x7fffffff;
|
||||
m_nextModDelta = 0;
|
||||
m_modVal = 0;
|
||||
if (header.m_modOff) {
|
||||
if (header.m_modOff != 0u) {
|
||||
m_modWheelData = m_parent->m_songData + header.m_modOff;
|
||||
if (m_modWheelData[0] != 0x80 || m_modWheelData[1] != 0x00) {
|
||||
auto delta = DecodeDelta(m_modWheelData);
|
||||
@@ -204,18 +208,18 @@ void SongState::Track::advanceRegion() { setRegion(m_nextRegion); }
|
||||
int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
isBig = ptr[0] == 0;
|
||||
Header header = *reinterpret_cast<const Header*>(ptr);
|
||||
if (isBig)
|
||||
if (isBig) {
|
||||
header.swapFromBig();
|
||||
const uint32_t* trackIdx = reinterpret_cast<const uint32_t*>(ptr + header.m_trackIdxOff);
|
||||
const uint32_t* regionIdxTable = reinterpret_cast<const uint32_t*>(ptr + header.m_regionIdxOff);
|
||||
}
|
||||
const auto* trackIdx = reinterpret_cast<const uint32_t*>(ptr + header.m_trackIdxOff);
|
||||
const auto* regionIdxTable = reinterpret_cast<const uint32_t*>(ptr + header.m_regionIdxOff);
|
||||
|
||||
/* First determine maximum index of MIDI regions across all tracks */
|
||||
uint32_t maxRegionIdx = 0;
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (trackIdx[i]) {
|
||||
if (trackIdx[i] != 0) {
|
||||
const TrackRegion* region = nullptr;
|
||||
const TrackRegion* nextRegion =
|
||||
reinterpret_cast<const TrackRegion*>(ptr + (isBig ? SBig(trackIdx[i]) : trackIdx[i]));
|
||||
const auto* nextRegion = reinterpret_cast<const TrackRegion*>(ptr + (isBig ? SBig(trackIdx[i]) : trackIdx[i]));
|
||||
|
||||
/* Iterate all regions */
|
||||
while (nextRegion->indexValid(isBig)) {
|
||||
@@ -234,10 +238,9 @@ int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
|
||||
/* Validate all tracks */
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (trackIdx[i]) {
|
||||
if (trackIdx[i] != 0) {
|
||||
const TrackRegion* region = nullptr;
|
||||
const TrackRegion* nextRegion =
|
||||
reinterpret_cast<const TrackRegion*>(ptr + (isBig ? SBig(trackIdx[i]) : trackIdx[i]));
|
||||
const auto* nextRegion = reinterpret_cast<const TrackRegion*>(ptr + (isBig ? SBig(trackIdx[i]) : trackIdx[i]));
|
||||
|
||||
/* Iterate all regions */
|
||||
while (nextRegion->indexValid(isBig)) {
|
||||
@@ -248,36 +251,42 @@ int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
const unsigned char* data = ptr + (isBig ? SBig(regionIdxTable[regionIdx]) : regionIdxTable[regionIdx]);
|
||||
|
||||
/* Can't reliably validate final region */
|
||||
if (regionIdx == maxRegionIdx)
|
||||
if (regionIdx == maxRegionIdx) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Expected end pointer (next region) */
|
||||
const unsigned char* expectedEnd =
|
||||
ptr + (isBig ? SBig(regionIdxTable[regionIdx + 1]) : regionIdxTable[regionIdx + 1]);
|
||||
|
||||
auto header2 = *reinterpret_cast<const Track::Header*>(data);
|
||||
if (isBig)
|
||||
if (isBig) {
|
||||
header2.swapBig();
|
||||
}
|
||||
data += 12;
|
||||
|
||||
/* continuous pitch data */
|
||||
if (header2.m_pitchOff) {
|
||||
if (header2.m_pitchOff != 0u) {
|
||||
const unsigned char* dptr = ptr + header2.m_pitchOff;
|
||||
while (dptr[0] != 0x80 || dptr[1] != 0x00)
|
||||
while (dptr[0] != 0x80 || dptr[1] != 0x00) {
|
||||
DecodeDelta(dptr);
|
||||
}
|
||||
dptr += 2;
|
||||
if (dptr >= (expectedEnd - 4) && (dptr <= expectedEnd))
|
||||
if (dptr >= (expectedEnd - 4) && (dptr <= expectedEnd)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* continuous modulation data */
|
||||
if (header2.m_modOff) {
|
||||
if (header2.m_modOff != 0u) {
|
||||
const unsigned char* dptr = ptr + header2.m_modOff;
|
||||
while (dptr[0] != 0x80 || dptr[1] != 0x00)
|
||||
while (dptr[0] != 0x80 || dptr[1] != 0x00) {
|
||||
DecodeDelta(dptr);
|
||||
}
|
||||
dptr += 2;
|
||||
if (dptr >= (expectedEnd - 4) && (dptr <= expectedEnd))
|
||||
if (dptr >= (expectedEnd - 4) && (dptr <= expectedEnd)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop through as many commands as we can for this time period */
|
||||
@@ -292,10 +301,11 @@ int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
/* End of channel */
|
||||
data += 2;
|
||||
break;
|
||||
} else if (data[0] & 0x80 && data[1] & 0x80) {
|
||||
}
|
||||
if ((data[0] & 0x80) != 0 && (data[1] & 0x80) != 0) {
|
||||
/* Control change */
|
||||
data += 2;
|
||||
} else if (data[0] & 0x80) {
|
||||
} else if ((data[0] & 0x80) != 0) {
|
||||
/* Program change */
|
||||
data += 2;
|
||||
} else {
|
||||
@@ -314,16 +324,15 @@ int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
/* End of channel */
|
||||
data += 4;
|
||||
break;
|
||||
} else {
|
||||
if ((data[2] & 0x80) != 0x80) {
|
||||
/* Note */
|
||||
} else if (data[2] & 0x80 && data[3] & 0x80) {
|
||||
/* Control change */
|
||||
} else if (data[2] & 0x80) {
|
||||
/* Program change */
|
||||
}
|
||||
data += 4;
|
||||
}
|
||||
if ((data[2] & 0x80) != 0x80) {
|
||||
/* Note */
|
||||
} else if (((data[2] & 0x80) != 0) && ((data[3] & 0x80) != 0)) {
|
||||
/* Control change */
|
||||
} else if ((data[2] & 0x80) != 0) {
|
||||
/* Program change */
|
||||
}
|
||||
data += 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,12 +341,14 @@ int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bad)
|
||||
if (bad) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bad)
|
||||
if (bad) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -347,28 +358,31 @@ int SongState::DetectVersion(const unsigned char* ptr, bool& isBig) {
|
||||
bool SongState::initialize(const unsigned char* ptr, bool loop) {
|
||||
m_loop = loop;
|
||||
m_sngVersion = DetectVersion(ptr, m_bigEndian);
|
||||
if (m_sngVersion < 0)
|
||||
if (m_sngVersion < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_songData = ptr;
|
||||
m_header = *reinterpret_cast<const Header*>(ptr);
|
||||
if (m_bigEndian)
|
||||
if (m_bigEndian) {
|
||||
m_header.swapFromBig();
|
||||
const uint32_t* trackIdx = reinterpret_cast<const uint32_t*>(ptr + m_header.m_trackIdxOff);
|
||||
}
|
||||
|
||||
const auto* trackIdx = reinterpret_cast<const uint32_t*>(ptr + m_header.m_trackIdxOff);
|
||||
m_regionIdx = reinterpret_cast<const uint32_t*>(ptr + m_header.m_regionIdxOff);
|
||||
const uint8_t* chanMap = reinterpret_cast<const uint8_t*>(ptr + m_header.m_chanMapOff);
|
||||
const auto* chanMap = reinterpret_cast<const uint8_t*>(ptr + m_header.m_chanMapOff);
|
||||
|
||||
/* Initialize all tracks */
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
if (trackIdx[i]) {
|
||||
const TrackRegion* region =
|
||||
reinterpret_cast<const TrackRegion*>(ptr + (m_bigEndian ? SBig(trackIdx[i]) : trackIdx[i]));
|
||||
if (trackIdx[i] != 0u) {
|
||||
const auto* region = reinterpret_cast<const TrackRegion*>(ptr + (m_bigEndian ? SBig(trackIdx[i]) : trackIdx[i]));
|
||||
uint8_t chan = chanMap[i];
|
||||
uint32_t loopStart =
|
||||
(m_header.m_initialTempo & 0x80000000) ? m_header.m_loopStartTicks[chan] : m_header.m_loopStartTicks[0];
|
||||
(m_header.m_initialTempo & 0x80000000) != 0u ? m_header.m_loopStartTicks[chan] : m_header.m_loopStartTicks[0];
|
||||
m_tracks[i] = Track(*this, chan, loopStart, region, m_header.m_initialTempo & 0x7fffffff);
|
||||
} else
|
||||
} else {
|
||||
m_tracks[i] = Track();
|
||||
}
|
||||
}
|
||||
|
||||
m_songState = SongPlayState::Playing;
|
||||
@@ -377,32 +391,35 @@ bool SongState::initialize(const unsigned char* ptr, bool loop) {
|
||||
}
|
||||
|
||||
void SongState::Track::resetTempo() {
|
||||
if (m_parent->m_header.m_tempoTableOff)
|
||||
if (m_parent->m_header.m_tempoTableOff != 0u) {
|
||||
m_tempoPtr = reinterpret_cast<const TempoChange*>(m_parent->m_songData + m_parent->m_header.m_tempoTableOff);
|
||||
else
|
||||
} else {
|
||||
m_tempoPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
m_remDt += dt;
|
||||
|
||||
/* Compute ticks to compute based on current tempo */
|
||||
double ticksPerSecond = m_tempo * 384 / 60;
|
||||
double ticksPerSecond = static_cast<double>(m_tempo) * 384 / 60;
|
||||
uint32_t ticks = uint32_t(std::floor(m_remDt * ticksPerSecond));
|
||||
|
||||
/* See if there's an upcoming tempo change in this interval */
|
||||
while (m_tempoPtr && m_tempoPtr->m_tick != 0xffffffff) {
|
||||
while ((m_tempoPtr != nullptr) && m_tempoPtr->m_tick != 0xffffffff) {
|
||||
TempoChange change = *m_tempoPtr;
|
||||
if (m_parent->m_bigEndian)
|
||||
if (m_parent->m_bigEndian) {
|
||||
change.swapBig();
|
||||
}
|
||||
|
||||
if (m_curTick + ticks > change.m_tick)
|
||||
if (m_curTick + ticks > change.m_tick) {
|
||||
ticks = change.m_tick - m_curTick;
|
||||
}
|
||||
|
||||
if (ticks <= 0) {
|
||||
/* Turn over tempo */
|
||||
m_tempo = change.m_tempo & 0x7fffffff;
|
||||
ticksPerSecond = m_tempo * 384 / 60;
|
||||
ticksPerSecond = static_cast<double>(m_tempo) * 384 / 60;
|
||||
ticks = uint32_t(std::floor(m_remDt * ticksPerSecond));
|
||||
seq.setTempo(m_midiChan, m_tempo * 384 / 60.0);
|
||||
++m_tempoPtr;
|
||||
@@ -417,10 +434,11 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
/* Advance region if needed */
|
||||
while (m_nextRegion->indexValid(m_parent->m_bigEndian)) {
|
||||
uint32_t nextRegTick = (m_parent->m_bigEndian ? SBig(m_nextRegion->m_startTick) : m_nextRegion->m_startTick);
|
||||
if (uint32_t(endTick) > nextRegTick)
|
||||
if (uint32_t(endTick) > nextRegTick) {
|
||||
advanceRegion();
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop finished notes */
|
||||
@@ -432,14 +450,14 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
}
|
||||
}
|
||||
|
||||
if (m_data) {
|
||||
if (m_data != nullptr) {
|
||||
/* Update continuous pitch data */
|
||||
if (m_pitchWheelData) {
|
||||
int32_t pitchTick = m_curTick;
|
||||
int32_t remPitchTicks = ticks;
|
||||
if (m_pitchWheelData != nullptr) {
|
||||
auto pitchTick = static_cast<int32_t>(m_curTick);
|
||||
auto remPitchTicks = static_cast<int32_t>(ticks);
|
||||
while (pitchTick < int32_t(endTick)) {
|
||||
/* See if there's an upcoming pitch change in this interval */
|
||||
int32_t nextTick = m_nextPitchTick;
|
||||
auto nextTick = static_cast<int32_t>(m_nextPitchTick);
|
||||
if (pitchTick + remPitchTicks > nextTick) {
|
||||
/* Update pitch */
|
||||
m_pitchVal += m_nextPitchDelta;
|
||||
@@ -458,12 +476,12 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
}
|
||||
|
||||
/* Update continuous modulation data */
|
||||
if (m_modWheelData) {
|
||||
int32_t modTick = m_curTick;
|
||||
int32_t remModTicks = ticks;
|
||||
if (m_modWheelData != nullptr) {
|
||||
auto modTick = static_cast<int32_t>(m_curTick);
|
||||
auto remModTicks = static_cast<int32_t>(ticks);
|
||||
while (modTick < int32_t(endTick)) {
|
||||
/* See if there's an upcoming modulation change in this interval */
|
||||
int32_t nextTick = m_nextModTick;
|
||||
auto nextTick = static_cast<int32_t>(m_nextModTick);
|
||||
if (modTick + remModTicks > nextTick) {
|
||||
/* Update modulation */
|
||||
m_modVal += m_nextModDelta;
|
||||
@@ -486,11 +504,12 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
/* Revision */
|
||||
while (true) {
|
||||
/* Advance wait timer if active, returning if waiting */
|
||||
if (m_eventWaitCountdown) {
|
||||
m_eventWaitCountdown -= ticks;
|
||||
if (m_eventWaitCountdown != 0) {
|
||||
m_eventWaitCountdown -= static_cast<int32_t>(ticks);
|
||||
ticks = 0;
|
||||
if (m_eventWaitCountdown > 0)
|
||||
if (m_eventWaitCountdown > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load next command */
|
||||
@@ -498,16 +517,17 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
/* End of channel */
|
||||
m_data = nullptr;
|
||||
break;
|
||||
} else if (m_data[0] & 0x80 && m_data[1] & 0x80) {
|
||||
}
|
||||
if ((m_data[0] & 0x80) != 0u && (m_data[1] & 0x80) != 0u) {
|
||||
/* Control change */
|
||||
uint8_t val = m_data[0] & 0x7f;
|
||||
uint8_t ctrl = m_data[1] & 0x7f;
|
||||
seq.setCtrlValue(m_midiChan, ctrl, val);
|
||||
seq.setCtrlValue(m_midiChan, ctrl, static_cast<int8_t>(val));
|
||||
m_data += 2;
|
||||
} else if (m_data[0] & 0x80) {
|
||||
} else if ((m_data[0] & 0x80) != 0u) {
|
||||
/* Program change */
|
||||
uint8_t prog = m_data[0] & 0x7f;
|
||||
seq.setChanProgram(m_midiChan, prog);
|
||||
seq.setChanProgram(static_cast<int8_t>(m_midiChan), static_cast<int8_t>(prog));
|
||||
m_data += 2;
|
||||
} else {
|
||||
/* Note */
|
||||
@@ -516,8 +536,9 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
uint16_t length = (m_parent->m_bigEndian ? SBig(*reinterpret_cast<const uint16_t*>(m_data + 2))
|
||||
: *reinterpret_cast<const uint16_t*>(m_data + 2));
|
||||
seq.keyOn(m_midiChan, note, vel);
|
||||
if (length == 0)
|
||||
if (length == 0) {
|
||||
seq.keyOff(m_midiChan, note, 0);
|
||||
}
|
||||
m_remNoteLengths[note] = length;
|
||||
m_data += 4;
|
||||
}
|
||||
@@ -529,11 +550,12 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
/* Legacy */
|
||||
while (true) {
|
||||
/* Advance wait timer if active, returning if waiting */
|
||||
if (m_eventWaitCountdown) {
|
||||
m_eventWaitCountdown -= ticks;
|
||||
if (m_eventWaitCountdown != 0) {
|
||||
m_eventWaitCountdown -= static_cast<int32_t>(ticks);
|
||||
ticks = 0;
|
||||
if (m_eventWaitCountdown > 0)
|
||||
if (m_eventWaitCountdown > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load next command */
|
||||
@@ -541,29 +563,29 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
/* End of channel */
|
||||
m_data = nullptr;
|
||||
break;
|
||||
} else {
|
||||
if ((m_data[2] & 0x80) != 0x80) {
|
||||
/* Note */
|
||||
uint16_t length = (m_parent->m_bigEndian ? SBig(*reinterpret_cast<const uint16_t*>(m_data))
|
||||
: *reinterpret_cast<const uint16_t*>(m_data));
|
||||
uint8_t note = m_data[2] & 0x7f;
|
||||
uint8_t vel = m_data[3] & 0x7f;
|
||||
seq.keyOn(m_midiChan, note, vel);
|
||||
if (length == 0)
|
||||
seq.keyOff(m_midiChan, note, 0);
|
||||
m_remNoteLengths[note] = length;
|
||||
} else if (m_data[2] & 0x80 && m_data[3] & 0x80) {
|
||||
/* Control change */
|
||||
uint8_t val = m_data[2] & 0x7f;
|
||||
uint8_t ctrl = m_data[3] & 0x7f;
|
||||
seq.setCtrlValue(m_midiChan, ctrl, val);
|
||||
} else if (m_data[2] & 0x80) {
|
||||
/* Program change */
|
||||
uint8_t prog = m_data[2] & 0x7f;
|
||||
seq.setChanProgram(m_midiChan, prog);
|
||||
}
|
||||
m_data += 4;
|
||||
}
|
||||
if ((m_data[2] & 0x80) != 0x80) {
|
||||
/* Note */
|
||||
uint16_t length = (m_parent->m_bigEndian ? SBig(*reinterpret_cast<const uint16_t*>(m_data))
|
||||
: *reinterpret_cast<const uint16_t*>(m_data));
|
||||
uint8_t note = m_data[2] & 0x7f;
|
||||
uint8_t vel = m_data[3] & 0x7f;
|
||||
seq.keyOn(m_midiChan, note, vel);
|
||||
if (length == 0) {
|
||||
seq.keyOff(m_midiChan, note, 0);
|
||||
}
|
||||
m_remNoteLengths[note] = length;
|
||||
} else if ((m_data[2] & 0x80) != 0u && (m_data[3] & 0x80) != 0u) {
|
||||
/* Control change */
|
||||
uint8_t val = m_data[2] & 0x7f;
|
||||
uint8_t ctrl = m_data[3] & 0x7f;
|
||||
seq.setCtrlValue(m_midiChan, ctrl, static_cast<int8_t>(val));
|
||||
} else if ((m_data[2] & 0x80) != 0u) {
|
||||
/* Program change */
|
||||
uint8_t prog = m_data[2] & 0x7f;
|
||||
seq.setChanProgram(static_cast<int8_t>(m_midiChan), static_cast<int8_t>(prog));
|
||||
}
|
||||
m_data += 4;
|
||||
|
||||
/* Set next delta-time */
|
||||
int32_t absTick = (m_parent->m_bigEndian ? SBig(*reinterpret_cast<const int32_t*>(m_data))
|
||||
@@ -579,7 +601,7 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
|
||||
/* Handle loop end */
|
||||
if (m_parent->m_loop) {
|
||||
int loopTo;
|
||||
int loopTo = 0;
|
||||
if ((loopTo = m_nextRegion->indexLoop(m_parent->m_bigEndian)) != -1) {
|
||||
uint32_t loopEndTick = (m_parent->m_bigEndian ? SBig(m_nextRegion->m_startTick) : m_nextRegion->m_startTick);
|
||||
if (uint32_t(endTick) > loopEndTick) {
|
||||
@@ -593,25 +615,30 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_data)
|
||||
if (m_data == nullptr) {
|
||||
return m_nextRegion->indexDone(m_parent->m_bigEndian, m_parent->m_loop);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SongState::advance(Sequencer& seq, double dt) {
|
||||
/* Stopped */
|
||||
if (m_songState == SongPlayState::Stopped)
|
||||
if (m_songState == SongPlayState::Stopped) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Advance all tracks */
|
||||
bool done = true;
|
||||
for (Track& trk : m_tracks)
|
||||
if (trk)
|
||||
for (Track& trk : m_tracks) {
|
||||
if (trk) {
|
||||
done &= trk.advance(seq, dt);
|
||||
}
|
||||
}
|
||||
|
||||
if (done)
|
||||
if (done) {
|
||||
m_songState = SongPlayState::Stopped;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
} // namespace amuse
|
||||
|
||||
Reference in New Issue
Block a user