DR Developer's Guide
DR Interfaces | DR Methods | DR Types and Misc API

This file documents both IMoaDrSound and IMoaDrSound2. IMoaDrSound2 has all of the methods of IMoaDrSound, plus an additional PauseSound method. Use the IMoaDrSound interface with Director 6 and 7, and use the IMoaDrSound2 interface with Director 8 and later. Note: the syntax in this file has been updated to C++ format from the original C format.

IMoaDrSound2



Interface ID: IID_IMoaDrSound2
Pointer type: PIMoaDrSound2
Class ID: CID_IMoaDrSound2
Inheritance: IMoaDrSound
Header file: driservc.h

IMoaDrSound



Interface ID: IID_IMoaDrSound
Pointer type: PIMoaDrSound
Inheritance: IMoaUnknown
Header file: driservc.h

Description

This callback interface provides platform-independent access to the sound mixing capabilities of Director. On the Macintosh, up to 8 sound channels are available, each of which can simultaneously play sounds independent of the others. There are also 8 sound channels available on Windows. On older Windows systems, up to 4 sound channels were available for playing independent sounds. Sound channel numbering is 1-based.

Methods

GetSoundChannelCount() Determines the number of available sound channels.
GetSoundChannelStatus() Returns the status of a specified sound channel.
GetFreeSoundChannel() Returns the number of the next available sound channel.
PlaySound() Plays the specified sound.
PlaySoundRaw() The same as PlaySound, but has an additional pRawSoundStream parameter.
StopSound() Stops the sound in the specified channel.
SetSoundChannelVolume() Sets the volume for a particular sound channel.
GetTime() Returns the amount of time the sound in the specified channel has been playing.
PauseSound() Pauses the sound currently playing. This is available only for the IMoaDrSound2 interface.

GetFreeSoundChannel()

Syntax

GetFreeSoundChannel(MoaUlong FAR * piChannel))

Parameters

piChannel - Sound channel number

Returns

MoaError

Description

Call this method to get the next available sound channel. This method works from the highest-numbered sound channel down.


GetSoundChannelCount()

Syntax

GetSoundChannelCount(MoaUlong FAR * pCount)

Parameters

pCount - Number of sound channels available

Returns

MoaError

Description

Call this method to determine the number of sound channels available. There are 8 sound channels available on both Macintosh and Windows.


GetSoundChannelStatus()

Syntax

GetSoundChannelStatus(MoaUlong iChannel)

Parameters

iChannel - Sound channel number

Returns

MoaError

Description

Returns the current status of the specified sound channel.


GetTime()

Syntax

GetTime(MoaUlong iChannel, MoaUlong* pTime))

Parameters

iChannel - Sound channel number

pTime - Time from beginning of sound (in milliseconds)

Returns

MoaError

Description

Returns the amount of time that the sound in the specified channel has been playing.


PlaySound()

Syntax

PlaySound(MoaUlong iChannel, PIMoaStream pSoundStream, ConstPMoaChar psSoundFormat,
PMoaMmValue pProxyChannel)

Parameters

iChannel - Sound channel number
pSoundStream - Stream containing sound data
psSoundFormat - String representing sound data format
pProxyChannel - Sprite channel playing the sound. This parameter can be set to NULL.

Returns

MoaError

Description

Plays the sound provided by pSoundStream. Playback conforms to the lifetime of the sprite referred to by pProxyChannel. If a sound is already playing in the specified channel, this sound will supersede it.


PlaySoundRaw()

Syntax

PlaySoundRaw(MoaUlong iChannel,
PIMoaStream pRawSoundStream,
PMoaSoundFormat pSndFormat,
PMoaMmCuePoint pCuePointList,
MoaUlong nCuePoints,
PMoaMmValue pProxyChannel)

Parameters

iChannel - Sound channel number
pRawSoundStream - Stream containing sound data
pSndFormat - Pointer to a Moa sound format structure containing information about the structure of the sound. This parameter cannot be left blank.
pCuePointList - List of sound cue points
nCuePoints - Number of items in pCuePointList
pProxyChannel - Sprite channel playing the sound. This parameter can be set to Null.

Returns

MoaError

Description

Plays the sound provided by pSoundStream. Playback conforms to the lifetime of the sprite referred to by pProxyChannel. If a sound is already playing in the specified channel, this sound will supersede it.


SetSoundChannelVolume()

Syntax

SetSoundChannelVolume(MoaUlong iChannel, MoaUshort nVolume)

Parameters

iChannel - Sound channel number
nVolume - Volume level setting (range: 0 - 255)

Returns

MoaError

Description

Sets the volume of the sound in the specified channel.


StopSound()

Syntax

StopSound(MoaUlong iChannel, MoaUlong* pTime)

Parameters

iChannel - Sound channel number
pTime - Time until sound stops (in milliseconds)

Returns

MoaError

Description

Stops the sound in the specified channel at the specified time.


PauseSound()

Syntax

PauseSound(MoaUlong iChannel, MoaBoolParam* bPauseState)

Parameters

iChannel - Sound channel number
bPauseState - Boolean value specifying whether to pause the sound. Enter True to pause sound playback, enter False to resume sound playback.

Returns

MoaError

Description

Pauses the sound in the specified channel. This method is only available with the IMoaDrSound2 interface

Copyright © 1995-2007 Adobe Macromedia Software LLC, Inc.