精易论坛

标题: Python-调用Bass音频库播放音乐 [打印本页]

作者: 大司命    时间: 2020-12-13 14:34
标题: Python-调用Bass音频库播放音乐
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-

  3. from ctypes import windll
  4. from os import getcwd
  5. from os.path import exists

  6. if __name__ == '__main__':
  7.     filepath = getcwd() + r"\bass.dll"

  8.     if exists(filepath):
  9.         dll = windll.LoadLibrary(filepath)
  10.         dll.BASS_Init(-1, 44100, 0, None, None)
  11.         handle = dll.BASS_StreamCreateFile(False, r"F:\KuGou\何晟铭&杜淳 - 爱的供养(男声合唱版).mp3".encode("gbk"), None, None, 0)
  12.         dll.BASS_ChannelPlay(handle, False)
  13.         pos = dll.BASS_ChannelGetLength(handle, 0)
  14.         while dll.BASS_ChannelGetPosition(handle, 0) != pos:
  15.             pass
  16.         dll.BASS_Free()
复制代码


bass.zip (149.53 KB, 下载次数: 32)

Python-调用Bass音频库播放音乐
https://bbs.266.la/forum.php?mod=viewthread&tid=514
(出处: 派生社区)


作者: 果心豆腐酱    时间: 2020-12-13 16:32
这论坛还有phthon的吗
作者: 禾子    时间: 2020-12-27 15:42
如果有更详细的注释就更方便理解了
作者: yuzhong    时间: 2023-11-6 17:08
11111111111111111111111111
作者: yuzhong    时间: 2025-4-6 00:39
11111111111111111111111111
作者: yuzhong    时间: 2025-4-15 10:11
111111111111111111111111111




欢迎光临 精易论坛 (https://125.confly.eu.org/) Powered by Discuz! X3.4