I am giving serious consideration to abandoning waveOut multimedia and the wav format, for most of the audio in my C++/MFC project. However, I've never done any programming with a codec, and I still can't see how to step into Ogg Vorbis. If I convert all my wav files to ogg, there seem to be two major issues I'm facing: 1) What exactly will I replace my waveOut functions with? 2) What is the best method to absolutely ensure that a user's pc will be able to play the ogg files? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://westfish.xiph.org/pipermail/vorbis-dev/attachments/20040626/508630ee/attachment.html
>----- Original Message ----- >From: Steve Russell >To: vorbis-dev@xiph.org >Sent: Saturday, June 26, 2004 8:22 PM >Subject: [Vorbis-dev] getting started > > >I am giving serious consideration to abandoning waveOut multimedia and thewav format, for most of the audio in my C++/MFC project. However, I've never done any >programming with a codec, and I still can't see how to step into Ogg Vorbis. If I convert all my wav files to ogg, there seem to be two major issues I'm facing:> >1) What exactly will I replace my waveOut functions with? > >2) What is the best method to absolutely ensure that a user's pc will beable to play the ogg files? Depending what you want to do, directshow is probably the best bet... i have written codecs for the various xiph codec... they are at various stages of development... vorbis and speex are fairly complete.... You can find the project here... www.illiminable.com/ogg/ Once installed any directshow enabled application will be able to play ogg files. Writing code to use directshow to play audio using directshow is only like 15 lines. (once the codecs are installed). You basicly create a filter graph object... tell it to render the file, tell it to play... that's all you have to do. There's tons of example code in the directx 9 sdk to programattically play files with directshow. And the source can be found in the xiph repository here... svn.xiph.org/trunk/oggdsf Zen.
Forwarded: forgot to change reply address :( ----- Original Message ----- From: "illiminable" <ogg@illiminable.com> To: "Steve Russell" <srussell@innernet.net> Sent: Saturday, June 26, 2004 10:58 PM Subject: Re: [Vorbis-dev] getting started> > ----- Original Message ----- > From: "Steve Russell" <srussell@innernet.net> > To: "illiminable" <ogg@illiminable.com> > Sent: Saturday, June 26, 2004 9:56 PM > Subject: Re: [Vorbis-dev] getting started > > > > I very much appreciate your help, and I will take a good look your > project. > > Possibly Ogg Vorbis is going to force me to finally start using DirectXat> > least in some capacity. If most of my files are speech, would you still > be > > making the same recommendation? > > I'd suggest for now if you pull my project from subversion, that you pull > revision 6744, thats the last stable release, and the source that builtthe> binaries that are on the site.... i'm currently making changes fairly > regularly at the head... so who knows what bugs i'm putting there ! :) I'd > not recommend pulling the head version uot at the moment. It's also quite > large... i think more than 20megs, 5000 files combined source/docs... sobe> prepared for a wait if you are on dial-up internet. I really should start > properly tagging the releases ! > > It's also not too build friendly at the moment either... as i'm really the > only one writing it... so i've been putting more effort into advancing it > than tweaking the build... there is a readme in the root that explainsmost> of what you need to do to get it to build... it also requires nasm and > directx9 sdk in order to build. > > If you are fairly proficient with Visual studio you shouldn't have toomuch> problem though... To be honest... for what you want to do, you probably > won't even need the source... you will never interact directly with it > anyway... though it may be ?interesting? to read... you can browse it over > the web at the address i gave. If you install the binaries, directshowdoes> the rest... you only ever interact via the directshow interfaces anyway.If> you want to see an overview of how directshows graph architecture works,in> the directx sdk is a program called graphedit... it visually shows the > filter graphs... eg http://www.illiminable.com/ogg/graphedit.html > > Using directshow to play audio... is seriously very very easy, all thehard> stuff is making the filters... once you have the filters, the rest is > easy... and a good way to ease into it... the rest of directshow... is > well... lets just say it takes some getting used to ! > > If you look at the IGraphBuilder, IMediaControl and IFilterGraph interface > in MSDN... it's all fairly well documented... it should be pretty clearwhat> to do and there is a fair bit of example code on MSDN too.... if you > > google directshow <interface name> > > it's almost always first hit for all directshow stuff. > > As for speech files... i'd recommend speex over vorbis... a filter forspeex> is also in the package... you'll get far better size reduction by using > speex... and it's no extra effort to use vorbis for music and speex for > speech... basically exactly the same code... depending the type of filethat> gets loaded into the demux filter, it will attach to the correct decoder > anyway. > > All you have to do is > > 1) Create a filtergraph object with COM > 2) get an Igraphbuilder interface >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/igraphbuilderinterface.asp> using COM. > IGraphBuilder* locGraphBuilder; > HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, > CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&locGraphBuilder); > 3) Call RenderFile on the IGraphbuilder interface with the filename > 4) get an IMediaControl interface from the filter graph > 5) Call play on the IMediaControl interface. > > All the codec stuff will be done automagically behind the scenes, so longas> my filters are installed. > > Zen. >
<004901c45b80$cde5fdc0$0100000a@tiger> <006601c45b85$5d119d70$861382cd@stever> <005f01c45b8e$01c52f00$0100000a@tiger> <008401c45b8f$2d24e4a0$861382cd@stever> Message-ID: <002001c45c5e$20eb28a0$0100000a@tiger>> > > > All you have to do is > > > > 1) Create a filtergraph object with COM > > 2) get an Igraphbuilder interface > > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/igraphbuilderinterface.asp> > using COM. > > IGraphBuilder* locGraphBuilder; > > HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, > > CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&locGraphBuilder); > > 3) Call RenderFile on the IGraphbuilder interface with the filename > > 4) get an IMediaControl interface from the filter graph > > 5) Call play on the IMediaControl interface. > > > > All the codec stuff will be done automagically behind the scenes, solong> as > > my filters are installed. > > > > Zen. > >Actually today i needed a simple player to do some testing... so here's the entire code for a *zero* feature, *zero* error checking command line audio player for ogg... requires my filters installed... and you need to link to strmiids.lib. Actually it will play any audio format... mp3s wmas, anything directshow has a filter for. This should get you started, and hopefully be a good starting point for anyone wanting to integrate ogg simply into windows. Obviously there's more to make it functional... but it's a starting point. It will be in the subversion repository as an example on my next checkin. // CLOgg.cpp : Command line minimalist audio player. // #include "stdafx.h" #include <dshow.h> #include <windows.h> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { IGraphBuilder* locGraphBuilder = NULL; IMediaControl* locMediaControl = NULL; HRESULT locHR; CoInitialize(NULL); locHR = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&locGraphBuilder); locHR = locGraphBuilder->RenderFile(L"g:\\h.ogg", NULL); locHR = locGraphBuilder->QueryInterface(IID_IMediaControl, (void**)&locMediaControl); locHR = locMediaControl->Run(); //Wait till you enter a number and press enter to exit. int x; cin>>x; locMediaControl->Release(); locGraphBuilder->Release(); CoUninitialize(); return 0; } Enjoy, Zen.
<004901c45b80$cde5fdc0$0100000a@tiger> <006601c45b85$5d119d70$861382cd@stever> <005f01c45b8e$01c52f00$0100000a@tiger> <008401c45b8f$2d24e4a0$861382cd@stever> <002001c45c5e$20eb28a0$0100000a@tiger> Message-ID: <20040627164151.GA28880@ghostscript.com> On Sun, Jun 27, 2004 at 11:47:57PM +0800, illiminable wrote:> Actually today i needed a simple player to do some testing... so here's the > entire code for a *zero* feature, *zero* error checking command line audio > player for ogg...Hey, not a bad answer to the infamous, "What routine do I call to make my media player?" question. :-) -r
<002001c45c5e$20eb28a0$0100000a@tiger> Message-ID: <000b01c45c6f$66d1d790$5b1082cd@stever> Wow, thanks! I hate to keep asking such basic questions, but could I get just a little comment on how or where this stuff fits into the mmio / waveOut functions I am presently using to play my standard wave files? My audio typically plays at the beginning of each cycle in a series of interactive educational activities and in response to incorrect drag and drop choices. I do not provide the user with any audio choices. My stuff resembles a game, and often requiring pretty low latency at that. ----- Original Message ----- From: "illiminable" <ogg@illiminable.com> To: <vorbis-dev@xiph.org> Sent: Sunday, June 27, 2004 11:47 AM Subject: Re: [Vorbis-dev] getting started> > > > > > All you have to do is > > > > > > 1) Create a filtergraph object with COM > > > 2) get an Igraphbuilder interface > > > > > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/igraphbuilderinterface.asp> > > using COM. > > > IGraphBuilder* locGraphBuilder; > > > HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, > > > CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&locGraphBuilder); > > > 3) Call RenderFile on the IGraphbuilder interface with the filename > > > 4) get an IMediaControl interface from the filter graph > > > 5) Call play on the IMediaControl interface. > > > > > > All the codec stuff will be done automagically behind the scenes, so > long > > as > > > my filters are installed. > > > > > > Zen. > > > > > Actually today i needed a simple player to do some testing... so here'sthe> entire code for a *zero* feature, *zero* error checking command line audio > player for ogg... requires my filters installed... and you need to link to > strmiids.lib. Actually it will play any audio format... mp3s wmas,anything> directshow has a filter for. This should get you started, and hopefully bea> good starting point for anyone wanting to integrate ogg simply intowindows.> Obviously there's more to make it functional... but it's a starting point.> It will be in the subversion repository as an example on my next checkin. > > // CLOgg.cpp : Command line minimalist audio player. > // > > #include "stdafx.h" > #include <dshow.h> > #include <windows.h> > #include <iostream> > using namespace std; > int _tmain(int argc, _TCHAR* argv[]) > { > IGraphBuilder* locGraphBuilder = NULL; > IMediaControl* locMediaControl = NULL; > HRESULT locHR; > CoInitialize(NULL); > locHR = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, > IID_IGraphBuilder, (void **)&locGraphBuilder); > locHR = locGraphBuilder->RenderFile(L"g:\\h.ogg", NULL); > > locHR = locGraphBuilder->QueryInterface(IID_IMediaControl, > (void**)&locMediaControl); > > locHR = locMediaControl->Run(); > > //Wait till you enter a number and press enter to exit. > int x; > cin>>x; > locMediaControl->Release(); > locGraphBuilder->Release(); > CoUninitialize(); > > return 0; > } > > Enjoy, > > Zen. > > > > _______________________________________________ > Vorbis-dev mailing list > Vorbis-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/vorbis-dev
Forwarded : Forgot to change address again... i swear we didn't have to do this before ! :) ----- Original Message ----- From: "illiminable" <ogg@illiminable.com> To: "Steve Russell" <srussell@innernet.net> Sent: Monday, June 28, 2004 2:20 AM Subject: Re: [Vorbis-dev] getting started> > ----- Original Message ----- > From: "Steve Russell" <srussell@innernet.net> > To: <vorbis-dev@xiph.org> > Sent: Monday, June 28, 2004 1:51 AM > Subject: Re: [Vorbis-dev] getting started > > > > Wow, thanks! I hate to keep asking such basic questions, but could Iget> > just a little comment on how or where this stuff fits into the mmio / > > waveOut functions I am presently using to play my standard wave files?My> > audio typically plays at the beginning of each cycle in a series of > > interactive educational activities and in response to incorrect drag and > > drop choices. I do not provide the user with any audio choices. Mystuff> > resembles a game, and often requiring pretty low latency at that. > > The only multimedia stuff i've ever done is with directshow... so i know > nothing about waveout. But i would imagine if your sound clips are very > short, ie a few seconds max.. you'll definately get lower latency using a > raw audio form. This is probably better for things like user interfaceaudio> feedback. Directshow doesn't have much latency... most of the latency isin> setting up graph.. which takes a fraction of a second... but is not > instant... > > Though if you pre-built all the graphs with your audio, then just calledRun> as needed, the response would be pretty good... though you'll always have > some small amount of latency due to demuxing and decoding. > > Zen. >
<002001c45c5e$20eb28a0$0100000a@tiger> Message-ID: <007b01c45d2a$9a7b54c0$0100000a@tiger> Incidentally... i just realised this same code plays video too... theora (if you have my filters installed www.illiminable.com/ogg/), mpg, avi whatever you have a filter for... so i am also posting it to theora-dev. Zen.> > Actually today i needed a simple player to do some testing... so here'sthe> entire code for a *zero* feature, *zero* error checking command line audio > player for ogg... requires my filters installed... and you need to link to > strmiids.lib. Actually it will play any audio format... mp3s wmas,anything> directshow has a filter for. This should get you started, and hopefully bea> good starting point for anyone wanting to integrate ogg simply intowindows.> Obviously there's more to make it functional... but it's a starting point. > It will be in the subversion repository as an example on my next checkin. > > // CLOgg.cpp : Command line minimalist audio player. > // > > #include "stdafx.h" > #include <dshow.h> > #include <windows.h> > #include <iostream> > using namespace std; > int _tmain(int argc, _TCHAR* argv[]) > { > IGraphBuilder* locGraphBuilder = NULL; > IMediaControl* locMediaControl = NULL; > HRESULT locHR; > CoInitialize(NULL); > locHR = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, > IID_IGraphBuilder, (void **)&locGraphBuilder); > locHR = locGraphBuilder->RenderFile(L"g:\\h.ogg", NULL); > > locHR = locGraphBuilder->QueryInterface(IID_IMediaControl, > (void**)&locMediaControl); > > locHR = locMediaControl->Run(); > > //Wait till you enter a number and press enter to exit. > int x; > cin>>x; > locMediaControl->Release(); > locGraphBuilder->Release(); > CoUninitialize(); > > return 0; > } > > Enjoy, > > Zen. > > > > _______________________________________________ > Vorbis-dev mailing list > Vorbis-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/vorbis-dev > > >
<002001c45c5e$20eb28a0$0100000a@tiger> Message-ID: <007b01c45d2a$9a7b54c0$0100000a@tiger> Incidentally... i just realised this same code plays video too... theora (if you have my filters installed www.illiminable.com/ogg/), mpg, avi whatever you have a filter for... so i am also posting it to theora-dev. Zen.> > Actually today i needed a simple player to do some testing... so here'sthe> entire code for a *zero* feature, *zero* error checking command line audio > player for ogg... requires my filters installed... and you need to link to > strmiids.lib. Actually it will play any audio format... mp3s wmas,anything> directshow has a filter for. This should get you started, and hopefully bea> good starting point for anyone wanting to integrate ogg simply intowindows.> Obviously there's more to make it functional... but it's a starting point. > It will be in the subversion repository as an example on my next checkin. > > // CLOgg.cpp : Command line minimalist audio player. > // > > #include "stdafx.h" > #include <dshow.h> > #include <windows.h> > #include <iostream> > using namespace std; > int _tmain(int argc, _TCHAR* argv[]) > { > IGraphBuilder* locGraphBuilder = NULL; > IMediaControl* locMediaControl = NULL; > HRESULT locHR; > CoInitialize(NULL); > locHR = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, > IID_IGraphBuilder, (void **)&locGraphBuilder); > locHR = locGraphBuilder->RenderFile(L"g:\\h.ogg", NULL); > > locHR = locGraphBuilder->QueryInterface(IID_IMediaControl, > (void**)&locMediaControl); > > locHR = locMediaControl->Run(); > > //Wait till you enter a number and press enter to exit. > int x; > cin>>x; > locMediaControl->Release(); > locGraphBuilder->Release(); > CoUninitialize(); > > return 0; > } > > Enjoy, > > Zen. > > > > _______________________________________________ > Vorbis-dev mailing list > Vorbis-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/vorbis-dev > > >