What's with "ElastoManiac"?
What's with "ElastoManiac"?
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Elastomania ( the game )
http://www.moposite.com/info_elasto_mania.php
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu
I get "The page cannot be displayed". I'll try it later.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
allright...
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu
Good to know that this is a very friendly forum. Anyway; to dwks this doesn't work:
That's why I gonna rename the file.PHP Code:
mciSendString ( "Play \"blah blah.mp3\"", 0, 0, 0 );
if you ask me, the best thing to use for playing music/sound is FMod.
It's absolutly simple to use.
And it supports just about every platform.
It's the most powerfull api for audio, so check it out http://www.fmod.org/
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu
I dug out some mci sample code. It definitely handles long file names.
Code:#include <windows.h> #include <stdlib.h> #include <stdio.h> #include <tchar.h> #if defined(_MSC_VER) # pragma comment(lib, "Winmm.lib") #endif /* * Returns the length, in milliseconds, of an MP3 or WMA file. */ ULONG GetSongLength(LPCTSTR szFile) { TCHAR szCommandString[1000]; TCHAR szResult[100]; wsprintf(szCommandString, TEXT("open \"%s\" type mpegvideo alias TempFile"), szFile); if (ERROR_SUCCESS == mciSendString(szCommandString, NULL, 0, NULL) && ERROR_SUCCESS == mciSendString(TEXT("set TempFile time format milliseconds"), NULL, 0, NULL) && ERROR_SUCCESS == mciSendString(TEXT("status TempFile length"), szResult, 100, NULL) && ERROR_SUCCESS == mciSendString(TEXT("close TempFile"), NULL, 0, NULL)) { return _tcstoul(szResult, NULL, 10); } return 0; } /* * Plays an MP3 or WMA file. */ BOOL PlaySong(LPCTSTR szFile) { TCHAR szCommandString[1000]; wsprintf(szCommandString, TEXT("open \"%s\" type mpegvideo alias MediaFile"), szFile); /* By default mci functions will return immediately and the task will be carried out * asynchronously. To have the function wait, place the word "wait" at the end of the * command string. ie. "play MediaFile wait" */ if (ERROR_SUCCESS == mciSendString(szCommandString, NULL, 0, NULL) && ERROR_SUCCESS == mciSendString(TEXT("play MediaFile"), NULL, 0, NULL)) { return TRUE; } return FALSE; } int main(void) { ULONG length, mins, secs, tsecs; /* Get the length of the song in milliseconds. */ length = GetSongLength(TEXT("C:\\Path To\\Your song.mp3")); /* Convert to minutes, seconds, tenths of a second. */ mins = length / 60000; secs = (length % 60000) / 1000; tsecs = (length % 1000) / 100; /* Print out length of song. */ printf("The length of the song is %lu milliseconds (%lu:%02lu.%lu).\n", length, mins, secs, tsecs); /* Play song. */ if (!PlaySong(TEXT("C:\\Path To\\Your song.mp3"))) { printf("Failed to play song!"); } getchar(); return 0; }
Last edited by anonytmouse; 12-11-2005 at 12:00 PM.
Omg, really really thanks dude, you have saved my project! I already wasn't really looking forward on Fmod thing, I noticed that Fmod also doesn't run on Dev-C++. Don't got much time now but I will look into it soon.
Thanks Yuri.
when I tried this, it gave a could not find file error
all I did was change both the directories to C:\\windows\\desktop\\sound.mp3
and yes, I have that file on my desktop
--oops I just did a search and didn't look at the dates
Last edited by HForN; 05-27-2006 at 09:27 AM.
Could you please not bump old threads. If you want to discuss an issue raised in an ancient thread, simply create a new one with a reference link to the original.
Originally Posted by kermi3
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.