Package com.ms.com.directX |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
Applications use the dSoundResource class to load wave format objects.
public class dSoundResource implements IdSoundResource { public void LoadWaveResource(int hnd, DSResourceDesc desc, byte[] wave); public WaveFormatEx LoadWaveResource(int hnd, DSResourceDesc desc); public void LoadWaveFile(String name, DSResourceDesc desc, byte[] wave); public WaveFormatEx LoadWaveFile(String name, DSResourceDesc desc); public void ReadBuffer(int srcidx, int dstidx, int size, DSResourceDesc desc, byte[] buffer, int maxbuf); }
The methods are as follows:
LoadWaveResource |
LoadWaveFile |
ReadBuffer |
public void LoadWaveResource(int hnd, DSResourceDesc desc, byte[] wave);Loads a wave resource from the given module.
Return Value:
No return value.
Parameter Description hnd Handle of the module containing the resource. desc The DSResourceDesc object that receives a description of the resource. wave Array variable that receives the wave resource data.
public WaveFormatEx LoadWaveResource(int hnd, DSResourceDesc desc);Loads a wave resource and returns it as a wave format object.
Return Value:
Returns the WaveFormatEx object if successful; null otherwise.
Parameter Description hnd Handle of the module containing the resource. desc The DSResourceDesc object that receives a description of the resource.
public void LoadWaveFile(String name, DSResourceDesc desc, byte[] wave);Loads a wave resource from the given file.
Return Value:
No return value.
Parameter Description name Name of the file that contains the resource. desc The DSResourceDesc object that receives a description of the resource. wave Array variable that receives the wave resource data.
public WaveFormatEx LoadWaveFile(String name, DSResourceDesc desc);Loads a wave resource from a file and returns it as a wave format object.
Return Value:
Returns the WaveFormatEx object if successful; null otherwise.
Parameter Description name Name of the file that contains the resource. desc The DSResourceDesc object that receives a description of the resource.
public void ReadBuffer(int srcidx, int dstidx, int size, DSResourceDesc desc, byte[] buffer, int maxbuf);Reads an amount of data from a resource into the given buffer.
Return Value:
No return value.
Parameter Description srcidx Index into the resource, indicating the first byte of data to read. dstidx Index into the buffer, indicating to first byte to receive the data to be read. size Number of bytes of data to read. desc The DSResourceDesc object that contains a description of the resource. The fields of this object must have been previously initialized by using LoadWaveResource or LoadWaveFile. buffer Array variable that receives the data. maxbuf Length of the buffer array. The method retrieves no more than this amount of data. Remarks:
If dstidx is non-zero and dstidx + size is greater than maxbuf, the method fills to the end of the buffer, then wraps back to the beginning of the buffer and continues to fill the buffer until the method reads the requested data or encounters the position specified by dstidx.