Packages
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.directX   Previous This
Package
Next

 


Class DirectSoundResource

public class DirectSoundResource implements 
            IDirectSoundResource
{
  // Methods
  public void loadWaveFile(String name,
        DSResourceDesc resourceDesc, byte[] wave);
  public WaveFormatEx loadWaveFile(String name,
        DSResourceDesc resourceDesc);
  public void loadWaveResource(int handle,
        DSResourceDesc resourceDesc, byte[] wave);
  public WaveFormatEx loadWaveResource(int handle,
        DSResourceDesc resourceDesc);
  public void readBuffer(int sourceIndex, int destIndex, int size,
        DSResourceDesc resourceDesc, byte[] buffer, int maxbuf);
}

Applications use the DirectSoundResource class to load wave format objects.

Methods

loadWaveFile

public void loadWaveFile(String name, DSResourceDesc resourceDesc,
        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.
resourceDesc 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 resourceDesc);

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.
resourceDesc The DSResourceDesc object that receives a description of the resource.

loadWaveResource

public void loadWaveResource(int handle, DSResourceDesc resourceDesc,
        byte[] wave);

Loads a wave resource from the given module.

Return Value:

No return value.

ParameterDescription
handle Handle of the module containing the resource.
resourceDesc The DSResourceDesc object that receives a description of the resource.
wave Array variable that receives the wave resource data.

loadWaveResource

public WaveFormatEx loadWaveResource(int handle,
        DSResourceDesc resourceDesc);

Loads a wave resource and returns it as a wave format object.

Return Value:

Returns the WaveFormatEx object if successful; null otherwise.

ParameterDescription
handle Handle of the module containing the resource.
resourceDesc The DSResourceDesc object that receives a description of the resource.

readBuffer

public void readBuffer(int sourceIndex, int destIndex, int size,
        DSResourceDesc resourceDesc, byte[] buffer, int maxbuf);

Reads an amount of data from a resource into the given buffer.

Return Value:

No return value.

ParameterDescription
sourceIndex Index into the resource, indicating the first byte of data to read.
destIndex Index into the buffer, indicating to first byte to receive the data to be read.
size Number of bytes of data to read.
resourceDesc 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 destIndex is non-zero and destIndex + 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 destIndex.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.