Step 6


Because the first sounds that you may want to play are the title music tracks, let s start with the methods that you have at your disposal.

 bool PlayStreamingBuffers(int nBuffers, streamingIDenum sN0,                            streamingIDenum sN1 = dud_stream,                            streamingIDenum sN2 = dud_stream,                            streamingIDenum sN3 = dud_stream,                            streamingIDenum sN4 = dud_stream ); 

This method will start between one and five streaming tracks in sync (more or less). The PlayStreamingBuffers method could easily be extended to play more than five sounds. Note the use of the dud_stream enumeration member as a default. The call to play just one track is as follows .

 PlayStreamingBuffers(1,ID_drums); 

Or to play four of the tracks, use the following.

 PlayStreamingBuffers(4,ID_bass,ID_perc,ID_drums,ID_sax); 

These IDs can be listed in any order. If you want to vary the volume of the music, use the following function.

 bool SetStreamingBuffersVolume(float distanceRatio, int nBuffers,                                 streamingIDenum sN0,                                 streamingIDenum sN1 = dud_stream,                                 streamingIDenum sN2 = dud_stream,                                 streamingIDenum sN3 = dud_stream,                                 streamingIDenum sN4 = dud_stream ); 

The following statement sets the volume for the drums track to sound as if it were two and a half times the distance that the audio recorder was when it recorded the sound.

 SetStreamingBuffersVolume(2.5f,1,ID_drums); 

To fade music in and out, this method can be called repeatedly from your timer function.

The method to stop streaming tracks follows the same syntax design.

 bool StopStreamingBuffers(int nBuffers, streamingIDenum sN0,                            streamingIDenum sN1 = dud_stream,                            streamingIDenum sN2 = dud_stream,                            streamingIDenum sN3 = dud_stream,                            streamingIDenum sN4 = dud_stream ); 

You can stop any of the tracks without any hindrance to the others, using the following code.

 StopStreamingBuffers(2,ID_drums,ID_sax); 



Fundamentals of Audio and Video Programming for Games
Fundamentals of Audio and Video Programming for Games (Pro-Developer)
ISBN: 073561945X
EAN: 2147483647
Year: 2003
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net