-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The reset mechanism used to try to remove everything bit by bit. error prone. Instead, do the obbious thing of unstream a blank engine state. Unfortunatley we can't with current APIs do a Multi from a memory stream only a file, so rather than just embed a multi make a little helper program to just make raw binary of engine state and put it in resources etc... Closes #1301 Closes #1162 Closes #1123
- Loading branch information
Showing
9 changed files
with
137 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
project(init-maker) | ||
|
||
message(STATUS "Making ${PROJECT_NAME} executable") | ||
add_executable(${PROJECT_NAME} init-maker.cpp) | ||
target_link_libraries(${PROJECT_NAME} scxt-core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Shortcircuit XT - a Surge Synth Team product | ||
* | ||
* A fully featured creative sampler, available as a standalone | ||
* and plugin for multiple platforms. | ||
* | ||
* Copyright 2019 - 2024, Various authors, as described in the github | ||
* transaction log. | ||
* | ||
* ShortcircuitXT is released under the Gnu General Public Licence | ||
* V3 or later (GPL-3.0-or-later). The license is found in the file | ||
* "LICENSE" in the root of this repository or at | ||
* https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
* Individual sections of code which comprises ShortcircuitXT in this | ||
* repository may also be used under an MIT license. Please see the | ||
* section "Licensing" in "README.md" for details. | ||
* | ||
* ShortcircuitXT is inspired by, and shares code with, the | ||
* commercial product Shortcircuit 1 and 2, released by VemberTech | ||
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in | ||
* 2020 at the outset of this project. | ||
* | ||
* All source for ShortcircuitXT is available at | ||
* https://github.com/surge-synthesizer/shortcircuit-xt | ||
*/ | ||
|
||
#include <fstream> | ||
|
||
#include "engine/engine.h" | ||
#include "json/scxt_traits.h" | ||
#include "json/engine_traits.h" | ||
|
||
#include "tao/json/msgpack/to_string.hpp" | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
if (argc != 2) | ||
{ | ||
SCLOG("Usage: " << argv[0] << " out-path"); | ||
exit(1); | ||
} | ||
auto e = std::make_unique<scxt::engine::Engine>(); | ||
auto sg = scxt::engine::Engine::StreamGuard(scxt::engine::Engine::FOR_MULTI); | ||
auto msg = tao::json::msgpack::to_string(scxt::json::scxt_value(*e)); | ||
|
||
SCLOG("Message is of size " << msg.size()); | ||
|
||
auto p = fs::path(argv[1]); | ||
|
||
SCLOG("Writing to file " << p.u8string()); | ||
|
||
std::ofstream f(p, std::ios::binary); | ||
if (!f.is_open()) | ||
{ | ||
SCLOG("Unable to open file"); | ||
exit(2); | ||
} | ||
|
||
f.write(msg.c_str(), msg.size()); | ||
|
||
SCLOG("Output complete"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,5 +91,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC | |
minimp3 | ||
md5sum::md5 | ||
|
||
scxt-resources-core | ||
|
||
sc-compiler-options | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters