Sign in to follow this  
Fire Lancer

Loading sound files

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this