* feat: add midi support refactor: hotkeys * feat: add support for knob * fix: return hotkey instance * feat: save local/remote VolumeKnob * refactor: add default values for Key to avoid trash values * feat: call setLocal/RemoteVolume * refactor: make remote/localVolumeKnob optional, add optional serialize for bindings * feat: expose getKeyName * fix(x11): misplaced sleep * fix: don't change volume whjen "shouldNotifyKnob" is true * feat: smooth out volume changes fix: volume not changing during playback * chore(deps): bump webviewpp * chore(deps): bump webviewpp * fix(queue): don't unlock mutex for function call * docs: improve contributing and move to root * feat(windows): rework hotkeys, enable midi support * chore(deps): update traypp Fixes issue where a segmentation fault would occur upon closing the program * fix(windows): undefined UNICODE when including tiny-process-library * refactor: make sound deduction function constexpr * chore(deps): bump frontend * refactor: reorder includes Co-authored-by: Curve <fynnbwdt@gmail.com>
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#pragma once
|
|
#if defined(_WIN32)
|
|
#include <core/hotkeys/hotkeys.hpp>
|
|
#include <mutex>
|
|
#include <thread>
|
|
#include <windows.h>
|
|
|
|
namespace Soundux
|
|
{
|
|
namespace Objects
|
|
{
|
|
class WindowsHotkeys : public Hotkeys
|
|
{
|
|
std::thread listener;
|
|
std::thread keyPresser;
|
|
std::atomic<bool> kill = false;
|
|
|
|
std::condition_variable cv;
|
|
std::mutex keysToPressMutex;
|
|
std::vector<Key> keysToPress;
|
|
|
|
private:
|
|
void listen();
|
|
void presser();
|
|
void setup() override;
|
|
|
|
private:
|
|
static HHOOK oMouseProc;
|
|
static HHOOK oKeyboardProc;
|
|
|
|
static LRESULT CALLBACK mouseProc(int, WPARAM, LPARAM);
|
|
static LRESULT CALLBACK keyBoardProc(int, WPARAM, LPARAM);
|
|
|
|
public:
|
|
~WindowsHotkeys();
|
|
std::string getKeyName(const Key &key) override;
|
|
void pressKeys(const std::vector<Key> &keys) override;
|
|
void releaseKeys(const std::vector<Key> &keys) override;
|
|
};
|
|
} // namespace Objects
|
|
} // namespace Soundux
|
|
|
|
#endif |