This commit is contained in:
恍兮惚兮 2024-12-22 21:11:47 +08:00
parent e7adc51431
commit 0613d0bcb0
3 changed files with 6 additions and 6 deletions

View File

@ -12,7 +12,7 @@
int stereo = STEREO; int stereo = STEREO;
DECLARE_API void encodemp3(void *ptr, size_t size, void (*cb)(void *ptr, size_t size)) DECLARE_API void encodemp3(void *ptr, size_t size, void (*cb)(void *ptr, size_t size), int bitrate)
{ {
shine_config_t config; shine_config_t config;
shine_t s; shine_t s;
@ -21,7 +21,7 @@ DECLARE_API void encodemp3(void *ptr, size_t size, void (*cb)(void *ptr, size_t
/* Set the default MPEG encoding paramters - basically init the struct */ /* Set the default MPEG encoding paramters - basically init the struct */
shine_set_config_mpeg_defaults(&config.mpeg); shine_set_config_mpeg_defaults(&config.mpeg);
config.mpeg.bitr = 320; config.mpeg.bitr = bitrate; // 8-320;
uint32_t sampleRate = 0; uint32_t sampleRate = 0;
uint64_t totalSampleCount = 0; uint64_t totalSampleCount = 0;

View File

@ -186,7 +186,7 @@ def bass_decode(bs, ext=None):
header.append(bytes(c_int(size))) header.append(bytes(c_int(size)))
header.extend(res) header.extend(res)
data = b"".join(header) data = b"".join(header)
return winsharedutils.encodemp3(data) return winsharedutils.encodemp3(data, 32)
class series_audioplayer: class series_audioplayer:

View File

@ -334,16 +334,16 @@ clipboard_callback_stop.argtypes = (HWND,)
clipboard_callback_type = CFUNCTYPE(None, c_wchar_p, c_bool) clipboard_callback_type = CFUNCTYPE(None, c_wchar_p, c_bool)
_encodemp3 = utilsdll.encodemp3 _encodemp3 = utilsdll.encodemp3
_encodemp3.argtypes = c_void_p, c_size_t, c_void_p _encodemp3.argtypes = c_void_p, c_size_t, c_void_p, c_int
def encodemp3(wav): def encodemp3(wav, bitr=320):
ret = [] ret = []
def cb(ptr, size): def cb(ptr, size):
ret.append(cast(ptr, POINTER(c_char))[:size]) ret.append(cast(ptr, POINTER(c_char))[:size])
_encodemp3(wav, len(wav), CFUNCTYPE(None, c_void_p, c_size_t)(cb)) _encodemp3(wav, len(wav), CFUNCTYPE(None, c_void_p, c_size_t)(cb), bitr)
if len(ret): if len(ret):
return ret[0] return ret[0]
return None return None