Lumino
ln::Sound Class Reference

Sound. More...

#include <Sound.hpp>

Inherits ln::Object.

Public Member Functions

void setVolume (float value)
 Sound クラスのインスタンスを作成します。 More...
 
float getVolume () const
 この Sound の音量を取得します。
 
void setPitch (float value)
 この Sound のピッチ (音高) を設定します。 More...
 
float getPitch () const
 この Sound のピッチ (音高) を取得します。
 
void setLoopEnabled (bool enabled)
 ループ再生の有無を設定します。 More...
 
bool isLoopEnabled () const
 ループ再生が有効かを確認します。
 
void SetLoopRange (uint32_t begin, uint32_t length)
 ループ範囲を設定します。 More...
 
void play ()
 この Sound の再生を開始します。
 
void stop ()
 この Sound の再生を停止します。
 
void pause ()
 この Sound の再生を一時停止します。
 
void resume ()
 一時停止中の再生を再開します。
 
void set3DEnabled (bool enabled)
 サウンドを 3D 音源として再生するかを設定します。(規定値:false) More...
 
bool is3DEnabled () const
 この Sound が 3D 音声であるかを確認します。
 
void setEmitterPosition (const Vector3 &position)
 3D 音声としての位置を設定します。
 
const Vector3getEmitterPosition () const
 3D 音声としての位置を取得します。
 
void setEmitterVelocity (const Vector3 &velocity)
 3D 音声としての速度を設定します。
 
const Vector3getEmitterVelocity () const
 3D 音声としての位置を取得します。
 
void setEmitterMaxDistance (float distance)
 3D 音声としての減衰距離を設定します。(default:100)
 
int64_t getTotalSamples () const
 音声データの全サンプル数を取得します。 More...
 
int64_t getPlayedSamples () const
 現在の再生サンプル数を取得します。
 
int getSamplingRate () const
 サンプリングレートを取得します。 More...
 
SoundPlayingState playingState () const
 この Sound の現在の再生状態を取得します。
 
void fadeVolume (float targetVolume, float time, SoundFadeBehavior behavior)
 音量のフェードを開始します。 More...
 

Detailed Description

Member Function Documentation

◆ fadeVolume()

void ln::Sound::fadeVolume ( float  targetVolume,
float  time,
SoundFadeBehavior  behavior 
)

音量のフェードを開始します。

Parameters
[in]targetVolume: フェード先音量
[in]time: 変化にかける時間 (秒)
[in]state: 音量フェード完了時の動作 現在の音量から targetVolume へ音量の遷移を行います。現在の音量は getVolume() で取得できる値です。 フェード中は音量が変更され、getVolume() で取得できる値が変わります。

◆ getSamplingRate()

int ln::Sound::getSamplingRate ( ) const

サンプリングレートを取得します。

MIDI の場合は 768 を返します。

◆ getTotalSamples()

int64_t ln::Sound::getTotalSamples ( ) const

音声データの全サンプル数を取得します。

MIDI の場合はミュージックタイム単位 (四分音符ひとつ分が 768) で、 1度でも play() で再生を開始していないと取得できません。

◆ set3DEnabled()

void ln::Sound::set3DEnabled ( bool  enabled)

サウンドを 3D 音源として再生するかを設定します。(規定値:false)

設定は play() の前に行う必要があります。

◆ setLoopEnabled()

void ln::Sound::setLoopEnabled ( bool  enabled)

ループ再生の有無を設定します。

Parameters
[in]enabled: true の場合、ループ再生する

◆ SetLoopRange()

void ln::Sound::SetLoopRange ( uint32_t  begin,
uint32_t  length 
)

ループ範囲を設定します。

Parameters
[in]begin: ループ範囲の開始サンプル
[in]length: ループ範囲のサンプル数

MIDI の場合、ループ範囲はミュージックタイム単位 (四分音符ひとつ分を 768 で表す) で指定します。

◆ setPitch()

void ln::Sound::setPitch ( float  value)

この Sound のピッチ (音高) を設定します。

Parameters
[in]volume: ピッチ (0.5~2.0。初期値は 1.0)

◆ setVolume()

void ln::Sound::setVolume ( float  value)

Sound クラスのインスタンスを作成します。

Sound クラスのインスタンスを作成します。 この Sound の音量を設定します。

Parameters
[in]volume: 音量 (0.0~1.0。初期値は 1.0)

The documentation for this class was generated from the following file: