move pybass_constants out of pybass folder
This commit is contained in:
parent
8fcfac0f04
commit
47aefc4db8
8
audio.py
8
audio.py
@ -1,11 +1,9 @@
|
||||
# platform-dependent audio module using BASS
|
||||
|
||||
import platform, ctypes, os
|
||||
from pybass import constants_only as ctts
|
||||
from pybass_constants import *
|
||||
import ini
|
||||
|
||||
DOWNLOADPROC = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p)
|
||||
|
||||
dll = None
|
||||
dllf = ""
|
||||
opus = ""
|
||||
@ -61,7 +59,7 @@ def getdevices():
|
||||
"""
|
||||
Get BASS devices
|
||||
"""
|
||||
info = ctts.BASS_DEVICEINFO() if use_ctypes else dll.BASS_DEVICEINFO()
|
||||
info = BASS_DEVICEINFO()
|
||||
ind = 0
|
||||
devices = []
|
||||
while dll.BASS_GetDeviceInfo(ind, ctypes.c_voidp(ctypes.addressof(info)) if use_ctypes else info):
|
||||
@ -73,7 +71,7 @@ def loadhandle(mem, file, offset=0, length=0, flags=0):
|
||||
"""
|
||||
Load a BASS stream handle
|
||||
"""
|
||||
return dll.BASS_StreamCreateFile(mem, file, ctts.QWORD(offset), ctts.QWORD(length), flags)
|
||||
return dll.BASS_StreamCreateFile(mem, file, QWORD(offset), QWORD(length), flags)
|
||||
|
||||
def loadURLhandle(url, offset, flags, proc=DOWNLOADPROC(), user=0):
|
||||
"""
|
||||
|
36
gameview.py
36
gameview.py
@ -2,7 +2,7 @@ import socket, thread, time, os, buttons, urllib, charselect, ini, random
|
||||
from os.path import exists
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
from pybass import constants_only as bass
|
||||
from pybass_constants import *
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from functools import partial
|
||||
|
||||
@ -1103,21 +1103,21 @@ class gui(QtGui.QWidget):
|
||||
|
||||
def changeMusicVolume(self, value):
|
||||
if self.music:
|
||||
audio.sethandleattr(self.music, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.music, BASS_ATTRIB_VOL, value / 100.0)
|
||||
|
||||
def changeSoundVolume(self, value):
|
||||
if self.sound:
|
||||
audio.sethandleattr(self.sound, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.realizationsnd, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.wtcesfx, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.guiltysfx, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.notguiltysfx, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.sound, BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.realizationsnd, BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.wtcesfx, BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.guiltysfx, BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.notguiltysfx, BASS_ATTRIB_VOL, value / 100.0)
|
||||
if self.modcall:
|
||||
audio.sethandleattr(self.modcall, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.modcall, BASS_ATTRIB_VOL, value / 100.0)
|
||||
|
||||
def changeBlipVolume(self, value):
|
||||
if self.blipsnd:
|
||||
audio.sethandleattr(self.blipsnd, bass.BASS_ATTRIB_VOL, value / 100.0)
|
||||
audio.sethandleattr(self.blipsnd, BASS_ATTRIB_VOL, value / 100.0)
|
||||
|
||||
def setJudgeButtons(self):
|
||||
if self.charside == 'jud':
|
||||
@ -2055,7 +2055,7 @@ class gui(QtGui.QWidget):
|
||||
for callword in callwords:
|
||||
if callword.lower() in self.m_chatmessage[CHATMSG].lower():
|
||||
self.ooclog.append("<b>%s called you.</b>" % f_char)
|
||||
snd = audio.loadhandle(False, "word_call.wav", 0, 0, bass.BASS_STREAM_AUTOFREE)
|
||||
snd = audio.loadhandle(False, "word_call.wav", 0, 0, BASS_STREAM_AUTOFREE)
|
||||
if snd:
|
||||
audio.playhandle(snd, True)
|
||||
break
|
||||
@ -2131,7 +2131,7 @@ class gui(QtGui.QWidget):
|
||||
else:
|
||||
self.blipsnd = 0
|
||||
|
||||
audio.sethandleattr(self.blipsnd, bass.BASS_ATTRIB_VOL, self.blipslider.value() / 100.0)
|
||||
audio.sethandleattr(self.blipsnd, BASS_ATTRIB_VOL, self.blipslider.value() / 100.0)
|
||||
|
||||
emote_mod = int(self.m_chatmessage[EMOTE_MOD])
|
||||
if emote_mod in (0, 5) and self.m_chatmessage[SCREENSHAKE] == "1":
|
||||
@ -2333,7 +2333,7 @@ class gui(QtGui.QWidget):
|
||||
self.objectsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-objection.opus', 0, 0, 0)
|
||||
else:
|
||||
self.objectsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-objection.wav', 0, 0, 0)
|
||||
audio.sethandleattr(self.objectsnd, bass.BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
|
||||
audio.sethandleattr(self.objectsnd, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
|
||||
audio.playhandle(self.objectsnd, True)
|
||||
|
||||
def play_sfx(self):
|
||||
@ -2351,12 +2351,12 @@ class gui(QtGui.QWidget):
|
||||
|
||||
if exists(AOpath + 'sounds/general/' + sfx + '.wav'):
|
||||
self.sound = audio.loadhandle(False, AOpath + 'sounds/general/' + sfx + '.wav', 0, 0, 0)
|
||||
audio.sethandleattr(self.sound, bass.BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
|
||||
audio.sethandleattr(self.sound, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
|
||||
audio.playhandle(self.sound, True)
|
||||
|
||||
elif exists(AOpath + 'sounds/general/' + sfx + '.opus'):
|
||||
self.sound = audio.loadhandle(False, AOpath + 'sounds/general/' + sfx + '.opus', 0, 0, 0)
|
||||
audio.sethandleattr(self.sound, bass.BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
|
||||
audio.sethandleattr(self.sound, BASS_ATTRIB_VOL, self.soundslider.value() / 100.0)
|
||||
audio.playhandle(self.sound, True)
|
||||
|
||||
def playMusic(self, mus):
|
||||
@ -2370,21 +2370,21 @@ class gui(QtGui.QWidget):
|
||||
|
||||
if exists(AOpath + 'sounds/music/' + mus):
|
||||
self.music = audio.loadhandle(False, AOpath + 'sounds/music/' + mus, 0, 0, 0)
|
||||
audio.sethandleattr(self.music, bass.BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
|
||||
audio.sethandleattr(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
|
||||
audio.playhandle(self.music, True)
|
||||
|
||||
elif ini.read_ini_bool("AO2XP.ini", "General", "download music"):
|
||||
if mus.lower().startswith("http"):
|
||||
self.music = audio.loadURLhandle(mus, 0, bass.BASS_STREAM_BLOCK)
|
||||
self.music = audio.loadURLhandle(mus, 0, BASS_STREAM_BLOCK)
|
||||
else:
|
||||
for bucket in buckets:
|
||||
if not bucket: continue
|
||||
print "music stream:", bucket+'base/sounds/music/' + mus.lower()
|
||||
self.music = audio.loadURLhandle(bucket+'base/sounds/music/' + mus.lower(), 0, bass.BASS_STREAM_BLOCK)
|
||||
self.music = audio.loadURLhandle(bucket+'base/sounds/music/' + mus.lower(), 0, BASS_STREAM_BLOCK)
|
||||
if self.music: break
|
||||
|
||||
if self.music:
|
||||
audio.sethandleattr(self.music, bass.BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
|
||||
audio.sethandleattr(self.music, BASS_ATTRIB_VOL, self.musicslider.value() / 100.0)
|
||||
audio.playhandle(self.music, True)
|
||||
|
||||
def stopMusic(self):
|
||||
|
@ -516,6 +516,8 @@ BASS_FILEPOS_CONNECTED = 4
|
||||
BASS_FILEPOS_BUFFER = 5
|
||||
BASS_FILEPOS_SOCKET = 6
|
||||
|
||||
DOWNLOADPROC = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p)
|
||||
|
||||
# BASS_ChannelSetSync types
|
||||
BASS_SYNC_POS = 0
|
||||
BASS_SYNC_END = 2
|
Loading…
Reference in New Issue
Block a user