Sound Object Functions

From Danmakufu Wiki
Jump to: navigation, search

ObjSound_Create

Returns: object ID (real)

Creates a sound object.

ObjSound_Load

Arguments:
 1) object ID (real)
 2) path (char)

Loads the specified sound file.

ObjSound_Play

Arguments:
 1) object ID (real)

Plays the sound file associated to the object.

Note: this glitches when you want to play sound effects lasting longer than 5 seconds, not including music.

ObjSound_Stop

Arguments:
 1) object ID (real)

Stops the sound file associated to the object.

ObjSound_SetVolumeRate

Arguments:
 1) object ID (real)
 2) volume (real)

Sets the volume of the sound object (0-100).

ObjSound_SetPanRate

Arguments:
 1) object ID (real)
 2) volume (real)

Sets the pan volume of the sound object (-100-100). 0 is neutral, -100 is left-side only, 100 is right-side only.

ObjSound_SetFade

Arguments:
 1) object ID (real)
 2) fade (real)

Sets the fade time of the sound object. Fade value is how much the volume will increase per second; accepts negative values for fadeouts.

ObjSound_SetLoopEnable

Arguments:
 1) object ID (real)
 2) loop (bool)

When set to true, the sound object will be allowed to loop.

ObjSound_SetLoopTime

Arguments:
 1) object ID (real)
 2) loop start (real)
 3) loop end (real)

Sets the timing of the loop, in seconds.

ObjSound_SetLoopSampleCount

Arguments:
 1) object ID (real)
 2) loop sample start (real)
 3) loop sample end (real)

Sets the timing of the loop based on the sample count.

ObjSound_SetRestartEnable

Arguments:
 1) object ID (real)
 2) restart (bool)

When set to true, allows the sound object to continue where it left off instead of restarting every time ObjSound_Play is called.

ObjSound_SetSoundDivision

Arguments:
 1) object ID (real)
 2) type of sound (real)

Specifies whether a sound is a BGM or a sound effect:

  • SOUND_BGM
  • SOUND_SE

(Note: As of ph3 [.1 pre6a], this function is useless.)

ObjSound_IsPlaying

Arguments:
 1) object ID (real)

Returns: true/false (bool)

Returns true if the sound file is playing.

ObjSound_GetVolumeRate

Arguments:
 1) object ID (real)

Returns: volume (real)

Returns the volume (0-100) of the sound file.