What's with "ElastoManiac"?
Printable View
What's with "ElastoManiac"?
Elastomania ( the game )
http://www.moposite.com/info_elasto_mania.php
I get "The page cannot be displayed". I'll try it later.
allright... :)
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/
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;
}
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
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.
Quote:
Originally Posted by kermi3