mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-01 13:06:25 +00:00
- preset switcher is now chooser
- lots of work to preset chooser involving randomization and iteration git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@230 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -16,6 +16,7 @@ extern "C" {
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
}
|
||||
#include <cassert>
|
||||
|
||||
PresetLoader::PresetLoader(std::string dirname) :m_dirname(dirname)
|
||||
{
|
||||
@ -37,13 +38,13 @@ m_entries.clear();
|
||||
closedir(m_dir);
|
||||
}
|
||||
|
||||
// Allocate a new a stream given the current diectory name
|
||||
// Allocate a new a stream given the current directory name
|
||||
if ((m_dir = opendir(m_dirname.c_str())) == NULL) {
|
||||
handleDirectoryError();
|
||||
}
|
||||
|
||||
std::string fullPath;
|
||||
std::ostringstream out(fullPath);
|
||||
|
||||
std::ostringstream out;
|
||||
|
||||
struct dirent * dir_entry;
|
||||
while ((dir_entry = readdir(m_dir)) != NULL) {
|
||||
@ -68,6 +69,17 @@ while ((dir_entry = readdir(m_dir)) != NULL) {
|
||||
|
||||
}
|
||||
|
||||
std::auto_ptr<Preset> PresetLoader::loadPreset(unsigned int index, const PresetInputs & presetInputs, PresetOutputs & presetOutputs) {
|
||||
|
||||
// Check that index isn't insane
|
||||
assert(index >= 0);
|
||||
assert(index < m_entries.size());
|
||||
|
||||
// Return a new auto pointer to a present
|
||||
return std::auto_ptr<Preset>(new Preset(m_entries[index], presetInputs, presetOutputs));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PresetLoader::handleDirectoryError() {
|
||||
switch (errno) {
|
||||
@ -88,4 +100,4 @@ void PresetLoader::handleDirectoryError() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user