Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dimensionslip authored Oct 20, 2024
1 parent eb0eec7 commit a71a140
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/bindings/fluid_filerenderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,32 @@ new_fluid_file_renderer(fluid_synth_t *synth)
goto error_recovery;
}

#ifdef _WIN32
if (0 == FLUID_STRCMP("-", filename))
dev->sndfile = sf_open(filename, SFM_WRITE, &info); // pipe open
else
{
int u16_count;
LPWSTR filename_wchar;
dev->sndfile = NULL;

// utf-8 filename to utf-16 filename_wchar
if (1 > (u16_count = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, NULL, 0)))
FLUID_LOG(FLUID_ERR, "Failed to convert UTF8 string to wide char string");
else if (NULL == (filename_wchar = (LPWSTR)FLUID_ARRAY(WCHAR, u16_count)))
FLUID_LOG(FLUID_ERR, "Out of memory");
else
{
if (u16_count != MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, filename_wchar, u16_count))
FLUID_LOG(FLUID_ERR, "Failed to convert UTF8 string to wide char string");
else
dev->sndfile = sf_wchar_open(filename_wchar, SFM_WRITE, &info); // file open
FLUID_FREE(filename_wchar);
}
}
#else
dev->sndfile = sf_open(filename, SFM_WRITE, &info);
#endif

if(!dev->sndfile)
{
Expand Down

0 comments on commit a71a140

Please sign in to comment.