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 / Looping music - not looping

Author
Message
bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 21st Nov 2010 04:51
Have started creating the menu for the game with some music playing in the background before starting.

The LOOP MUSIC command though only plays once then stops; have looked around the forums but have not actually come across an explanation.

Can anyone let me know if there is anything I am missing? The initial code snippet is below:

Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Nov 2010 09:01
Hi, I'm not an expert on DBPro's sound commands (I've only played around with them once or twice) but you could try this:



Hope this helps

A clever person solves a problem, a wise person avoids it - Albert Einstein
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Nov 2010 11:26
The command is bugged. When using the "music" commands (as opposed to "sound") you have to check the length of your track and see if the sound has finished manually. Rubbish I know, example:



Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st Nov 2010 21:01
This happens because your program is suspended, so DBP can't make an internal check (which I believe only accrue at the end of a loop) to see if the music has stopped. You can test this by doing this:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 21st Nov 2010 21:06
Sorry, but I've never seen this used before
From the original snippet....



Might not have to do with your problem, but wonder if that is also an error.

Dabbler
19
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 21st Nov 2010 21:12
I think the sound and music commands only update within a sync. I have had this problem before.

Try this:



I hope it helps.


Whatever...
bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 23rd Nov 2010 00:06
Thanks for all the replies. I will check it out as soon as I get home.

The double synching

was the only way I could get the screen to show the text before the wait key.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Nov 2010 13:20
You won't see anything until TWO syncs have been performed - but you only need the extra sync ONCE at the start of your program. That's why my demos usually start with something like this:



I put the extra sync there so I don't forget it later.

I don't understand why it's needed. I'm told it's something to do with "double buffering". Such arcane issues are beyond me - I've just learnt to live with it.
bodmcn
15
Years of Service
User Offline
Joined: 6th Oct 2010
Location:
Posted: 23rd Nov 2010 23:57
Oh excellent thanks.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Nov 2010 19:42
Quote: "I'm told it's something to do with "double buffering""

that's correct. Double buffered screens are so called as the GFX card (Or whatever) holds two copies of the previous 2 screens. So when you sync the screen, what you actually see is an image from 3 frames ago. They used to do it to increase the speed at which screens were rendered to the display by always having a copy of the displayable screen in memory.

As for the music looping, I'd strongly suggest torrey's (free) enhanced audio plugin. it's much better at handling looping music as well as providing numerous enhanced functions.

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2026-07-21 12:51:17
Your offset time is: 2026-07-21 12:51:17