Revert "Experiment with removing the static MediaPlayer"

This reverts commit fb1ed58d37.
This commit is contained in:
Mike Griese 2021-11-16 09:40:23 -06:00
parent fb1ed58d37
commit 02344048de
4 changed files with 17 additions and 25 deletions

View file

@ -33,7 +33,7 @@ static const Duration AnimationDuration = DurationHelper::FromTimeSpan(winrt::Wi
winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::s_focusedBorderBrush = { nullptr }; winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::s_focusedBorderBrush = { nullptr };
winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::s_unfocusedBorderBrush = { nullptr }; winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::s_unfocusedBorderBrush = { nullptr };
// winrt::Windows::Media::Playback::MediaPlayer Pane::s_bellPlayer = { nullptr }; winrt::Windows::Media::Playback::MediaPlayer Pane::s_bellPlayer = { nullptr };
Pane::Pane(const Profile& profile, const TermControl& control, const bool lastFocused) : Pane::Pane(const Profile& profile, const TermControl& control, const bool lastFocused) :
_control{ control }, _control{ control },
@ -71,14 +71,14 @@ Pane::Pane(const Profile& profile, const TermControl& control, const bool lastFo
e.Handled(true); e.Handled(true);
}); });
// if (!s_bellPlayer) if (!s_bellPlayer)
// { {
// try try
// { {
// s_bellPlayer = winrt::Windows::Media::Playback::MediaPlayer(); s_bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
// } }
// CATCH_LOG(); CATCH_LOG();
// } }
} }
Pane::Pane(std::shared_ptr<Pane> first, Pane::Pane(std::shared_ptr<Pane> first,
@ -1125,13 +1125,13 @@ winrt::fire_and_forget Pane::_playBellSound(winrt::Windows::Foundation::Uri uri)
co_await winrt::resume_foreground(_root.Dispatcher()); co_await winrt::resume_foreground(_root.Dispatcher());
if (auto pane{ weakThis.get() }) if (auto pane{ weakThis.get() })
{ {
// if (s_bellPlayer) if (s_bellPlayer)
// { {
// auto source{ winrt::Windows::Media::Core::MediaSource::CreateFromUri(uri) }; auto source{ winrt::Windows::Media::Core::MediaSource::CreateFromUri(uri) };
// auto item{ winrt::Windows::Media::Playback::MediaPlaybackItem(source) }; auto item{ winrt::Windows::Media::Playback::MediaPlaybackItem(source) };
// s_bellPlayer.Source(item); s_bellPlayer.Source(item);
// s_bellPlayer.Play(); s_bellPlayer.Play();
// } }
} }
} }

View file

@ -229,7 +229,7 @@ private:
bool _zoomed{ false }; bool _zoomed{ false };
// static winrt::Windows::Media::Playback::MediaPlayer s_bellPlayer; static winrt::Windows::Media::Playback::MediaPlayer s_bellPlayer;
bool _IsLeaf() const noexcept; bool _IsLeaf() const noexcept;
bool _HasFocusedChild() const noexcept; bool _HasFocusedChild() const noexcept;

View file

@ -56,12 +56,6 @@ namespace winrt::TerminalApp::implementation
_hostingHwnd{} _hostingHwnd{}
{ {
InitializeComponent(); InitializeComponent();
try
{
_bellPlayer = winrt::Windows::Media::Playback::MediaPlayer();
}
CATCH_LOG();
} }
// Method Description: // Method Description:

View file

@ -201,8 +201,6 @@ namespace winrt::TerminalApp::implementation
std::shared_ptr<Toast> _windowIdToast{ nullptr }; std::shared_ptr<Toast> _windowIdToast{ nullptr };
std::shared_ptr<Toast> _windowRenameFailedToast{ nullptr }; std::shared_ptr<Toast> _windowRenameFailedToast{ nullptr };
winrt::Windows::Media::Playback::MediaPlayer _bellPlayer{ nullptr };
void _ShowAboutDialog(); void _ShowAboutDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowQuitDialog(); winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowQuitDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowCloseWarningDialog(); winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowCloseWarningDialog();