HOW TO USE
DEPRECATED
Initialize PDJE Engine
-
class PDJE
the main Interface of this Engine PDJE gets music data and track data from database. from that datas, you can activate music player and you can get a music player handler. with this player handler, you can control music’s mixing in real time.
to-use
make PDJE object
call SearchTrack
call InitPlayer
use player. this is handler.
we use “PDJE” class as an interface.
auto engine = PDJE("path/to/root/Database_path");
this code Initialize engine and interfaces.
Search Track and Music
-
MUS_VEC PDJE::SearchMusic(const UNSANITIZED &Title, const UNSANITIZED &composer, const double bpm = -1)
searches musics and metadatas from database. if you don’t need to filter, send “” to the values
- Parameters:
Title – the title of the music
composer – the composer of the music
bpm – the bpm of the music. send under zero to skip filter
- Returns:
double bpm = 140.0;
auto music_searched = engine->SearchMusic("Music Title", "Composer name", bpm);
if(music_searched.empty()){
std::cout << "can't find anything" << std::endl;
return -1;
}
for(auto i : music_searched){
std::cout
<< "title: "
<< i.title
<< "path: "
<< i.musicPath
<< std::endl;
}
-
TRACK_VEC PDJE::SearchTrack(const UNSANITIZED &Title)
searches track the track contains the note data, mix data and included music lists.
- Parameters:
Title – the title of the track. send “” to skip filter
- Returns:
TRACK_VEC the array of the track_data. find what you want
auto trackSearch = engine->SearchTrack("Track Title");
if(trackSearch.empty()){
std::cout << "can't find anything" << std::endl;
return -1;
}
for(auto i: trackSearch){
std::cout
<< " track title: "
<< i.trackTitle
<< " note binary size: "
<< i.noteBinary.size()
<< " mix binary size: "
<< i.mixBinary.size()
<< std::endl;
}
Initialize Player
-
bool PDJE::InitPlayer(PLAY_MODE mode, trackdata &td, const unsigned int FrameBufferSize)
this inits the music handler. the music handler called a “player” it initializes the player
- Parameters:
mode – the play modes. you can choose “FULL_PRE_RENDER”, “HYBRID_RENDER”, “FULL_MANUAL_RENDER”
td – the track data. you can get this from SearchTrack()
FrameBufferSize – the buffersize. in this project, it uses 48000 samplerate. if you use 48 as a value, in theory, it calls mixing function 1000 times per second.
- Returns:
true no error
- Returns:
false error
auto Track_Chosen = trackSearch[0];
int Buffer_Size = 48;
engine->InitPlayer(PLAY_MODE::FULL_PRE_RENDER, Track_Chosen, Buffer_Size);
if(!engine->player){
std::cout << "can't use track" << std::endl;
return -1;
}
Handle Player
-
class audioPlayer
The music handler class this is the music handler class. you can play/stop music, controlling fx, attach other music in realtime manually or getting music’s playing position and consumed frames.
this is the handler of musics.
-
bool audioPlayer::Activate()
Plays music.
engine->player->Activate();
-
bool audioPlayer::Deactivate()
Stops music.
engine->player->Deactivate();
Warning
doxygenfunction: Cannot find function “audioPlayer::GetFXControlPannel” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
auto FXController = engine->player->GetFXControlPannel();
Warning
doxygenfunction: Cannot find function “audioPlayer::GetMusicControlPannel” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
auto MusicController = engine->player->GetMusicControlPannel();
Handle FXControlPannel
Warning
doxygenfunction: Cannot find function “FXControlPannel::FX_ON_OFF” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
bool TurnON = true;
FXController->FX_ON_OFF(FXList::ChooseFX, TurnON);
Warning
doxygenfunction: Cannot find function “FXControlPannel::GetArgSetter” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
auto argHandler = FXController->GetArgSetter(FXList::ChooseFX);
for(auto i : argHandler){
std::cout
<< "FX key: "
<< i.first
<< std::endl;
}
double FXValue = 2.0;
argHandler["FX key name"](FXValue);ß
Warning
doxygenfunction: Cannot find function “FXControlPannel::checkSomethingOn” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
if(FXController->checkSomethingOn()){
std::cout<< "FX is turned on" << std::endl;
}
Handle MusicControlPannel
Warning
doxygenclass: Cannot find class “MusicControlPannel” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
Warning
doxygenfunction: Cannot find function “MusicControlPannel::LoadMusic” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
auto MUSIC_TO_LOAD = music_searched[0];
MusicController->LoadMusic(*engine->DBROOT, MUSIC_TO_LOAD);
Warning
doxygenfunction: Cannot find function “MusicControlPannel::CueMusic” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
unsigned long long music_position = 0;
MusicController->CueMusic("MUSIC_TITLE", music_position);
Warning
doxygenfunction: Cannot find function “MusicControlPannel::SetMusic” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
bool ON = true;
MusicController->SetMusic("MUSIC_TITLE", ON);
Warning
doxygenfunction: Cannot find function “MusicControlPannel::GetLoadedMusicList” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
MusicController->GetLoadedMusicList();
Warning
doxygenfunction: Cannot find function “MusicControlPannel::UnloadMusic” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
MusicController->UnloadMusic("MUSIC_TITLE");
Warning
doxygenfunction: Cannot find function “MusicControlPannel::getFXHandle” in doxygen xml output for project “Project_DJ_Engine” from directory: ./xml
auto fxHandler = MusicController->getFXHandle("MUSIC_TITLE");
Handle Editor
-
bool PDJE::InitEditor(const DONT_SANITIZE &auth_name, const DONT_SANITIZE &auth_email, const DONT_SANITIZE &projectRoot)
Initializes the editor.
- Parameters:
auth_name – The author’s name for Git commits.
auth_email – The author’s email for Git commits.
projectRoot – The root directory of the editor project.
- Returns:
trueif the editor was initialized successfully,falseotherwise.
engine->InitEditor("editor's name", "editor's email. no need to fill", "Editor Sandbox Directory");
-
bool editorObject::Open(const fs::path &projectPath)
Opens an existing editor project. if PDJE called InitEditor, you don’t need to call this again.
- Parameters:
projectPath – The path to the project.
- Returns:
trueif the project was opened successfully,falseotherwise.
engine->editor->Open("Editor Sandbox Directory");
This code opens the editor project. if the path is empty, generates new one.
this will be called from PDJE::InitEditor. no need to call twice.
-
DONT_SANITIZE editorObject::DESTROY_PROJECT()
Destroys the entire project.
Warning
This operation is irreversible.
- Returns:
A string indicating the result of the operation.
engine->editor->DESTROY_PROJECT();
This removes the opened project. use careful.
template<typename EDIT_ARG_TYPE> AddLine<EDIT_ARG_TYPE>(const EDIT_ARG_TYPE& obj)
and
AddLine(const std::string& musicName, const std::string& firstBar)
engine->editor->AddLine<EDIT_ARG_NOTE>(noteObj);
engine->editor->AddLine<EDIT_ARG_KEY_VALUE>(key_value_Obj);
engine->editor->AddLine<EDIT_ARG_MIX>(mixObj);
engine->editor->AddLine<EDIT_ARG_MUSIC>(musicObj);
engine->editor->AddLine("music name", "48000");
this code adds data into the editor project. every add command calls save function, and will be recorded by git.
to see what is that datas, go to pdje format page