def method_play(self): if self.bass_handle: if self.method_get_state() in (pybass.BASS_ACTIVE_STOPPED, pybass.BASS_ACTIVE_PAUSED): if not pybass.BASS_ChannelPlay(self.bass_handle, False): print 'BASS_ChannelPlay error', pybass.get_error_description(pybass.BASS_ErrorGetCode()) else: self.slider.timer_start() self.btn_play.SetLabel(_('Pause')) self.btn_stop.Enable(True) else: if not pybass.BASS_ChannelPause(self.bass_handle): print 'BASS_ChannelPause error', pybass.get_error_description(pybass.BASS_ErrorGetCode()) else: self.slider.timer_stop() self.btn_play.SetLabel(_('Unpause'))
def sound_play(self): if self.bass_handle: self.sound_playing = pybass.BASS_ChannelPlay( self.bass_handle, False)
def InitAudio(self): ###### # import ctypes # from packages.pybassex import pybassex # ex = pybassex() # path = 'C:\\Users\\tkmix\\Desktop\\WORK\\macrobox-player\\source\\packages\\bass_vst.dll' # bass_module = ctypes.WinDLL(path) # func_type = ctypes.WINFUNCTYPE # QWORD = ctypes.c_int64 # HSTREAM = ctypes.c_ulong # BASS_VST_ChannelSetDSP = func_type( # ctypes.c_ulong, ctypes.c_ulong, ctypes.c_void_p, ctypes.c_int64, ctypes.c_ulong)(('BASS_VST_ChannelSetDSP', bass_module)) # BASS_VST_GetParam = func_type( # ctypes.c_bool, HSTREAM, ctypes.c_int64)(('BASS_VST_GetParam', bass_module)) # # BASS_VST_SetParam = func_type( # # ctypes.c_bool, HSTREAM, ctypes.c_int64, ctypes.c_float)(('BASS_VST_SetParam', bass_module)) # BASS_VST_SetParam = func_type( # ctypes.c_bool, HSTREAM, ctypes.c_int64, ctypes.c_float)(('BASS_VST_SetParam', bass_module)) # BASS_VST_EmbedEditor = func_type( # ctypes.c_bool, HSTREAM, ctypes.c_int64)(('BASS_VST_EmbedEditor', bass_module)) # BASS_VST_SetScope = func_type( # ctypes.c_bool, HSTREAM, ctypes.c_int64)(('BASS_VST_SetScope', bass_module)) # BASS_VST_GetInfo = func_type( # HSTREAM, ctypes.c_ulong)(('BASS_VST_GetInfo', bass_module)) ###### self.parent.parent.ListBox.List.pending.SkipStopIcon = True if self.path == self.parent.cue.path: is_position_set = True else: is_position_set = False self.path = self.parent.cue.path if pybass.BASS_ChannelIsActive(self.hStream) == 1: pybass.BASS_StreamFree(self.hStream) if sys.platform.startswith('win'): flags = pybass.BASS_STREAM_PRESCAN | pybass.BASS_UNICODE elif sys.platform.startswith('darwin'): flags = pybass.BASS_STREAM_PRESCAN self.path = self.path.encode(sys.getfilesystemencoding()) self.hStream = pybass.BASS_StreamCreateFile(False, self.path, 0, 0, flags) ###### # print(dir(pybass)) # from pybass import pybass_vst vst_plugin_name = 'LoudMax64.dll' vst_plugin_name = 'LoudMaxLite64.dll' # vst_plugin_path = os.path.join(os.path.dirname(__file__), 'packages', vst_plugin_name) vst_plugin_path = os.path.join('assets', 'dlls', vst_plugin_name) if hasattr(sys, '_MEIPASS'): vst_plugin_path = os.path.join(sys._MEIPASS, vst_plugin_path) else: vst_plugin_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), vst_plugin_path) # BASS_VST_KEEP_CHANS = 0x00000001 flags = pybass.BASS_UNICODE | pybass.BASS_VST_KEEP_CHANS self.vstHandle = pybass.BASS_VST_ChannelSetDSP(self.hStream, vst_plugin_path, flags, 0) pybass.BASS_VST_SetParam(self.vstHandle, 0, 0.0) pybass.BASS_VST_SetParam(self.vstHandle, 1, 1.0) pybass.BASS_VST_SetParam(self.vstHandle, 2, 0.0) pybass.BASS_VST_SetParam(self.vstHandle, 3, 0.0) # print(os.path.join(os.path.dirname(__file__), 'packages', 'LoudMax64.dll')) # self.parent.Show() # x = BASS_VST_SetScope(self.vstHandle, 123) # dialog = wx.TextEntryDialog(self.parent.parent.parent, 'Enter Your Name', 'Text Entry Dialog') # BASS_VST_EmbedEditor(self.vstHandle, dialog.GetHandle()) # dialog.ShowModal() # if dialog.ShowModal() == wx.ID_OK: # self.text.SetValue('Name entered:' + dialog.GetValue()) # dialog.Destroy() # BASS_VST_EmbedEditor(self.vstHandle, self.parent.GetHandle()) # print() # param = BASS_VST_GetParam(self.vstHandle, 0) # info = None # BASS_VST_SetParam(self.vstHandle, 1, 1.0) # print(param) # param = BASS_VST_GetParam(self.vstHandle, 1) # print(param) ###### self.parent.cue.hStream = self.hStream audio.set_volume(self.hStream, 0.0) if self.resume is not None: resume = self.resume if self.resume < 0: duration = audio.get_duration(self.hStream) resume = duration + self.resume audio.set_position(self.hStream, resume) pybass.BASS_ChannelPlay(self.hStream, False) self.fadein.cnt = self.fadein.time if is_position_set is False and self.parent.IsLoopOn(): self.fadein.cnt = self.fadein.time else: self.parent.SetVolume() self.resume = None self.pending = False # self.parent.FocusPlayingItem() self.parent.parent.ListTab.reInitBuffer = True self.parent.parent.ListBox.List.reInitBuffer = True
def playhandle(handle, restart): """ Play a handle """ return dll.BASS_ChannelPlay(handle, restart)
def sound_play(): global sound_playing, bass_handle if bass_handle: sound_playing = pybass.BASS_ChannelPlay(bass_handle, False)