.. _program_listing_file_include_tests_editorTest.cpp: Program Listing for File editorTest.cpp ======================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/tests/editorTest.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "PDJE_interface.hpp" #include #include // #include int main() { std::cout << "editor tester" << std::endl; auto engine = new PDJE(std::string("testRoot.db")); if (engine->InitEditor("test", "test", "testEditorProject")) { std::cout << "init ok" << std::endl; bool Flag_Already_has_music = false; engine->editor->getAll( [&Flag_Already_has_music](const EDIT_ARG_MUSIC &margs) { if (margs.musicName == "testMiku") { Flag_Already_has_music = true; } }); if (!Flag_Already_has_music) { if (engine->editor->ConfigNewMusic( "testMiku", "Camellia", "../../DMCA_FREE_DEMO_MUSIC/miku_temp.wav")) { EDIT_ARG_MUSIC temp; temp.musicName = "testMiku"; temp.arg.beat = 0; temp.arg.subBeat = 0; temp.arg.separate = 4; temp.arg.bpm = "138"; engine->editor->AddLine(temp); EDIT_ARG_MIX bpmSet; bpmSet.beat = 0; bpmSet.subBeat = 0; bpmSet.type = TypeEnum::BPM_CONTROL; bpmSet.details = DetailEnum::TIME_STRETCH; bpmSet.separate = 4; bpmSet.ID = 0; bpmSet.first = "138"; engine->editor->AddLine(bpmSet); EDIT_ARG_MIX loadMusic; loadMusic.beat = 0; loadMusic.subBeat = 0; loadMusic.type = TypeEnum::LOAD; loadMusic.separate = 4; loadMusic.first = "testMiku"; loadMusic.second = "Camellia"; loadMusic.third = "138"; loadMusic.ID = 0; engine->editor->AddLine(loadMusic); EDIT_ARG_MIX changeBpm; changeBpm.beat = 40; changeBpm.subBeat = 0; changeBpm.type = TypeEnum::BPM_CONTROL; changeBpm.details = DetailEnum::TIME_STRETCH; changeBpm.separate = 4; changeBpm.ID = 0; changeBpm.first = "170"; engine->editor->AddLine(changeBpm); EDIT_ARG_MIX unloadMusic; unloadMusic.beat = 200; unloadMusic.subBeat = 0; unloadMusic.type = TypeEnum::UNLOAD; unloadMusic.ID = 0; unloadMusic.separate = 4; engine->editor->AddLine(unloadMusic); std::cout << "config init ok" << std::endl; } else { std::cout << "config init failed" << std::endl; } if (engine->editor->ConfigNewMusic( "ヒアソビ", "Camellia", "../../DMCA_FREE_DEMO_MUSIC/miku_temp.wav")) { EDIT_ARG_MUSIC temp; temp.musicName = "ヒアソビ"; temp.arg.beat = 0; temp.arg.subBeat = 0; temp.arg.separate = 4; temp.arg.bpm = "134"; engine->editor->AddLine(temp); } } if (engine->SearchMusic("testMiku", "Camellia").empty()) { bool renderRes = engine->editor->render("testTrack", *(engine->DBROOT)); bool pushRes = engine->editor->pushToRootDB( *(engine->DBROOT), "testMiku", "Camellia"); bool pushResSecond = engine->editor->pushToRootDB( *(engine->DBROOT), "ヒアソビ", "Camellia"); bool trackPushRes = engine->editor->pushToRootDB(*(engine->DBROOT), "testTrack"); if (pushRes) std::cout << "pushRes ok" << std::endl; if (renderRes) std::cout << "renderRes ok" << std::endl; if (trackPushRes) std::cout << "trackPushRes ok" << std::endl; if (pushResSecond) std::cout << "pushResSecond ok" << std::endl; if (pushRes && renderRes && trackPushRes && pushResSecond) std::cout << "push ok" << std::endl; else std::cout << "push failed" << std::endl; } trackdata td; td = engine->SearchTrack("testTrack").front(); auto initres = engine->InitPlayer(PLAY_MODE::HYBRID_RENDER, td, 48); auto activeres = engine->player->Activate(); auto musPannel = engine->player->GetMusicControlPannel(); auto muses = engine->SearchMusic("ヒアソビ", "Camellia"); musPannel->LoadMusic(*(engine->DBROOT), muses.front()); getchar(); musPannel->SetMusic("ヒアソビ", true); // musPannel-> getchar(); auto Fxhandle = musPannel->getFXHandle("ヒアソビ"); Fxhandle->FX_ON_OFF(FXList::OCSFILTER, true); Fxhandle->FX_ON_OFF(FXList::EQ, true); auto ocshandle = Fxhandle->GetArgSetter(FXList::OCSFILTER); ocshandle["ocsFilterHighLowSW"](1); ocshandle["rangeFreqHalf"](2500); ocshandle["middleFreq"](5000); ocshandle["bps"](2.2333333); ocshandle["OCSFilterDryWet"](0.7); getchar(); musPannel->ChangeBpm("ヒアソビ", 120, 60); auto eqhandle = Fxhandle->GetArgSetter(FXList::EQ); eqhandle["EQHigh"](-20); eqhandle["EQMid"](-20); eqhandle["EQLow"](20); getchar(); auto deactres = engine->player->Deactivate(); auto editor = engine->GetEditorObject(); editor->GetLogWithJSONGraph(); editor->GetLogWithJSONGraph(); editor->GetLogWithJSONGraph(); editor->GetLogWithJSONGraph("music name"); } else { std::cout << "init failed " << std::endl; delete engine; return 1; } delete engine; // std::cout<ConfigNewMusic("testMiku", "Camellia", "") return 0; }