|
|
|
View previous topic - View next topic |
Author |
Message |
ThousandKnives Wandering Minstrel
Joined: 17 May 2003 Posts: 147 Location: Boston
|
Posted: Fri Aug 01, 2003 6:30 am Post subject: OGGs, baby |
[quote] |
|
Seems most people around here use Allegro and SDK and whatnot, but I figured I would take a stab at asking.
I'm trying to add MP3 support for background music in my game, and it seems the best way to do that with Direct X is by using DirectShow.
Trouble is, I compile using Bloodshed and GCC. Thus, I need libraries in *.a format. I've been able to obtain the rest of the DirectX libraries I need (daraw, dinput, dxguid, dsound, winmm) in that format, but I cannot seem to find the "strmiids" library in *.a format anywhere.
If anyone knows of the existence of "libstrmiids.a", please let me know.
Also, if anyone knows other methods for playing MP3s, I would like to hear about it. Just not if it uses Allegro or SDK, as I'm not considering making such a switch at this time.
Last edited by ThousandKnives on Sat Aug 02, 2003 7:46 am; edited 1 time in total
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Fri Aug 01, 2003 6:57 am Post subject: |
[quote] |
|
There's miles sound system :P
I wrote an MP3/AVI player in VC++6 before, but I don't know where you'd find your libs. I think you need quartz.lib (or .a or whatever) too.
Code: | #include "dshow.h"
#include "strmif.h"
class CMP3
{
public:
CMP3();
~CMP3();
void Init(void);
void Load(char *pFile);
void Run(void);
void Shutdown(void);
void WaitComplete(void);
void Pause(void);
void Stop(void);
char* GetEvent(void);
private:
IMediaControl *pMediaControl;
IMediaEvent *pEvent;
IGraphBuilder *pGraph;
//IBasicAudio *pAudio;
long evCode;
//char* CurrentSong;
};
CMP3::CMP3()
{
evCode = 0;
pGraph = NULL;
pMediaControl = NULL;
pEvent = NULL;
}
CMP3::~CMP3()
{
Shutdown();
}
void CMP3::Init(void)
{
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void**)&pMediaControl);
pGraph->QueryInterface(IID_IMediaEvent, (void**)&pEvent);
//pGraph->QueryInterface(IID_IBasicAudio, (void**)&pAudio);
}
void CMP3::Load(char *pFile)
{
//strcpy(CurrentSong, pFile);
WCHAR wFile[MAX_PATH];
MultiByteToWideChar( CP_ACP, 0, pFile, -1, wFile, MAX_PATH );
pGraph->RenderFile(wFile, NULL); //CHANGE MP3 file name. Plays AVI too.
}
void CMP3::Run(void)
{
pMediaControl->Run();
}
void CMP3::Shutdown(void)
{
if (pMediaControl){
pMediaControl->Release();
pMediaControl = NULL;
}
if (pEvent){
pEvent->Release();
pEvent = NULL;
}
if (pGraph){
pGraph->Release();
pGraph = NULL;
}
}
void CMP3::WaitComplete(void)
{
pEvent->WaitForCompletion(INFINITE,&evCode);
}
void CMP3::Pause(void)
{
pMediaControl->Pause();
}
void CMP3::Stop(void)
{
pMediaControl->Stop();
}
/*void SetVolume(long vol)
{
pAudio->put_Volume(vol);
}*/ |
Then to use that:
Code: | #include "dshow.h"
#include "strmif.h"
#pragma comment (lib, "dxguid.lib")
#pragma comment (lib, "quartz.lib")
#pragma comment (lib, "strmiids.lib")
int main()
{
CMP3 Music;
CoInitialize(NULL);
Music.Init();
Music.Load( "WhateverMP3orAVI.mp3" );
Music.Run();
Music.WaitComplete();
Music.Shutdown();
CoUninitialize();
return 0;
} |
|
|
Back to top |
|
|
valderman Mage
Joined: 29 Aug 2002 Posts: 334 Location: Gothenburg, Sweden
|
Posted: Fri Aug 01, 2003 9:54 am Post subject: |
[quote] |
|
How about FMOD? Oh, and are you really sure you want to use MP3 for background music? If I were you, I'd use OGG, since it's free. _________________ http://www.weeaboo.se
|
|
Back to top |
|
|
BigManJones Scholar
Joined: 22 Mar 2003 Posts: 196
|
Posted: Fri Aug 01, 2003 2:28 pm Post subject: |
[quote] |
|
How about openAL or DUMB
EDIT my bad, DUMB doesn't support mp3 and I looked over the openal documentation for 5 minutes and couldn't find a list of supported formats
|
|
Back to top |
|
|
ThousandKnives Wandering Minstrel
Joined: 17 May 2003 Posts: 147 Location: Boston
|
Posted: Fri Aug 01, 2003 8:16 pm Post subject: |
[quote] |
|
Valderman wrote: | How about FMOD? Oh, and are you really sure you want to use MP3 for background music? If I were you, I'd use OGG, since it's free. |
Hmm, this OGG looks very interesting. I hadn't heard of it before. I'm currently looking into it. Thanks for the heads up.
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Fri Aug 01, 2003 9:56 pm Post subject: |
[quote] |
|
DUMB supports playback of IT, XM, S3M and MOD files. There's an extension, DUMBOGG, which can be used for playing OGG files, but as of now this extension is lagging behind and cannot be used with the latest DUMB version.
We're using OGG as well, be it with AllegroOGG which will not be usefull for you. We're switching to ClanLib, a game programming library that supports OGG as well. Indeed, OGG is free, and it's quality is basically the same if not better (so you can use lower bitrates, making for a smaller download).
|
|
Back to top |
|
|
ThousandKnives Wandering Minstrel
Joined: 17 May 2003 Posts: 147 Location: Boston
|
Posted: Sat Aug 02, 2003 2:38 am Post subject: |
[quote] |
|
Yeah Im currently very serious about using OGG. My sound guy works in CoolEdit making PCM stuff- so IT, XM, etc is useless to me.
Trouble is the OGG Vorbis Windows SDK doesn't use *.a library files either. I need to do more research though. I've seen some things that seem to suggest Bloodshed *can* actually use *.libs. Which would make more sense to me, but I dunno.
I would like to use the OGG Vorbis methods directly into DirectSound so as not to use excessive varieties of SDKs and their accompanying user requirements.
|
|
Back to top |
|
|
BigManJones Scholar
Joined: 22 Mar 2003 Posts: 196
|
|
Back to top |
|
|
ThousandKnives Wandering Minstrel
Joined: 17 May 2003 Posts: 147 Location: Boston
|
Posted: Sat Aug 02, 2003 7:48 am Post subject: |
[quote] |
|
Thanks for the link. There seems to be an important distinction between which libraries can and cannot be used without conversion. The OGG libraries CAN be used without conversion. So, anyway yeah I have now successfully implemented OGG support in my game name, and its pretty sweet. Thanks for the tips everyone.
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
|
Back to top |
|
|
ThousandKnives Wandering Minstrel
Joined: 17 May 2003 Posts: 147 Location: Boston
|
Posted: Mon Aug 04, 2003 10:05 pm Post subject: |
[quote] |
|
Hehe, actually I found that exact same tutorial. I agree that its very well done. However, I'm all settled on OGGs now. Thanks.
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Tue Aug 05, 2003 1:49 am Post subject: |
[quote] |
|
Ya, OGG is a very good decision, but Blizzard just uses WAV files. I guess they can with three CDs of info o_O
|
|
Back to top |
|
|
Modanung Mage
Joined: 20 Jun 2002 Posts: 317 Location: The Netherlands
|
Posted: Tue Aug 05, 2003 10:50 am Post subject: |
[quote] |
|
In WarCraft 3 they use WAV for samples, but not for music they don't, for music they just use MP3.
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Tue Aug 05, 2003 11:05 am Post subject: |
[quote] |
|
The benefit of using mp3 over practically any other format is that you can allow users to dump their own mp3 files into some sort of music folder that comes with the distro you provide. While this might not be a great idea for rpgs, where music can often become a character in and of itself, it's a great idea for tbs, rts, sim, and racing games. The Sims and the latter Grand Theft Auto games provided this functionality (so that you could listen to your own music over the radio in these games).
Course, they probably paid the money for the mp3 license.
Although, I must admit that if you can find a way to go the mp3 route, and have a system where supporting mp3 makes sense (e.g., one of the types of games listed above), why not take it? With the probability of your product becoming large enough to be noticed by the lawyers that prosecute patent-violation being relatively low, the only consideration therefore becomes distro size; for somebody who is running a broadband connection, downloading an archive with mp3's loaded in it shouldn't be that bad. Not to mention that you could provide the mp3's in a separate archive, which could be an optional download. And, if you were to go the "radio station" route in-program, the user could dump their mp3s into the distro's music folder (as mentioned). _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
Locrian Wandering Minstrel
Joined: 04 Apr 2003 Posts: 105 Location: VA USA
|
Posted: Tue Aug 05, 2003 11:53 am Post subject: |
[quote] |
|
Why couldn't you do the same thing with OGG? Anyone who can handle the idea of modifying a game to suit his/her personal tastes is probably smart enough to download and use a WAV to OGG or MP3 to OGG converter program. It might not be as easy as clicking and dragging a bunch of songs from your MP3 folder but its close and doesn't cost any money to license.
|
|
Back to top |
|
|
|
Page 1 of 2 |
All times are GMT Goto page 1, 2 Next
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|