![]() |
| | #1 |
| Supermassive black hole Join Date: Jul 2005 Location: South Wales, UK
Posts: 1,709
| FMOD Decides it doesn't want to... This snippet works, but only sometimes: Code: result = fmod_system->createStream ("\\Condensed.mp3", FMOD_DEFAULT, 0, &sound);
if (result != FMOD_OK) {
cout << "\tFAILED\n";
exit (1);
}
Anyone have a similar problem?
__________________ Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry |
| ahluka is offline | |
| | #2 |
| Registered User Join Date: May 2004
Posts: 1,362
| does removing the '\\' make a difference? |
| sand_man is offline | |
| | #3 |
| Supermassive black hole Join Date: Jul 2005 Location: South Wales, UK
Posts: 1,709
| Nope I get the same problem. EDIT: When it doesn't load it from the same dir, if I move it to C:\\Condensed.mp3 then it loads it, and I re-compile it using "\\Condensed.mp3", it suddenly can see it.
__________________ Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry |
| ahluka is offline | |
| | #4 |
| Registered User Join Date: Jun 2004
Posts: 134
| Then you could get the path to your exe and then strcat \\Condensed.mp3. I had to do that once for something can't quite remember what though.
__________________ New to the BBS? Go Here: http://postingandyou.info/ I'll bet I get flamed for this. |
| ~Kyo~ is offline | |
| | #5 |
| Supermassive black hole Join Date: Jul 2005 Location: South Wales, UK
Posts: 1,709
| Ok I'll try that. EDIT: I assume there's a winAPI call to get that - to save me hard coding it?
__________________ Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry Last edited by ahluka; 02-15-2006 at 04:49 AM. |
| ahluka is offline | |
| | #6 |
| Super Moderator Join Date: Aug 2001
Posts: 7,819
| This will play MP3's through DirectShow. Most of the source originates from Special Effects Game Programing with DirectX 8. All it needs is a window handle. Code: #ifndef CDXSHOWWND
#define CDXSHOWWND
#include <dshow.h>
class CDXShowWnd
{
protected:
IGraphBuilder *m_pGraph;
IVideoWindow *m_pVidWnd;
IMediaControl *m_pMedia;
IMediaEvent *m_pEvent;
HWND m_Hwnd;
public:
CDXShowWnd(void):m_pGraph(NULL),m_pVidWnd(NULL),m_Hwnd(0) {}
virtual ~CDXShowWnd(void)
{
ShutDown();
}
void Create(HWND hwnd)
{
//Create filter graph
CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC,IID_IGraphBuilder,
(void **)&m_pGraph);
m_pGraph->QueryInterface(IID_IVideoWindow,(void **)&m_pVidWnd);
m_pGraph->QueryInterface(IID_IMediaControl,(void **)&m_pMedia);
m_pGraph->QueryInterface(IID_IMediaEvent,(void **)&m_pEvent);
//Set window
m_pVidWnd->put_Owner((OAHWND)hwnd);
m_pVidWnd->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
RECT grc;
::GetClientRect(hwnd,&grc);
m_pVidWnd->SetWindowPosition(0,0,grc.right,grc.bottom);
}
void Play(const unsigned short *File)
{
m_pGraph->RenderFile(File,NULL);
m_pMedia->Run();
long lDone=0;
m_pEvent->WaitForCompletion(0,&lDone);
}
void ShutDown(void)
{
m_pMedia->Release();
m_pEvent->Release();
m_pVidWnd->Release();
m_pGraph->Release();
CoUninitialize();
}
};
#endif
To respond to messages consult the DirectShow SDK on how to use IMediaEvent and callbacks.
__________________ If you aim at everything you will hit something but you won't know what it is. |
| Bubba is offline | |
| | #7 |
| Supermassive black hole Join Date: Jul 2005 Location: South Wales, UK
Posts: 1,709
| Cheers Bubba; I was going to ask about using DirectX for sound if all else failed.
__________________ Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry |
| ahluka is offline | |
| | #8 |
| Super Moderator Join Date: Aug 2001
Posts: 7,819
| DirectSound won't natively load MP3's nor will DirectMusic. To get the spec for MP3's you must pay for them. But DirectShow does support them and you can use DirectShow as your sound system for simple apps.
__________________ If you aim at everything you will hit something but you won't know what it is. |
| Bubba is offline | |
| | #9 |
| Registered User Join Date: Jun 2004
Posts: 134
| Or in theory... you are typing \\Condensed.mp3 you could use just Condensed.mp3 to get from the same directory or for say another dir you could sound\\Condensed.mp3. \\Condensed.mp3 may have some strange effects. I don't know why I didn't think of it sooner... but it hit me when I was working on some code... Code: player->SetImage("art/man.bmp",APAL);
Maybe this will help you some.
__________________ New to the BBS? Go Here: http://postingandyou.info/ I'll bet I get flamed for this. |
| ~Kyo~ is offline | |
| | #10 |
| Registered User Join Date: Jan 2006
Posts: 7
| Try to use: ".\\Condensed.mp3" or "./Condensed.mp3" The dot at start tells that Condensed is in the same folder where the executable is running (or debugging). Almost the same way the double dot, tells the file is at the "one folder above" folder. It reminds a little bit of "DOS", Unix, e.t.c. I hope this to work.. Ps. For other folder (examples) you can use: ".\\x\\y\\z.mp3" (or "./x/y/z.mp3"). Or "..\\..\\x\\y\\z.mp3" ("../../x/y/z.mp3") e.t.c. At least I never had such problems using the dots. (I have never try it without the dots). |
| terablade is offline | |
| | #11 |
| Supermassive black hole Join Date: Jul 2005 Location: South Wales, UK
Posts: 1,709
| Cheers to everyone for your help
__________________ Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry |
| ahluka is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Incorrect results from fmod()? | karlthetruth | C Programming | 4 | 04-11-2008 09:12 AM |
| FMOD implimentation, how'd you do it? | Jeremy G | Game Programming | 10 | 06-12-2004 12:04 AM |
| error with fmod() function | minesweeper | C++ Programming | 3 | 08-30-2003 05:24 AM |
| Fmod and windows programming | AtomRiot | Windows Programming | 1 | 01-06-2003 03:13 PM |
| fmod problem | yusiye | C Programming | 3 | 08-01-2002 07:28 PM |