Skip to content

Commit aab800d

Browse files
committed
Truly fix SWIG setup
1 parent bac5312 commit aab800d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pymp3decoder/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
from . import _pymp3_c
1+
from . import pymp3_c
22
import struct
3+
print(pymp3_c.__dict__)
4+
# # print all attributes
5+
# print(dir(pymp3_c))
36

47

58
def get_pad(bn):
@@ -51,7 +54,7 @@ def __init__(self, pcm_buf_size):
5154

5255
self.joined = bytearray([0]*pcm_buf_size*2)
5356

54-
self.decoder = _pymp3_c.LameDecoder()
57+
self.decoder = pymp3_c.LameDecoder()
5558

5659
def get_tag_length(self, mp3_buffer):
5760
""" Get tag length of ID3v2 header
@@ -221,7 +224,7 @@ def decode(self, mp3_data, remaining):
221224
except ValueError as e:
222225
raise RuntimeError("Caught exception '{}' - likely cause is that the PCM buffer was not big enough to hold all the decoded data for this frame".format(e))
223226

224-
_pymp3_c.interlace_array(self.pcm_l, self.pcm_r, self.joined, total_samples_read)
227+
pymp3_c.interlace_array(self.pcm_l, self.pcm_r, self.joined, total_samples_read)
225228

226229
# first multiply by 2 because it's a bytearray and we are returning data
227230
# in shorts, which are 2 bytes. then, multiply by 2 again because we

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import setup, Extension
66

77
interlace_module = Extension(
8-
"_pymp3_c",
8+
"pymp3decoder._pymp3_c",
99
sources=[
1010
"pymp3decoder/pymp3_c.i",
1111
],
@@ -19,7 +19,7 @@
1919
'/opt/homebrew/lib',
2020
'/usr/local/lib',
2121
],
22-
swig_opts=['-c++', '-py3']
22+
swig_opts=['-c++', '-py3', '-module', 'pymp3_c']
2323
)
2424

2525
setup(

0 commit comments

Comments
 (0)