I'm trying to edit some .wav files and .flac files. The filenames are in japanese/english. Every single time I want to open an audio file in Waveshop, it keeps providing an error about an Incorrect File Path. How do I fix this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
WaveShop itself can be compiled for Unicode, provided the following fix is made to CDocManagerEx::CFileDialogEx::OnTypeChange() in DocManagerEx.cpp:
USES_CONVERSION;
SetDefExt(T2CA(ext)); // set default extension
should be changed to:
USES_CONVERSION;
SetDefExt((LPCSTR)(LPCTSTR)ext); // set default extension
UNLESS you're using VS2012 or higher, in which case it should just be:
SetDefExt(ext); // set default extension
Here the issue is that CFileDialog::SetDefExt had an incorrect prototype in afxdlgs.h The extension argument's type was given as LPCSTR, but it should have been LPCTSTR, since the SetDefExt function does in fact support both MBCS and Unicode. In a Unicode build, passing a MBCS string to SetDefExt (as the function prototype seems to require) causes SetDefExt to fail and possibly crash the app. This stupidity persisted for many years until Microsoft finally fixed it in VS2012 by changing SetDefExt's argument type to LPCTSTR, as it should have been all along. Incidentally CFileDialog::SetControlText had the same exact issue.
But all of this is beside the point. The real problem with making WaveShop Unicode is that many of the libraries it depends on don't support Unicode, because they use char pointers and char arrays for strings. You can locate such cases by searching WaveShop's source files for USES_CONVERSION. It may be that some of those libraries (libsndfile, libid3tag, libmp4ad) have branches that do support Unicode but everything would have to be reintegrated and retested. Just to be clear that's a big job even if it's possible at all, and I'm not volunteering to do it.
However if you only want to edit WAV files, rebuilding WaveShop for Unicode (with the SetDefExt fix described above) might work fine for you. WaveShop handles WAV files natively, and those libraries I mentioned are only needed to handle audio file formats other than WAV.
Last edit: Chris Korda 2017-07-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to edit some .wav files and .flac files. The filenames are in japanese/english. Every single time I want to open an audio file in Waveshop, it keeps providing an error about an Incorrect File Path. How do I fix this?
The shipping version of Waveshop isn't built for Unicode. The only solution
is to rebuild the project sources with Unicode enabled.
Last edit: Chris Korda 2017-07-17
WaveShop itself can be compiled for Unicode, provided the following fix is made to CDocManagerEx::CFileDialogEx::OnTypeChange() in DocManagerEx.cpp:
should be changed to:
UNLESS you're using VS2012 or higher, in which case it should just be:
Here the issue is that CFileDialog::SetDefExt had an incorrect prototype in afxdlgs.h The extension argument's type was given as LPCSTR, but it should have been LPCTSTR, since the SetDefExt function does in fact support both MBCS and Unicode. In a Unicode build, passing a MBCS string to SetDefExt (as the function prototype seems to require) causes SetDefExt to fail and possibly crash the app. This stupidity persisted for many years until Microsoft finally fixed it in VS2012 by changing SetDefExt's argument type to LPCTSTR, as it should have been all along. Incidentally CFileDialog::SetControlText had the same exact issue.
But all of this is beside the point. The real problem with making WaveShop Unicode is that many of the libraries it depends on don't support Unicode, because they use char pointers and char arrays for strings. You can locate such cases by searching WaveShop's source files for USES_CONVERSION. It may be that some of those libraries (libsndfile, libid3tag, libmp4ad) have branches that do support Unicode but everything would have to be reintegrated and retested. Just to be clear that's a big job even if it's possible at all, and I'm not volunteering to do it.
However if you only want to edit WAV files, rebuilding WaveShop for Unicode (with the SetDefExt fix described above) might work fine for you. WaveShop handles WAV files natively, and those libraries I mentioned are only needed to handle audio file formats other than WAV.
Last edit: Chris Korda 2017-07-17