Add OSC command to set volume level and play state

This commit is contained in:
baydam
2015-03-05 21:37:13 +00:00
parent a39fa73118
commit b71db2874c
4 changed files with 75 additions and 1 deletions
+58
View File
@@ -2490,6 +2490,64 @@ bool MainWindow::setTextureRate(int texture_id, double rate)
return true;
}
bool MainWindow::setTextureVolume(int texture_id, double volume)
{
Paint::ptr paint = this->mappingManager->getPaintById(texture_id);
if (paint.get() == NULL)
{
std::cout << "No such texture paint id " << texture_id << std::endl;
return false;
}
else
{
if (paint->getType() == "media")
{
Media *media = (Media *) paint.get(); // FIXME: use sharedptr cast
videoTimer->stop();
media->setVolume(volume);
videoTimer->start();
}
else
{
std::cout << "Paint id " << texture_id << " is not a media texture." << std::endl;
return false;
}
}
return true;
}
void MainWindow::setTexturePlayState(int texture_id, bool played)
{
Paint::ptr paint = this->mappingManager->getPaintById(texture_id);
if (paint.get() == NULL)
{
std::cout << "No such texture paint id " << texture_id << std::endl;
}
else
{
if (paint->getType() == "media")
{
if (played)
{
videoTimer->stop();
paint->play();
videoTimer->start();
}
else
{
videoTimer->stop();
paint->pause();
videoTimer->start();
}
}
else
{
std::cout << "Paint id " << texture_id << " is not a media texture." << std::endl;
}
}
}
void MainWindow::quitMapMap()
{
close();