Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / sound playing() = 1

Author
Message
Odintk45
16
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 28th Jul 2009 11:14
Hello,
(Sorry for my English, I'm french ...)
The "sound playing ()" function always return 1, even when the sound is completely played. I tried to use other wav files but the problem persists ... Here is the code for my program :



Because of this problem, the sound is played only once instead of being played in loop.
Somebody would have an idea to solve this problem ?

Thanks
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 28th Jul 2009 14:59
Loop sound command?


I like work. It fascinates me. I sit and look at it for hours.
Odintk45
16
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 28th Jul 2009 17:01
For my program I need to use the "sound play()".

Nobody ever had this problem?
Deego
17
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 28th Jul 2009 17:04
Yeah you basically wrote out the loop sound command in long form, except it doesn't work.

Try using loop sound, and activate/deactivate that command to start and stop it.
Odintk45
16
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 28th Jul 2009 21:21
The problem is that I need to stop playing the sound at any time, and when I do, the sound must continue to be read to the end without pause in the middle. With the "loop sound" I have no way of knowing if I'm at the beginning, middle or end of sound, so if I deactivate the command, it will stop during playback.
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Jul 2009 00:10
Why? What are you doing exactly? Have you tried pause sound? Or if you need it to carry on playing then change the volume? I'm not sure what your after here, the sound stuff with DB is a little buggy I'm afraid. If you give more info maybe I can give you an idea. There are addons that are better for sound too. IanM's matrix utils has some I believe.

http://s6.bitefight.org/c.php?uid=103081
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 29th Jul 2009 01:42 Edited at: 29th Jul 2009 01:45
Quote: "Why? What are you doing exactly? Have you tried pause sound?"

He wants to play a complete looping sound but control it to stop at the end of the loop. If you have a siren blaring in your game when the player enters a zone, you don't want the siren to stop abruptly in mid-sound when the player's X/Y/Z leaves it. You would want the last NEEENER-NEEENER sound to finish.

Odintk45 - it sounds like a bug in DBPro to me. Like DVader suggested you can look at other commands from plugins but I would also report this problem in the Bug Forum with a small snippet of code.
[EDIT] There already is a post on it. Add your example and they can Confirm it's a bug.
http://forum.thegamecreators.com/?m=forum_view&t=149479&b=15

I'm not a real programmer but I play one with DBPro!
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Jul 2009 14:53 Edited at: 29th Jul 2009 15:03
I just quickly tried this bit of code.


It loops continuously. No error checking but I'm just lazy lol. You will still need to put in a condition to stop it of course.
You can see when it works if you use this instead. The screen will change colour every time it loops.


http://s6.bitefight.org/c.php?uid=103081
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 29th Jul 2009 16:36
Maybe it's a problem with non-WAV files? That is odd.

Odintk45 you should upload one of your sounds, or try a WAV file and see if it works.

I'm not a real programmer but I play one with DBPro!
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Jul 2009 17:57
I used a wav because it is what Odin was using according to the top of the post. but I assume this will work for him. You just need a flag to say when the sound is on or off. I just got the sound to loop using play sound as requested.

http://s6.bitefight.org/c.php?uid=103081
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 29th Jul 2009 18:28
If he forgot to put his code in a loop or overwrote the soundID variable with something else I'm going to retire from trying to be helpful.

I'm not a real programmer but I play one with DBPro!
Odintk45
16
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 29th Jul 2009 23:11
What is very strange is that the DVader's code everything is fine with me too. Maybe the problem comes from another part of my code, but it is much too big for you that I can upload it here. I get and I'll tell you what I found.
Thank you for your responses.
Dabbler
18
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 30th Jul 2009 05:34
@Odintk45:

I had a problem like this about a year ago. I had sound play() tests within a loop to wait for a sound to stop playing. I updated DB and the loops went eternal. The newer version of DBPro was updating the sound test within a sync.

You may be having a similar problem. If your sound test is in a loop without a sync, I would suggest putting a sync in for a test.

Good luck with this.


Whatever...
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Jul 2009 06:21
The fact my snippet works means it is not a bug, and is code related as you say. Tiresius I hope you keep being helpful to peeps. Lot's of us need it
Yes, Odin, sometimes you just have to pick through and see what's causing the problems. The sync suggestion by Dabbler makes sense, not using it can cause real headaches. I tend to put it in on automatic pilot when making new projects.

http://s6.bitefight.org/c.php?uid=103081
Odintk45
16
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 30th Jul 2009 12:27
Dabbler, thank you very much for your reply, the problem was there in my code I do not use the sync command but fastsync

Login to post a reply

Server time is: 2025-08-08 19:30:38
Your offset time is: 2025-08-08 19:30:38