def doRegister(self): if self._channel == 0: print( "failed to register DSP block <> because the channel is invalid" ) elif not self.ChannelCheckSettings(self._channel): print( "failed to register DSP block <> because the channel does not support it" ) else: chaninfo = pybass.BASS_CHANNELINFO() if not pybass.BASS_ChannelGetInfo(self._channel, chaninfo): return False proc = self.cbk_proc_stereo if chaninfo.chans == 1: proc = self.cbk_proc_mono if proc != None: self._handle = pybass.BASS_ChannelSetDSP( self._channel, proc, self.data, self._priority) return self._handle != 0 return False
def ChannelCheckSettings(self, channel): # todo check if callable if self.cbk_set == None: return True # get the channel information chaninfo = pybass.BASS_CHANNELINFO() if not pybass.BASS_ChannelGetInfo(self._channel, ctypes.byref(chaninfo)): return False # get the settings from the current DSP. s = 0 if self.cbk_set != None: s = long(self.cbk_set()) r = True # check requirements for given flags #TODO chaninfo is not updating memory correctly. support_m = s & DSP_CHAN_MONO #and chaninfo.chans==1 support_s = s & DSP_CHAN_STEREO #and chaninfo.chans==2 #print chaninfo.chans, s,support_m , support_s r = support_m or support_s return True
def method_get_channel_info(self): channel_info = pybass.BASS_CHANNELINFO() if not pybass.BASS_ChannelGetInfo(self.bass_handle, channel_info): print('BASS_ChannelGetInfo error %s' % pybass.get_error_description(pybass.BASS_ErrorGetCode())) return channel_info