I am trying to play a .mp3 file in python using winmm.dll (ctypes.windll.winmm). But when I try to get a length of some file in milliseconds, instead of actual length (05:23 = about 323000 ms) I get just 3. Time format got by status command is "m", and it doesn't change after set command. Here is some code that illustrates the problem:
from ctypes import windll, c_buffer
fp = 'song.mp3'
alias = 'test'
buf = c_buffer(255)
r = windll.winmm.mciSendStringW(f'open "{fp}" alias {alias}', buf, 254, 0)
print(r)
buf = c_buffer(255)
r = windll.winmm.mciSendStringW(f'status {alias} time format', buf, 254, 0)
print(r, buf.value)
buf = c_buffer(255)
r = windll.winmm.mciSendStringW(f'set {alias} time format milliseconds', buf, 254, 0)
print(r)
buf = c_buffer(255)
r = windll.winmm.mciSendStringW(f'status {alias} time format', buf, 254, 0)
print(r, buf.value)
buf = c_buffer(255)
r = windll.winmm.mciSendStringW(f'status {alias} length', buf, 254, 0)
print(r, buf.value)
And its output:
0
0 b'm'
0
0 b'm'
0 b'3'
Thanks in advance for your help!