Better CMake dependency handling

This commit is contained in:
Jack Andersen 2019-06-11 16:02:52 -10:00
parent 1b10016369
commit 2a3444400e
22 changed files with 141 additions and 147 deletions

View File

@ -42,8 +42,8 @@
@public @public
std::unique_ptr<boo::IAudioVoiceEngine> booEngine; std::unique_ptr<boo::IAudioVoiceEngine> booEngine;
std::experimental::optional<amuse::BooBackendVoiceAllocator> amuseAllocator; std::optional<amuse::BooBackendVoiceAllocator> amuseAllocator;
std::experimental::optional<amuse::Engine> amuseEngine; std::optional<amuse::Engine> amuseEngine;
std::shared_ptr<amuse::Voice> activeSFXVox; std::shared_ptr<amuse::Voice> activeSFXVox;
} }
- (BOOL)importURL:(NSURL*)url; - (BOOL)importURL:(NSURL*)url;

View File

@ -4,7 +4,7 @@
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#include <map> #include <map>
#include <string> #include <string>
#include "optional.hpp" #include <optional>
#include <amuse/amuse.hpp> #include <amuse/amuse.hpp>
#include <athena/FileReader.hpp> #include <athena/FileReader.hpp>
@ -43,9 +43,9 @@ struct AudioGroupDataCollection {
MetaData(athena::io::FileReader& r) MetaData(athena::io::FileReader& r)
: fmt(amuse::DataFormat(r.readUint32Little())), absOffs(r.readUint32Little()), active(r.readUint32Little()) {} : fmt(amuse::DataFormat(r.readUint32Little())), absOffs(r.readUint32Little()), active(r.readUint32Little()) {}
}; };
std::experimental::optional<MetaData> m_metaData; std::optional<MetaData> m_metaData;
std::experimental::optional<amuse::AudioGroupData> m_loadedData; std::optional<amuse::AudioGroupData> m_loadedData;
const amuse::AudioGroup* m_loadedGroup; const amuse::AudioGroup* m_loadedGroup;
std::vector<AudioGroupToken*> m_groupTokens; std::vector<AudioGroupToken*> m_groupTokens;

View File

@ -486,7 +486,7 @@ bool AudioGroupDataCollection::loadMeta(AudioGroupFilePresenter* presenter)
if (!coord) if (!coord)
return false; return false;
NSError* err; NSError* err;
__block std::experimental::optional<MetaData>& ret = m_metaData; __block std::optional<MetaData>& ret = m_metaData;
[coord coordinateReadingItemAtURL:m_meta [coord coordinateReadingItemAtURL:m_meta
options:NSFileCoordinatorReadingResolvesSymbolicLink error:&err options:NSFileCoordinatorReadingResolvesSymbolicLink error:&err
byAccessor:^(NSURL* newUrl) byAccessor:^(NSURL* newUrl)

View File

@ -8,7 +8,7 @@
#include <AudioUnit/AudioUnit.h> #include <AudioUnit/AudioUnit.h>
#include "optional.hpp" #include <optional>
#include "amuse/BooBackend.hpp" #include "amuse/BooBackend.hpp"
#include "amuse/Engine.hpp" #include "amuse/Engine.hpp"
@ -34,8 +34,8 @@ void RegisterAudioUnit();
@public @public
AudioUnitViewController* m_viewController; AudioUnitViewController* m_viewController;
std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend; std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend;
std::experimental::optional<amuse::AudioUnitBackendVoiceAllocator> m_voxAlloc; std::optional<amuse::AudioUnitBackendVoiceAllocator> m_voxAlloc;
std::experimental::optional<amuse::Engine> m_engine; std::optional<amuse::Engine> m_engine;
AudioGroupFilePresenter* m_filePresenter; AudioGroupFilePresenter* m_filePresenter;
AUAudioUnitBus* m_outBus; AUAudioUnitBus* m_outBus;
AUAudioUnitBusArray* m_outs; AUAudioUnitBusArray* m_outs;

View File

@ -13,13 +13,8 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boo AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}
message(STATUS "Preparing standalone build") message(STATUS "Preparing standalone build")
add_subdirectory(boo) add_subdirectory(boo)
add_subdirectory(athena) add_subdirectory(athena)
include_directories(athena/include)
endif() endif()
atdna(atdna_AudioGroupPool.cpp include/amuse/AudioGroupPool.hpp)
atdna(atdna_AudioGroupProject.cpp include/amuse/AudioGroupProject.hpp)
atdna(atdna_AudioGroupSampleDirectory.cpp include/amuse/AudioGroupSampleDirectory.hpp)
set(SOURCES set(SOURCES
lib/AudioGroup.cpp lib/AudioGroup.cpp
lib/AudioGroupData.cpp lib/AudioGroupData.cpp
@ -45,10 +40,7 @@ set(SOURCES
lib/Common.cpp lib/Common.cpp
lib/DSPCodec.cpp lib/DSPCodec.cpp
lib/N64MusyXCodec.cpp lib/N64MusyXCodec.cpp
lib/VolumeTable.cpp lib/VolumeTable.cpp)
atdna_AudioGroupPool.cpp
atdna_AudioGroupProject.cpp
atdna_AudioGroupSampleDirectory.cpp)
set(HEADERS set(HEADERS
include/amuse/AudioGroup.hpp include/amuse/AudioGroup.hpp
@ -86,27 +78,24 @@ if(NX)
list(APPEND HEADERS include/switch_math.hpp) list(APPEND HEADERS include/switch_math.hpp)
endif() endif()
unset(EXTRAS)
if(TARGET boo)
include_directories(${BOO_INCLUDE_DIR} ${BOO_INCLUDE_DIR}/../lib ${BOO_INCLUDE_DIR}/../soxr/src
${LOGVISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${LZOKAY_INCLUDE_DIR})
list(APPEND EXTRAS lib/BooBackend.cpp include/amuse/BooBackend.hpp)
endif()
include_directories(include)
set(AMUSE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "amuse include path" FORCE)
add_library(amuse add_library(amuse
${SOURCES} ${SOURCES}
${HEADERS} ${HEADERS})
${EXTRAS}) target_atdna(amuse atdna_AudioGroupPool.cpp include/amuse/AudioGroupPool.hpp)
target_atdna(amuse atdna_AudioGroupProject.cpp include/amuse/AudioGroupProject.hpp)
target_atdna(amuse atdna_AudioGroupSampleDirectory.cpp include/amuse/AudioGroupSampleDirectory.hpp)
target_include_directories(amuse PUBLIC include)
target_link_libraries(amuse athena-core ${ZLIB_LIBRARIES} lzokay)
if(TARGET boo)
target_sources(amuse PRIVATE lib/BooBackend.cpp include/amuse/BooBackend.hpp)
target_link_libraries(amuse boo)
endif()
if (NOT MSVC)
target_compile_options(amuse PRIVATE -Wno-unknown-pragmas)
endif()
if(COMMAND add_sanitizers) if(COMMAND add_sanitizers)
add_sanitizers(amuse) add_sanitizers(amuse)
endif() endif()
if(COMMAND cotire)
set_target_properties(amuse PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(amuse)
endif()
if(TARGET boo AND NOT WINDOWS_STORE AND NOT NX) if(TARGET boo AND NOT WINDOWS_STORE AND NOT NX)
# AudioUnit Target (OS X only) # AudioUnit Target (OS X only)
@ -119,15 +108,15 @@ if(TARGET boo AND NOT WINDOWS_STORE AND NOT NX)
# Player # Player
add_executable(amuseplay WIN32 driver/amuseplay.cpp) add_executable(amuseplay WIN32 driver/amuseplay.cpp)
target_link_libraries(amuseplay amuse boo ${BOO_SYS_LIBS} logvisor athena-core athena-libyaml ${ZLIB_LIBRARIES} lzokay) target_link_libraries(amuseplay amuse logvisor)
# Converter # Converter
add_executable(amuseconv driver/amuseconv.cpp) add_executable(amuseconv driver/amuseconv.cpp)
target_link_libraries(amuseconv amuse boo ${BOO_SYS_LIBS} logvisor athena-core athena-libyaml ${ZLIB_LIBRARIES} lzokay) target_link_libraries(amuseconv amuse logvisor)
# Renderer # Renderer
add_executable(amuserender driver/amuserender.cpp) add_executable(amuserender driver/amuserender.cpp)
target_link_libraries(amuserender amuse boo ${BOO_SYS_LIBS} logvisor athena-core athena-libyaml ${ZLIB_LIBRARIES} lzokay) target_link_libraries(amuserender amuse logvisor)
if(COMMAND add_sanitizers) if(COMMAND add_sanitizers)
add_sanitizers(amuseplay) add_sanitizers(amuseplay)

View File

@ -84,4 +84,4 @@ target_link_libraries(amuse-gui ${PLAT_LIBS}
${Qt5Xml_LIBRARIES} ${Qt5Xml_LIBRARIES}
${Qt5Svg_LIBRARIES} ${Qt5Svg_LIBRARIES}
${Qt5Qml_LIBRARIES} ${Qt5Qml_LIBRARIES}
amuse boo ${BOO_SYS_LIBS} logvisor athena-core athena-libyaml xxhash ${ZLIB_LIBRARIES} lzokay) amuse boo ${BOO_SYS_LIBS} logvisor athena-core xxhash ${ZLIB_LIBRARIES} lzokay)

View File

@ -1296,7 +1296,7 @@ ProjectModel::SoundGroupNode* ProjectModel::newSoundGroup(GroupNode* group, cons
return nullptr; return nullptr;
} }
auto node = amuse::MakeObj<SoundGroupNode>(name, amuse::MakeObj<amuse::SFXGroupIndex>()); auto node = amuse::MakeObj<SoundGroupNode>(name, amuse::MakeObj<amuse::SFXGroupIndex>());
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add Sound Group %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<SoundGroupNode>(tr("Add Sound Group %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1316,7 +1316,7 @@ ProjectModel::SongGroupNode* ProjectModel::newSongGroup(GroupNode* group, const
return nullptr; return nullptr;
} }
auto node = amuse::MakeObj<SongGroupNode>(name, amuse::MakeObj<amuse::SongGroupIndex>()); auto node = amuse::MakeObj<SongGroupNode>(name, amuse::MakeObj<amuse::SongGroupIndex>());
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add Song Group %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<SongGroupNode>(tr("Add Song Group %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1428,7 +1428,7 @@ ProjectModel::SoundMacroNode* ProjectModel::newSoundMacro(GroupNode* group, cons
dataNode->readCmds<athena::utility::NotSystemEndian>(r, templ->m_length); dataNode->readCmds<athena::utility::NotSystemEndian>(r, templ->m_length);
} }
auto node = amuse::MakeObj<SoundMacroNode>(name, dataNode); auto node = amuse::MakeObj<SoundMacroNode>(name, dataNode);
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add Sound Macro %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<SoundMacroNode>(tr("Add Sound Macro %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1450,7 +1450,7 @@ ProjectModel::ADSRNode* ProjectModel::newADSR(GroupNode* group, const QString& n
auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>(); auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>();
*dataNode = std::make_unique<amuse::ADSR>(); *dataNode = std::make_unique<amuse::ADSR>();
auto node = amuse::MakeObj<ADSRNode>(name, dataNode); auto node = amuse::MakeObj<ADSRNode>(name, dataNode);
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add ADSR %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<ADSRNode>(tr("Add ADSR %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1472,7 +1472,7 @@ ProjectModel::CurveNode* ProjectModel::newCurve(GroupNode* group, const QString&
auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>(); auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>();
*dataNode = std::make_unique<amuse::Curve>(); *dataNode = std::make_unique<amuse::Curve>();
auto node = amuse::MakeObj<CurveNode>(name, dataNode); auto node = amuse::MakeObj<CurveNode>(name, dataNode);
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add Curve %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<CurveNode>(tr("Add Curve %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1493,7 +1493,7 @@ ProjectModel::KeymapNode* ProjectModel::newKeymap(GroupNode* group, const QStrin
} }
auto dataNode = amuse::MakeObj<std::array<amuse::Keymap, 128>>(); auto dataNode = amuse::MakeObj<std::array<amuse::Keymap, 128>>();
auto node = amuse::MakeObj<KeymapNode>(name, dataNode); auto node = amuse::MakeObj<KeymapNode>(name, dataNode);
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add Keymap %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<KeymapNode>(tr("Add Keymap %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1514,7 +1514,7 @@ ProjectModel::LayersNode* ProjectModel::newLayers(GroupNode* group, const QStrin
} }
auto dataNode = amuse::MakeObj<std::vector<amuse::LayerMapping>>(); auto dataNode = amuse::MakeObj<std::vector<amuse::LayerMapping>>();
auto node = amuse::MakeObj<LayersNode>(name, dataNode); auto node = amuse::MakeObj<LayersNode>(name, dataNode);
g_MainWindow->pushUndoCommand(new NodeAddUndoCommand(tr("Add Layers %1"), node.get(), group)); g_MainWindow->pushUndoCommand(new NodeAddUndoCommand<LayersNode>(tr("Add Layers %1"), node.get(), group));
return node.get(); return node.get();
} }
@ -1590,14 +1590,16 @@ static void WriteMimeYAML(athena::io::YAMLDocWriter& w, ProjectModel::LayersNode
} }
template <class NT> template <class NT>
EditorUndoCommand* ProjectModel::readMimeYAML(athena::io::YAMLDocReader& r, const QString& name, GroupNode* gn) {} EditorUndoCommand* ProjectModel::readMimeYAML(athena::io::YAMLDocReader& r, const QString& name, GroupNode* gn) {
return nullptr;
}
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SongGroupNode>(athena::io::YAMLDocReader& r, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SongGroupNode>(athena::io::YAMLDocReader& r,
const QString& name, GroupNode* gn) { const QString& name, GroupNode* gn) {
auto dataNode = amuse::MakeObj<amuse::SongGroupIndex>(); auto dataNode = amuse::MakeObj<amuse::SongGroupIndex>();
dataNode->fromYAML(r); dataNode->fromYAML(r);
auto node = amuse::MakeObj<SongGroupNode>(name, dataNode); auto node = amuse::MakeObj<SongGroupNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add Song Group %1"), node.get(), gn); return new NodeAddUndoCommand<SongGroupNode>(ProjectModel::tr("Add Song Group %1"), node.get(), gn);
} }
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SoundGroupNode>(athena::io::YAMLDocReader& r, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SoundGroupNode>(athena::io::YAMLDocReader& r,
@ -1605,7 +1607,7 @@ EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SoundGroupNode>(athe
auto dataNode = amuse::MakeObj<amuse::SFXGroupIndex>(); auto dataNode = amuse::MakeObj<amuse::SFXGroupIndex>();
dataNode->fromYAML(r); dataNode->fromYAML(r);
auto node = amuse::MakeObj<SoundGroupNode>(name, dataNode); auto node = amuse::MakeObj<SoundGroupNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add Sound Group %1"), node.get(), gn); return new NodeAddUndoCommand<SoundGroupNode>(ProjectModel::tr("Add Sound Group %1"), node.get(), gn);
} }
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SoundMacroNode>(athena::io::YAMLDocReader& r, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SoundMacroNode>(athena::io::YAMLDocReader& r,
@ -1615,7 +1617,7 @@ EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SoundMacroNode>(athe
if (auto __v = r.enterSubVector("cmds", cmdCount)) if (auto __v = r.enterSubVector("cmds", cmdCount))
dataNode->fromYAML(r, cmdCount); dataNode->fromYAML(r, cmdCount);
auto node = amuse::MakeObj<SoundMacroNode>(name, dataNode); auto node = amuse::MakeObj<SoundMacroNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add SoundMacro %1"), node.get(), gn); return new NodeAddUndoCommand<SoundMacroNode>(ProjectModel::tr("Add SoundMacro %1"), node.get(), gn);
} }
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::ADSRNode>(athena::io::YAMLDocReader& r, const QString& name, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::ADSRNode>(athena::io::YAMLDocReader& r, const QString& name,
@ -1630,7 +1632,7 @@ EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::ADSRNode>(athena::io
static_cast<amuse::ADSR&>(**dataNode).read(r); static_cast<amuse::ADSR&>(**dataNode).read(r);
} }
auto node = amuse::MakeObj<ADSRNode>(name, dataNode); auto node = amuse::MakeObj<ADSRNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add ADSR %1"), node.get(), gn); return new NodeAddUndoCommand<ADSRNode>(ProjectModel::tr("Add ADSR %1"), node.get(), gn);
} }
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::CurveNode>(athena::io::YAMLDocReader& r, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::CurveNode>(athena::io::YAMLDocReader& r,
@ -1638,7 +1640,7 @@ EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::CurveNode>(athena::i
auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>(std::make_unique<amuse::Curve>()); auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>(std::make_unique<amuse::Curve>());
static_cast<amuse::Curve&>(**dataNode).read(r); static_cast<amuse::Curve&>(**dataNode).read(r);
auto node = amuse::MakeObj<CurveNode>(name, dataNode); auto node = amuse::MakeObj<CurveNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add Curve %1"), node.get(), gn); return new NodeAddUndoCommand<CurveNode>(ProjectModel::tr("Add Curve %1"), node.get(), gn);
} }
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::KeymapNode>(athena::io::YAMLDocReader& r, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::KeymapNode>(athena::io::YAMLDocReader& r,
@ -1653,7 +1655,7 @@ EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::KeymapNode>(athena::
} }
} }
auto node = amuse::MakeObj<KeymapNode>(name, dataNode); auto node = amuse::MakeObj<KeymapNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add Keymap %1"), node.get(), gn); return new NodeAddUndoCommand<KeymapNode>(ProjectModel::tr("Add Keymap %1"), node.get(), gn);
} }
template <> template <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::LayersNode>(athena::io::YAMLDocReader& r, EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::LayersNode>(athena::io::YAMLDocReader& r,
@ -1669,7 +1671,7 @@ EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::LayersNode>(athena::
} }
} }
auto node = amuse::MakeObj<LayersNode>(name, dataNode); auto node = amuse::MakeObj<LayersNode>(name, dataNode);
return new NodeAddUndoCommand(ProjectModel::tr("Add Layers %1"), node.get(), gn); return new NodeAddUndoCommand<LayersNode>(ProjectModel::tr("Add Layers %1"), node.get(), gn);
} }
template <class NT> template <class NT>
@ -1801,25 +1803,25 @@ void ProjectModel::cut(const QModelIndex& index) {
EditorUndoCommand* cmd = nullptr; EditorUndoCommand* cmd = nullptr;
switch (n->type()) { switch (n->type()) {
case INode::Type::SongGroup: case INode::Type::SongGroup:
cmd = new NodeDelUndoCommand(tr("Cut SongGroup %1"), static_cast<SongGroupNode*>(n)); cmd = new NodeDelUndoCommand<SongGroupNode>(tr("Cut SongGroup %1"), static_cast<SongGroupNode*>(n));
break; break;
case INode::Type::SoundGroup: case INode::Type::SoundGroup:
cmd = new NodeDelUndoCommand(tr("Cut SFXGroup %1"), static_cast<SoundGroupNode*>(n)); cmd = new NodeDelUndoCommand<SoundGroupNode>(tr("Cut SFXGroup %1"), static_cast<SoundGroupNode*>(n));
break; break;
case INode::Type::SoundMacro: case INode::Type::SoundMacro:
cmd = new NodeDelUndoCommand(tr("Cut SoundMacro %1"), static_cast<SoundMacroNode*>(n)); cmd = new NodeDelUndoCommand<SoundMacroNode>(tr("Cut SoundMacro %1"), static_cast<SoundMacroNode*>(n));
break; break;
case INode::Type::ADSR: case INode::Type::ADSR:
cmd = new NodeDelUndoCommand(tr("Cut ADSR %1"), static_cast<ADSRNode*>(n)); cmd = new NodeDelUndoCommand<ADSRNode>(tr("Cut ADSR %1"), static_cast<ADSRNode*>(n));
break; break;
case INode::Type::Curve: case INode::Type::Curve:
cmd = new NodeDelUndoCommand(tr("Cut Curve %1"), static_cast<CurveNode*>(n)); cmd = new NodeDelUndoCommand<CurveNode>(tr("Cut Curve %1"), static_cast<CurveNode*>(n));
break; break;
case INode::Type::Keymap: case INode::Type::Keymap:
cmd = new NodeDelUndoCommand(tr("Cut Keymap %1"), static_cast<KeymapNode*>(n)); cmd = new NodeDelUndoCommand<KeymapNode>(tr("Cut Keymap %1"), static_cast<KeymapNode*>(n));
break; break;
case INode::Type::Layer: case INode::Type::Layer:
cmd = new NodeDelUndoCommand(tr("Cut Layers %1"), static_cast<LayersNode*>(n)); cmd = new NodeDelUndoCommand<LayersNode>(tr("Cut Layers %1"), static_cast<LayersNode*>(n));
break; break;
default: default:
break; break;
@ -1878,14 +1880,14 @@ QModelIndex ProjectModel::duplicate(const QModelIndex& index) {
case INode::Type::SoundGroup: { case INode::Type::SoundGroup: {
SoundGroupNode* cn = static_cast<SoundGroupNode*>(n); SoundGroupNode* cn = static_cast<SoundGroupNode*>(n);
auto node = amuse::MakeObj<SoundGroupNode>(newName, amuse::MakeObj<amuse::SFXGroupIndex>(*cn->m_index)); auto node = amuse::MakeObj<SoundGroupNode>(newName, amuse::MakeObj<amuse::SFXGroupIndex>(*cn->m_index));
cmd = new NodeAddUndoCommand(tr("Add Sound Group %1"), node.get(), gn); cmd = new NodeAddUndoCommand<SoundGroupNode>(tr("Add Sound Group %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
case INode::Type::SongGroup: { case INode::Type::SongGroup: {
SongGroupNode* cn = static_cast<SongGroupNode*>(n); SongGroupNode* cn = static_cast<SongGroupNode*>(n);
auto node = amuse::MakeObj<SongGroupNode>(newName, amuse::MakeObj<amuse::SongGroupIndex>(*cn->m_index)); auto node = amuse::MakeObj<SongGroupNode>(newName, amuse::MakeObj<amuse::SongGroupIndex>(*cn->m_index));
cmd = new NodeAddUndoCommand(tr("Add Song Group %1"), node.get(), gn); cmd = new NodeAddUndoCommand<SongGroupNode>(tr("Add Song Group %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
@ -1894,35 +1896,35 @@ QModelIndex ProjectModel::duplicate(const QModelIndex& index) {
auto dataNode = amuse::MakeObj<amuse::SoundMacro>(); auto dataNode = amuse::MakeObj<amuse::SoundMacro>();
dataNode->buildFromPrototype(*cn->m_obj); dataNode->buildFromPrototype(*cn->m_obj);
auto node = amuse::MakeObj<SoundMacroNode>(newName, dataNode); auto node = amuse::MakeObj<SoundMacroNode>(newName, dataNode);
cmd = new NodeAddUndoCommand(tr("Add Sound Macro %1"), node.get(), gn); cmd = new NodeAddUndoCommand<SoundMacroNode>(tr("Add Sound Macro %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
case INode::Type::ADSR: { case INode::Type::ADSR: {
ADSRNode* cn = static_cast<ADSRNode*>(n); ADSRNode* cn = static_cast<ADSRNode*>(n);
auto node = amuse::MakeObj<ADSRNode>(newName, DuplicateTable(cn->m_obj->get())); auto node = amuse::MakeObj<ADSRNode>(newName, DuplicateTable(cn->m_obj->get()));
cmd = new NodeAddUndoCommand(tr("Add ADSR %1"), node.get(), gn); cmd = new NodeAddUndoCommand<ADSRNode>(tr("Add ADSR %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
case INode::Type::Curve: { case INode::Type::Curve: {
CurveNode* cn = static_cast<CurveNode*>(n); CurveNode* cn = static_cast<CurveNode*>(n);
auto node = amuse::MakeObj<CurveNode>(newName, DuplicateTable(cn->m_obj->get())); auto node = amuse::MakeObj<CurveNode>(newName, DuplicateTable(cn->m_obj->get()));
cmd = new NodeAddUndoCommand(tr("Add Curve %1"), node.get(), gn); cmd = new NodeAddUndoCommand<CurveNode>(tr("Add Curve %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
case INode::Type::Keymap: { case INode::Type::Keymap: {
KeymapNode* cn = static_cast<KeymapNode*>(n); KeymapNode* cn = static_cast<KeymapNode*>(n);
auto node = amuse::MakeObj<KeymapNode>(newName, amuse::MakeObj<std::array<amuse::Keymap, 128>>(*cn->m_obj)); auto node = amuse::MakeObj<KeymapNode>(newName, amuse::MakeObj<std::array<amuse::Keymap, 128>>(*cn->m_obj));
cmd = new NodeAddUndoCommand(tr("Add Keymap %1"), node.get(), gn); cmd = new NodeAddUndoCommand<KeymapNode>(tr("Add Keymap %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
case INode::Type::Layer: { case INode::Type::Layer: {
LayersNode* cn = static_cast<LayersNode*>(n); LayersNode* cn = static_cast<LayersNode*>(n);
auto node = amuse::MakeObj<LayersNode>(newName, amuse::MakeObj<std::vector<amuse::LayerMapping>>(*cn->m_obj)); auto node = amuse::MakeObj<LayersNode>(newName, amuse::MakeObj<std::vector<amuse::LayerMapping>>(*cn->m_obj));
cmd = new NodeAddUndoCommand(tr("Add Layers %1"), node.get(), gn); cmd = new NodeAddUndoCommand<LayersNode>(tr("Add Layers %1"), node.get(), gn);
ret = ProjectModel::index(node.get()); ret = ProjectModel::index(node.get());
break; break;
} }
@ -1958,25 +1960,25 @@ void ProjectModel::del(const QModelIndex& index) {
break; break;
} }
case INode::Type::SongGroup: case INode::Type::SongGroup:
cmd = new NodeDelUndoCommand(tr("Delete SongGroup %1"), static_cast<SongGroupNode*>(n)); cmd = new NodeDelUndoCommand<SongGroupNode>(tr("Delete SongGroup %1"), static_cast<SongGroupNode*>(n));
break; break;
case INode::Type::SoundGroup: case INode::Type::SoundGroup:
cmd = new NodeDelUndoCommand(tr("Delete SFXGroup %1"), static_cast<SoundGroupNode*>(n)); cmd = new NodeDelUndoCommand<SoundGroupNode>(tr("Delete SFXGroup %1"), static_cast<SoundGroupNode*>(n));
break; break;
case INode::Type::SoundMacro: case INode::Type::SoundMacro:
cmd = new NodeDelUndoCommand(tr("Delete SoundMacro %1"), static_cast<SoundMacroNode*>(n)); cmd = new NodeDelUndoCommand<SoundMacroNode>(tr("Delete SoundMacro %1"), static_cast<SoundMacroNode*>(n));
break; break;
case INode::Type::ADSR: case INode::Type::ADSR:
cmd = new NodeDelUndoCommand(tr("Delete ADSR %1"), static_cast<ADSRNode*>(n)); cmd = new NodeDelUndoCommand<ADSRNode>(tr("Delete ADSR %1"), static_cast<ADSRNode*>(n));
break; break;
case INode::Type::Curve: case INode::Type::Curve:
cmd = new NodeDelUndoCommand(tr("Delete Curve %1"), static_cast<CurveNode*>(n)); cmd = new NodeDelUndoCommand<CurveNode>(tr("Delete Curve %1"), static_cast<CurveNode*>(n));
break; break;
case INode::Type::Keymap: case INode::Type::Keymap:
cmd = new NodeDelUndoCommand(tr("Delete Keymap %1"), static_cast<KeymapNode*>(n)); cmd = new NodeDelUndoCommand<KeymapNode>(tr("Delete Keymap %1"), static_cast<KeymapNode*>(n));
break; break;
case INode::Type::Layer: case INode::Type::Layer:
cmd = new NodeDelUndoCommand(tr("Delete Layers %1"), static_cast<LayersNode*>(n)); cmd = new NodeDelUndoCommand<LayersNode>(tr("Delete Layers %1"), static_cast<LayersNode*>(n));
break; break;
case INode::Type::Sample: { case INode::Type::Sample: {
int result = int result =

View File

@ -80,7 +80,7 @@ std::pair<std::pair<qreal, qreal>, std::pair<qreal, qreal>> SampleView::iterateS
} }
DSPDecompressFrameRanged(sampleBlock, m_sampleData + 8 * startBlock, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1, DSPDecompressFrameRanged(sampleBlock, m_sampleData + 8 * startBlock, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1,
&m_prev2, startRem, end); &m_prev2, startRem, end);
for (int s = 0; s < end - startRem; ++s) for (uint32_t s = 0; s < end - startRem; ++s)
accumulate(sampleBlock[s]); accumulate(sampleBlock[s]);
if (end == 14) if (end == 14)
++startBlock; ++startBlock;
@ -88,14 +88,14 @@ std::pair<std::pair<qreal, qreal>, std::pair<qreal, qreal>> SampleView::iterateS
for (uint32_t b = startBlock; b < endBlock; ++b) { for (uint32_t b = startBlock; b < endBlock; ++b) {
DSPDecompressFrame(sampleBlock, m_sampleData + 8 * b, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1, &m_prev2, 14); DSPDecompressFrame(sampleBlock, m_sampleData + 8 * b, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1, &m_prev2, 14);
for (int s = 0; s < 14; ++s) for (uint32_t s = 0; s < 14; ++s)
accumulate(sampleBlock[s]); accumulate(sampleBlock[s]);
} }
if (endRem) { if (endRem) {
DSPDecompressFrame(sampleBlock, m_sampleData + 8 * endBlock, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1, DSPDecompressFrame(sampleBlock, m_sampleData + 8 * endBlock, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1,
&m_prev2, endRem); &m_prev2, endRem);
for (int s = 0; s < endRem; ++s) for (uint32_t s = 0; s < endRem; ++s)
accumulate(sampleBlock[s]); accumulate(sampleBlock[s]);
} }
} else if (m_sample->getSampleFormat() == amuse::SampleFormat::PCM_PC) { } else if (m_sample->getSampleFormat() == amuse::SampleFormat::PCM_PC) {

View File

@ -1349,8 +1349,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1214"/> <location filename="../ProjectModel.cpp" line="1214"/>
<location filename="../ProjectModel.cpp" line="1751"/> <location filename="../ProjectModel.cpp" line="1753"/>
<location filename="../ProjectModel.cpp" line="1874"/> <location filename="../ProjectModel.cpp" line="1876"/>
<source>Add Subproject %1</source> <source>Add Subproject %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1367,8 +1367,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1299"/> <location filename="../ProjectModel.cpp" line="1299"/>
<location filename="../ProjectModel.cpp" line="1608"/> <location filename="../ProjectModel.cpp" line="1610"/>
<location filename="../ProjectModel.cpp" line="1881"/> <location filename="../ProjectModel.cpp" line="1883"/>
<source>Add Sound Group %1</source> <source>Add Sound Group %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1379,8 +1379,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1319"/> <location filename="../ProjectModel.cpp" line="1319"/>
<location filename="../ProjectModel.cpp" line="1600"/> <location filename="../ProjectModel.cpp" line="1602"/>
<location filename="../ProjectModel.cpp" line="1888"/> <location filename="../ProjectModel.cpp" line="1890"/>
<source>Add Song Group %1</source> <source>Add Song Group %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1396,7 +1396,7 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1431"/> <location filename="../ProjectModel.cpp" line="1431"/>
<location filename="../ProjectModel.cpp" line="1897"/> <location filename="../ProjectModel.cpp" line="1899"/>
<source>Add Sound Macro %1</source> <source>Add Sound Macro %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1412,8 +1412,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1453"/> <location filename="../ProjectModel.cpp" line="1453"/>
<location filename="../ProjectModel.cpp" line="1633"/> <location filename="../ProjectModel.cpp" line="1635"/>
<location filename="../ProjectModel.cpp" line="1904"/> <location filename="../ProjectModel.cpp" line="1906"/>
<source>Add ADSR %1</source> <source>Add ADSR %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1429,8 +1429,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1475"/> <location filename="../ProjectModel.cpp" line="1475"/>
<location filename="../ProjectModel.cpp" line="1641"/> <location filename="../ProjectModel.cpp" line="1643"/>
<location filename="../ProjectModel.cpp" line="1911"/> <location filename="../ProjectModel.cpp" line="1913"/>
<source>Add Curve %1</source> <source>Add Curve %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1446,8 +1446,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1496"/> <location filename="../ProjectModel.cpp" line="1496"/>
<location filename="../ProjectModel.cpp" line="1656"/> <location filename="../ProjectModel.cpp" line="1658"/>
<location filename="../ProjectModel.cpp" line="1918"/> <location filename="../ProjectModel.cpp" line="1920"/>
<source>Add Keymap %1</source> <source>Add Keymap %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1463,8 +1463,8 @@
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1517"/> <location filename="../ProjectModel.cpp" line="1517"/>
<location filename="../ProjectModel.cpp" line="1672"/> <location filename="../ProjectModel.cpp" line="1674"/>
<location filename="../ProjectModel.cpp" line="1925"/> <location filename="../ProjectModel.cpp" line="1927"/>
<source>Add Layers %1</source> <source>Add Layers %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1475,97 +1475,97 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1618"/> <location filename="../ProjectModel.cpp" line="1620"/>
<source>Add SoundMacro %1</source> <source>Add SoundMacro %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1804"/> <location filename="../ProjectModel.cpp" line="1806"/>
<source>Cut SongGroup %1</source> <source>Cut SongGroup %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1807"/> <location filename="../ProjectModel.cpp" line="1809"/>
<source>Cut SFXGroup %1</source> <source>Cut SFXGroup %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1810"/> <location filename="../ProjectModel.cpp" line="1812"/>
<source>Cut SoundMacro %1</source> <source>Cut SoundMacro %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1813"/> <location filename="../ProjectModel.cpp" line="1815"/>
<source>Cut ADSR %1</source> <source>Cut ADSR %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1816"/> <location filename="../ProjectModel.cpp" line="1818"/>
<source>Cut Curve %1</source> <source>Cut Curve %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1819"/> <location filename="../ProjectModel.cpp" line="1821"/>
<source>Cut Keymap %1</source> <source>Cut Keymap %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1822"/> <location filename="../ProjectModel.cpp" line="1824"/>
<source>Cut Layers %1</source> <source>Cut Layers %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1946"/> <location filename="../ProjectModel.cpp" line="1948"/>
<source>Delete Subproject</source> <source>Delete Subproject</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1947"/> <location filename="../ProjectModel.cpp" line="1949"/>
<source>&lt;p&gt;The subproject %1 will be permanently deleted from the project. Sample files will be permanently removed from the file system.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;This action cannot be undone!&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Continue?&lt;/p&gt;</source> <source>&lt;p&gt;The subproject %1 will be permanently deleted from the project. Sample files will be permanently removed from the file system.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;This action cannot be undone!&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Continue?&lt;/p&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1961"/> <location filename="../ProjectModel.cpp" line="1963"/>
<source>Delete SongGroup %1</source> <source>Delete SongGroup %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1964"/> <location filename="../ProjectModel.cpp" line="1966"/>
<source>Delete SFXGroup %1</source> <source>Delete SFXGroup %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1967"/> <location filename="../ProjectModel.cpp" line="1969"/>
<source>Delete SoundMacro %1</source> <source>Delete SoundMacro %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1970"/> <location filename="../ProjectModel.cpp" line="1972"/>
<source>Delete ADSR %1</source> <source>Delete ADSR %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1973"/> <location filename="../ProjectModel.cpp" line="1975"/>
<source>Delete Curve %1</source> <source>Delete Curve %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1976"/> <location filename="../ProjectModel.cpp" line="1978"/>
<source>Delete Keymap %1</source> <source>Delete Keymap %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1979"/> <location filename="../ProjectModel.cpp" line="1981"/>
<source>Delete Layers %1</source> <source>Delete Layers %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1983"/> <location filename="../ProjectModel.cpp" line="1985"/>
<source>Delete Sample</source> <source>Delete Sample</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ProjectModel.cpp" line="1984"/> <location filename="../ProjectModel.cpp" line="1986"/>
<source>&lt;p&gt;The sample %1 will be permanently deleted from the file system. &lt;p&gt;&lt;strong&gt;This action cannot be undone!&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Continue?&lt;/p&gt;</source> <source>&lt;p&gt;The sample %1 will be permanently deleted from the file system. &lt;p&gt;&lt;strong&gt;This action cannot be undone!&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Continue?&lt;/p&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -206,7 +206,7 @@ bool AudioGroupDataCollection::loadMeta() {
athena::io::FileReader r(path, 1024 * 32, false); athena::io::FileReader r(path, 1024 * 32, false);
if (r.hasError()) if (r.hasError())
return false; return false;
std::experimental::optional<MetaData>& ret = m_metaData; std::optional<MetaData>& ret = m_metaData;
ret.emplace(r); ret.emplace(r);
return ret.operator bool(); return ret.operator bool();
} }

View File

@ -2,7 +2,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include "optional.hpp" #include <optional>
#include <amuse/amuse.hpp> #include <amuse/amuse.hpp>
#include <athena/FileReader.hpp> #include <athena/FileReader.hpp>
@ -33,9 +33,9 @@ struct AudioGroupDataCollection {
MetaData(athena::io::FileReader& r) MetaData(athena::io::FileReader& r)
: fmt(amuse::DataFormat(r.readUint32Little())), absOffs(r.readUint32Little()), active(r.readUint32Little()) {} : fmt(amuse::DataFormat(r.readUint32Little())), absOffs(r.readUint32Little()), active(r.readUint32Little()) {}
}; };
std::experimental::optional<MetaData> m_metaData; std::optional<MetaData> m_metaData;
std::experimental::optional<amuse::AudioGroupData> m_loadedData; std::optional<amuse::AudioGroupData> m_loadedData;
const amuse::AudioGroup* m_loadedGroup; const amuse::AudioGroup* m_loadedGroup;
struct GroupToken { struct GroupToken {
int m_groupId; int m_groupId;

View File

@ -3,7 +3,7 @@
#include "audioeffectx.h" #include "audioeffectx.h"
#include "VSTEditor.hpp" #include "VSTEditor.hpp"
#include <memory> #include <memory>
#include "optional.hpp" #include <optional>
#include "amuse/BooBackend.hpp" #include "amuse/BooBackend.hpp"
#include "amuse/Engine.hpp" #include "amuse/Engine.hpp"
@ -25,8 +25,8 @@ public:
class VSTBackend : public AudioEffectX { class VSTBackend : public AudioEffectX {
std::mutex m_lock; std::mutex m_lock;
std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend; std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend;
std::experimental::optional<amuse::VSTBackendVoiceAllocator> m_voxAlloc; std::optional<amuse::VSTBackendVoiceAllocator> m_voxAlloc;
std::experimental::optional<amuse::Engine> m_engine; std::optional<amuse::Engine> m_engine;
std::shared_ptr<amuse::Sequencer> m_curSeq; std::shared_ptr<amuse::Sequencer> m_curSeq;
int m_reqGroup = -1; int m_reqGroup = -1;
int m_curGroup = -1; int m_curGroup = -1;

View File

@ -4,7 +4,7 @@
#include "boo/boo.hpp" #include "boo/boo.hpp"
#include "boo/audiodev/IAudioVoiceEngine.hpp" #include "boo/audiodev/IAudioVoiceEngine.hpp"
#include "logvisor/logvisor.hpp" #include "logvisor/logvisor.hpp"
#include "optional.hpp" #include <optional>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <signal.h> #include <signal.h>

View File

@ -513,13 +513,15 @@ static inline int32_t SBig(int32_t val) { return bswap32(val); }
static inline uint32_t SBig(uint32_t val) { return bswap32(val); } static inline uint32_t SBig(uint32_t val) { return bswap32(val); }
static inline int64_t SBig(int64_t val) { return bswap64(val); } static inline int64_t SBig(int64_t val) { return bswap64(val); }
static inline uint64_t SBig(uint64_t val) { return bswap64(val); } static inline uint64_t SBig(uint64_t val) { return bswap64(val); }
static inline float SBig(float val) { inline float SBig(float val) {
int32_t ival = bswap32(*((int32_t*)(&val))); union { float f; atInt32 i; } uval1 = {val};
return *((float*)(&ival)); union { atInt32 i; float f; } uval2 = {bswap32(uval1.i)};
return uval2.f;
} }
static inline double SBig(double val) { inline double SBig(double val) {
int64_t ival = bswap64(*((int64_t*)(&val))); union { double f; atInt64 i; } uval1 = {val};
return *((double*)(&ival)); union { atInt64 i; double f; } uval2 = {bswap64(uval1.i)};
return uval2.f;
} }
#ifndef SBIG #ifndef SBIG
#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24) #define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)

View File

@ -285,7 +285,7 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(SystemStringView groupPath)
if (auto __v = r.enterSubVector(k.first.c_str(), mappingCount)) { if (auto __v = r.enterSubVector(k.first.c_str(), mappingCount)) {
auto& kmOut = ret.m_keymaps[KeymapId::CurNameDB->resolveIdFromName(k.first)]; auto& kmOut = ret.m_keymaps[KeymapId::CurNameDB->resolveIdFromName(k.first)];
kmOut = MakeObj<std::array<Keymap, 128>>(); kmOut = MakeObj<std::array<Keymap, 128>>();
for (int i = 0; i < mappingCount && i < 128; ++i) for (size_t i = 0; i < mappingCount && i < 128; ++i)
if (auto __r2 = r.enterSubRecord(nullptr)) if (auto __r2 = r.enterSubRecord(nullptr))
(*kmOut)[i].read(r); (*kmOut)[i].read(r);
} }
@ -300,7 +300,7 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(SystemStringView groupPath)
auto& layOut = ret.m_layers[LayersId::CurNameDB->resolveIdFromName(l.first)]; auto& layOut = ret.m_layers[LayersId::CurNameDB->resolveIdFromName(l.first)];
layOut = MakeObj<std::vector<LayerMapping>>(); layOut = MakeObj<std::vector<LayerMapping>>();
layOut->reserve(mappingCount); layOut->reserve(mappingCount);
for (int lm = 0; lm < mappingCount; ++lm) { for (size_t lm = 0; lm < mappingCount; ++lm) {
if (auto __r2 = r.enterSubRecord(nullptr)) { if (auto __r2 = r.enterSubRecord(nullptr)) {
layOut->emplace_back(); layOut->emplace_back();
layOut->back().read(r); layOut->back().read(r);
@ -316,9 +316,9 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(SystemStringView groupPath)
} }
int SoundMacro::assertPC(int pc) const { int SoundMacro::assertPC(int pc) const {
if (pc == -1) if (pc < 0)
return -1; return -1;
if (pc >= m_cmds.size()) { if (size_t(pc) >= m_cmds.size()) {
fprintf(stderr, "SoundMacro PC bounds exceeded [%d/%d]\n", pc, int(m_cmds.size())); fprintf(stderr, "SoundMacro PC bounds exceeded [%d/%d]\n", pc, int(m_cmds.size()));
abort(); abort();
} }
@ -329,7 +329,7 @@ template <athena::Endian DNAE>
void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size) { void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size) {
uint32_t numCmds = size / 8; uint32_t numCmds = size / 8;
m_cmds.reserve(numCmds); m_cmds.reserve(numCmds);
for (int i = 0; i < numCmds; ++i) { for (uint32_t i = 0; i < numCmds; ++i) {
uint32_t data[2]; uint32_t data[2];
athena::io::Read<athena::io::PropType::None>::Do<decltype(data), DNAE>({}, data, r); athena::io::Read<athena::io::PropType::None>::Do<decltype(data), DNAE>({}, data, r);
athena::io::MemoryReader r(data, 8); athena::io::MemoryReader r(data, 8);
@ -370,7 +370,7 @@ void SoundMacro::toYAML(athena::io::YAMLDocWriter& w) const {
void SoundMacro::fromYAML(athena::io::YAMLDocReader& r, size_t cmdCount) { void SoundMacro::fromYAML(athena::io::YAMLDocReader& r, size_t cmdCount) {
m_cmds.reserve(cmdCount); m_cmds.reserve(cmdCount);
for (int c = 0; c < cmdCount; ++c) for (size_t c = 0; c < cmdCount; ++c)
if (auto __r2 = r.enterSubRecord(nullptr)) if (auto __r2 = r.enterSubRecord(nullptr))
m_cmds.push_back(SoundMacro::CmdDo<MakeCmdOp, std::unique_ptr<SoundMacro::ICmd>>(r)); m_cmds.push_back(SoundMacro::CmdDo<MakeCmdOp, std::unique_ptr<SoundMacro::ICmd>>(r));
} }

View File

@ -256,7 +256,7 @@ AudioGroupProject AudioGroupProject::_AudioGroupProject(athena::io::IStreamReade
/* MIDI setups */ /* MIDI setups */
r.seek(subDataOff + header.midiSetupsOff, athena::Begin); r.seek(subDataOff + header.midiSetupsOff, athena::Begin);
while (r.position() + 4 < groupBegin + header.groupEndOff) { while (atInt64(r.position() + 4) < groupBegin + header.groupEndOff) {
uint16_t songId; uint16_t songId;
athena::io::Read<athena::io::PropType::None>::Do<decltype(songId), DNAE>({}, songId, r); athena::io::Read<athena::io::PropType::None>::Do<decltype(songId), DNAE>({}, songId, r);
r.seek(2, athena::Current); r.seek(2, athena::Current);
@ -345,7 +345,7 @@ void SongGroupIndex::fromYAML(athena::io::YAMLDocReader& r) {
SongId::CurNameDB->registerPair(songName, songId); SongId::CurNameDB->registerPair(songName, songId);
std::array<SongGroupIndex::MIDISetup, 16>& setup = m_midiSetups[songId]; std::array<SongGroupIndex::MIDISetup, 16>& setup = m_midiSetups[songId];
for (int i = 0; i < 16 && i < chanCount; ++i) for (size_t i = 0; i < 16 && i < chanCount; ++i)
if (auto __r2 = r.enterSubRecord(nullptr)) if (auto __r2 = r.enterSubRecord(nullptr))
setup[i].read(r); setup[i].read(r);
} }
@ -548,7 +548,7 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, bool ab
} }
} else { } else {
r.seek(subDataOff + header.midiSetupsOff, athena::Begin); r.seek(subDataOff + header.midiSetupsOff, athena::Begin);
while (r.position() < groupBegin + header.groupEndOff) { while (atInt64(r.position()) < groupBegin + header.groupEndOff) {
uint16_t id; uint16_t id;
athena::io::Read<athena::io::PropType::None>::Do<decltype(id), DNAE>({}, id, r); athena::io::Read<athena::io::PropType::None>::Do<decltype(id), DNAE>({}, id, r);
SongId::CurNameDB->registerPair(NameDB::generateName(id, NameDB::Type::Song), id); SongId::CurNameDB->registerPair(NameDB::generateName(id, NameDB::Type::Song), id);

View File

@ -665,7 +665,7 @@ void AudioGroupSampleDirectory::_extractWAV(SampleId id, const EntryData& ent, a
} else if (fmt == SampleFormat::PCM) { } else if (fmt == SampleFormat::PCM) {
dataLen = numSamples * 2; dataLen = numSamples * 2;
const int16_t* cur = reinterpret_cast<const int16_t*>(samp); const int16_t* cur = reinterpret_cast<const int16_t*>(samp);
for (int i = 0; i < numSamples; ++i) for (uint32_t i = 0; i < numSamples; ++i)
w.writeInt16Big(cur[i]); w.writeInt16Big(cur[i]);
} else // PCM_PC } else // PCM_PC
{ {
@ -794,11 +794,11 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData&
if (curSample == 0) if (curSample == 0)
header.x3e_ps = adpcmOut[0]; header.x3e_ps = adpcmOut[0];
if (header.xc_loop_flag) { if (header.xc_loop_flag) {
if (loopStartSample >= curSample && loopStartSample < curSample + 14) if (loopStartSample >= int32_t(curSample) && loopStartSample < int32_t(curSample) + 14)
header.x44_loop_ps = adpcmOut[0]; header.x44_loop_ps = adpcmOut[0];
if (loopStartSample - 1 >= curSample && loopStartSample - 1 < curSample + 14) if (loopStartSample - 1 >= int32_t(curSample) && loopStartSample - 1 < int32_t(curSample) + 14)
header.x46_loop_hist1 = convSamps[2 + (loopStartSample - 1 - curSample)]; header.x46_loop_hist1 = convSamps[2 + (loopStartSample - 1 - curSample)];
if (loopStartSample - 2 >= curSample && loopStartSample - 2 < curSample + 14) if (loopStartSample - 2 >= int32_t(curSample) && loopStartSample - 2 < int32_t(curSample) + 14)
header.x48_loop_hist2 = convSamps[2 + (loopStartSample - 2 - curSample)]; header.x48_loop_hist2 = convSamps[2 + (loopStartSample - 2 - curSample)];
} }
remSamples -= sampleCount; remSamples -= sampleCount;

View File

@ -1554,7 +1554,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadSta
fread(data.get(), 1, endPos, midifp); fread(data.get(), 1, endPos, midifp);
const uint32_t* lengths = reinterpret_cast<const uint32_t*>(data.get()); const uint32_t* lengths = reinterpret_cast<const uint32_t*>(data.get());
int i = 0; size_t i = 0;
for (; i < 128; ++i) { for (; i < 128; ++i) {
uint32_t len = SBig(lengths[i]); uint32_t len = SBig(lengths[i]);
if (len == 0) if (len == 0)
@ -1569,7 +1569,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadSta
break; break;
SystemChar name[128]; SystemChar name[128];
SNPrintf(name, 128, _SYS_STR("Song%u"), i); SNPrintf(name, 128, _SYS_STR("Song%u"), unsigned(i));
std::unique_ptr<uint8_t[]> song(new uint8_t[len]); std::unique_ptr<uint8_t[]> song(new uint8_t[len]);
memmove(song.get(), data.get() + cur, len); memmove(song.get(), data.get() + cur, len);
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), len, -1, i)); ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), len, -1, i));

View File

@ -1185,7 +1185,7 @@ std::vector<uint8_t> SongConverter::MIDIToSong(const std::vector<uint8_t>& data,
} }
/* See if there's a matching region buffer already present */ /* See if there's a matching region buffer already present */
int regIdx = 0; size_t regIdx = 0;
for (Region& reg : regions) { for (Region& reg : regions) {
if (reg == region) if (reg == region)
break; break;
@ -1279,7 +1279,7 @@ std::vector<uint8_t> SongConverter::MIDIToSong(const std::vector<uint8_t>& data,
head.swapToBig(); head.swapToBig();
*reinterpret_cast<SongState::Header*>(&*ret.insert(ret.cend(), headSz, 0)) = head; *reinterpret_cast<SongState::Header*>(&*ret.insert(ret.cend(), headSz, 0)) = head;
for (int i = 0; i < 64; ++i) { for (size_t i = 0; i < 64; ++i) {
if (i >= trackRegionIdxArr.size()) { if (i >= trackRegionIdxArr.size()) {
ret.insert(ret.cend(), 4, 0); ret.insert(ret.cend(), 4, 0);
continue; continue;
@ -1361,7 +1361,7 @@ std::vector<uint8_t> SongConverter::MIDIToSong(const std::vector<uint8_t>& data,
for (SongState::TrackRegion& reg : regionBuf) for (SongState::TrackRegion& reg : regionBuf)
*reinterpret_cast<SongState::TrackRegion*>(&*ret.insert(ret.cend(), 12, 0)) = reg; *reinterpret_cast<SongState::TrackRegion*>(&*ret.insert(ret.cend(), 12, 0)) = reg;
for (int i = 0; i < 64; ++i) { for (size_t i = 0; i < 64; ++i) {
if (i >= trackRegionIdxArr.size()) { if (i >= trackRegionIdxArr.size()) {
ret.insert(ret.cend(), 4, 0); ret.insert(ret.cend(), 4, 0);
continue; continue;

View File

@ -435,7 +435,7 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
if (m_pitchWheelData) { if (m_pitchWheelData) {
int32_t pitchTick = m_curTick; int32_t pitchTick = m_curTick;
int32_t remPitchTicks = ticks; int32_t remPitchTicks = ticks;
while (pitchTick < endTick) { while (pitchTick < int32_t(endTick)) {
/* See if there's an upcoming pitch change in this interval */ /* See if there's an upcoming pitch change in this interval */
int32_t nextTick = m_nextPitchTick; int32_t nextTick = m_nextPitchTick;
if (pitchTick + remPitchTicks > nextTick) { if (pitchTick + remPitchTicks > nextTick) {
@ -459,7 +459,7 @@ bool SongState::Track::advance(Sequencer& seq, double dt) {
if (m_modWheelData) { if (m_modWheelData) {
int32_t modTick = m_curTick; int32_t modTick = m_curTick;
int32_t remModTicks = ticks; int32_t remModTicks = ticks;
while (modTick < endTick) { while (modTick < int32_t(endTick)) {
/* See if there's an upcoming modulation change in this interval */ /* See if there's an upcoming modulation change in this interval */
int32_t nextTick = m_nextModTick; int32_t nextTick = m_nextModTick;
if (modTick + remModTicks > nextTick) { if (modTick + remModTicks > nextTick) {

View File

@ -292,11 +292,11 @@ bool SoundMacro::CmdLoop::Do(SoundMacroState& st, Voice& vox) const {
return false; return false;
} }
uint32_t useTimes = times; uint16_t useTimes = times;
if (random) if (random)
useTimes = vox.getEngine().nextRandom() % times; useTimes = vox.getEngine().nextRandom() % times;
if (st.m_loopCountdown == -1 && useTimes != -1) if (st.m_loopCountdown == -1 && useTimes != 65535)
st.m_loopCountdown = useTimes; st.m_loopCountdown = useTimes;
if (st.m_loopCountdown > 0) { if (st.m_loopCountdown > 0) {

View File

@ -1,5 +1,6 @@
#include "amuse/VolumeTable.hpp" #include "amuse/VolumeTable.hpp"
#include "amuse/Common.hpp" #include "amuse/Common.hpp"
#include <cmath>
namespace amuse { namespace amuse {