Qt: add sound-effect to screenshots

This commit is contained in:
Megamouse 2021-10-24 11:45:56 +02:00
parent 5e436984a2
commit d5ca9dacb6

View File

@ -12,12 +12,13 @@
#include "Emu/Cell/Modules/cellScreenshot.h" #include "Emu/Cell/Modules/cellScreenshot.h"
#include "Emu/RSX/rsx_utils.h" #include "Emu/RSX/rsx_utils.h"
#include <QCoreApplication> #include <QApplication>
#include <QDateTime> #include <QDateTime>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMessageBox> #include <QMessageBox>
#include <QPainter> #include <QPainter>
#include <QScreen> #include <QScreen>
#include <QSound>
#include <string> #include <string>
#include <thread> #include <thread>
@ -715,6 +716,19 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
screenshot_log.success("Successfully saved cell screenshot to %s", cell_sshot_filename); screenshot_log.success("Successfully saved cell screenshot to %s", cell_sshot_filename);
} }
// Play a sound
Emu.CallAfter([]()
{
if (const std::string sound_path = fs::get_config_dir() + "sounds/screenshot.wav"; fs::is_file(sound_path))
{
QSound::play(qstr(sound_path));
}
else
{
QApplication::beep();
}
});
return; return;
}, },
std::move(data)) std::move(data))