Skip to content

Commit

Permalink
This was one idea but I have a better one
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Jan 27, 2022
1 parent 3873146 commit 59a6377
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/cascadia/TerminalApp/Pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,13 +1124,23 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect
{
// Audible is set, play the sound
auto sounds{ _profile.BellSound() };
bool playedBell{ false };

if (sounds && sounds.Size() > 0)
{
winrt::hstring soundPath{ wil::ExpandEnvironmentStringsW<std::wstring>(sounds.GetAt(rand() % sounds.Size()).c_str()) };
winrt::Windows::Foundation::Uri uri{ soundPath };
_playBellSound(uri);
if (sounds.Size() == 1 && sounds.GetAt(0).empty())
{
}
else
{
winrt::hstring soundPath{ wil::ExpandEnvironmentStringsW<std::wstring>(sounds.GetAt(rand() % sounds.Size()).c_str()) };
winrt::Windows::Foundation::Uri uri{ soundPath };
_playBellSound(uri);
playedBell = true;
}
}
else

if (!playedBell)
{
const auto soundAlias = reinterpret_cast<LPCTSTR>(SND_ALIAS_SYSTEMHAND);
PlaySound(soundAlias, NULL, SND_ALIAS_ID | SND_ASYNC | SND_SENTRY);
Expand Down

0 comments on commit 59a6377

Please sign in to comment.