mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-06 15:15:53 +00:00
Deleted all playlist-related code from libprojectM.
Note: SDL test UI won't compile after this commit. Will be fixed in a later commit, when the playlist library is done.
This commit is contained in:
@ -5,51 +5,26 @@
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
projectMWrapper::projectMWrapper(std::string configFile, int flags)
|
||||
: ProjectM(std::move(configFile), static_cast<ProjectM::Flags>(flags))
|
||||
projectMWrapper::projectMWrapper(std::string configFile)
|
||||
: ProjectM(std::move(configFile))
|
||||
{
|
||||
}
|
||||
|
||||
projectMWrapper::projectMWrapper(class ProjectM::Settings settings, int flags)
|
||||
: ProjectM(std::move(settings), static_cast<ProjectM::Flags>(flags))
|
||||
projectMWrapper::projectMWrapper(class ProjectM::Settings settings)
|
||||
: ProjectM(std::move(settings))
|
||||
{
|
||||
}
|
||||
|
||||
void projectMWrapper::PresetSwitchedEvent(bool isHardCut, size_t presetIndex) const
|
||||
{
|
||||
if (_presetSwitchedEventCallback)
|
||||
{
|
||||
_presetSwitchedEventCallback(isHardCut, presetIndex, _presetSwitchedEventUserData);
|
||||
}
|
||||
}
|
||||
|
||||
void projectMWrapper::ShuffleEnabledValueChanged(bool shuffle_enabled) const
|
||||
{
|
||||
if (_shuffleEnableChangedEventCallback)
|
||||
{
|
||||
_shuffleEnableChangedEventCallback(shuffle_enabled, _shuffleEnableChangedEventUserData);
|
||||
}
|
||||
}
|
||||
|
||||
void projectMWrapper::PresetSwitchFailedEvent(bool isHardCut, unsigned int presetIndex,
|
||||
void projectMWrapper::PresetSwitchFailedEvent(bool isHardCut, const std::string& presetFilename,
|
||||
const std::string& failureMessage) const
|
||||
{
|
||||
if (_presetSwitchFailedEventCallback)
|
||||
{
|
||||
_presetSwitchFailedEventCallback(isHardCut, presetIndex,
|
||||
_presetSwitchFailedEventCallback(isHardCut, presetFilename.c_str(),
|
||||
failureMessage.c_str(), _presetSwitchFailedEventUserData);
|
||||
}
|
||||
}
|
||||
|
||||
void projectMWrapper::PresetRatingChanged(unsigned int presetIndex, int rating, PresetRatingType ratingType) const
|
||||
{
|
||||
if (_presetRatingChangedEventCallback)
|
||||
{
|
||||
_presetRatingChangedEventCallback(presetIndex, rating, static_cast<projectm_preset_rating_type>(ratingType),
|
||||
_presetRatingChangedEventUserData);
|
||||
}
|
||||
}
|
||||
|
||||
projectMWrapper* handle_to_instance(projectm_handle instance)
|
||||
{
|
||||
return reinterpret_cast<projectMWrapper*>(instance);
|
||||
@ -98,7 +73,6 @@ void projectm_free_settings(const projectm_settings* settings)
|
||||
{
|
||||
if (settings)
|
||||
{
|
||||
projectm_free_string(settings->preset_path);
|
||||
projectm_free_string(settings->texture_path);
|
||||
projectm_free_string(settings->data_path);
|
||||
}
|
||||
@ -106,11 +80,11 @@ void projectm_free_settings(const projectm_settings* settings)
|
||||
delete settings;
|
||||
}
|
||||
|
||||
projectm_handle projectm_create(const char* setting_file_path, int flags)
|
||||
projectm_handle projectm_create(const char* setting_file_path)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto projectMInstance = new projectMWrapper(std::string(setting_file_path), flags);
|
||||
auto projectMInstance = new projectMWrapper(std::string(setting_file_path));
|
||||
return reinterpret_cast<projectm_handle>(projectMInstance);
|
||||
}
|
||||
catch (...)
|
||||
@ -119,7 +93,7 @@ projectm_handle projectm_create(const char* setting_file_path, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
projectm_handle projectm_create_settings(const projectm_settings* settings, int flags)
|
||||
projectm_handle projectm_create_settings(const projectm_settings* settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -130,7 +104,6 @@ projectm_handle projectm_create_settings(const projectm_settings* settings, int
|
||||
cppSettings.textureSize = settings->texture_size;
|
||||
cppSettings.windowWidth = settings->window_width;
|
||||
cppSettings.windowHeight = settings->window_height;
|
||||
cppSettings.presetPath = settings->preset_path ? settings->preset_path : "";
|
||||
cppSettings.texturePath = settings->texture_path ? settings->texture_path : "";
|
||||
cppSettings.dataPath = settings->data_path ? settings->data_path : "";
|
||||
cppSettings.softCutDuration = settings->soft_cut_duration;
|
||||
@ -141,10 +114,8 @@ projectm_handle projectm_create_settings(const projectm_settings* settings, int
|
||||
cppSettings.beatSensitivity = settings->beat_sensitivity;
|
||||
cppSettings.aspectCorrection = settings->aspect_correction;
|
||||
cppSettings.easterEgg = settings->easter_egg;
|
||||
cppSettings.shuffleEnabled = settings->shuffle_enabled;
|
||||
cppSettings.softCutRatingsEnabled = settings->soft_cut_ratings_enabled;
|
||||
|
||||
auto projectMInstance = new projectMWrapper(cppSettings, flags);
|
||||
auto projectMInstance = new projectMWrapper(cppSettings);
|
||||
return reinterpret_cast<projectm_handle>(projectMInstance);
|
||||
}
|
||||
catch (...)
|
||||
@ -159,22 +130,6 @@ void projectm_destroy(projectm_handle instance)
|
||||
delete projectMInstance;
|
||||
}
|
||||
|
||||
void projectm_set_preset_switched_event_callback(projectm_handle instance, projectm_preset_switched_event callback,
|
||||
void* user_data)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->_presetSwitchedEventCallback = callback;
|
||||
projectMInstance->_presetSwitchedEventUserData = user_data;
|
||||
}
|
||||
|
||||
void projectm_set_shuffle_enable_changed_event_callback(projectm_handle instance,
|
||||
projectm_shuffle_enable_changed_event callback, void* user_data)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->_shuffleEnableChangedEventCallback = callback;
|
||||
projectMInstance->_shuffleEnableChangedEventUserData = user_data;
|
||||
}
|
||||
|
||||
void projectm_set_preset_switch_failed_event_callback(projectm_handle instance,
|
||||
projectm_preset_switch_failed_event callback, void* user_data)
|
||||
{
|
||||
@ -183,14 +138,6 @@ void projectm_set_preset_switch_failed_event_callback(projectm_handle instance,
|
||||
projectMInstance->_presetSwitchFailedEventUserData = user_data;
|
||||
}
|
||||
|
||||
void projectm_set_preset_rating_changed_event_callback(projectm_handle instance,
|
||||
projectm_preset_rating_changed_event callback, void* user_data)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->_presetRatingChangedEventCallback = callback;
|
||||
projectMInstance->_presetRatingChangedEventUserData = user_data;
|
||||
}
|
||||
|
||||
void projectm_reset_gl(projectm_handle instance, int width, int height)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
@ -336,12 +283,6 @@ void projectm_set_fps(projectm_handle instance, int32_t fps)
|
||||
projectMInstance->SetFramesPerSecond(fps);
|
||||
}
|
||||
|
||||
const char* projectm_get_preset_path(projectm_handle instance)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectm_alloc_string_from_std_string(projectMInstance->Settings().presetPath);
|
||||
}
|
||||
|
||||
const char* projectm_get_texture_path(projectm_handle instance)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
@ -414,7 +355,6 @@ projectm_settings* projectm_get_settings(projectm_handle instance)
|
||||
settingsStruct->texture_size = settings.textureSize;
|
||||
settingsStruct->window_width = settings.windowWidth;
|
||||
settingsStruct->window_height = settings.windowHeight;
|
||||
settingsStruct->preset_path = projectm_alloc_string_from_std_string(settings.presetPath);
|
||||
settingsStruct->texture_path = projectm_alloc_string_from_std_string(settings.texturePath);
|
||||
settingsStruct->data_path = projectm_alloc_string_from_std_string(settings.dataPath);
|
||||
settingsStruct->soft_cut_duration = settings.softCutDuration;
|
||||
@ -425,8 +365,6 @@ projectm_settings* projectm_get_settings(projectm_handle instance)
|
||||
settingsStruct->beat_sensitivity = settings.beatSensitivity;
|
||||
settingsStruct->aspect_correction = settings.aspectCorrection;
|
||||
settingsStruct->easter_egg = settings.easterEgg;
|
||||
settingsStruct->shuffle_enabled = settings.shuffleEnabled;
|
||||
settingsStruct->soft_cut_ratings_enabled = settings.softCutRatingsEnabled;
|
||||
|
||||
return settingsStruct;
|
||||
}
|
||||
@ -440,7 +378,6 @@ void projectm_write_config(const char* config_file, const projectm_settings* set
|
||||
cppSettings.textureSize = settings->texture_size;
|
||||
cppSettings.windowWidth = settings->window_width;
|
||||
cppSettings.windowHeight = settings->window_height;
|
||||
cppSettings.presetPath = settings->preset_path ? settings->preset_path : "";
|
||||
cppSettings.texturePath = settings->texture_path ? settings->texture_path : "";
|
||||
cppSettings.dataPath = settings->data_path ? settings->data_path : "";
|
||||
cppSettings.softCutDuration = settings->soft_cut_duration;
|
||||
@ -451,36 +388,10 @@ void projectm_write_config(const char* config_file, const projectm_settings* set
|
||||
cppSettings.beatSensitivity = settings->beat_sensitivity;
|
||||
cppSettings.aspectCorrection = settings->aspect_correction;
|
||||
cppSettings.easterEgg = settings->easter_egg;
|
||||
cppSettings.shuffleEnabled = settings->shuffle_enabled;
|
||||
cppSettings.softCutRatingsEnabled = settings->soft_cut_ratings_enabled;
|
||||
|
||||
ProjectM::WriteConfig(config_file, cppSettings);
|
||||
}
|
||||
|
||||
void projectm_select_preset_position(projectm_handle instance, unsigned int index)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->SelectPresetPosition(index);
|
||||
}
|
||||
|
||||
void projectm_select_preset(projectm_handle instance, unsigned int index, bool hard_cut)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->SelectPreset(index, hard_cut);
|
||||
}
|
||||
|
||||
void projectm_remove_preset(projectm_handle instance, unsigned int index)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->RemovePreset(index);
|
||||
}
|
||||
|
||||
void projectm_clear_playlist(projectm_handle instance)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->ClearPlaylist();
|
||||
}
|
||||
|
||||
void projectm_lock_preset(projectm_handle instance, bool lock)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
@ -493,160 +404,6 @@ bool projectm_is_preset_locked(projectm_handle instance)
|
||||
return projectMInstance->PresetLocked();
|
||||
}
|
||||
|
||||
unsigned int projectm_get_preset_index(projectm_handle instance, const char* preset_name)
|
||||
{
|
||||
if (!preset_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->PresetIndex(preset_name);
|
||||
}
|
||||
|
||||
void projectm_select_preset_by_name(projectm_handle instance, const char* preset_name, bool hard_cut)
|
||||
{
|
||||
if (!preset_name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->SelectPresetByName(preset_name, hard_cut);
|
||||
}
|
||||
|
||||
bool projectm_get_selected_preset_index(projectm_handle instance, unsigned int* index)
|
||||
{
|
||||
if (!index)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->SelectedPresetIndex(*index);
|
||||
}
|
||||
|
||||
void projectm_add_preset_url(projectm_handle instance, const char* preset_url, const char* preset_name,
|
||||
int* rating_list, unsigned int rating_list_length)
|
||||
{
|
||||
if (!preset_url
|
||||
|| !preset_name
|
||||
|| (!rating_list && rating_list_length > 0)
|
||||
|| rating_list_length != TOTAL_RATING_TYPES)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RatingList ratingList;
|
||||
for (unsigned int ratingIndex = 0; ratingIndex < rating_list_length; ratingIndex++)
|
||||
{
|
||||
ratingList.push_back(rating_list[ratingIndex]);
|
||||
}
|
||||
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->AddPresetURL(preset_url, preset_name, ratingList);
|
||||
}
|
||||
|
||||
void projectm_insert_preset_url(projectm_handle instance, unsigned int index, const char* preset_url,
|
||||
const char* preset_name, int* rating_list, unsigned int rating_list_length)
|
||||
{
|
||||
if (!preset_url
|
||||
|| !preset_name
|
||||
|| (!rating_list && rating_list_length > 0)
|
||||
|| rating_list_length != TOTAL_RATING_TYPES)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RatingList ratingList;
|
||||
for (unsigned int ratingIndex = 0; ratingIndex < rating_list_length; ratingIndex++)
|
||||
{
|
||||
ratingList.push_back(rating_list[ratingIndex]);
|
||||
}
|
||||
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->InsertPresetURL(index, preset_url, preset_name, ratingList);
|
||||
}
|
||||
|
||||
bool projectm_preset_position_valid(projectm_handle instance)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->PresetPositionValid();
|
||||
}
|
||||
|
||||
const char* projectm_get_preset_filename(projectm_handle instance, unsigned int index)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectm_alloc_string_from_std_string(projectMInstance->PresetURL(index));
|
||||
}
|
||||
|
||||
const char* projectm_get_preset_name(projectm_handle instance, unsigned int index)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectm_alloc_string_from_std_string(projectMInstance->PresetName(index));
|
||||
}
|
||||
|
||||
void projectm_set_preset_name(projectm_handle instance, unsigned int index, const char* name)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->ChangePresetName(index, name);
|
||||
}
|
||||
|
||||
int projectm_get_preset_rating(projectm_handle instance, unsigned int index, projectm_preset_rating_type rating_type)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->PresetRating(index, static_cast<PresetRatingType>(rating_type));
|
||||
}
|
||||
|
||||
void projectm_set_preset_rating(projectm_handle instance, unsigned int index, int rating,
|
||||
projectm_preset_rating_type rating_type)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->ChangePresetRating(index, rating, static_cast<PresetRatingType>(rating_type));
|
||||
}
|
||||
|
||||
unsigned int projectm_get_playlist_size(projectm_handle instance)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->PlaylistSize();
|
||||
}
|
||||
|
||||
bool projectm_get_shuffle_enabled(projectm_handle instance)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->ShuffleEnabled();
|
||||
}
|
||||
|
||||
void projectm_set_shuffle_enabled(projectm_handle instance, bool shuffle_enabled)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->SetShuffleEnabled(shuffle_enabled);
|
||||
}
|
||||
|
||||
unsigned int projectm_get_search_index(projectm_handle instance, const char* name)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
return projectMInstance->SearchIndex(name);
|
||||
}
|
||||
|
||||
void projectm_select_previous_preset(projectm_handle instance, bool hard_cut)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->SelectPrevious(hard_cut);
|
||||
}
|
||||
|
||||
void projectm_select_next_preset(projectm_handle instance, bool hard_cut)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->SelectNext(hard_cut);
|
||||
}
|
||||
|
||||
void projectm_select_random_preset(projectm_handle instance, bool hard_cut)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
projectMInstance->SelectRandom(hard_cut);
|
||||
}
|
||||
|
||||
void projectm_get_window_size(projectm_handle instance, size_t* width, size_t* height)
|
||||
{
|
||||
auto projectMInstance = handle_to_instance(instance);
|
||||
|
||||
Reference in New Issue
Block a user