2020-06-09 04:44:20 (edited by Zarvox 2020-06-09 05:00:21)

I suck at python. Can someone please explain how to use lucia's virtualinput function as well as the play_stationary function from soundpool? There are like 3 soundpools, I tried all of them and none worked. Thanks.

if lucia.key_pressed(pygame.K_RETURN)
lucia.audio.soundpool.play_stationary("sounds/test.ogg")
lucia.audio.bass.soundpool.play_stationary("sounds/test.ogg")
lucia.audio.openal.soundpool.play_stationary("sounds/test.ogg")

the looping and persistent flags are set to False by default. Also which one should I use for sound.py as well

2020-06-09 07:19:40

You need to make an instance of the SoundPool object
p = lucia.audiobackend.SoundPool()
p.play blah

2020-06-09 07:32:53 (edited by Zarvox 2020-06-09 07:35:42)

@2 I think that path is off, it threw me an error. I tried modifying the line but no success. Do soundpool have less lag than pygame's mixer?
AttributeError: module 'lucia.audio.backend' has no attribute 'SoundPool'

2020-06-09 07:41:51

uh, it is not lucia.audio.backend it is lucia.audio_backend
here is an example
pool=lucia.audio_backend.SoundPool()
if lucia.key_pressed(lucia.K_LCTRL):
    pool.play_stationary('gun.ogg')
hope this helps

if you like this post, please thum it up!
if you like to see my projects, feel free to check out my github
if you want to contact me, you can do here by skype. or you can follow me on twitter: @bhanuponguru
discord: bhanu#7882

2020-06-09 07:54:19 (edited by Zarvox 2020-06-09 08:01:32)

AttributeError: module 'lucia' has no attribute 'audiobackend'
That was from post 2. So I put a period, that  didn't work. Then I saw how you wrote it. Post 2 forgot the underline between audio and backend.
It works, and it is not laggy like pygame mixer. Great.

2020-06-09 12:17:34 (edited by Zarvox 2020-06-09 13:12:17)

now my next question. How do I destroy the sound? I can find most functions in the lucia directory, but audio I am completely stuck, can't find the right functions anywhere. Also in the sound object how do I get the sound length? I have tried len(object) and object.length with and without parentheses, no luck.
Edit I think I found where to look for things. In the lucia __init__ file it mentions to setup the audio backend.bass, so the bass folder has the correct files. But the length still isn't specified

2020-06-09 16:44:37

First, for virtual input, check my signature. You’ll find an answer there.
Second, what you’re looking for is in the bass directory, soundPool.py.  Specifically, the destroy_sound function.

2020-06-09 17:37:18 (edited by Zarvox 2020-06-09 17:39:17)

h now I found it thanks. Do you know to get the length of the sound using sound.py? I have seen it referenced as len(filename), could I try that and see if that works