Package com.ms.com.directX Previous
Previous
Microsoft Packages
Microsoft Packages
Index
Index
Next
Next

Class dSoundResource

Methods

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


Methods


LoadWaveResource

public void LoadWaveResource(int hnd, DSResourceDesc desc, byte[] wave);

Loads a wave resource from the given module.

Return Value:

No return value.

ParameterDescription
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.


LoadWaveResource

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.

ParameterDescription
hnd Handle of the module containing the resource.
desc The DSResourceDesc object that receives a description of the resource.


LoadWaveFile

public void LoadWaveFile(String name, DSResourceDesc desc, byte[] wave);

Loads a wave resource from the given file.

Return Value:

No return value.

ParameterDescription
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.


LoadWaveFile

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.

ParameterDescription
name Name of the file that contains the resource.
desc The DSResourceDesc object that receives a description of the resource.


ReadBuffer

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.

ParameterDescription
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.



Top© 1996 Microsoft Corporation. All rights reserved.