Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode paths on windows correctly handled #1396

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ jobs:
cmake -S . -B ./build ${{ matrix.cmakeConfig }} -DCMAKE_BUILD_TYPE=Debug
cmake --build ./build --config Debug --target ${{ matrix.target }} --parallel 4

- name: Run Clap Validator
if: ${{ matrix.clapValidate }}
uses: jatinchowdhury18/clap-val-action@main
with:
plugin_path: "./build/shortcircuit-products/Shortcircuit XT.clap"
#- name: Run Clap Validator
# if: ${{ matrix.clapValidate }}
# uses: jatinchowdhury18/clap-val-action@main
# with:
# plugin_path: "./build/shortcircuit-products/Shortcircuit XT.clap"

- name: Run Tests
if: ${{ matrix.runTests }}
Expand Down
2 changes: 1 addition & 1 deletion libs/sst/libgig-modified
Submodule libgig-modified updated 1 files
+47 −36 src/RIFF.cpp
Binary file added resources/test_samples/聲音不好.flac
Binary file not shown.
Binary file added resources/test_samples/聲音不好.mp3
Binary file not shown.
12 changes: 12 additions & 0 deletions src/sample/loaders/load_mp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,23 @@ bool Sample::parseMP3(const fs::path &p)
{
mp3dec_t mp3d;
mp3dec_file_info_t info;
#if WIN32
int count =
MultiByteToWideChar(CP_UTF8, 0, p.u8string().c_str(), p.u8string().length(), NULL, 0);
std::wstring wstr(count, 0);
MultiByteToWideChar(CP_UTF8, 0, p.u8string().c_str(), p.u8string().length(), &wstr[0], count);
if (mp3dec_load_w(&mp3d, &wstr[0], &info, nullptr, nullptr))
{
SCLOG("Failed to parse MP3");
return false;
}
#else
if (mp3dec_load(&mp3d, p.u8string().c_str(), &info, nullptr, nullptr))
{
SCLOG("Failed to parse MP3");
return false;
}
#endif

if (info.channels < 1 || info.channels > 2)
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/sample/sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ bool Sample::loadFromSF2(const fs::path &p, sf2::File *f, int sampleIndex)

auto s = sfsample;

auto fnp = fs::path{f->GetRiffFile()->GetFileName()};
auto fnp = fs::path(fs::u8path(f->GetRiffFile()->GetFileName()));
displayName = fmt::format("{} - ({} @ {})", s->Name, fnp.filename().u8string(), sampleIndex);

if (frameSize == 2 && channels == 1 && sfsample->SampleType == sf2::Sample::MONO_SAMPLE)
Expand Down
Loading