Make the visualisation duration configurable

This commit is contained in:
David Sansome 2010-06-07 13:36:50 +00:00
parent 0e19ca17e5
commit ade492c56f
6 changed files with 20 additions and 2 deletions

View File

@ -37,6 +37,8 @@ public:
double sampledPresetDuration();
void ChangePresetDuration(int seconds) { _presetDuration = seconds; }
#ifndef WIN32
/* The first ticks value of the application */
struct timeval startTime;

View File

@ -917,3 +917,7 @@ void projectM::changeTextureSize(int size) {
_settings.titleFontURL, _settings.menuFontURL);
}
void projectM::changePresetDuration(int seconds) {
timeKeeper->ChangePresetDuration(seconds);
}

View File

@ -154,6 +154,7 @@ public:
void changeTextureSize(int size);
void changePresetDuration(int seconds);
const Settings & settings() const {

View File

@ -41,6 +41,7 @@ ProjectMVisualisation::ProjectMVisualisation(QObject *parent)
projectm_(NULL),
preset_model_(NULL),
mode_(Random),
duration_(15),
texture_size_(512)
{
connect(this, SIGNAL(sceneRectChanged(QRectF)), SLOT(SceneRectChanged(QRectF)));
@ -89,8 +90,8 @@ void ProjectMVisualisation::InitProjectM() {
s.fps = 35;
s.windowWidth = 512;
s.windowHeight = 512;
s.smoothPresetDuration = 10;
s.presetDuration = 15;
s.smoothPresetDuration = 5;
s.presetDuration = duration_;
s.presetURL = preset_path.toStdString();
s.shuffleEnabled = true;
s.easterEgg = 0; // ??
@ -126,6 +127,13 @@ void ProjectMVisualisation::SetTextureSize(int size) {
projectm_->changeTextureSize(texture_size_);
}
void ProjectMVisualisation::SetDuration(int seconds) {
duration_ = seconds;
if (projectm_)
projectm_->changePresetDuration(duration_);
}
void ProjectMVisualisation::ConsumeBuffer(GstBuffer *buffer, GstEnginePipeline*) {
const int samples_per_channel = GST_BUFFER_SIZE(buffer) / sizeof(short) / 2;
const short* data = reinterpret_cast<short*>(GST_BUFFER_DATA(buffer));

View File

@ -50,6 +50,7 @@ public:
public slots:
void SetTextureSize(int size);
void SetDuration(int seconds);
void SetSelected(const QStringList& paths, bool selected);
void ClearSelected();
@ -76,6 +77,7 @@ private:
boost::scoped_ptr<projectM> projectm_;
ProjectMPresetModel* preset_model_;
Mode mode_;
int duration_;
std::vector<int> default_rating_list_;

View File

@ -51,6 +51,7 @@ void VisualisationSelector::showEvent(QShowEvent *) {
ui_->list->setModel(vis_->preset_model());
connect(ui_->list->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
vis_->preset_model(), SLOT(SetImmediatePreset(QModelIndex)));
connect(ui_->delay, SIGNAL(valueChanged(int)), vis_, SLOT(SetDuration(int)));
ui_->mode->setCurrentIndex(vis_->mode());
}