Advertisement Jump to content
Sign in to follow this  
Fire Lancer

Loading sound files

This topic is 3651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to create a set of classes for loading sound files which I can easily extend and supports loading the entire file into a buffer and streaming the file however I'm not entirly sure on the interface or how to implement streaming. Also I'm not sure on the best way to work out which class is able (if any) to load a given file... The output needs to be in a format suitable for XAudio2, ie PCM, adPCM or xWMA
class ISoundData
{
public:
    virtual void Destroy()=0;//{delete this;}
    virtual unsigned GetSize()=0;//in bytes of the sound data
    virtual WAVEFORMATEX* GetFormat()=0;//ISoundData imp still "owns" this
    virtual void Read(unsigned char *data, unsigned bytes)=0;//starts where last read left of. Go back to start having reached the end
};

I know how to load basic PCM waves filling out the WAVEFORMATEX structure and reading the data section, however I could not find any info on how to load other wave formats, nor how exactly I should use WAVEFORMATEX for formats larger than 20 bytes...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!