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.

Newcomers DBPro Corner / MP3 Music - What is the final decision to fix it in DBPro?

Author
Message
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 28th Apr 2016 12:36
Hello again friends!!

I am at an impasse with my game due to the music/sound issues with DBPro. I have searched the forums without much luck on what causes say Name1.mp3 to play but Name2.mp3 will not. Here is what I have to play:

+ Code Snippet

The above code works as a loop, but then I have this:

+ Code Snippet

I setup the DELETE MUSIC/LOAD MUSIC on a suggestion but I still cannot get these MP3's to play their sounds. They will play outside DBPro using VLC.
The MP3's are at 190 kbps. I have made attempts to try 320 kbps files with no success. I even installed the Enhanced Audio Plugin and changed all the LOAD/PLAY/LOOP/etc MUSIC to AUDIO and was rewarded having Windows 10 Blue screen on me. Oh joy I broke Windows 10! I even went as far as converting all the mp3's to wavs and use SOUND commands. Still I have the problem with the files either playing or not. I saw a suggestion to try PLAY MUSIC xx : PLAY MUSIC xx twice. NO luck.

So what was decided with this issue and best was to fix it? I am using DBPro with U77 upgrade. And I have tried downgrading to earlier versions.

Also one quick question: Can I no longer activate my purchased copy of DBPro?
Don't call me handsome....Just say I am Visually Basic.
Grog Grueslayer
11
Years of Service
User Offline
Joined: 30th May 2005
Location: Darkbasic Pro
Posted: 28th Apr 2016 16:34
I don't know what you had for the first version but it is much better to load all the soundfx once at the beginning of the program and never delete anything that you're going to just reload again a few seconds/minutes later. Another suggestion is to just play the sound without having to GOSUB away just to play a sound. Keep it in the IF/THEN that contains the GOSUB to the sound. It's easier to use SOUND PLAYING or SOUND LOOPING to see if the sound is playing/looping and stop the sound as needed.


[quote=Also one quick question: Can I no longer activate my purchased copy of DBPro?]

When you login to your account here you start on the Account Dashboard. Click on the button that says "Keys" and hit the blue button that says "Download Darkbasic Pro Activator". It'll take you to GitHub, download the file Dark.Basic.Pro.Binary.120216.zip, extract it and copy it to your Darkbasic Pro directory. That should activate anything related to Darkbasic Pro (at least that's what the instructions say). I haven't tried this myself yet since I just barely came back to Darkbasic Pro.
WickedX
8
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 28th Apr 2016 17:23
Quote: "=When you login to your account here you start on the Account Dashboard. Click on the button that says "Keys" and hit the blue button that says "Download Darkbasic Pro Activator". It'll take you to GitHub, download the file Dark.Basic.Pro.Binary.120216.zip, extract it and copy it to your Darkbasic Pro directory. That should activate anything related to Darkbasic Pro (at least that's what the instructions say). I haven't tried this myself yet since I just barely came back to Darkbasic Pro."


That will also overwrite your version with the broken open source version.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 28th Apr 2016 17:37
Thanks Grog! I see what you are saying. I had it in the beginning this way before and not to the subroutine. But I do know that I have a routine that calls different MP3 sounds for the various creatures in the game and I has it as various subroutines to play or loop the (music number). Here is part of the code that carries three(3) of the sounds to the subroutine labeled MSoundOne, etc

+ Code Snippet

And here is part of the subroutines:
+ Code Snippet

So the MP3's are played or looped all over the program too much to list but I hope you get the jest of the way it plays. I did load the sounds in the beginning as so:

+ Code Snippet

And the subroutine example played 16,17,& 18 as MSoundOne,MSoundTwo, & MSoundThree. Only problem is that they will not play no matter what. I tried DELETE MUSIC : LOAD MUSIC and LOOP MUSIC MSoundOne to reload it back into memory and still no sound. I have this looping as the background sound and it works great: Load Music "Media\Sounds\Thunderstorm.Mp3",2 at the beginning of the program. A few of the MP3's will play then stop working all together. Since I am using MP3's should I not use MUSIC PLAYING and MUSIC LOOPING? I understand that SOUND is used for WAV's files.

I am wondering where the problem lies: The code, or a bug in the compiler/DBPro, or the sound files themselves. I will rewrite the code again using your suggestions and I will keep you posted. Seems like when I listen to the speakers, it sounds like the MP3's are clogged because on one test the MP3 played and then when called again to play it would not and it followed by all the others not playing, just the looping thunderstorm playing in the background.







Don't call me handsome....Just say I am Visually Basic.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 28th Apr 2016 17:43
Quote: "That will also overwrite your version with the broken open source version. "


What is the best version that I can count on? and how do I install it?
Don't call me handsome....Just say I am Visually Basic.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 28th Apr 2016 19:48
I did as suggested and Loaded all the MP3 first and only PLAY MUSIC or LOOP MUSIC then STOP MUSIC when needed. Same results.

I loaded:
+ Code Snippet

The music first and started the theme music (45) above.

Then when I approached the Lever in the game and Collision executed the PLAY MUSIC 44 on Returnkey(), only the Play Object ran, but no sound from PLAY MUSIC 44 .

+ Code Snippet

Any suggestions?

If Coding was like cooking, Chef Ramsey would be yelling at me about now!
LBFN
9
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Apr 2016 21:16
Quote: "Any suggestions?"

First, you can verify that the sound indeed loaded okay by having it play as soon as it is loaded, just to check it. In the code I would say that you should check to see if the sound is playing already before you play it. It may be that while your finger is on the mouse button or RETURN key, it is trying to play it a bunch of times and messes up.




So many games to code.....so little time.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 28th Apr 2016 22:01
I setup a quick little subroutine to play immediately after the music is loaded. All 44 MP4 files played (individually) as expected so the music is being loaded into memory. Why it does not play within the Main Function I don't yet understand. I will add a few traps around the PLAY MUSIC commands to see if the MP3 is still present. I will let you know something as soon as I try it.
If Coding was like cooking, Chef Ramsey would be yelling at me about now!
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 28th Apr 2016 23:13
Ok here is my results:

If at the beginning of the program I run LOAD MUSIC "Lever_Sound.mp3",44 then the MP3 plays on the PLAY MUSIC 44.

Once inside the DO...LOOP and the main game Function is running; then no sound plays on the PLAY MUSIC 44. I even tried the DELETE/LOAD MUSIC again and still no sound. Sound only occurs outside the main game function.

+ Code Snippet

And #44 is only one example of the MP3's that won't play either as PLAY MUSIC or LOOP MUSIC.

Any ideas please? All I know is that within the DO...Loop of the main program a FUNCTION is called and no sound files play within this FUNCTION. Do I need to carry anything over into the Function?



If Coding was like cooking, Chef Ramsey would be yelling at me about now!
LBFN
9
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 29th Apr 2016 01:53 Edited at: 29th Apr 2016 01:55
This is what I was suggesting.

+ Code Snippet


EDIT: Be sure to add it in every place you play music 44.



So many games to code.....so little time.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 29th Apr 2016 02:53 Edited at: 29th Apr 2016 02:55
Well I don't know. I modified the 400 object and the object plays but still no sound. None of the MP3's executed within the main program Function plays any sound. Only the Thunderstorm.mp3 executed as a loop outside the function plays.

My mind is mud right now. There is something being overlooked here. It is either a DBPro bug or a procedure not being executed right or in the wrong order. This problem didn't start until I upgraded my pc. I tried installing K-Lite codecs to see if anything different would occur. No change.
What would cause Mp3's not to play sound even though they are loaded into memory and play outside the Do..Loop Main Program function but not within?

+ Code Snippet
If Coding was like cooking, Chef Ramsey would be yelling at me about now!
LBFN
9
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Apr 2016 00:14
Okay, I might be a little goofy for suggesting this, but maybe it will work. Try placing STOP MUSIC 44 right before the PLAY MUSIC 44. It seems like I have had to do that to get it to work sometimes.



So many games to code.....so little time.
Grog Grueslayer
11
Years of Service
User Offline
Joined: 30th May 2005
Location: Darkbasic Pro
Posted: 30th Apr 2016 07:53
Quote: "Once inside the DO...LOOP and the main game Function is running; then no sound plays on the PLAY MUSIC 44. I even tried the DELETE/LOAD MUSIC again and still no sound. Sound only occurs outside the main game function."


Can you show us the whole DO/LOOP?
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 30th Apr 2016 15:40
+ Code Snippet

Here is the LOOP as requested. Anything within the FUNCTION Moveplayer() as far as MP3's will not play, but outside the LOOP will.
If Coding was like cooking, Chef Ramsey would be yelling at me about now!
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 30th Apr 2016 16:14
Tried a little experiment:

I added this to my stats screen:

set cursor 1,10
If Music Exist (44) = 1 then Print "Music 44 is present"
If Music Exist (44) = 0 then Print "Music 44 is NOT present"
set cursor 1,40
If Music playing(44) = 1 then Print "Music 44 is playing"
If Music playing(44) = 0 then Print "Music 44 is NOT playing"

When I go to activate the Lever - that stats show "Music 44 is present" BUT it shows "Music 44 is NOT playing" when PLAY MUSIC 44 runs. Somehow the PLAY MUSIC command is being ignored. going back to recheck the coding. The OBJECT still plays but no Sound.
If Coding was like cooking, Chef Ramsey would be yelling at me about now!
Grog Grueslayer
11
Years of Service
User Offline
Joined: 30th May 2005
Location: Darkbasic Pro
Posted: 30th Apr 2016 17:24
Quote: "Here is the LOOP as requested."


Yeah that's fine. It's still a mystery to me too. Try putting a delay between the music playing and the object animation with WAIT. Increase the delay to see if it plays any sound or plays longer.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 30th Apr 2016 17:31
I made some progress and learned a few things.

I have LOOP MUSIC 2 that plays the thunderstorm.mp3 in the background BEFORE the Do...Loop. I commented that out. Then I changed the location of PLAY MUSIC 44 from:
+ Code Snippet

To this:

+ Code Snippet

Placing it AFTER the Play Object command and that worked!! However any other PLAY MUSIC 44 commands will not work if another one is playing. That can be fixed.
I also got another MP3 to play opening up the doors the levers release. HOWEVER once LOOP MUSIC 2 is reinstalled, Only MUSIC 44 will play and the doors stop playing their sounds again.

I need a vacation!!!

If Coding was like cooking, Chef Ramsey would be yelling at me about now!
Grog Grueslayer
11
Years of Service
User Offline
Joined: 30th May 2005
Location: Darkbasic Pro
Posted: 5th May 2016 04:07
This is just a shot in the dark but maybe pause the music instead of stopping it so when it needs to play again resume it.
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 9th May 2016 02:58
I will try that...loop maybe then pause it. Play will not work.
If Coding was like cooking, Chef Ramsey would be yelling at me about now!
Katyman
FPSC Reloaded TGC Backer
4
Years of Service
User Offline
Joined: 5th Oct 2012
Location: Katy, Texas USA
Posted: 10th May 2016 03:19 Edited at: 10th May 2016 03:28
Hello Again I am back and there seems to be a correlation with Music not playing and the existence of SET MUSIC VOLUME command. I removed all the VOLUME statements and the MP3's started playing again. I added 1 SET MUSIC Volume for the background and I noticed that during playing the Music files would start getting corrupted and stop playing in a domino effect. All would play once or more then there would be a snag on one, then quiet on all except the background music (Loop Music 2 which has the SET MUSIC VOLUME 2,50).

Also I tried adding the AUDIO add-on and rewrote a copy of the program using LOAD AUDIO/PLAY AUDIO/etc commands. The system froze on Compile/Run and had to be manually powered off. Passing that up.

I need to adjust music volume but it seems that the command corrupts the Music file in memory and I have tried DELETE/LOAD/PLAY routines before with little success. Any suggestions or past experiences with such problems and how to correct it or go around?

UPDATE: I see where some forums mention TOO MANY MP3 files being loaded can cause problems. I load 45 total and wondering if I should only Load the files at time of use and then delete it or what?
If Coding was like cooking, Chef Ramsey would be yelling at me about now!

Login to post a reply

Server time is: 2017-03-27 19:18:41
Your offset time is: 2017-03-27 19:18:41