MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_audio_wave_voice.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_AUDIO_WAVE_VOICE_H_1611869697
12#define INCGUARD_MGL_AUDIO_WAVE_VOICE_H_1611869697
13
16
17#include <future>
18
19namespace MGL::Audio
20{
22class WaveVoice : public Voice
23{
24public:
25 WaveVoice(VoiceKey key, const File::PathView &path, bool isLoop = false, uint32_t loopFrame = 0) noexcept;
26
27 bool Load() noexcept override;
28 bool GetSample(float &outDataL, float &outDataR, uint32_t trackIndex, size_t sampleFrame) const noexcept override;
29
30 /* ------------------------------------------------------------------------- */
36 /* ------------------------------------------------------------------------- */
37 uint32_t GetTotalFrame([[maybe_unused]] uint32_t trackIndex) const noexcept override
38 {
39 return _totalFrame;
40 }
41
42 /* ------------------------------------------------------------------------- */
49 /* ------------------------------------------------------------------------- */
50 bool IsLoop([[maybe_unused]] uint32_t trackIndex) const noexcept override
51 {
52 return _isLoop;
53 }
54
55 /* ------------------------------------------------------------------------- */
61 /* ------------------------------------------------------------------------- */
62 uint32_t GetLoopFrame([[maybe_unused]] uint32_t trackIndex) const noexcept override
63 {
64 return _loopFrame;
65 }
66
67 /* ------------------------------------------------------------------------- */
72 /* ------------------------------------------------------------------------- */
73 uint32_t GetTrackCount() const noexcept override
74 {
75 return 1;
76 }
77
78private:
79 bool LoadWaveFile() noexcept;
80
81 File::Path _path;
82 WaveLoader::Format _format{};
83 bool _isLoop;
84 STL::unique_ptr<std::byte[]> _data{nullptr};
85 size_t _dataSize{0};
86 uint32_t _totalFrame{0};
87 uint32_t _loopFrame;
88 std::future<void> _future;
89};
90} // namespace MGL::Audio
91
92#endif // INCGUARD_MGL_AUDIO_WAVE_VOICE_H_1611869697
93
94// vim: et ts=4 sw=4 sts=4
MGL オーディオボイス
Definition mgl_audio_voice.h:24
WAVEローダークラス
Definition mgl_audio_wave_loader.h:21
MGL WAVEボイス
Definition mgl_audio_wave_voice.h:23
WaveVoice(VoiceKey key, const File::PathView &path, bool isLoop=false, uint32_t loopFrame=0) noexcept
コンストラクタ
Definition mgl_audio_wave_voice.cc:30
uint32_t GetTrackCount() const noexcept override
ボイスが持つトラックの数を取得
Definition mgl_audio_wave_voice.h:73
uint32_t GetLoopFrame(uint32_t trackIndex) const noexcept override
指定したトラックのループフレームを取得
Definition mgl_audio_wave_voice.h:62
bool Load() noexcept override
ボイスの読み込み処理
Definition mgl_audio_wave_voice.cc:46
bool GetSample(float &outDataL, float &outDataR, uint32_t trackIndex, size_t sampleFrame) const noexcept override
スタティックボイスのサンプルの取得
Definition mgl_audio_wave_voice.cc:125
uint32_t GetTotalFrame(uint32_t trackIndex) const noexcept override
ボイスの最大フレーム数を取得
Definition mgl_audio_wave_voice.h:37
bool IsLoop(uint32_t trackIndex) const noexcept override
指定したトラックのループ設定を取得
Definition mgl_audio_wave_voice.h:50
文字列の参照のみを行うファイルパスクラス
Definition mgl_file_path_view.h:20
VoiceKey
ボイスキー
Definition mgl_audio_defs.h:22
MGL オーディオボイス
MGL WAVEローダー
std::unique_ptr< T, Deleter > unique_ptr
MGLのアロケータを利用するユニークポインタ
Definition mgl_stl_memory.h:247