app: use audio volume

This commit is contained in:
itsmattkc 2022-08-06 20:09:39 -07:00
parent 16d4646972
commit ec5c08ef95
2 changed files with 7 additions and 0 deletions

View file

@ -292,6 +292,7 @@ void MediaPanel::StartAudioPlayback()
if (m->codec_type() == AVMEDIA_TYPE_AUDIO) {
if (m->StartPlayingAudio(output_dev, fmt)) {
auto out = new QAudioOutput(output_dev, fmt, this);
out->setVolume(m->GetVolume());
out->start(m);
connect(out, &QAudioOutput::stateChanged, this, [this]{
auto out = static_cast<QAudioOutput*>(sender());
@ -355,6 +356,7 @@ void MediaPanel::OpenMediaInstance(si::Object *o)
m->Open(o->ExtractToMemory());
m->SetStartOffset(float(o->time_offset_) * 0.001f);
m->SetVolume(float(o->volume_) / 79.0f);
m->SetVirtualTime(0);
m_mediaInstances.push_back(m);

View file

@ -74,6 +74,9 @@ public:
void SetVirtualTime(float f);
float GetVolume() const { return m_volume; }
void SetVolume(float v) { m_volume = v; }
signals:
void EndOfFile();
@ -114,6 +117,8 @@ private:
float m_virtualPosition;
float m_volume;
};
class MediaPanel : public Panel