cheofusi/just_playback

error when playing files with certain characters

Opened this issue · 4 comments

When I try to play files that have Japanese characters in the file name I get the error

line 235, in __bind
    raise MiniaudioError(MA_RESULT_STR[ma_res])
just_playback.ma_result.MiniaudioError: MA_DOES_NOT_EXIST

the same might happen with other characters as well but I haven't tested it

Hi @jimmy-taylor-1,

Could you try installing v0.1.8 ? Let me know if it solves your problem.

Unfortunately this seems to have made the problem worse, now i get this error for every file I try to play

line 55, in load_file
    self.__bind(lib.load_file_w(self.__ma_attrs, path_to_file.encode('utf-16le')))
TypeError: initializer for ctype 'wchar_t *' must be a cdata pointer, not bytes

Unfortunately this seems to have made the problem worse, now i get this error for every file I try to play

line 55, in load_file
    self.__bind(lib.load_file_w(self.__ma_attrs, path_to_file.encode('utf-16le')))
TypeError: initializer for ctype 'wchar_t *' must be a cdata pointer, not bytes

I was getting the same error, even when directly compiling from source. I got mine working by simply removing the encoding,

so from:

if platform.system() == 'Windows':
        self.__bind(lib.load_file(self.__ma_attrs, path_to_file.encode('utf-16le')))

to:

if platform.system() == 'Windows':
        self.__bind(lib.load_file(self.__ma_attrs, path_to_file))

Also, when compiling from source, there is a little bit difference in the code, but you can still remove the utf16le encoding part completely and it will solve the issue.

Note: this isn't the right solution and we should perform some type of validation before deciding and going on with the encoding, but works for now.

I've updated the wheels on PyPI. Uninstalling and then reinstalling v0.1.8 should fix this issue.