File tree Expand file tree Collapse file tree 8 files changed +96
-1
lines changed
Expand file tree Collapse file tree 8 files changed +96
-1
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,7 @@ target_sources(rpcs3_emu PRIVATE
500500 RSX/Overlays/overlays.cpp
501501 RSX/Overlays/overlay_animated_icon.cpp
502502 RSX/Overlays/overlay_animation.cpp
503+ RSX/Overlays/overlay_audio.cpp
503504 RSX/Overlays/overlay_compile_notification.cpp
504505 RSX/Overlays/overlay_controls.cpp
505506 RSX/Overlays/overlay_cursor.cpp
Original file line number Diff line number Diff line change 1+ #include " stdafx.h"
2+ #include " overlay_audio.h"
3+ #include " Emu/System.h"
4+
5+ namespace rsx
6+ {
7+ namespace overlays
8+ {
9+ audio_player::audio_player (const std::string& audio_path)
10+ {
11+ init_audio (audio_path);
12+ }
13+
14+ void audio_player::init_audio (const std::string& audio_path)
15+ {
16+ if (audio_path.empty ()) return ;
17+
18+ m_video_source = ensure (Emu.GetCallbacks ().make_video_source ());
19+ m_video_source->set_audio_path (audio_path);
20+ }
21+
22+ void audio_player::set_active (bool active)
23+ {
24+ if (m_video_source)
25+ {
26+ m_video_source->set_active (active);
27+ }
28+ }
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include " util/video_source.h"
4+
5+ namespace rsx
6+ {
7+ namespace overlays
8+ {
9+ class audio_player
10+ {
11+ public:
12+ audio_player (const std::string& audio_path);
13+ ~audio_player () = default ;
14+
15+ void set_active (bool active);
16+
17+ private:
18+ void init_audio (const std::string& audio_path);
19+
20+ std::unique_ptr<video_source> m_video_source;
21+ };
22+ }
23+ }
Original file line number Diff line number Diff line change @@ -167,6 +167,23 @@ namespace rsx
167167 }
168168 }
169169
170+ void display_manager::start_audio (const std::string& audio_path)
171+ {
172+ if (audio_path.empty ())
173+ {
174+ m_audio_player.reset ();
175+ return ;
176+ }
177+
178+ m_audio_player = std::make_unique<audio_player>(audio_path);
179+ m_audio_player->set_active (true );
180+ }
181+
182+ void display_manager::stop_audio ()
183+ {
184+ m_audio_player.reset ();
185+ }
186+
170187 void display_manager::on_overlay_activated (const std::shared_ptr<overlay>& /* item*/ )
171188 {
172189 // TODO: Internal management, callbacks, etc
Original file line number Diff line number Diff line change 11#pragma once
22
33#include " overlays.h"
4+ #include " overlay_audio.h"
45
56#include " Emu/IdManager.h"
67#include " Utilities/mutex.h"
@@ -25,6 +26,8 @@ namespace rsx
2526 lf_queue<u32 > m_type_ids_to_remove;
2627 atomic_t <u32 > m_pending_removals_count = 0 ;
2728
29+ std::unique_ptr<audio_player> m_audio_player;
30+
2831 bool remove_type (u32 type_id);
2932
3033 bool remove_uid (u32 uid);
@@ -167,6 +170,9 @@ namespace rsx
167170 std::function<void(s32)> on_input_loop_exit = nullptr, // [optional] What to do with the result if any
168171 std::function<s32()> input_loop_override = nullptr); // [optional] What to do during the input loop. By default calls user_interface::run_input_loop
169172
173+ void start_audio (const std::string& audio_path);
174+ void stop_audio ();
175+
170176 private:
171177 struct overlay_input_thread
172178 {
Original file line number Diff line number Diff line change @@ -711,6 +711,11 @@ namespace rsx
711711 if (g_cfg.misc .use_native_interface && (g_cfg.video .renderer == video_renderer::opengl || g_cfg.video .renderer == video_renderer::vulkan))
712712 {
713713 m_overlay_manager = g_fxo->init <rsx::overlays::display_manager>(0 );
714+
715+ if (const std::string audio_path = Emu.GetSfoDir (true ) + " /SND0.AT3" ; fs::is_file (audio_path))
716+ {
717+ m_overlay_manager->start_audio (audio_path);
718+ }
714719 }
715720
716721 if (!_ar)
@@ -1101,6 +1106,11 @@ namespace rsx
11011106 thread_ctrl::set_thread_affinity_mask (thread_ctrl::get_affinity_mask (thread_class::rsx));
11021107 }
11031108
1109+ if (auto manager = g_fxo->try_get <rsx::overlays::display_manager>())
1110+ {
1111+ manager->stop_audio ();
1112+ }
1113+
11041114 while (!test_stopped ())
11051115 {
11061116 // Wait for external pause events
Original file line number Diff line number Diff line change 145145 <ClCompile Include =" Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.cpp" />
146146 <ClCompile Include =" Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.cpp" />
147147 <ClCompile Include =" Emu\RSX\Overlays\overlay_animated_icon.cpp" />
148+ <ClCompile Include =" Emu\RSX\Overlays\overlay_audio.cpp" />
148149 <ClCompile Include =" Emu\RSX\Overlays\overlay_controls.cpp" />
149150 <ClCompile Include =" Emu\RSX\Overlays\overlay_cursor.cpp" />
150151 <ClCompile Include =" Emu\RSX\Overlays\overlay_debug_overlay.cpp" />
704705 <ClInclude Include =" Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.h" />
705706 <ClInclude Include =" Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.h" />
706707 <ClInclude Include =" Emu\RSX\Overlays\overlay_animated_icon.h" />
708+ <ClInclude Include =" Emu\RSX\Overlays\overlay_audio.h" />
707709 <ClInclude Include =" Emu\RSX\Overlays\overlay_cursor.h" />
708710 <ClInclude Include =" Emu\RSX\Overlays\overlay_debug_overlay.h" />
709711 <ClInclude Include =" Emu\RSX\Overlays\overlay_edit_text.hpp" />
11031105 <Import Project =" $(VCTargetsPath)\Microsoft.Cpp.targets" />
11041106 <ImportGroup Label =" ExtensionTargets" >
11051107 </ImportGroup >
1106- </Project >
1108+ </Project >
Original file line number Diff line number Diff line change 14111411 <ClCompile Include =" Loader\ISO.cpp" >
14121412 <Filter >Loader</Filter >
14131413 </ClCompile >
1414+ <ClCompile Include =" Emu\RSX\Overlays\overlay_audio.cpp" >
1415+ <Filter >Emu\GPU\RSX\Overlays</Filter >
1416+ </ClCompile >
14141417 </ItemGroup >
14151418 <ItemGroup >
14161419 <ClInclude Include =" Crypto\aes.h" >
28332836 <ClInclude Include =" Loader\ISO.h" >
28342837 <Filter >Loader</Filter >
28352838 </ClInclude >
2839+ <ClInclude Include =" Emu\RSX\Overlays\overlay_audio.h" >
2840+ <Filter >Emu\GPU\RSX\Overlays</Filter >
2841+ </ClInclude >
28362842 </ItemGroup >
28372843 <ItemGroup >
28382844 <None Include =" Emu\RSX\Program\GLSLSnippets\GPUDeswizzle.glsl" >
You can’t perform that action at this time.
0 commit comments