mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[AlwaysOnTop] Proof of concept (#14360)
Co-authored-by: Niels Laute <niels.laute@live.nl>
This commit is contained in:
44
src/modules/alwaysontop/AlwaysOnTop/Sound.h
Normal file
44
src/modules/alwaysontop/AlwaysOnTop/Sound.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <mmsystem.h> // sound
|
||||
|
||||
class Sound
|
||||
{
|
||||
public:
|
||||
enum class Type
|
||||
{
|
||||
On,
|
||||
Off,
|
||||
};
|
||||
|
||||
Sound()
|
||||
: isPlaying(false)
|
||||
{}
|
||||
|
||||
void Play(Type type)
|
||||
{
|
||||
BOOL success = false;
|
||||
switch (type)
|
||||
{
|
||||
case Type::On:
|
||||
success = PlaySound(TEXT("Media\\Speech On.wav"), NULL, SND_FILENAME | SND_ASYNC);
|
||||
break;
|
||||
case Type::Off:
|
||||
success = PlaySound(TEXT("Media\\Speech Off.wav"), NULL, SND_FILENAME | SND_ASYNC);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
Logger::error(L"Sound playing error");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic<bool> isPlaying;
|
||||
};
|
||||
Reference in New Issue
Block a user