Start playing sound after second...

Posted By: Benni003

Start playing sound after second... - 12/11/13 14:31

Hi, I need to start a sound not at the beginning of the file, but after a defined second.
And also I need to get the seconds of the whole sound file.
I start playing the sound with snd_play().

As an Example I have the file test.ogg the sound length is 20 seconds. How can I get this value and is it possible to start at an other second than 0 ?
Posted By: ThunderStorm

Re: Start playing sound after second... - 12/11/13 15:49

With snd_playing() you can get the current play-position of the sound-file.

EDIT: re-read your question and now see, that I missed the point.
Maybe you should use a sound-editor and cut the sound as you want.
Posted By: ThunderStorm

Re: Start playing sound after second... - 12/11/13 15:56

You can use snd_buffer(SOUND* snd, void** pDesc, void*** ppSample) for that.
Never used it, but a look into the manual may be helpful.
Posted By: Benni003

Re: Start playing sound after second... - 12/12/13 10:23

Thank you for your answers. I think snd_buffer() could work. Please could anyone write me a short example? I don't have experiences with handling buffers and I don't want to make something wrong in this point.

1. Getting the seconds of a sounds (full length)
2. start playing the sound from a certain second on.
Posted By: Benni003

Re: Start playing sound after second... - 12/13/13 09:17

could anyone help me in this point please?
I really need to do this soon smirk
Posted By: WretchedSid

Re: Start playing sound after second... - 12/13/13 22:40

Iirc, A8 is using OpenAL, so I would be a little bit surprised if this method would still work. But yeah, otherwise it seems like you just have to provide PCM packages? So, grab the bitrate, depth and the packages and skim forward until you are at your point of interest. The math is well described on the internet.

Quote:
I really need to do this soon

That's nice, but it doesn't mean that we need to write code for you. If you need something urgently, pay someone for it. Or wait like everyone else until someone has the time and enthusiasm to write code for you for free wink
Posted By: Superku

Re: Start playing sound after second... - 12/14/13 04:16

Quote:
A8 is using OpenAL

If you create OAL sounds, yes, which is a different instruction than the regular snd_create.
Posted By: WretchedSid

Re: Start playing sound after second... - 12/14/13 05:41

Geez, did JCL become a PHP developer?!
© 2024 lite-C Forums