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
std::unique_ptr<boo::IAudioVoiceEngine> booEngine;
std::experimental::optional<amuse::BooBackendVoiceAllocator> amuseAllocator;
std::experimental::optional<amuse::Engine> amuseEngine;
std::optional<amuse::BooBackendVoiceAllocator> amuseAllocator;
std::optional<amuse::Engine> amuseEngine;
std::shared_ptr<amuse::Voice> activeSFXVox;
}
- (BOOL)importURL:(NSURL*)url;

View File

@ -4,7 +4,7 @@
#import <AppKit/AppKit.h>
#include <map>
#include <string>
#include "optional.hpp"
#include <optional>
#include <amuse/amuse.hpp>
#include <athena/FileReader.hpp>
@ -43,9 +43,9 @@ struct AudioGroupDataCollection {
MetaData(athena::io::FileReader& r)
: 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;
std::vector<AudioGroupToken*> m_groupTokens;

View File

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

View File

@ -8,7 +8,7 @@
#include <AudioUnit/AudioUnit.h>
#include "optional.hpp"
#include <optional>
#include "amuse/BooBackend.hpp"
#include "amuse/Engine.hpp"
@ -34,8 +34,8 @@ void RegisterAudioUnit();
@public
AudioUnitViewController* m_viewController;
std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend;
std::experimental::optional<amuse::AudioUnitBackendVoiceAllocator> m_voxAlloc;
std::experimental::optional<amuse::Engine> m_engine;
std::optional<amuse::AudioUnitBackendVoiceAllocator> m_voxAlloc;
std::optional<amuse::Engine> m_engine;
AudioGroupFilePresenter* m_filePresenter;
AUAudioUnitBus* m_outBus;
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")
add_subdirectory(boo)
add_subdirectory(athena)
include_directories(athena/include)
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
lib/AudioGroup.cpp
lib/AudioGroupData.cpp
@ -45,10 +40,7 @@ set(SOURCES
lib/Common.cpp
lib/DSPCodec.cpp
lib/N64MusyXCodec.cpp
lib/VolumeTable.cpp
atdna_AudioGroupPool.cpp
atdna_AudioGroupProject.cpp
atdna_AudioGroupSampleDirectory.cpp)
lib/VolumeTable.cpp)
set(HEADERS
include/amuse/AudioGroup.hpp
@ -86,27 +78,24 @@ if(NX)
list(APPEND HEADERS include/switch_math.hpp)
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
${SOURCES}
${HEADERS}
${EXTRAS})
${HEADERS})
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)
add_sanitizers(amuse)
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)
# AudioUnit Target (OS X only)
@ -119,15 +108,15 @@ if(TARGET boo AND NOT WINDOWS_STORE AND NOT NX)
# Player
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
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
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)
add_sanitizers(amuseplay)

View File

@ -84,4 +84,4 @@ target_link_libraries(amuse-gui ${PLAT_LIBS}
${Qt5Xml_LIBRARIES}
${Qt5Svg_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;
}
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();
}
@ -1316,7 +1316,7 @@ ProjectModel::SongGroupNode* ProjectModel::newSongGroup(GroupNode* group, const
return nullptr;
}
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();
}
@ -1428,7 +1428,7 @@ ProjectModel::SoundMacroNode* ProjectModel::newSoundMacro(GroupNode* group, cons
dataNode->readCmds<athena::utility::NotSystemEndian>(r, templ->m_length);
}
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();
}
@ -1450,7 +1450,7 @@ ProjectModel::ADSRNode* ProjectModel::newADSR(GroupNode* group, const QString& n
auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>();
*dataNode = std::make_unique<amuse::ADSR>();
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();
}
@ -1472,7 +1472,7 @@ ProjectModel::CurveNode* ProjectModel::newCurve(GroupNode* group, const QString&
auto dataNode = amuse::MakeObj<std::unique_ptr<amuse::ITable>>();
*dataNode = std::make_unique<amuse::Curve>();
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();
}
@ -1493,7 +1493,7 @@ ProjectModel::KeymapNode* ProjectModel::newKeymap(GroupNode* group, const QStrin
}
auto dataNode = amuse::MakeObj<std::array<amuse::Keymap, 128>>();
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();
}
@ -1514,7 +1514,7 @@ ProjectModel::LayersNode* ProjectModel::newLayers(GroupNode* group, const QStrin
}
auto dataNode = amuse::MakeObj<std::vector<amuse::LayerMapping>>();
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();
}
@ -1590,14 +1590,16 @@ static void WriteMimeYAML(athena::io::YAMLDocWriter& w, ProjectModel::LayersNode
}
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 <>
EditorUndoCommand* ProjectModel::readMimeYAML<ProjectModel::SongGroupNode>(athena::io::YAMLDocReader& r,
const QString& name, GroupNode* gn) {
auto dataNode = amuse::MakeObj<amuse::SongGroupIndex>();
dataNode->fromYAML(r);
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 <>
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>();
dataNode->fromYAML(r);
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 <>
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))
dataNode->fromYAML(r, cmdCount);
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 <>
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);
}
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 <>
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>());
static_cast<amuse::Curve&>(**dataNode).read(r);
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 <>
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);
return new NodeAddUndoCommand(ProjectModel::tr("Add Keymap %1"), node.get(), gn);
return new NodeAddUndoCommand<KeymapNode>(ProjectModel::tr("Add Keymap %1"), node.get(), gn);
}
template <>
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);
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>
@ -1801,25 +1803,25 @@ void ProjectModel::cut(const QModelIndex& index) {
EditorUndoCommand* cmd = nullptr;
switch (n->type()) {
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;
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;
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;
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;
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;
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;
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;
default:
break;
@ -1878,14 +1880,14 @@ QModelIndex ProjectModel::duplicate(const QModelIndex& index) {
case INode::Type::SoundGroup: {
SoundGroupNode* cn = static_cast<SoundGroupNode*>(n);
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());
break;
}
case INode::Type::SongGroup: {
SongGroupNode* cn = static_cast<SongGroupNode*>(n);
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());
break;
}
@ -1894,35 +1896,35 @@ QModelIndex ProjectModel::duplicate(const QModelIndex& index) {
auto dataNode = amuse::MakeObj<amuse::SoundMacro>();
dataNode->buildFromPrototype(*cn->m_obj);
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());
break;
}
case INode::Type::ADSR: {
ADSRNode* cn = static_cast<ADSRNode*>(n);
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());
break;
}
case INode::Type::Curve: {
CurveNode* cn = static_cast<CurveNode*>(n);
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());
break;
}
case INode::Type::Keymap: {
KeymapNode* cn = static_cast<KeymapNode*>(n);
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());
break;
}
case INode::Type::Layer: {
LayersNode* cn = static_cast<LayersNode*>(n);
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());
break;
}
@ -1958,25 +1960,25 @@ void ProjectModel::del(const QModelIndex& index) {
break;
}
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;
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;
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;
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;
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;
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;
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;
case INode::Type::Sample: {
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,
&m_prev2, startRem, end);
for (int s = 0; s < end - startRem; ++s)
for (uint32_t s = 0; s < end - startRem; ++s)
accumulate(sampleBlock[s]);
if (end == 14)
++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) {
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]);
}
if (endRem) {
DSPDecompressFrame(sampleBlock, m_sampleData + 8 * endBlock, m_sample->m_ADPCMParms.dsp.m_coefs, &m_prev1,
&m_prev2, endRem);
for (int s = 0; s < endRem; ++s)
for (uint32_t s = 0; s < endRem; ++s)
accumulate(sampleBlock[s]);
}
} else if (m_sample->getSampleFormat() == amuse::SampleFormat::PCM_PC) {

View File

@ -1349,8 +1349,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1214"/>
<location filename="../ProjectModel.cpp" line="1751"/>
<location filename="../ProjectModel.cpp" line="1874"/>
<location filename="../ProjectModel.cpp" line="1753"/>
<location filename="../ProjectModel.cpp" line="1876"/>
<source>Add Subproject %1</source>
<translation type="unfinished"></translation>
</message>
@ -1367,8 +1367,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1299"/>
<location filename="../ProjectModel.cpp" line="1608"/>
<location filename="../ProjectModel.cpp" line="1881"/>
<location filename="../ProjectModel.cpp" line="1610"/>
<location filename="../ProjectModel.cpp" line="1883"/>
<source>Add Sound Group %1</source>
<translation type="unfinished"></translation>
</message>
@ -1379,8 +1379,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1319"/>
<location filename="../ProjectModel.cpp" line="1600"/>
<location filename="../ProjectModel.cpp" line="1888"/>
<location filename="../ProjectModel.cpp" line="1602"/>
<location filename="../ProjectModel.cpp" line="1890"/>
<source>Add Song Group %1</source>
<translation type="unfinished"></translation>
</message>
@ -1396,7 +1396,7 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1431"/>
<location filename="../ProjectModel.cpp" line="1897"/>
<location filename="../ProjectModel.cpp" line="1899"/>
<source>Add Sound Macro %1</source>
<translation type="unfinished"></translation>
</message>
@ -1412,8 +1412,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1453"/>
<location filename="../ProjectModel.cpp" line="1633"/>
<location filename="../ProjectModel.cpp" line="1904"/>
<location filename="../ProjectModel.cpp" line="1635"/>
<location filename="../ProjectModel.cpp" line="1906"/>
<source>Add ADSR %1</source>
<translation type="unfinished"></translation>
</message>
@ -1429,8 +1429,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1475"/>
<location filename="../ProjectModel.cpp" line="1641"/>
<location filename="../ProjectModel.cpp" line="1911"/>
<location filename="../ProjectModel.cpp" line="1643"/>
<location filename="../ProjectModel.cpp" line="1913"/>
<source>Add Curve %1</source>
<translation type="unfinished"></translation>
</message>
@ -1446,8 +1446,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1496"/>
<location filename="../ProjectModel.cpp" line="1656"/>
<location filename="../ProjectModel.cpp" line="1918"/>
<location filename="../ProjectModel.cpp" line="1658"/>
<location filename="../ProjectModel.cpp" line="1920"/>
<source>Add Keymap %1</source>
<translation type="unfinished"></translation>
</message>
@ -1463,8 +1463,8 @@
</message>
<message>
<location filename="../ProjectModel.cpp" line="1517"/>
<location filename="../ProjectModel.cpp" line="1672"/>
<location filename="../ProjectModel.cpp" line="1925"/>
<location filename="../ProjectModel.cpp" line="1674"/>
<location filename="../ProjectModel.cpp" line="1927"/>
<source>Add Layers %1</source>
<translation type="unfinished"></translation>
</message>
@ -1475,97 +1475,97 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1618"/>
<location filename="../ProjectModel.cpp" line="1620"/>
<source>Add SoundMacro %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1804"/>
<location filename="../ProjectModel.cpp" line="1806"/>
<source>Cut SongGroup %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1807"/>
<location filename="../ProjectModel.cpp" line="1809"/>
<source>Cut SFXGroup %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1810"/>
<location filename="../ProjectModel.cpp" line="1812"/>
<source>Cut SoundMacro %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1813"/>
<location filename="../ProjectModel.cpp" line="1815"/>
<source>Cut ADSR %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1816"/>
<location filename="../ProjectModel.cpp" line="1818"/>
<source>Cut Curve %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1819"/>
<location filename="../ProjectModel.cpp" line="1821"/>
<source>Cut Keymap %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1822"/>
<location filename="../ProjectModel.cpp" line="1824"/>
<source>Cut Layers %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1946"/>
<location filename="../ProjectModel.cpp" line="1948"/>
<source>Delete Subproject</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1961"/>
<location filename="../ProjectModel.cpp" line="1963"/>
<source>Delete SongGroup %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1964"/>
<location filename="../ProjectModel.cpp" line="1966"/>
<source>Delete SFXGroup %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1967"/>
<location filename="../ProjectModel.cpp" line="1969"/>
<source>Delete SoundMacro %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1970"/>
<location filename="../ProjectModel.cpp" line="1972"/>
<source>Delete ADSR %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1973"/>
<location filename="../ProjectModel.cpp" line="1975"/>
<source>Delete Curve %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1976"/>
<location filename="../ProjectModel.cpp" line="1978"/>
<source>Delete Keymap %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1979"/>
<location filename="../ProjectModel.cpp" line="1981"/>
<source>Delete Layers %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProjectModel.cpp" line="1983"/>
<location filename="../ProjectModel.cpp" line="1985"/>
<source>Delete Sample</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>

View File

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

View File

@ -2,7 +2,7 @@
#include <map>
#include <memory>
#include "optional.hpp"
#include <optional>
#include <amuse/amuse.hpp>
#include <athena/FileReader.hpp>
@ -33,9 +33,9 @@ struct AudioGroupDataCollection {
MetaData(athena::io::FileReader& r)
: 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;
struct GroupToken {
int m_groupId;

View File

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

View File

@ -4,7 +4,7 @@
#include "boo/boo.hpp"
#include "boo/audiodev/IAudioVoiceEngine.hpp"
#include "logvisor/logvisor.hpp"
#include "optional.hpp"
#include <optional>
#include <cstdio>
#include <cstring>
#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 int64_t SBig(int64_t val) { return bswap64(val); }
static inline uint64_t SBig(uint64_t val) { return bswap64(val); }
static inline float SBig(float val) {
int32_t ival = bswap32(*((int32_t*)(&val)));
return *((float*)(&ival));
inline float SBig(float val) {
union { float f; atInt32 i; } uval1 = {val};
union { atInt32 i; float f; } uval2 = {bswap32(uval1.i)};
return uval2.f;
}
static inline double SBig(double val) {
int64_t ival = bswap64(*((int64_t*)(&val)));
return *((double*)(&ival));
inline double SBig(double val) {
union { double f; atInt64 i; } uval1 = {val};
union { atInt64 i; double f; } uval2 = {bswap64(uval1.i)};
return uval2.f;
}
#ifndef SBIG
#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)) {
auto& kmOut = ret.m_keymaps[KeymapId::CurNameDB->resolveIdFromName(k.first)];
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))
(*kmOut)[i].read(r);
}
@ -300,7 +300,7 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(SystemStringView groupPath)
auto& layOut = ret.m_layers[LayersId::CurNameDB->resolveIdFromName(l.first)];
layOut = MakeObj<std::vector<LayerMapping>>();
layOut->reserve(mappingCount);
for (int lm = 0; lm < mappingCount; ++lm) {
for (size_t lm = 0; lm < mappingCount; ++lm) {
if (auto __r2 = r.enterSubRecord(nullptr)) {
layOut->emplace_back();
layOut->back().read(r);
@ -316,9 +316,9 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(SystemStringView groupPath)
}
int SoundMacro::assertPC(int pc) const {
if (pc == -1)
if (pc < 0)
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()));
abort();
}
@ -329,7 +329,7 @@ template <athena::Endian DNAE>
void SoundMacro::readCmds(athena::io::IStreamReader& r, uint32_t size) {
uint32_t numCmds = size / 8;
m_cmds.reserve(numCmds);
for (int i = 0; i < numCmds; ++i) {
for (uint32_t i = 0; i < numCmds; ++i) {
uint32_t data[2];
athena::io::Read<athena::io::PropType::None>::Do<decltype(data), DNAE>({}, data, r);
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) {
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))
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 */
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;
athena::io::Read<athena::io::PropType::None>::Do<decltype(songId), DNAE>({}, songId, r);
r.seek(2, athena::Current);
@ -345,7 +345,7 @@ void SongGroupIndex::fromYAML(athena::io::YAMLDocReader& r) {
SongId::CurNameDB->registerPair(songName, 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))
setup[i].read(r);
}
@ -548,7 +548,7 @@ void AudioGroupProject::BootstrapObjectIDs(athena::io::IStreamReader& r, bool ab
}
} else {
r.seek(subDataOff + header.midiSetupsOff, athena::Begin);
while (r.position() < groupBegin + header.groupEndOff) {
while (atInt64(r.position()) < groupBegin + header.groupEndOff) {
uint16_t id;
athena::io::Read<athena::io::PropType::None>::Do<decltype(id), DNAE>({}, id, r);
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) {
dataLen = numSamples * 2;
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]);
} else // PCM_PC
{
@ -794,11 +794,11 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData&
if (curSample == 0)
header.x3e_ps = adpcmOut[0];
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];
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)];
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)];
}
remSamples -= sampleCount;

View File

@ -1554,7 +1554,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadSta
fread(data.get(), 1, endPos, midifp);
const uint32_t* lengths = reinterpret_cast<const uint32_t*>(data.get());
int i = 0;
size_t i = 0;
for (; i < 128; ++i) {
uint32_t len = SBig(lengths[i]);
if (len == 0)
@ -1569,7 +1569,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadSta
break;
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]);
memmove(song.get(), data.get() + cur, len);
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 */
int regIdx = 0;
size_t regIdx = 0;
for (Region& reg : regions) {
if (reg == region)
break;
@ -1279,7 +1279,7 @@ std::vector<uint8_t> SongConverter::MIDIToSong(const std::vector<uint8_t>& data,
head.swapToBig();
*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()) {
ret.insert(ret.cend(), 4, 0);
continue;
@ -1361,7 +1361,7 @@ std::vector<uint8_t> SongConverter::MIDIToSong(const std::vector<uint8_t>& data,
for (SongState::TrackRegion& reg : regionBuf)
*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()) {
ret.insert(ret.cend(), 4, 0);
continue;

View File

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

View File

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

View File

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