mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
MPV should respect volume levels now
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
95713ae439
commit
26f6156f34
2
main.cpp
2
main.cpp
@ -66,5 +66,7 @@ int main (int argc, char* argv[])
|
|||||||
// show the wallpaper application
|
// show the wallpaper application
|
||||||
app.show ();
|
app.show ();
|
||||||
|
|
||||||
|
appPointer = nullptr;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -20,6 +20,9 @@ using namespace WallpaperEngine::Application;
|
|||||||
CWallpaperApplication::CWallpaperApplication (CApplicationContext& context) :
|
CWallpaperApplication::CWallpaperApplication (CApplicationContext& context) :
|
||||||
m_context (context)
|
m_context (context)
|
||||||
{
|
{
|
||||||
|
// copy state to global variables for now
|
||||||
|
g_AudioVolume = context.audioVolume;
|
||||||
|
g_AudioEnabled = context.audioEnabled;
|
||||||
this->setupContainer ();
|
this->setupContainer ();
|
||||||
this->loadProject ();
|
this->loadProject ();
|
||||||
this->setupProperties ();
|
this->setupProperties ();
|
||||||
|
@ -12,7 +12,7 @@ using namespace WallpaperEngine::Audio::Drivers;
|
|||||||
|
|
||||||
void audio_callback (void* userdata, uint8_t* streamData, int length)
|
void audio_callback (void* userdata, uint8_t* streamData, int length)
|
||||||
{
|
{
|
||||||
CSDLAudioDriver* driver = reinterpret_cast <CSDLAudioDriver*> (userdata);
|
auto* driver = reinterpret_cast <CSDLAudioDriver*> (userdata);
|
||||||
|
|
||||||
memset (streamData, 0, length);
|
memset (streamData, 0, length);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
extern bool g_AudioEnabled;
|
extern bool g_AudioEnabled;
|
||||||
|
extern int g_AudioVolume;
|
||||||
|
|
||||||
using namespace WallpaperEngine;
|
using namespace WallpaperEngine;
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
@ -19,6 +20,8 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext* context, CAudioContext* aud
|
|||||||
m_width (16),
|
m_width (16),
|
||||||
m_height (16)
|
m_height (16)
|
||||||
{
|
{
|
||||||
|
double volume = g_AudioVolume * 100.0 / 128.0;
|
||||||
|
|
||||||
// create mpv contexts
|
// create mpv contexts
|
||||||
this->m_mpv = mpv_create ();
|
this->m_mpv = mpv_create ();
|
||||||
|
|
||||||
@ -37,6 +40,7 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext* context, CAudioContext* aud
|
|||||||
|
|
||||||
mpv_set_option_string (this->m_mpv, "hwdec", "auto");
|
mpv_set_option_string (this->m_mpv, "hwdec", "auto");
|
||||||
mpv_set_option_string (this->m_mpv, "loop", "inf");
|
mpv_set_option_string (this->m_mpv, "loop", "inf");
|
||||||
|
mpv_set_option (this->m_mpv, "volume", MPV_FORMAT_DOUBLE, &volume);
|
||||||
|
|
||||||
// initialize gl context for mpv
|
// initialize gl context for mpv
|
||||||
mpv_opengl_init_params gl_init_params {get_proc_address, nullptr};
|
mpv_opengl_init_params gl_init_params {get_proc_address, nullptr};
|
||||||
|
Loading…
Reference in New Issue
Block a user