20tab / mpg123-python

mpg123 python wrapper
MIT License
15 stars 7 forks source link

Windows10 lib123out issue #3

Open sumandroid12 opened 6 years ago

sumandroid12 commented 6 years ago

This simple code here

from mpg123 import Mpg123, Out123

# load an mp3 file
mp3 = Mpg123('D:/mpg123/test.mp3', library_path = 'D:/mpg123/libmpg123-0.dll')

# use libout123 to access the sound device
out = Out123(library_path = 'D:/mpg123/libout123-0.dll')

# decode mp3 frames and send them to the sound device
for frame in mp3.iter_frames(out.start):
    out.play(frame)

Gives this error:

C:\Data\Anaconda3\python.exe "C:/Users/$Username$/IdeaProjects/ESP_1/sound2.py"
Traceback (most recent call last):
  File "C:/Users/$Username$/IdeaProjects/ESP_1/sound2.py", line 7, in <module>
    out = Out123(library_path = 'D:/mpg123/libout123-0.dll')
  File "C:\Data\Anaconda3\lib\site-packages\mpg123.py", line 282, in __init__
    raise self.OpenException(self.plain_strerror(errcode))
mpg123.OpenException: invalid error code
[src/libout123/module.c:185] error: Failure getting module directory! (Perhaps set MPG123_MODDIR?)
[src/libout123/module.c:185] error: Failure getting module directory! (Perhaps set MPG123_MODDIR?)
[src/libout123/libout123.c:451] error: Found no driver out of [win32,win32_wasapi] working with device <default>.

How to get it working with windows.. I am thinking the drivers in mpg123/plugin are not getting loaded?

rdeioris commented 6 years ago

Hi, libout123 requires access to a plugins/ directory in which to find the related dll.

You can put the plugins directory into the same directory of the py script, or specify it via the MPG123_MODDIR environment directory

feature09 commented 5 years ago

Hi, how to specify the MPG123_MODDIR environment? I have put the plugins folder in the same directory as the py script, but it's get same error. And I have add sys.path.append('plugins/') in my codes.