mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-28 09:38:52 +01:00
WIP: Updated volume support.
This commit is contained in:
parent
c9a87c3d9e
commit
46cc7084d1
@ -54,6 +54,8 @@ public:
|
||||
virtual void setText(std::string text, int id = -1) {};
|
||||
virtual void setImage(std::string filePath, int id = -1) {};
|
||||
int getId( );
|
||||
virtual void setVolume(double volume) {};
|
||||
virtual double getVolume() {return 0.0;};
|
||||
|
||||
protected:
|
||||
Page &page;
|
||||
|
||||
@ -83,6 +83,7 @@ void ReloadableMedia::update(float dt)
|
||||
baseViewInfo.ImageHeight = loadedComponent_->baseViewInfo.ImageHeight;
|
||||
}
|
||||
|
||||
static_cast<VideoComponent *>(loadedComponent_)->setVolume(volume_);
|
||||
loadedComponent_->update(dt);
|
||||
}
|
||||
|
||||
@ -456,3 +457,15 @@ void ReloadableMedia::draw()
|
||||
loadedComponent_->draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ReloadableMedia::setVolume(double volume)
|
||||
{
|
||||
volume_ = volume;
|
||||
}
|
||||
|
||||
|
||||
double ReloadableMedia::getVolume()
|
||||
{
|
||||
return volume_;
|
||||
}
|
||||
|
||||
@ -36,6 +36,8 @@ public:
|
||||
Component *findComponent(std::string collection, std::string type, std::string basename, std::string filepath, bool systemMode);
|
||||
|
||||
void enableTextFallback_(bool value);
|
||||
void setVolume(double volume);
|
||||
double getVolume();
|
||||
|
||||
private:
|
||||
void reloadTexture();
|
||||
@ -55,4 +57,5 @@ private:
|
||||
std::string currentCollection_;
|
||||
Page *page_;
|
||||
int displayOffset_;
|
||||
double volume_;
|
||||
};
|
||||
|
||||
@ -51,6 +51,7 @@ void VideoComponent::update(float dt)
|
||||
}
|
||||
if(isPlaying_)
|
||||
{
|
||||
videoInst_->setVolume(volume_);
|
||||
videoInst_->update(dt);
|
||||
|
||||
// video needs to run a frame to start getting size info
|
||||
|
||||
@ -767,9 +767,9 @@ void PageBuilder::loadReloadableImages(xml_node<> *layout, std::string tagName,
|
||||
static_cast<ReloadableMedia *>(c)->enableTextFallback_(false);
|
||||
}
|
||||
|
||||
xml_attribute<> *volumeXml = componentXml->first_attribute("volume");
|
||||
if(volumeXml)
|
||||
static_cast<VideoComponent *>(c)->setVolume(Utils::convertFloat(volumeXml->value()));
|
||||
xml_attribute<> *volumeXml = componentXml->first_attribute("volume");
|
||||
if(volumeXml)
|
||||
static_cast<ReloadableMedia *>(c)->setVolume(Utils::convertFloat(volumeXml->value()));
|
||||
}
|
||||
|
||||
if(c)
|
||||
|
||||
@ -31,4 +31,5 @@ public:
|
||||
virtual void draw() = 0;
|
||||
virtual int getHeight() = 0;
|
||||
virtual int getWidth() = 0;
|
||||
virtual void setVolume(double volume) = 0;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user