def rec(self): if self.captureDev != None: s_available = al.ALint(0) #capture audio alc.alcGetIntegerv(self.captureDev, alc.ALC_CAPTURE_SAMPLES, 1, s_available) #transfer captured audio data into tmp buffer, add to main buffer box = ' ' * (s_available.value * 2) alc.alcCaptureSamples(self.captureDev, box, s_available) self.samplescaptured += box
def is_hrtf_enabled(self): alc.alcGetIntegerv(self.world.device, alc.ALC_HRTF_SOFT, 1, self.hrtf_buffers[2]) if self.hrtf_buffers[2].value == alc.ALC_HRTF_DISABLED_SOFT: return False elif self.hrtf_buffers[2].value == alc.ALC_HRTF_ENABLED_SOFT: return True elif self.hrtf_buffers[2].value == alc.ALC_HRTF_DENIED_SOFT: return False elif self.hrtf_buffers[2].value == alc.ALC_HRTF_REQUIRED_SOFT: return True elif self.hrtf_buffers[2].value == alc.ALC_HRTF_HEADPHONES_DETECTED_SOFT: return True elif self.hrtf_buffers[2].value == alc.ALC_HRTF_UNSUPPORTED_FORMAT_SOFT: return False
def __init__(self, rolloff_factor=0.5, max_distance=10): self.sources = [] # All the sounds self.all_paused = False self.default_rolloff_factor = rolloff_factor self.world = lucia.audio_backend.audio_world self.listener = self.world.listener # get list of available htrf tables self.hrtf_buffers = [alc.ALCint(), alc.ALCint * 4, alc.ALCint()] alc.alcGetIntegerv(self.world.device, alc.ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, self.hrtf_buffers[0]) # attributes for device to set specified hrtf table self.hrtf_select = self.hrtf_buffers[1](alc.ALC_HRTF_SOFT, alc.ALC_TRUE, alc.ALC_HRTF_ID_SOFT, 1) lucia.audio_backend.sound_pools.append(self)
def __init__(self): #load device/context/listener self.device = alc.alcOpenDevice(None) self.context = alc.alcCreateContext(self.device, None) alc.alcMakeContextCurrent(self.context) #get list of available htrf tables self.hrtf_buffers = [alc.ALCint(), alc.ALCint * 4, alc.ALCint()] alc.alcGetIntegerv(self.device, alc.ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, self.hrtf_buffers[0]) #attributes for device to set specified hrtf table self.hrtf_select = self.hrtf_buffers[1](alc.ALC_HRTF_SOFT, alc.ALC_TRUE, alc.ALC_HRTF_ID_SOFT, 1)