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.

Author
Message
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 10th Feb 2014 15:59
Hello community!

Does anyone know how can i add sound with an openfiledialog and then play it on background?

Thank You!

Alex Matei CEO
www.alexmatei.com
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 10th Feb 2014 18:39
Not gonna code it for you but here are the steps/functions you need to take

1 - Filedialog (Bluegui, I assume)
Get the info from the dialog (see bluegui docs)
2 - Find and load sound file
Have a function check the data and open the file
3 - Play Sound
Create a function that plays the sounds. Don't forget to loop it if that is what you want.

Perhaps this project of yours is a little too much? You constantly ask others to provide you the code and then you ask them for the changes you need. You need to dive into documentation more and use the search function of the forum. Others have said it before too. Whenever you provide some code, some logic or even an idea on something and then ask for specific help, people are more motivated to help you.

I do hope you don't get this wrong. I love your enthusiasm and would hate to see others possibly ignore your threads.

Regards Sph!nx
www.mental-image.net
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 10th Feb 2014 21:28
I am not really asking just to make someone my code because i am a lazy guy or i have no shame or something...I just don't know the respective codes and believe it or not i am reading dark basic's manual but i am learning a whole lot more from guys like you, chafari on this forum... Really is it wrong to ask so many questions? And thank you for the response

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 10th Feb 2014 21:41
And sorry on blue gui the only thing i can't do is to get the file when pressing ok...i mean and example

openfile = createdialog blah blah

i open the file dialog i select the file and after that i don't know what to do....how can i load the file like play sound,(something from openfile dialog)...i can't seem to find that type of information

Alex Matei CEO
www.alexmatei.com
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 10th Feb 2014 21:46 Edited at: 10th Feb 2014 21:49
Quote: "Really is it wrong to ask so many questions?"


Quote: "I love your enthusiasm and would hate to see others possibly ignore your threads."


I believe what Sph!nx is saying is that if you just post questions people will be less inclined to help, whereas if you post a short snippet of what you're trying to do it shows initiative.
It's absolutely fine to ask questions, but if you haven't noticed there's been a LOT of threads lately where folks ask for help without even trying themselves (not saying you're one of those, but hopefully you get the point).

<Edit>
I'm not at all familiar with blue gui, is there a reason why you can't just use the load sound/load music commands?

New sig coming soon..
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 10th Feb 2014 21:48 Edited at: 10th Feb 2014 21:50
I think the misunderstanding here is how you make you question, about an open file dialog . It sound to me that you need a pop up dialog where you select with mouse the sound you want and start playing.

I suppose Sph!nx didn't mean to be unpolite, but playing a sound is quite easy if you load it, but is something more complicated if you need what I mention above. If you need an openfile dialog, you could use something like the one I gave you to open images.

When we open a sound, we can make it loops or just play, but if we are into the main LOOP and we want to play sound, we can NOT let say play a sound when we press a key. We need some other condition to play a sound. Something like this piece of code



If we press spacekey, the sound will play, and we have to release the spacekey if we want it to play again.

Cheers.

I'm not a grumpy grandpa
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 10th Feb 2014 22:00
I didn't said that he was unpolite i understand now what he said .
Thank You Chafari for the example. Very good one i will you use it to resolve a big bug from my editor!

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 10th Feb 2014 22:07
I know that loading a sound is easy from dbpro code perspective but fro blue gui, not easy

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 10th Feb 2014 22:22
I will try to post some work !

Alex Matei CEO
www.alexmatei.com
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 10th Feb 2014 23:52
Ohw, no I didn't mean to be impolite! We Dutch folk are known to be a little too direct. I thought my closing line made my intentions clear. I apologize if it seemed harsh in any way.

Regards Sph!nx
www.mental-image.net
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 11th Feb 2014 08:25
No no, your intentions were very clear, not unpolite!

Alex Matei CEO
www.alexmatei.com
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 11th Feb 2014 14:30 Edited at: 11th Feb 2014 14:31
A very very basic example...



Regards Sph!nx
www.mental-image.net
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 12th Feb 2014 09:41
This is what i was looking for....the fact that i didn't knew how to load the sound from the openfile to the standard DBPRO load sound command.....Thank You Sph!nx again!

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 13th Feb 2014 22:24
Hey guyz,

I want to play a sound when the collision is made between the player and a another object. I did that, but the fact is that when i stay in the middle of it, it keeps repeating on and on. How can i solve this? Do i need to asign some booleans?
Here is the code that i have:



Thank You again!

Alex Matei CEO
www.alexmatei.com
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 14th Feb 2014 15:31
Hey mate,

I use other forms of collision detection so I've not tested it, but it sure does look better this way.


The reason the sound file is repeating, because you have it so that when the collision is happening the sounds get started, again and again, during the collision.

You could write a process where the collision code initiates another process that only runs the sound once. Instead of directly initiating the sound, use a data parser for another process.

Tip
New problem? Make a new thread! You get the right attention and others, who will search the forums in the future, will be able to find the those threads.

Regards Sph!nx
www.mental-image.net
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 14th Feb 2014 17:36
Hey Sph!nx, thank you for the response i managed to do make it sound once. Unfortunatly for now it doesn't replay when reentering the collision but it does the job



Alex Matei CEO
www.alexmatei.com
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Feb 2014 19:14
Quote: "Hey Sph!nx, thank you for the response i managed to do make it sound once. Unfortunatly for now it doesn't replay when reentering the collision but it does the job "





Cheers

I'm not a grumpy grandpa
Virtual Nomad
Moderator
20
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Feb 2014 21:16 Edited at: 14th Feb 2014 21:20
another way to skin the cat:



'use cursor keys to move

Virtual Nomad @ California, USA . DBPro V7.7 . Matrix1Utils 05.27.12
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 15th Feb 2014 15:01
Thanks guys,

Yep, there are may ways to do this.

Basically, you set the condition to play the sound once (trigger is collision) and after the sound has played the data (that would allow a new sound) needs to be reset.

Regards Sph!nx
www.mental-image.net

Login to post a reply

Server time is: 2026-07-07 00:09:36
Your offset time is: 2026-07-07 00:09:36