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 / Need feedback for my first application Cd Player.

Author
Message
Game Master1330
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location: (GetReaderXYZ() * 42 ) / 0
Posted: 20th Jan 2008 09:24
Hi,
I have been running round the forums trying to work out how to program but all of a sudden last night it clicked, amazing! (Well actually i read the manual but you know...) anyway so here is my first program!

Instructions;
1. Put a cd in.
2. type in the track number.
3. Wait until it plays.
4. To play a different track type in another track number.
5. Press escape to exit anytime you like.

HELP! IM BEEN CHASED BY 12 FIRE CHIKENS!
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 21st Jan 2008 19:31 Edited at: 8th Feb 2008 10:06
Well, it's been sort of a long time since I came anywhere near this area of the forum, so I return by offering some helpful improvements you could perhaps make:

Point 1:

Instead of:



you could replace the whole 25 line with a single:



Point 2:

Although very unlikely, a CD can have more than 25 tracks. Just before loading cdmusic, you can place an if statement to check if the track number specified was valid.



Point 3:

having no CD audio cable present in my machine, I can't really check, but I suspect that the music will play for about a few milliseconds before it is deleted... You can force your program to wait while music is playing with the music playing() expression



Edit: Hopefully you spotted the error in here...
music playing(1) = 1 should indeed have been
music playing(1) = 0 like it now says

Point 4:

your wait key call is never reached, pressing escape exits the program immediately, unless you have disabled the key in advance.


All in all, it's not bad for starter code. I won't show you some of my very first creations, but here are some ways to improve...

Have fun with DBP.
DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 7th Feb 2008 04:19
Well add this to the top of the program:



And after a while of messing around here is what I came up with.




If it was illegal to be stupid we'd run out of room.

Login to post a reply

Server time is: 2024-11-25 07:22:52
Your offset time is: 2024-11-25 07:22:52