2019-01-11 12:50:49

Hello.
There is a AGK library. This uses Sound_lib.
Below I will cite the code. And I have a question.
Can I create a sound check function using Sound_lib?
For example. sound.playing function, which returns True if the sound is playing, or False if the sound is not playing.

Code:
from attr import attrs, attrib, Factory
import sound_lib
from sound_lib import output
from sound_lib import stream
o=output.Output()
@attrs
class sound():
    handle=attrib(default=Factory(int))
    def load(self,filename=""):
        self.handle =stream.FileStream(file=filename)
    def play(self):
        self.handle.looping=False
        self.handle.play()
    def play_wait(self):
        self.handle.looping=False
        self.handle.play_blocking()
    def play_looped(self):
        self.handle.looping=True
        self.handle.play()
    def stop(self):
        if not self.handle==0:
            self.handle.stop()
            self.handle.set_position(0)
    def set_volume(self, new_volume):
        self.handle.set_volume(new_volume)
Thank you in advance for your help!

2019-01-11 13:09:14

Eh, again? Try and research.

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-01-11 13:24:34

nuno69,
There is nothing in the sound_lib documentation about such check. For this reason, I ask here

2019-01-11 13:33:21

From what I know, it's not possible. But I don't like Python so my information might be incorrect.

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-01-11 16:35:04

If you can get the length and/or position?

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2019-01-11 17:38:54

CAE_Jones,
What you mean?

2019-01-11 17:44:05 (edited by cartertemm 2019-01-11 17:44:57)

Yes, this is most certainly possible. Add the following where you want it

    def is_playing(self):
        return self.handle.is_playing

Maybe one day I'll get around to cleaning up AGK. It works, but it's never been tested for anything other than simple functionality. There are a bunch of issues I can think of just off the top of my head, for example the sound class fails to check for a valid handle, 3d is unstable, text input boxes lack customization... Regardless, it should be a decent starting point.
You'll most likely have to glew a lot of the pieces together for things to work. I coded for the project two or so years ago, so if you'd like some more help add me to skype, crtbraille.

2019-01-11 17:48:53

cartertemm,
Oh, I forgot that you are in my skype! I could immediately write to you about it.
But why in the sound_lib documentation there is nothing about is_playing?

2019-01-11 18:35:57 (edited by cartertemm 2019-01-11 18:37:14)

Because in order to find out about sound_lib, I had to read the code. Quality documentation was never really written, at least as far as I know. Most functions you'll need for minimal audio playback are located in channel.py