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 / loading a sound file

Author
Message
Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 10th Jul 2004 11:28
I am having trouble figuring out how to load a sound (wav) file using the load sound command. I am running DBP from C: and have my .wav file in a directory d:\sounds\. I have typed the command line as load sound d:\sounds\td.wav, musicsnd however when I run the program I get the error message "parameter for load sound do not match 'Filename,Sound Number' at line 8.

Thanks in advance for the help.

Timmins
Sparda
20
Years of Service
User Offline
Joined: 13th Jan 2004
Location: Pacifica
Posted: 10th Jul 2004 12:20
The extension for the sound needs to be in quotes

load sound "d:\sounds\td.wav", musicsnd

gl and hf
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 10th Jul 2004 12:20
Hmmm... The line of code should look like this...

Load Sound "D:\sounds\td.wav",1

...make sure your filename and path are correct...

well... Hope I helped...

Programming isn’t an addiction, its more of a mental and social dependancy.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Jul 2004 12:36
don't hard code your paths, copy the media to the same dir where your exe is and use

load sound "td.wav",1

or make a media sub folder in your game dir and use

load sound "\media\td.wav",1

If you hard code your paths to a root drive/folder and then at some point want to redistribute your game you will be in a world of hurt.
Just some friendly advice


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 10th Jul 2004 14:27
This can be done...

load sound "d:\sounds\td.wav",musicsnd

...as long as this is done first...

musicsnd=1

...but CattleRustler is correct, put your media in your games folder.

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href][/href]
Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 11th Jul 2004 02:57
Thanks for all of the help, that helped me to solve the problem and then some.

My next problem is that I would like to take a section of a large image, such as a jpg picture and create a sprite out of part of it. I've tried using the command "GET IMAGE" after loading an image with "LOAD IMAGE" however I can't seem to copy a part of the image, what values are to be used in the GET IMAGE command, are they pixel values or something else? Thanks again.

Timmins
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 11th Jul 2004 04:03
I don't think you can with jpgs but I could be wrong. Have you tried with a bitmap instead, just as a test?


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 11th Jul 2004 05:26
I tried with a .bmp image as well but wasn't having any success. Is it just easier (and usually recommended) to get an image editing program like Photoshop to edit the image? Thanks.

Timmins
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 11th Jul 2004 06:01 Edited at: 11th Jul 2004 06:02
hmm...
this may be one of those cases when DBP is different from my DBC, but I used "load bitmap file" and "get image x, y, x1, y1" quite successfully.

Are you sure you have the same focus? (current bitmap) for both?

Any truly great code should be indisguishable from magic.
Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 11th Jul 2004 06:31
Yes, I'm pretty sure that I was working with the same image. What is the parameter range for x,y,x1,y1? Are x,y,etc. pixel coordinates or something else? I would like to try this again.

Timmins
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 11th Jul 2004 07:41 Edited at: 11th Jul 2004 07:51
They start at the top left at 0,0 and go to the bottom right at whatever the pixel width,height of screen is. I think. You have to have the picture on screen to grab part of it using get image like this.


And this will save it to a file if need be.


Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 11th Jul 2004 07:58
Thanks for the help and the code. That was my problem, I hadn't pasted the image on the screen first before trying to capture a portion of it. I am trying to create a slot machine type program and I guess the best way to create the image of each of the rotating wheels is to make an animated sprite? One other question, is screen burn a concern when working on games that have a fixed image (ie a slot machine image)? If so, what temporary colours are best to use? Thanks again everyone for all of the help.

Timmins
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 11th Jul 2004 08:33
I think an animated sprite would do fine. As far as screen burn in ... I don't think that will be a problem unless you leave the 1 image on there for a very very long time. We have monitors at work that stay on the same image most of the time and it takes about 2 years before it actually burns to the screen with todays high refresh rate monitors. And thats displaying the same image (most of the screen as only the small numbers at the bottom change) for about 19 hours a day. Though this may depend on the monitor specs. Take into account also that these monitors clear the screen every frame before drawing the changes (which you will have to do any way or use sync on and let it do it for you) so this may be helping it.

Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 11th Jul 2004 08:52
Thanks again for all of the help.

Timmins
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 11th Jul 2004 09:13
I have a full 3d slot machine game if you're interested in seeing the code just let me know


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 11th Jul 2004 09:30
Thanks CattleRustler, I'll get back to you on that.

Timmins
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 11th Jul 2004 12:13
no worries. I don't blame you for not wanting to see other code - it kinda defeats the fun and the purpose. I was offerring before my brain thought it thru. Well, just know the offer always stands (on this and anything else) but will not again be spoken

Sorry to have put you on the spot

CR


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Timmins
20
Years of Service
User Offline
Joined: 10th Jun 2004
Location:
Posted: 12th Jul 2004 11:17
No worries, thanks.

Timmins

Login to post a reply

Server time is: 2024-09-22 16:19:38
Your offset time is: 2024-09-22 16:19:38