Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Streaming an mp3 to directX

Status
Not open for further replies.

audioplayer65

Programmer
May 2, 2001
14
US
I would like to implement one of the sample applications in the VB DirectX8 sdk but without loading the whole wave into memory first. There are no examples of how to do this. Also they don't show how to set up a codec to play MP3s or other formats in the sdk. Preferably I need to do a continously sliding pitch control, and maybe even play a file backwards. Any ideas?
 
I'm not sure about DirectX8 but atleast in the previous versions you had to set up a secondary buffer and it was YOUR responsibility to write the appropiate PCM data to it. This meant that you had a 1sec sound buffer, and everytime it ran dry you had to decode the next mp3 segment and write the PCM data to it. I do not believe DirectX has direct mp3 format support and you will have to 'stream' your own buffers. That is, unless you wanted to create a static buffer, which they are pretty much the same anyways.

Now, I could be wrong. I'm currently making the migration from Dx7 to 8 and will find out along the way what I can and cannot do. For example, Dx8 now has a little nifty texture_from_file loading routine which is handy.

Good luck on your venture.

Taylor
 
tcollins - do you know of any links to sample code that writes directly to the secondary buffer? also , do you know if it can be done in VB?
 
I read Inside DirectX ISBN 1-57231-696-9 to learn about DirectSound. I did sucessfully use DirectX7SDK with VisualBASIC 6, though that was quite some time ago now. I used to have a C/C++ sample around but I now have to recreated it in my haste/anger with MS Windows. However, I've now moved on to DirectX8 and will approach sound once again. To write to the 2ndary buffer simply means LOCKing the buffer, writting the data of your choice to it (ya, its a byte per byte copy) and UNLOCKing the buffer. You can then use the Play method to play the sound. Do note, that there is quite a bit of the setup that I have not yet described here.

Taylor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top