Logo
Classes | Public Types | Static Public Member Functions | List of all members
Yukar.Engine.Audio Class Reference

A class that manages playback of general audio such as BGM/SE/ME More...

Classes

class  SoundDef
 an instance of the loaded sound More...
 

Public Types

enum  SoundType { Map = 0 , Normal , Arnis }
 Playback type / Map, Normal is normal stereo, Arnis is 3D sound More...
 

Static Public Member Functions

static void PlayDummy ()
 Play built-in silent files More...
 
static void Initialize ()
 Initializing the sound system More...
 
static void InitializeSETypeCount (int inNormalSECount, int inArnisSECount)
 Setting the maximum number of sound effects that can be played simultaneously More...
 
static void Destroy ()
 Discarding the sound system More...
 
static void SetListenerMatrix (SharpKmyMath.Matrix4 mtx)
 Setting the listener position, direction, and upward direction for 3D sound More...
 
static void SetDistanceScaleMaxDistance (float v)
 Setting the reference distance for distance attenuation More...
 
static void PlayBgm (Common.Resource.SoundResource rom, float volume=1.0f, float tempo=1.0f, bool isTemporary=false)
 Play background music More...
 
static void SetBgmVolume (float volume)
 Setting the BGM volume More...
 
static void changeVolume ()
 Reflect system volume More...
 
static void PlayBgs (Common.Resource.SoundResource rom, float volume=1.0f, float tempo=1.0f)
 Play environmental sounds More...
 
static void StopBgm ()
 Stop background music More...
 
static void StopBgs ()
 Stop ambient sounds More...
 
static int LoadSound (Common.Resource.SoundResource rom, bool getUniqueId=false)
 load sound More...
 
static void UnloadSound (Common.Resource.SoundResource rom)
 Unload the sound, just decrement the reference count if it's referenced elsewhere More...
 
static void PlaySound (int id, float pan=0f, float volume=1.0f, float tempo=1.0f, Audio.SoundType soundType=Audio.SoundType.Normal)
 play sound effects More...
 
static void PauseSound (int id)
 sound pose More...
 
static void ResumeSound (int id)
 Resume a paused sound More...
 
static void UnloadSound (int id)
 Unload the sound, just decrement the reference count if it's referenced elsewhere More...
 
static SoundDef GetNowBgm (bool doClear=true, bool forSave=false)
 Get the current BGM More...
 
static void SwapBgm (SoundDef sound)
 You can replace the BGM being played and take over the playback position, etc. More...
 
static bool IsBgmPlaying ()
 Get whether BGM is playing More...
 
static SoundDef GetNowBgs ()
 Get the current environmental sound More...
 
static Common.Resource.ResourceItem GetNowBgsRom ()
 Get the resource of the environmental sound being played More...
 
static void setMasterVolume (float bgm, float se)
 Change master volume More...
 
static bool IsSePlaying (int seId)
 Gets whether the sound effect with the specified ID is being played More...
 
static bool IsSePlaying (Common.Resource.SoundResource sound)
 Get whether the sound effect of the specified resource is being played More...
 
static int GetSeId (Common.Resource.SoundResource sound, bool reverseOrder=false)
 Get the sound effect ID of the specified resource More...
 
static Sound CacheSound (SoundResource bgm)
 BGM pre-reading (for compatibility) Currently streaming playback is performed so there is no meaning. More...
 
static void UncacheSound (Sound pre)
 Releasing prefetched sounds More...
 
static void UnloadAllSound ()
 Release all sound effects More...
 
static void StopAllSound ()
 All sound effects have finished playing More...
 
static void StopSound (int loadedSeId)
 End of playback of sound effect with specified ID More...
 
static bool GetLoopPoint (string path, out int loopStart, out int loopEnd)
 Get the loop point of the sound file at the specified path More...
 
static void SetSePosition (int id, float x, float y, float z)
 Setting the playback position of the sound effect (When starting playback, the position must be set before PlaySound) More...
 
static void SetSEVolume (int id, float volume=1)
 Sound effect volume setting More...
 

Detailed Description

A class that manages playback of general audio such as BGM/SE/ME

Member Enumeration Documentation

◆ SoundType

Playback type / Map, Normal is normal stereo, Arnis is 3D sound

Enumerator
Map 
Normal 
Arnis 

Member Function Documentation

◆ CacheSound()

static Sound Yukar.Engine.Audio.CacheSound ( SoundResource  bgm)
static

BGM pre-reading (for compatibility) Currently streaming playback is performed so there is no meaning.

Parameters
bgm
Returns

◆ changeVolume()

static void Yukar.Engine.Audio.changeVolume ( )
static

Reflect system volume

◆ Destroy()

static void Yukar.Engine.Audio.Destroy ( )
static

Discarding the sound system

◆ GetLoopPoint()

static bool Yukar.Engine.Audio.GetLoopPoint ( string  path,
out int  loopStart,
out int  loopEnd 
)
static

Get the loop point of the sound file at the specified path

Parameters
path
loopStart
loopEnd
Returns

◆ GetNowBgm()

static SoundDef Yukar.Engine.Audio.GetNowBgm ( bool  doClear = true,
bool  forSave = false 
)
static

Get the current BGM

Parameters
doClearWhether to stop BGM
forSaveWhether to save save data (whether to ignore isTemporary mBgmSound)
Returns

◆ GetNowBgs()

static SoundDef Yukar.Engine.Audio.GetNowBgs ( )
static

Get the current environmental sound

Returns

◆ GetNowBgsRom()

static Common.Resource.ResourceItem Yukar.Engine.Audio.GetNowBgsRom ( )
static

Get the resource of the environmental sound being played

Returns

◆ GetSeId()

static int Yukar.Engine.Audio.GetSeId ( Common.Resource.SoundResource  sound,
bool  reverseOrder = false 
)
static

Get the sound effect ID of the specified resource

Parameters
sound
reverseOrder
Returns

◆ Initialize()

static void Yukar.Engine.Audio.Initialize ( )
static

Initializing the sound system

◆ InitializeSETypeCount()

static void Yukar.Engine.Audio.InitializeSETypeCount ( int  inNormalSECount,
int  inArnisSECount 
)
static

Setting the maximum number of sound effects that can be played simultaneously

Parameters
inNormalSECountNormal playback
inArnisSECount3D sound

◆ IsBgmPlaying()

static bool Yukar.Engine.Audio.IsBgmPlaying ( )
static

Get whether BGM is playing

Returns

◆ IsSePlaying() [1/2]

static bool Yukar.Engine.Audio.IsSePlaying ( Common.Resource.SoundResource  sound)
static

Get whether the sound effect of the specified resource is being played

Parameters
sound
Returns

◆ IsSePlaying() [2/2]

static bool Yukar.Engine.Audio.IsSePlaying ( int  seId)
static

Gets whether the sound effect with the specified ID is being played

Parameters
seId
Returns

◆ LoadSound()

static int Yukar.Engine.Audio.LoadSound ( Common.Resource.SoundResource  rom,
bool  getUniqueId = false 
)
static

load sound

Parameters
rom
getUniqueIdIf false, just return the ID if it has already been loaded
Returns

◆ PauseSound()

static void Yukar.Engine.Audio.PauseSound ( int  id)
static

sound pose

Parameters
idID of the sound

◆ PlayBgm()

static void Yukar.Engine.Audio.PlayBgm ( Common.Resource.SoundResource  rom,
float  volume = 1.0f,
float  tempo = 1.0f,
bool  isTemporary = false 
)
static

Play background music

Parameters
rom
volume
tempo
isTemporaryWhether to play as a temporary thing (fanfare) that is not recorded in save data

◆ PlayBgs()

static void Yukar.Engine.Audio.PlayBgs ( Common.Resource.SoundResource  rom,
float  volume = 1.0f,
float  tempo = 1.0f 
)
static

Play environmental sounds

Parameters
rom
volume
tempo

◆ PlayDummy()

static void Yukar.Engine.Audio.PlayDummy ( )
static

Play built-in silent files

Used to make Windows mixer volume save function by playing sound on the exe itself before kmyCore.dll

◆ PlaySound()

static void Yukar.Engine.Audio.PlaySound ( int  id,
float  pan = 0f,
float  volume = 1.0f,
float  tempo = 1.0f,
Audio.SoundType  soundType = Audio.SoundType.Normal 
)
static

play sound effects

Parameters
id
pan
volume
tempo
soundType

◆ ResumeSound()

static void Yukar.Engine.Audio.ResumeSound ( int  id)
static

Resume a paused sound

Parameters
idID of the sound

◆ SetBgmVolume()

static void Yukar.Engine.Audio.SetBgmVolume ( float  volume)
static

Setting the BGM volume

Parameters
volume

◆ SetDistanceScaleMaxDistance()

static void Yukar.Engine.Audio.SetDistanceScaleMaxDistance ( float  v)
static

Setting the reference distance for distance attenuation

Parameters
v

◆ SetListenerMatrix()

static void Yukar.Engine.Audio.SetListenerMatrix ( SharpKmyMath.Matrix4  mtx)
static

Setting the listener position, direction, and upward direction for 3D sound

Parameters
mtx

◆ setMasterVolume()

static void Yukar.Engine.Audio.setMasterVolume ( float  bgm,
float  se 
)
static

Change master volume

Parameters
bgm
se

◆ SetSePosition()

static void Yukar.Engine.Audio.SetSePosition ( int  id,
float  x,
float  y,
float  z 
)
static

Setting the playback position of the sound effect (When starting playback, the position must be set before PlaySound)

Parameters
idsound effect ID
xX-coordinate
yY coordinate
zZ-coordinate

◆ SetSEVolume()

static void Yukar.Engine.Audio.SetSEVolume ( int  id,
float  volume = 1 
)
static

Sound effect volume setting

Parameters
idsound effect ID
volumevolume

◆ StopAllSound()

static void Yukar.Engine.Audio.StopAllSound ( )
static

All sound effects have finished playing

◆ StopBgm()

static void Yukar.Engine.Audio.StopBgm ( )
static

Stop background music

◆ StopBgs()

static void Yukar.Engine.Audio.StopBgs ( )
static

Stop ambient sounds

◆ StopSound()

static void Yukar.Engine.Audio.StopSound ( int  loadedSeId)
static

End of playback of sound effect with specified ID

Parameters
loadedSeId

◆ SwapBgm()

static void Yukar.Engine.Audio.SwapBgm ( SoundDef  sound)
static

You can replace the BGM being played and take over the playback position, etc.

Parameters
sound

◆ UncacheSound()

static void Yukar.Engine.Audio.UncacheSound ( Sound  pre)
static

Releasing prefetched sounds

Parameters
pre

◆ UnloadAllSound()

static void Yukar.Engine.Audio.UnloadAllSound ( )
static

Release all sound effects

◆ UnloadSound() [1/2]

static void Yukar.Engine.Audio.UnloadSound ( Common.Resource.SoundResource  rom)
static

Unload the sound, just decrement the reference count if it's referenced elsewhere

Parameters
rom

◆ UnloadSound() [2/2]

static void Yukar.Engine.Audio.UnloadSound ( int  id)
static

Unload the sound, just decrement the reference count if it's referenced elsewhere

Parameters
id