From f315dac34cda171607660707be730361e1883444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Sun, 19 May 2024 16:54:50 +0800 Subject: [PATCH] discussions/756 --- LunaTranslator/LunaTranslator/gui/showword.py | 2 +- plugins/CMakeLists.txt | 3 ++- .../applicationloopbackaudio/CMakeLists.txt | 22 +++++++++++++++++++ .../applicationloopbackaudio/Common.h | 0 .../LoopbackCapture.cpp | 2 +- .../LoopbackCapture.h | 0 .../applicationloopbackaudio/runer.cpp | 2 +- plugins/scripts/copytarget.py | 1 + plugins/shareddllproxy/CMakeLists.txt | 2 +- plugins/shareddllproxy/shareddllproxy.cpp | 3 --- 10 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 plugins/applicationloopbackaudio/CMakeLists.txt rename plugins/{shareddllproxy => }/applicationloopbackaudio/Common.h (100%) rename plugins/{shareddllproxy => }/applicationloopbackaudio/LoopbackCapture.cpp (99%) rename plugins/{shareddllproxy => }/applicationloopbackaudio/LoopbackCapture.h (100%) rename plugins/{shareddllproxy => }/applicationloopbackaudio/runer.cpp (87%) diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index d52a4cae..74b5ab09 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -48,7 +48,7 @@ class loopbackrecorder: try: self.waitsignal = str(time.time()) self.engine = subproc_w( - './files/plugins/shareddllproxy32.exe recordaudio "{}" "{}"'.format( + './files/plugins/loopbackaudio.exe "{}" "{}"'.format( self.file, self.waitsignal ), ) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index d91db755..d256f0dd 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -39,4 +39,5 @@ add_subdirectory(exec) add_subdirectory(winrtutils) add_subdirectory(winsharedutils) add_subdirectory(hookmagpie) -add_subdirectory(shareddllproxy) \ No newline at end of file +add_subdirectory(shareddllproxy) +add_subdirectory(applicationloopbackaudio) \ No newline at end of file diff --git a/plugins/applicationloopbackaudio/CMakeLists.txt b/plugins/applicationloopbackaudio/CMakeLists.txt new file mode 100644 index 00000000..b344a417 --- /dev/null +++ b/plugins/applicationloopbackaudio/CMakeLists.txt @@ -0,0 +1,22 @@ + +project(loopbackaudio) + + +generate_product_version( + versioninfo + NAME "LunaTranslator loopbackaudio" + COMPANY_COPYRIGHT "HIllya51 (C) 2024" + VERSION_MAJOR ${VERSION_MAJOR} + VERSION_MINOR ${VERSION_MINOR} + VERSION_PATCH ${VERSION_PATCH} +) + + +if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + +else() + + add_executable(loopbackaudio runer.cpp LoopbackCapture.cpp ${versioninfo}) + target_precompile_headers(loopbackaudio REUSE_FROM pch) + target_link_libraries(loopbackaudio Mfplat mfuuid ) +endif() diff --git a/plugins/shareddllproxy/applicationloopbackaudio/Common.h b/plugins/applicationloopbackaudio/Common.h similarity index 100% rename from plugins/shareddllproxy/applicationloopbackaudio/Common.h rename to plugins/applicationloopbackaudio/Common.h diff --git a/plugins/shareddllproxy/applicationloopbackaudio/LoopbackCapture.cpp b/plugins/applicationloopbackaudio/LoopbackCapture.cpp similarity index 99% rename from plugins/shareddllproxy/applicationloopbackaudio/LoopbackCapture.cpp rename to plugins/applicationloopbackaudio/LoopbackCapture.cpp index 79484b12..3465340f 100644 --- a/plugins/shareddllproxy/applicationloopbackaudio/LoopbackCapture.cpp +++ b/plugins/applicationloopbackaudio/LoopbackCapture.cpp @@ -422,4 +422,4 @@ HRESULT CLoopbackCapture::OnAudioSampleRequested() } return S_OK; -} +} \ No newline at end of file diff --git a/plugins/shareddllproxy/applicationloopbackaudio/LoopbackCapture.h b/plugins/applicationloopbackaudio/LoopbackCapture.h similarity index 100% rename from plugins/shareddllproxy/applicationloopbackaudio/LoopbackCapture.h rename to plugins/applicationloopbackaudio/LoopbackCapture.h diff --git a/plugins/shareddllproxy/applicationloopbackaudio/runer.cpp b/plugins/applicationloopbackaudio/runer.cpp similarity index 87% rename from plugins/shareddllproxy/applicationloopbackaudio/runer.cpp rename to plugins/applicationloopbackaudio/runer.cpp index 5fbdc6b0..e1ebeb02 100644 --- a/plugins/shareddllproxy/applicationloopbackaudio/runer.cpp +++ b/plugins/applicationloopbackaudio/runer.cpp @@ -1,6 +1,6 @@ #include "LoopbackCapture.h" -int recordaudio(int argc, wchar_t *argv[]) +int wmain(int argc, wchar_t *argv[]) { CLoopbackCapture loopbackCapture; loopbackCapture.StartCaptureAsync(GetCurrentProcessId(), false, argv[1]); diff --git a/plugins/scripts/copytarget.py b/plugins/scripts/copytarget.py index 52f86c91..b8098ebe 100644 --- a/plugins/scripts/copytarget.py +++ b/plugins/scripts/copytarget.py @@ -2,6 +2,7 @@ import shutil,sys x86=int(sys.argv[1]) if x86: shutil.copy('../builds/_x86/shareddllproxy32.exe','../../LunaTranslator/files/plugins') + shutil.copy('../builds/_x86/loopbackaudio.exe','../../LunaTranslator/files/plugins') shutil.copy('../builds/_x86/winrtutils32.dll','../../LunaTranslator/files/plugins/DLL32') shutil.copy('../builds/_x86/winsharedutils32.dll','../../LunaTranslator/files/plugins/DLL32') else: diff --git a/plugins/shareddllproxy/CMakeLists.txt b/plugins/shareddllproxy/CMakeLists.txt index d9ffed6b..8a0d710e 100644 --- a/plugins/shareddllproxy/CMakeLists.txt +++ b/plugins/shareddllproxy/CMakeLists.txt @@ -21,7 +21,7 @@ if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) else() add_library(tinymp3 ../libs/tinymp3/shine_mp3.c) add_subdirectory(voiceroid2) - add_library(x86lib dreye.cpp jbj7.cpp kingsoft.cpp le.cpp neospeech.cpp ../implsapi.cpp LR.cpp applicationloopbackaudio/runer.cpp applicationloopbackaudio/LoopbackCapture.cpp mp3.cpp) + add_library(x86lib dreye.cpp jbj7.cpp kingsoft.cpp le.cpp neospeech.cpp ../implsapi.cpp LR.cpp mp3.cpp) target_precompile_headers(voiceroid2 REUSE_FROM pch) target_precompile_headers(x86lib REUSE_FROM pch) target_link_libraries(shareddllproxy Mfplat mfuuid x86lib tinymp3 voiceroid2 ${Detours}) diff --git a/plugins/shareddllproxy/shareddllproxy.cpp b/plugins/shareddllproxy/shareddllproxy.cpp index 72052060..135fc95a 100644 --- a/plugins/shareddllproxy/shareddllproxy.cpp +++ b/plugins/shareddllproxy/shareddllproxy.cpp @@ -5,7 +5,6 @@ int ntleaswmain(int argc, wchar_t *wargv[]); int updatewmain(int argc, wchar_t *wargv[]); bool checkisapatch(); #ifndef _WIN64 -int recordaudio(int argc, wchar_t *argv[]); int mainmp3(int argc, wchar_t *argv[]); int LRwmain(int argc, wchar_t *argv[]); int jbjwmain(int argc, wchar_t *argv[]); @@ -67,8 +66,6 @@ int wmain(int argc, wchar_t *argv[]) if (argv0 == L"update") return updatewmain(argc - 1, argv + 1); #ifndef _WIN64 - else if (argv0 == L"recordaudio") - return recordaudio(argc - 1, argv + 1); else if (argv0 == L"mainmp3") return mainmp3(argc - 1, argv + 1); else if (argv0 == L"LR")