2 #include<Multimedia/SDX.h>
10 Normal = DX_PLAYTYPE_NORMAL,
11 Back = DX_PLAYTYPE_BACK,
12 Loop = DX_PLAYTYPE_LOOP,
32 Sound(
const char *ファイル名 ,
double 音量 = 1.0)
38 int Load(
const char *ファイル名 ,
double 音量 = 1.0)
41 if(this->handle != NULL_HANDLE ) DxLib::DeleteSoundMem(handle);
42 DxLib::ChangeVolumeSoundMem(
int(音量 * 255), this->handle);
43 return this->handle = DxLib::LoadSoundMem(ファイル名);
45 handle = Mix_LoadWAV(ファイル名);
46 Mix_VolumeChunk(handle,
int(音量 * 128));
55 return !DxLib::DeleteSoundMem(handle);
57 Mix_FreeChunk(handle);
69 bool Play(PlayType 再生方法 = PlayType::Back ,
bool 先頭から再生 =
true)
const
72 return !DxLib::PlaySoundMem(this->handle, (
int)再生方法, 先頭から再生);
75 static int channel = 0;
76 Mix_PlayChannel(0, handle, (
int)再生方法);
77 channel = (++channel) % 2;
86 return !DxLib::CheckSoundMem(this->handle);
96 return !DxLib::StopSoundMem(this->handle);
106 return !DxLib::SetPanSoundMem(音声パン, this->handle);
116 return !DxLib::ChangeVolumeSoundMem(
int(音量 * 255), this->handle);
118 Mix_VolumeChunk(handle,
int(音量 * 128));
128 return !DxLib::SetFrequencySoundMem(再生周波数, this->handle);
138 return !DxLib::SetLoopPosSoundMem(ループ位置, this->handle);
149 return !DxLib::SetLoopSamplePosSoundMem(ループ周波数, this->handle);
bool SetLoopSamplePos(int ループ周波数)
サンプリング周波数でループ位置を設定.
Definition: Sound.h:146
bool Play(PlayType 再生方法=PlayType::Back, bool 先頭から再生=true) const
音声ファイルを再生.
Definition: Sound.h:69
bool SetPan(int 音声パン)
音声パンを設定.
Definition: Sound.h:103
bool SetFrequency(int 再生周波数)
再生周波数を設定.
Definition: Sound.h:125
bool Check() const
再生中か判定.
Definition: Sound.h:83
Sound(const char *ファイル名, double 音量=1.0)
音声ファイルをメモリに読み込む.
Definition: Sound.h:32
SoundHandle GetHandle() const
ハンドルを取得.
Definition: Sound.h:63
int Load(const char *ファイル名, double 音量=1.0)
音声ファイルをメモリに読み込む.
Definition: Sound.h:38
bool SetVolume(double 音量)
音量を0~1.0の範囲で設定.
Definition: Sound.h:113
bool Release()
音声ファイルをメモリから開放.
Definition: Sound.h:52
bool SetLoopPos(int ループ位置)
ミリ秒単位でループ位置を設定.
Definition: Sound.h:135
bool Stop()
再生を停止.
Definition: Sound.h:93