SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_mixer.h
1#ifndef SDL3PP_MIXER_H_
2#define SDL3PP_MIXER_H_
3
4#include "SDL3pp_audio.h"
5#include "SDL3pp_version.h"
6
7#ifdef SDL3PP_ENABLE_MIXER
8
9#include <SDL3_mixer/SDL_mixer.h>
10
11namespace SDL {
12
107
108// Forward decl
109struct MixerBase;
110
111// Forward decl
112struct Mixer;
113
115using MixerRaw = MIX_Mixer*;
116
123
124// Forward decl
125struct AudioBase;
126
127// Forward decl
128struct Audio;
129
131using AudioRaw = MIX_Audio*;
132
139
140// Forward decl
141struct TrackBase;
142
143// Forward decl
144struct Track;
145
147using TrackRaw = MIX_Track*;
148
155
156// Forward decl
157struct GroupBase;
158
159// Forward decl
160struct Group;
161
163using GroupRaw = MIX_Group*;
164
171
172// Forward decl
173struct AudioDecoderBase;
174
175// Forward decl
176struct AudioDecoder;
177
179using AudioDecoderRaw = MIX_AudioDecoder*;
180
187
188// Forward decl
189struct MixerLock;
190
224using PostMixCallback = void(SDLCALL*)(void* userdata,
225 MixerRaw mixer,
226 const AudioSpec* spec,
227 float* pcm,
228 int samples);
229
265 void(MixerRaw mixer, const AudioSpec* spec, float* pcm, int samples)>;
266
272struct MixerBase : ResourceBaseT<MixerRaw>
273{
275
297 void Destroy();
298
316
343 void GetFormat(AudioSpec* spec);
344
386 MixerLock Lock();
387
408 void Unlock(MixerLock&& lock);
409
465 Audio LoadAudio_IO(IOStreamRef io, bool predecode, bool closeio = false);
466
494 Audio LoadAudio(StringParam path, bool predecode);
495
552 Audio LoadAudioNoCopy(SourceBytes data, bool free_when_done);
553
588 const AudioSpec& spec,
589 bool closeio = false);
590
624 Audio LoadRawAudio(SourceBytes data, const AudioSpec& spec);
625
666 const AudioSpec& spec,
667 bool free_when_done);
668
704 Audio CreateSineWaveAudio(int hz, float amplitude, Sint64 ms);
705
730
745
780 void PlayTag(StringParam tag, PropertiesRef options);
781
811 bool PlayAudio(AudioRef audio);
812
845 void StopAllTracks(Sint64 fade_out_ms);
846
877 void StopTag(StringParam tag, Sint64 fade_out_ms);
878
898 void PauseAllTracks();
899
925 void PauseTag(StringParam tag);
926
946 void ResumeAllTracks();
947
973 void ResumeTag(StringParam tag);
974
999 void SetGain(float gain);
1000
1016 float GetGain();
1017
1051 void SetTagGain(StringParam tag, float gain);
1052
1080 void SetFrequencyRatio(float ratio);
1081
1097 float GetFrequencyRatio();
1098
1129
1153 void SetPostMixCallback(PostMixCallback cb, void* userdata);
1154
1177
1229 int Generate(TargetBytes buffer);
1230};
1231
1249{
1250 using MixerBase::MixerBase;
1251
1259 constexpr explicit Mixer(MixerRaw resource) noexcept
1260 : MixerBase(resource)
1261 {
1262 }
1263
1265 constexpr Mixer(Mixer&& other) noexcept
1266 : Mixer(other.release())
1267 {
1268 }
1269
1316 Mixer(AudioDeviceRef devid, OptionalRef<const AudioSpec> spec = std::nullopt);
1317
1345 Mixer(const AudioSpec& spec);
1346
1348 ~Mixer() { MIX_DestroyMixer(get()); }
1349
1351 constexpr Mixer& operator=(Mixer&& other) noexcept
1352 {
1353 swap(*this, other);
1354 return *this;
1355 }
1356};
1357
1400{
1401 MixerRef m_lock;
1402
1403public:
1448
1450 MixerLock(const MixerLock& other) = delete;
1451
1453 MixerLock(MixerLock&& other) noexcept
1454 : m_lock(std::move(other.m_lock))
1455 {
1456 }
1457
1479
1480 MixerLock& operator=(const MixerLock& other) = delete;
1481
1483 MixerLock& operator=(MixerLock&& other) noexcept
1484 {
1485 std::swap(m_lock, other.m_lock);
1486 return *this;
1487 }
1488
1490 constexpr operator bool() const { return bool(m_lock); }
1491
1512 void reset();
1513
1515 MixerRef resource() const { return m_lock; }
1516
1518 void release() { m_lock.release(); }
1519};
1520
1526struct AudioBase : ResourceBaseT<AudioRaw>
1527{
1529
1548 void Destroy();
1549
1595
1628
1644 void GetFormat(AudioSpec* spec);
1645
1665
1688};
1689
1707{
1708 using AudioBase::AudioBase;
1709
1717 constexpr explicit Audio(AudioRaw resource) noexcept
1718 : AudioBase(resource)
1719 {
1720 }
1721
1723 constexpr Audio(Audio&& other) noexcept
1724 : Audio(other.release())
1725 {
1726 }
1727
1785 Audio(MixerRef mixer, IOStreamRef io, bool predecode, bool closeio = false);
1786
1816 Audio(MixerRef mixer, StringParam path, bool predecode);
1817
1868 Audio(PropertiesRef props);
1869
1904 Audio(MixerRef mixer,
1905 IOStreamRef io,
1906 const AudioSpec& spec,
1907 bool closeio = false);
1908
1943 Audio(MixerRef mixer, SourceBytes data, const AudioSpec& spec);
1944
1946 ~Audio() { MIX_DestroyAudio(get()); }
1947
1949 constexpr Audio& operator=(Audio&& other) noexcept
1950 {
1951 swap(*this, other);
1952 return *this;
1953 }
1954};
1955
1972using StereoGains = MIX_StereoGains;
1973
1984using Point3D = MIX_Point3D;
1985
2007using TrackStoppedCallback = void(SDLCALL*)(void* userdata, TrackRaw track);
2008
2032
2069using TrackMixCallback = void(SDLCALL*)(void* userdata,
2070 TrackRaw track,
2071 const AudioSpec* spec,
2072 float* pcm,
2073 int samples);
2074
2112 void(TrackRaw track, const AudioSpec* spec, float* pcm, int samples)>;
2113
2119struct TrackBase : ResourceBaseT<TrackRaw>
2120{
2122
2142 void Destroy();
2143
2161
2175
2206 void SetAudio(AudioRef audio);
2207
2247 void SetAudioStream(AudioStreamRef stream);
2248
2296 void SetIOStream(IOStreamRef io, bool closeio = false);
2297
2346 const AudioSpec& spec,
2347 bool closeio = false);
2348
2375 void Tag(StringParam tag);
2376
2399 void Untag(StringParam tag);
2400
2414
2449 void SetPlaybackPosition(Sint64 frames);
2450
2475
2498
2524 int GetLoops();
2525
2554 void SetLoops(int num_loops);
2555
2577
2599
2625
2649
2676
2795 void Play(PropertiesRef options = nullptr);
2796
2828 bool Stop(Sint64 fade_out_frames);
2829
2851 bool Pause();
2852
2874 bool Resume();
2875
2898 bool Playing();
2899
2923 bool Paused();
2924
2949 void SetGain(float gain);
2950
2966 float GetGain();
2967
2990 void SetFrequencyRatio(float ratio);
2991
3016 float GetFrequencyRatio();
3017
3052 void SetOutputChannelMap(std::span<const int> chmap);
3053
3083 void SetStereo(const StereoGains& gains);
3084
3127 void Set3DPosition(const Point3D& position);
3128
3145
3168 void SetGroup(GroupRef group);
3169
3199 void SetStoppedCallback(TrackStoppedCallback cb, void* userdata);
3200
3229
3259 void SetRawCallback(TrackMixCallback cb, void* userdata);
3260
3288 void SetRawCallback(TrackMixCB cb);
3289
3322 void SetCookedCallback(TrackMixCallback cb, void* userdata);
3323
3355};
3356
3372{
3373 using TrackBase::TrackBase;
3374
3382 constexpr explicit Track(TrackRaw resource) noexcept
3383 : TrackBase(resource)
3384 {
3385 }
3386
3388 constexpr Track(Track&& other) noexcept
3389 : Track(other.release())
3390 {
3391 }
3392
3417 Track(MixerRef mixer);
3418
3420 ~Track() { MIX_DestroyTrack(get()); }
3421
3423 constexpr Track& operator=(Track&& other) noexcept
3424 {
3425 swap(*this, other);
3426 return *this;
3427 }
3428};
3429
3462using GroupMixCallback = void(SDLCALL*)(void* userdata,
3463 GroupRaw group,
3464 const AudioSpec* spec,
3465 float* pcm,
3466 int samples);
3467
3502 void(GroupRaw group, const AudioSpec* spec, float* pcm, int samples)>;
3503
3509struct GroupBase : ResourceBaseT<GroupRaw>
3510{
3512
3525 void Destroy();
3526
3544
3558
3584 void SetPostMixCallback(GroupMixCallback cb, void* userdata);
3585};
3586
3605{
3606 using GroupBase::GroupBase;
3607
3615 constexpr explicit Group(GroupRaw resource) noexcept
3616 : GroupBase(resource)
3617 {
3618 }
3619
3621 constexpr Group(Group&& other) noexcept
3622 : Group(other.release())
3623 {
3624 }
3625
3656 Group(MixerRef mixer);
3657
3659 ~Group() { MIX_DestroyGroup(get()); }
3660
3662 constexpr Group& operator=(Group&& other) noexcept
3663 {
3664 swap(*this, other);
3665 return *this;
3666 }
3667};
3668
3669#ifdef SDL3PP_DOC
3670
3678#define SDL_MIXER_MAJOR_VERSION
3679
3687#define SDL_MIXER_MINOR_VERSION
3688
3696#define SDL_MIXER_MICRO_VERSION
3697
3705#define SDL_MIXER_VERSION \
3706 SDL_VERSIONNUM( \
3707 SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)
3708
3714#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
3715 ((SDL_MIXER_MAJOR_VERSION >= X) && \
3716 (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION >= Y) && \
3717 (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION > Y || \
3718 SDL_MIXER_MICRO_VERSION >= Z))
3719
3720#endif // SDL3PP_DOC
3721
3722namespace MIX {
3723
3740inline int Version() { return MIX_Version(); }
3741
3760inline void Init() { CheckError(MIX_Init()); }
3761
3796inline void Quit() { MIX_Quit(); }
3797
3798} // namespace MIX
3799
3820inline int GetNumAudioDecoders() { return MIX_GetNumAudioDecoders(); }
3821
3851inline const char* GetAudioDecoder(int index)
3852{
3853 return MIX_GetAudioDecoder(index);
3854}
3855
3902 OptionalRef<const AudioSpec> spec = std::nullopt)
3903{
3904 return Mixer(devid, spec);
3905}
3906
3908 : Mixer(CheckError(MIX_CreateMixerDevice(devid, spec)))
3909{
3910}
3911
3912inline Mixer::Mixer(const AudioSpec& spec)
3913 : Mixer(CheckError(MIX_CreateMixer(&spec)))
3914{
3915}
3916
3944inline Mixer CreateMixer(const AudioSpec& spec) { return Mixer(spec); }
3945
3969inline void DestroyMixer(MixerRaw mixer) { MIX_DestroyMixer(mixer); }
3970
3972
3991{
3992 return CheckError(MIX_GetMixerProperties(mixer));
3993}
3994
3999
4005namespace prop::Mixer {
4006
4007constexpr auto DEVICE_NUMBER = MIX_PROP_MIXER_DEVICE_NUMBER;
4008
4009} // namespace prop::Mixer
4010
4038inline void GetMixerFormat(MixerRef mixer, AudioSpec* spec)
4039{
4040 CheckError(MIX_GetMixerFormat(mixer, spec));
4041}
4042
4044{
4045 SDL::GetMixerFormat(get(), spec);
4046}
4047
4091inline void LockMixer(MixerRef mixer) { MIX_LockMixer(mixer); }
4092
4093inline MixerLock MixerBase::Lock() { return {MixerRef(*this)}; }
4094
4096 : m_lock(std::move(resource))
4097{
4098 LockMixer(m_lock);
4099}
4100
4123inline void UnlockMixer(MixerRef mixer) { MIX_UnlockMixer(mixer); }
4124
4125inline void MixerBase::Unlock(MixerLock&& lock)
4126{
4127 SDL_assert_paranoid(lock.resource() == *this);
4128 std::move(lock).reset();
4129}
4130
4131inline void MixerLock::reset()
4132{
4133 if (!m_lock) return;
4134 UnlockMixer(m_lock);
4135 m_lock = {};
4136}
4137
4195 IOStreamRef io,
4196 bool predecode,
4197 bool closeio = false)
4198{
4199 return Audio(mixer, io, predecode, closeio);
4200}
4201
4203 bool predecode,
4204 bool closeio)
4205{
4206 return Audio(get(), io, predecode, closeio);
4207}
4208
4210 IOStreamRef io,
4211 bool predecode,
4212 bool closeio)
4213 : Audio(MIX_LoadAudio_IO(mixer, io, predecode, closeio))
4214{
4215}
4216
4217inline Audio::Audio(MixerRef mixer, StringParam path, bool predecode)
4218 : Audio(MIX_LoadAudio(mixer, path, predecode))
4219{
4220}
4221
4223 : Audio(CheckError(MIX_LoadAudioWithProperties(props)))
4224{
4225}
4226
4228 IOStreamRef io,
4229 const AudioSpec& spec,
4230 bool closeio)
4231 : Audio(CheckError(MIX_LoadRawAudio_IO(mixer, io, &spec, closeio)))
4232{
4233}
4234
4235inline Audio::Audio(MixerRef mixer, SourceBytes data, const AudioSpec& spec)
4236 : Audio(CheckError(
4237 MIX_LoadRawAudio(mixer, data.data(), data.size_bytes(), &spec)))
4238{
4239}
4240
4269inline Audio LoadAudio(MixerRef mixer, StringParam path, bool predecode)
4270{
4271 return Audio(mixer, path, predecode);
4272}
4273
4274inline Audio MixerBase::LoadAudio(StringParam path, bool predecode)
4275{
4276 return Audio(get(), path, predecode);
4277}
4278
4336 SourceBytes data,
4337 bool free_when_done)
4338{
4339 return Audio(CheckError(MIX_LoadAudioNoCopy(
4340 mixer, data.data(), data.size_bytes(), free_when_done)));
4341}
4342
4343inline Audio MixerBase::LoadAudioNoCopy(SourceBytes data, bool free_when_done)
4344{
4345 return SDL::LoadAudioNoCopy(get(), std::move(data), free_when_done);
4346}
4347
4399{
4400 return Audio(props);
4401}
4402
4408namespace prop::Audio {
4409
4411 MIX_PROP_AUDIO_LOAD_IOSTREAM_POINTER;
4412
4413constexpr auto LOAD_CLOSEIO_BOOLEAN =
4414 MIX_PROP_AUDIO_LOAD_CLOSEIO_BOOLEAN;
4415
4417 MIX_PROP_AUDIO_LOAD_PREDECODE_BOOLEAN;
4418
4420 MIX_PROP_AUDIO_LOAD_PREFERRED_MIXER_POINTER;
4422
4424 MIX_PROP_AUDIO_LOAD_SKIP_METADATA_TAGS_BOOLEAN;
4426
4427#if SDL_MIXER_VERSION_ATLEAST(3, 2, 4)
4428
4430 MIX_PROP_AUDIO_LOAD_IGNORE_LOOPS_BOOLEAN;
4431
4432#endif // SDL_MIXER_VERSION_ATLEAST(3, 2, 4)
4433
4434constexpr auto DECODER_STRING =
4435 MIX_PROP_AUDIO_DECODER_STRING;
4436
4437} // namespace prop::Audio
4438
4474 IOStreamRef io,
4475 const AudioSpec& spec,
4476 bool closeio = false)
4477{
4478 return Audio(mixer, io, spec, closeio);
4479}
4480
4482 const AudioSpec& spec,
4483 bool closeio)
4484{
4485 return Audio(get(), io, spec, closeio);
4486}
4487
4523 SourceBytes data,
4524 const AudioSpec& spec)
4525{
4526 return Audio(mixer, std::move(data), spec);
4527}
4528
4530{
4531 return Audio(get(), std::move(data), spec);
4532}
4533
4575 SourceBytes data,
4576 const AudioSpec& spec,
4577 bool free_when_done)
4578{
4579 return Audio(CheckError(MIX_LoadRawAudioNoCopy(
4580 mixer, data.data(), data.size_bytes(), &spec, free_when_done)));
4581}
4582
4584 const AudioSpec& spec,
4585 bool free_when_done)
4586{
4587 return SDL::LoadRawAudioNoCopy(get(), std::move(data), spec, free_when_done);
4588}
4589
4627 int hz,
4628 float amplitude,
4629 Sint64 ms)
4630{
4631 return Audio(CheckError(MIX_CreateSineWaveAudio(mixer, hz, amplitude, ms)));
4632}
4633
4634inline Audio MixerBase::CreateSineWaveAudio(int hz, float amplitude, Sint64 ms)
4635{
4636 return SDL::CreateSineWaveAudio(get(), hz, amplitude, ms);
4637}
4638
4685{
4686 return CheckError(MIX_GetAudioProperties(audio));
4687}
4688
4693
4700
4701constexpr auto TITLE_STRING =
4702 MIX_PROP_METADATA_TITLE_STRING;
4703
4704constexpr auto ARTIST_STRING =
4705 MIX_PROP_METADATA_ARTIST_STRING;
4706
4707constexpr auto ALBUM_STRING =
4708 MIX_PROP_METADATA_ALBUM_STRING;
4709
4710constexpr auto COPYRIGHT_STRING =
4711 MIX_PROP_METADATA_COPYRIGHT_STRING;
4712
4713constexpr auto TRACK_NUMBER =
4714 MIX_PROP_METADATA_TRACK_NUMBER;
4715
4716constexpr auto TOTAL_TRACKS_NUMBER =
4717 MIX_PROP_METADATA_TOTAL_TRACKS_NUMBER;
4718
4719constexpr auto YEAR_NUMBER =
4720 MIX_PROP_METADATA_YEAR_NUMBER;
4721
4723 MIX_PROP_METADATA_DURATION_FRAMES_NUMBER;
4724
4726 MIX_PROP_METADATA_DURATION_INFINITE_BOOLEAN;
4727
4728} // namespace prop::Audio::Metadata
4729
4763{
4764 return MIX_GetAudioDuration(audio);
4765}
4766
4768
4770constexpr Sint64 DURATION_UNKNOWN = MIX_DURATION_UNKNOWN;
4771
4773constexpr Sint64 DURATION_INFINITE = MIX_DURATION_INFINITE;
4774
4791inline void GetAudioFormat(AudioRef audio, AudioSpec* spec)
4792{
4793 CheckError(MIX_GetAudioFormat(audio, spec));
4794}
4795
4797{
4798 SDL::GetAudioFormat(get(), spec);
4799}
4800
4821inline void DestroyAudio(AudioRaw audio) { MIX_DestroyAudio(audio); }
4822
4824
4847inline Track CreateTrack(MixerRef mixer) { return Track(mixer); }
4848
4850
4852 : Track(CheckError(MIX_CreateTrack(mixer)))
4853{
4854}
4855
4877inline void DestroyTrack(TrackRaw track) { MIX_DestroyTrack(track); }
4878
4880
4899{
4900 return CheckError(MIX_GetTrackProperties(track));
4901}
4902
4907
4922{
4923 return CheckError(MIX_GetTrackMixer(track));
4924}
4925
4927
4959inline void SetTrackAudio(TrackRef track, AudioRef audio)
4960{
4961 CheckError(MIX_SetTrackAudio(track, audio));
4962}
4963
4965{
4966 SDL::SetTrackAudio(get(), audio);
4967}
4968
5010{
5011 CheckError(MIX_SetTrackAudioStream(track, stream));
5012}
5013
5015{
5016 SDL::SetTrackAudioStream(get(), stream);
5017}
5018
5066inline void SetTrackIOStream(TrackRef track,
5067 IOStreamRef io,
5068 bool closeio = false)
5069{
5070 CheckError(MIX_SetTrackIOStream(track, io, closeio));
5071}
5072
5073inline void TrackBase::SetIOStream(IOStreamRef io, bool closeio)
5074{
5075 SDL::SetTrackIOStream(get(), io, closeio);
5076}
5077
5127 IOStreamRef io,
5128 const AudioSpec& spec,
5129 bool closeio = false)
5130{
5131 CheckError(MIX_SetTrackRawIOStream(track, io, &spec, closeio));
5132}
5133
5135 const AudioSpec& spec,
5136 bool closeio)
5137{
5138 SDL::SetTrackRawIOStream(get(), io, spec, closeio);
5139}
5140
5168inline void TagTrack(TrackRef track, StringParam tag)
5169{
5170 CheckError(MIX_TagTrack(track, tag));
5171}
5172
5173inline void TrackBase::Tag(StringParam tag) { SDL::TagTrack(get(), tag); }
5174
5198inline void UntagTrack(TrackRef track, StringParam tag)
5199{
5200 MIX_UntagTrack(track, tag);
5201}
5202
5204
5219{
5220 int count;
5221 auto result = CheckError(MIX_GetTrackTags(track, &count));
5222 return OwnArray<char*>(result, count);
5223}
5224
5226
5242{
5243 int count;
5244 auto result = CheckError(MIX_GetTaggedTracks(mixer, tag, &count));
5245 return OwnArray<TrackRef>(reinterpret_cast<TrackRef*>(result), count);
5246}
5247
5252
5288inline void SetTrackPlaybackPosition(TrackRef track, Sint64 frames)
5289{
5290 CheckError(MIX_SetTrackPlaybackPosition(track, frames));
5291}
5292
5294{
5296}
5297
5322{
5323 return MIX_GetTrackPlaybackPosition(track);
5324}
5325
5330
5354{
5355 return MIX_GetTrackFadeFrames(track);
5356}
5357
5359{
5360 return SDL::GetTrackFadeFrames(get());
5361}
5362
5389inline int GetTrackLoops(TrackRef track) { return MIX_GetTrackLoops(track); }
5390
5391inline int TrackBase::GetLoops() { return SDL::GetTrackLoops(get()); }
5392
5421inline void SetTrackLoops(TrackRef track, int num_loops)
5422{
5423 CheckError(MIX_SetTrackLoops(track, num_loops));
5424}
5425
5426inline void TrackBase::SetLoops(int num_loops)
5427{
5428 SDL::SetTrackLoops(get(), num_loops);
5429}
5430
5452{
5453 return MIX_GetTrackAudio(track);
5454}
5455
5457
5480{
5481 return MIX_GetTrackAudioStream(track);
5482}
5483
5488
5515{
5516 return MIX_GetTrackRemaining(track);
5517}
5518
5520{
5521 return SDL::GetTrackRemaining(get());
5522}
5523
5547{
5548 return MIX_TrackMSToFrames(track, ms.count());
5549}
5550
5552{
5553 return SDL::TrackMSToFrames(get(), ms);
5554}
5555
5582{
5583 return Milliseconds(MIX_TrackFramesToMS(track, frames));
5584}
5585
5587{
5588 return SDL::TrackFramesToMS(get(), frames);
5589}
5590
5611{
5612 return MIX_AudioMSToFrames(audio, ms.count());
5613}
5614
5616{
5617 return SDL::AudioMSToFrames(get(), ms);
5618}
5619
5643{
5644 return Milliseconds(MIX_AudioFramesToMS(audio, frames));
5645}
5646
5648{
5649 return SDL::AudioFramesToMS(get(), frames);
5650}
5651
5668inline Sint64 MSToFrames(int sample_rate, Milliseconds ms)
5669{
5670 return MIX_MSToFrames(sample_rate, ms.count());
5671}
5672
5694inline Milliseconds FramesToMS(int sample_rate, Sint64 frames)
5695{
5696 return Milliseconds(MIX_FramesToMS(sample_rate, frames));
5697}
5698
5815inline void PlayTrack(TrackRef track, PropertiesRef options = nullptr)
5816{
5817 CheckError(MIX_PlayTrack(track, options));
5818}
5819
5820inline void TrackBase::Play(PropertiesRef options)
5821{
5822 SDL::PlayTrack(get(), options);
5823}
5824
5830namespace prop::Play {
5831
5832constexpr auto LOOPS_NUMBER = MIX_PROP_PLAY_LOOPS_NUMBER;
5833
5834constexpr auto MAX_FRAME_NUMBER =
5835 MIX_PROP_PLAY_MAX_FRAME_NUMBER;
5836
5838 MIX_PROP_PLAY_MAX_MILLISECONDS_NUMBER;
5839
5840constexpr auto START_FRAME_NUMBER =
5841 MIX_PROP_PLAY_START_FRAME_NUMBER;
5842
5844 MIX_PROP_PLAY_START_MILLISECOND_NUMBER;
5845
5846#if SDL_MIXER_VERSION_ATLEAST(3, 2, 2)
5847
5848constexpr auto START_ORDER_NUMBER =
5849 MIX_PROP_PLAY_START_ORDER_NUMBER;
5850
5851#endif // SDL_MIXER_VERSION_ATLEAST(3, 2, 2)
5852
5854 MIX_PROP_PLAY_LOOP_START_FRAME_NUMBER;
5855
5857 MIX_PROP_PLAY_LOOP_START_MILLISECOND_NUMBER;
5859
5861 MIX_PROP_PLAY_FADE_IN_FRAMES_NUMBER;
5862
5864 MIX_PROP_PLAY_FADE_IN_MILLISECONDS_NUMBER;
5866
5868 MIX_PROP_PLAY_FADE_IN_START_GAIN_FLOAT;
5869
5871 MIX_PROP_PLAY_APPEND_SILENCE_FRAMES_NUMBER;
5873
5875 MIX_PROP_PLAY_APPEND_SILENCE_MILLISECONDS_NUMBER;
5877
5879 MIX_PROP_PLAY_HALT_WHEN_EXHAUSTED_BOOLEAN;
5880
5881} // namespace prop::Play
5882
5917inline void PlayTag(MixerRef mixer, StringParam tag, PropertiesRef options)
5918{
5919 CheckError(MIX_PlayTag(mixer, tag, options));
5920}
5921
5923{
5924 SDL::PlayTag(get(), tag, options);
5925}
5926
5957inline bool PlayAudio(MixerRef mixer, AudioRef audio)
5958{
5959 return MIX_PlayAudio(mixer, audio);
5960}
5961
5963{
5964 return SDL::PlayAudio(get(), audio);
5965}
5966
5999inline bool StopTrack(TrackRef track, Sint64 fade_out_frames)
6000{
6001 return MIX_StopTrack(track, fade_out_frames);
6002}
6003
6004inline bool TrackBase::Stop(Sint64 fade_out_frames)
6005{
6006 return SDL::StopTrack(get(), fade_out_frames);
6007}
6008
6041inline void StopAllTracks(MixerRef mixer, Sint64 fade_out_ms)
6042{
6043 CheckError(MIX_StopAllTracks(mixer, fade_out_ms));
6044}
6045
6046inline void MixerBase::StopAllTracks(Sint64 fade_out_ms)
6047{
6048 SDL::StopAllTracks(get(), fade_out_ms);
6049}
6050
6082inline void StopTag(MixerRef mixer, StringParam tag, Sint64 fade_out_ms)
6083{
6084 CheckError(MIX_StopTag(mixer, tag, fade_out_ms));
6085}
6086
6087inline void MixerBase::StopTag(StringParam tag, Sint64 fade_out_ms)
6088{
6089 SDL::StopTag(get(), tag, fade_out_ms);
6090}
6091
6114inline bool PauseTrack(TrackRef track) { return MIX_PauseTrack(track); }
6115
6116inline bool TrackBase::Pause() { return SDL::PauseTrack(get()); }
6117
6138inline void PauseAllTracks(MixerRef mixer)
6139{
6140 CheckError(MIX_PauseAllTracks(mixer));
6141}
6142
6144
6171inline void PauseTag(MixerRef mixer, StringParam tag)
6172{
6173 CheckError(MIX_PauseTag(mixer, tag));
6174}
6175
6177
6200inline bool ResumeTrack(TrackRef track) { return MIX_ResumeTrack(track); }
6201
6202inline bool TrackBase::Resume() { return SDL::ResumeTrack(get()); }
6203
6224inline void ResumeAllTracks(MixerRef mixer)
6225{
6226 CheckError(MIX_ResumeAllTracks(mixer));
6227}
6228
6230
6256inline void ResumeTag(MixerRef mixer, StringParam tag)
6257{
6258 CheckError(MIX_ResumeTag(mixer, tag));
6259}
6260
6262{
6263 SDL::ResumeTag(get(), tag);
6264}
6265
6289inline bool TrackPlaying(TrackRef track) { return MIX_TrackPlaying(track); }
6290
6291inline bool TrackBase::Playing() { return SDL::TrackPlaying(get()); }
6292
6316inline bool TrackPaused(TrackRef track) { return MIX_TrackPaused(track); }
6317
6318inline bool TrackBase::Paused() { return SDL::TrackPaused(get()); }
6319
6345inline void SetMixerGain(MixerRef mixer, float gain)
6346{
6347 CheckError(MIX_SetMixerGain(mixer, gain));
6348}
6349
6350inline void MixerBase::SetGain(float gain) { SDL::SetMixerGain(get(), gain); }
6351
6368inline float GetMixerGain(MixerRef mixer) { return MIX_GetMixerGain(mixer); }
6369
6370inline float MixerBase::GetGain() { return SDL::GetMixerGain(get()); }
6371
6397inline void SetTrackGain(TrackRef track, float gain)
6398{
6399 CheckError(MIX_SetTrackGain(track, gain));
6400}
6401
6402inline void TrackBase::SetGain(float gain) { SDL::SetTrackGain(get(), gain); }
6403
6420inline float GetTrackGain(TrackRef track) { return MIX_GetTrackGain(track); }
6421
6422inline float TrackBase::GetGain() { return SDL::GetTrackGain(get()); }
6423
6458inline void SetTagGain(MixerRef mixer, StringParam tag, float gain)
6459{
6460 CheckError(MIX_SetTagGain(mixer, tag, gain));
6461}
6462
6463inline void MixerBase::SetTagGain(StringParam tag, float gain)
6464{
6465 SDL::SetTagGain(get(), tag, gain);
6466}
6467
6495inline void SetMixerFrequencyRatio(MixerRef mixer, float ratio)
6496{
6497 CheckError(MIX_SetMixerFrequencyRatio(mixer, ratio));
6498}
6499
6500inline void MixerBase::SetFrequencyRatio(float ratio)
6501{
6503}
6504
6522{
6523 return MIX_GetMixerFrequencyRatio(mixer);
6524}
6525
6527{
6529}
6530
6554inline void SetTrackFrequencyRatio(TrackRef track, float ratio)
6555{
6556 CheckError(MIX_SetTrackFrequencyRatio(track, ratio));
6557}
6558
6559inline void TrackBase::SetFrequencyRatio(float ratio)
6560{
6562}
6563
6590{
6591 return MIX_GetTrackFrequencyRatio(track);
6592}
6593
6595{
6597}
6598
6634inline void SetTrackOutputChannelMap(TrackRef track, std::span<const int> chmap)
6635{
6636 CheckError(
6637 MIX_SetTrackOutputChannelMap(track, chmap.data(), narrowS32(chmap.size())));
6638}
6639
6640inline void TrackBase::SetOutputChannelMap(std::span<const int> chmap)
6641{
6643}
6644
6675inline void SetTrackStereo(TrackRef track, const StereoGains& gains)
6676{
6677 CheckError(MIX_SetTrackStereo(track, &gains));
6678}
6679
6680inline void TrackBase::SetStereo(const StereoGains& gains)
6681{
6682 SDL::SetTrackStereo(get(), gains);
6683}
6684
6727inline void SetTrack3DPosition(TrackRef track, const Point3D& position)
6728{
6729 CheckError(MIX_SetTrack3DPosition(track, &position));
6730}
6731
6732inline void TrackBase::Set3DPosition(const Point3D& position)
6733{
6734 SDL::SetTrack3DPosition(get(), position);
6735}
6736
6754{
6755 Point3D position;
6756 CheckError(MIX_GetTrack3DPosition(track, &position));
6757 return position;
6758}
6759
6764
6794inline Group CreateGroup(MixerRef mixer) { return Group(mixer); }
6795
6797
6799 : Group(CheckError(MIX_CreateGroup(mixer)))
6800{
6801}
6802
6817inline void DestroyGroup(GroupRaw group) { MIX_DestroyGroup(group); }
6818
6820
6839{
6840 return CheckError(MIX_GetGroupProperties(group));
6841}
6842
6847
6862{
6863 return CheckError(MIX_GetGroupMixer(group));
6864}
6865
6867
6891inline void SetTrackGroup(TrackRef track, GroupRef group)
6892{
6893 CheckError(MIX_SetTrackGroup(track, group));
6894}
6895
6897{
6898 SDL::SetTrackGroup(get(), group);
6899}
6900
6932 void* userdata)
6933{
6934 CheckError(MIX_SetTrackStoppedCallback(track, cb, userdata));
6935}
6936
6965{
6966 SetTrackStoppedCallback(track, cb.wrapper, cb.data);
6967}
6968
6970 void* userdata)
6971{
6972 SDL::SetTrackStoppedCallback(get(), cb, userdata);
6973}
6974
6979
7011 void* userdata)
7012{
7013 CheckError(MIX_SetTrackRawCallback(track, cb, userdata));
7014}
7015
7044{
7045 SetTrackRawCallback(track, cb.wrapper, cb.data);
7046}
7047
7048inline void TrackBase::SetRawCallback(TrackMixCallback cb, void* userdata)
7049{
7050 SDL::SetTrackRawCallback(get(), cb, userdata);
7051}
7052
7054{
7056}
7057
7092 void* userdata)
7093{
7094 CheckError(MIX_SetTrackCookedCallback(track, cb, userdata));
7095}
7096
7128{
7129 SetTrackCookedCallback(track, cb.wrapper, cb.data);
7130}
7131
7132inline void TrackBase::SetCookedCallback(TrackMixCallback cb, void* userdata)
7133{
7134 SDL::SetTrackCookedCallback(get(), cb, userdata);
7135}
7136
7141
7169 void* userdata)
7170{
7171 CheckError(MIX_SetGroupPostMixCallback(group, cb, userdata));
7172}
7173
7198{
7199 SetGroupPostMixCallback(group, cb.wrapper, cb.data);
7200}
7201
7203{
7204 SDL::SetGroupPostMixCallback(get(), cb, userdata);
7205}
7206
7231 PostMixCallback cb,
7232 void* userdata)
7233{
7234 CheckError(MIX_SetPostMixCallback(mixer, cb, userdata));
7235}
7236
7259{
7260 SetPostMixCallback(mixer, cb.wrapper, cb.data);
7261}
7262
7263inline void MixerBase::SetPostMixCallback(PostMixCallback cb, void* userdata)
7264{
7265 SDL::SetPostMixCallback(get(), cb, userdata);
7266}
7267
7272
7324inline int Generate(MixerRef mixer, TargetBytes buffer)
7325{
7326 return CheckError(
7327 MIX_Generate(mixer, buffer.data(), narrowS32(buffer.size_bytes())), -1);
7328}
7329
7331{
7332 return SDL::Generate(get(), std::move(buffer));
7333}
7334
7340struct AudioDecoderBase : ResourceBaseT<AudioDecoderRaw>
7341{
7343
7353 void Destroy();
7354
7378
7394 void GetFormat(AudioSpec* spec);
7395
7416 int DecodeAudio(TargetBytes buffer, const AudioSpec& spec);
7417};
7418
7435{
7436 using AudioDecoderBase::AudioDecoderBase;
7437
7445 constexpr explicit AudioDecoder(AudioDecoderRaw resource) noexcept
7446 : AudioDecoderBase(resource)
7447 {
7448 }
7449
7451 constexpr AudioDecoder(AudioDecoder&& other) noexcept
7452 : AudioDecoder(other.release())
7453 {
7454 }
7455
7489 AudioDecoder(StringParam path, PropertiesRef props = nullptr);
7490
7528 bool closeio = false,
7529 PropertiesRef props = nullptr);
7530
7532 ~AudioDecoder() { MIX_DestroyAudioDecoder(get()); }
7533
7535 constexpr AudioDecoder& operator=(AudioDecoder&& other) noexcept
7536 {
7537 swap(*this, other);
7538 return *this;
7539 }
7540};
7541
7576 PropertiesRef props = nullptr)
7577{
7578 return AudioDecoder(path, props);
7579}
7580
7582 : AudioDecoder(MIX_CreateAudioDecoder(path, props))
7583{
7584}
7585
7587 bool closeio,
7588 PropertiesRef props)
7589 : AudioDecoder(MIX_CreateAudioDecoder_IO(io, closeio, props))
7590{
7591}
7592
7630 bool closeio = false,
7631 PropertiesRef props = nullptr)
7632{
7633 return AudioDecoder(io, closeio, props);
7634}
7635
7647inline void DestroyAudioDecoder(AudioDecoderRaw audiodecoder)
7648{
7649 MIX_DestroyAudioDecoder(audiodecoder);
7650}
7651
7653
7678{
7679 return CheckError(MIX_GetAudioDecoderProperties(audiodecoder));
7680}
7681
7686
7703inline void GetAudioDecoderFormat(AudioDecoderRef audiodecoder, AudioSpec* spec)
7704{
7705 CheckError(MIX_GetAudioDecoderFormat(audiodecoder, spec));
7706}
7707
7709{
7711}
7712
7733inline int DecodeAudio(AudioDecoderRef audiodecoder,
7734 TargetBytes buffer,
7735 const AudioSpec& spec)
7736{
7737 return CheckError(
7738 MIX_DecodeAudio(
7739 audiodecoder, buffer.data(), narrowS32(buffer.size_bytes()), &spec),
7740 -1);
7741}
7742
7744 const AudioSpec& spec)
7745{
7746 return SDL::DecodeAudio(get(), std::move(buffer), spec);
7747}
7748
7750
7751} // namespace SDL
7752
7753#endif /* SDL3PP_ENABLE_MIXER */
7754
7755#endif /* SDL3PP_MIXER_H_ */
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:1400
MixerRef resource() const
Get the reference to locked resource.
Definition SDL3pp_mixer.h:1515
MixerLock(MixerLock &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:1453
void release()
Releases the lock without unlocking.
Definition SDL3pp_mixer.h:1518
~MixerLock()
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:1478
MixerLock(const MixerLock &other)=delete
Copy constructor.
MixerLock & operator=(MixerLock &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:1483
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Source byte stream.
Definition SDL3pp_strings.h:246
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:310
constexpr const char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:313
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:58
Target byte stream.
Definition SDL3pp_strings.h:332
constexpr char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:418
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:415
#define SDL_assert_paranoid(condition)
An assertion test that is performed only when built with paranoid settings.
Definition SDL3pp_assert.h:383
SDL_AudioSpec AudioSpec
Format specifier for audio data.
Definition SDL3pp_audio.h:201
ResourceRefT< AudioStreamBase > AudioStreamRef
Reference for AudioStream.
Definition SDL3pp_audio.h:152
ResourceRefT< AudioDeviceBase > AudioDeviceRef
Reference for AudioDevice.
Definition SDL3pp_audio.h:136
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
ResourceRefT< IOStreamBase > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:37
void Quit()
Clean up all initialized subsystems.
Definition SDL3pp_init.h:329
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:55
void(SDLCALL *)(void *userdata, TrackRaw track) TrackStoppedCallback
A callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:2007
MakeFrontCallback< void(TrackRaw track)> TrackStoppedCB
A callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:2031
Audio LoadRawAudio(MixerRef mixer, SourceBytes data, const AudioSpec &spec)
Load raw PCM data from a memory buffer.
Definition SDL3pp_mixer.h:4522
void SetTrackStereo(TrackRef track, const StereoGains &gains)
Force a track to stereo output, with optionally left/right panning.
Definition SDL3pp_mixer.h:6675
void SetTrackIOStream(TrackRef track, IOStreamRef io, bool closeio=false)
Set a Track's input to an IOStream.
Definition SDL3pp_mixer.h:5066
Audio LoadAudioWithProperties(PropertiesRef props)
Load audio for playback through a collection of properties.
Definition SDL3pp_mixer.h:4398
void Destroy()
Destroy the specified audio.
Definition SDL3pp_mixer.h:4823
void SetTrackCookedCallback(TrackRef track, TrackMixCallback cb, void *userdata)
Set a callback that fires when the mixer has transformed a track's audio.
Definition SDL3pp_mixer.h:7090
AudioStreamRef GetAudioStream()
Query the AudioStream assigned to a track.
Definition SDL3pp_mixer.h:5484
bool Paused()
Query if a track is currently paused.
Definition SDL3pp_mixer.h:6318
PropertiesRef GetAudioDecoderProperties(AudioDecoderRef audiodecoder)
Get the properties associated with a AudioDecoder.
Definition SDL3pp_mixer.h:7677
Audio LoadRawAudioNoCopy(SourceBytes data, const AudioSpec &spec, bool free_when_done)
Load raw PCM data from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4583
float GetTrackFrequencyRatio(TrackRef track)
Query the frequency ratio of a track.
Definition SDL3pp_mixer.h:6589
void GetMixerFormat(MixerRef mixer, AudioSpec *spec)
Get the audio format a mixer is generating.
Definition SDL3pp_mixer.h:4038
MakeFrontCallback< void(GroupRaw group, const AudioSpec *spec, float *pcm, int samples)> GroupMixCB
A callback that fires when a Group has completed mixing.
Definition SDL3pp_mixer.h:3501
void SetTagGain(StringParam tag, float gain)
Set the gain control of all tracks with a specific tag.
Definition SDL3pp_mixer.h:6463
void PauseTag(StringParam tag)
Pause all tracks with a specific tag.
Definition SDL3pp_mixer.h:6176
MIX_Group * GroupRaw
Alias to raw representation for Group.
Definition SDL3pp_mixer.h:163
void SetGain(float gain)
Set a mixer's master gain control.
Definition SDL3pp_mixer.h:6350
void SetTagGain(MixerRef mixer, StringParam tag, float gain)
Set the gain control of all tracks with a specific tag.
Definition SDL3pp_mixer.h:6458
void SetTrackPlaybackPosition(TrackRef track, Sint64 frames)
Seek a playing track to a new position in its input.
Definition SDL3pp_mixer.h:5288
void UntagTrack(TrackRef track, StringParam tag)
Remove an arbitrary tag from a track.
Definition SDL3pp_mixer.h:5198
void(SDLCALL *)(void *userdata, TrackRaw track, const AudioSpec *spec, float *pcm, int samples) TrackMixCallback
A callback that fires when a Track is mixing at various stages.
Definition SDL3pp_mixer.h:2069
void ResumeAllTracks()
Resume all currently-paused tracks.
Definition SDL3pp_mixer.h:6229
PropertiesRef GetProperties()
Get the properties associated with a group.
Definition SDL3pp_mixer.h:6843
PropertiesRef GetProperties()
Get the properties associated with a AudioDecoder.
Definition SDL3pp_mixer.h:7682
AudioRef GetAudio()
Query the Audio assigned to a track.
Definition SDL3pp_mixer.h:5456
Milliseconds FramesToMS(int sample_rate, Sint64 frames)
Convert sample frames, at a specific sample rate, to milliseconds.
Definition SDL3pp_mixer.h:5694
void PauseTag(MixerRef mixer, StringParam tag)
Pause all tracks with a specific tag.
Definition SDL3pp_mixer.h:6171
PropertiesRef GetProperties()
Get the properties associated with a Audio.
Definition SDL3pp_mixer.h:4689
void PlayTrack(TrackRef track, PropertiesRef options=nullptr)
Start (or restart) mixing a track for playback.
Definition SDL3pp_mixer.h:5815
void Destroy()
Destroy the specified audio decoder.
Definition SDL3pp_mixer.h:7652
Sint64 TrackMSToFrames(TrackRef track, Milliseconds ms)
Convert milliseconds to sample frames for a track's current format.
Definition SDL3pp_mixer.h:5546
OwnArray< char * > GetTrackTags(TrackRef track)
Get the tags currently associated with a track.
Definition SDL3pp_mixer.h:5218
Sint64 MSToFrames(Milliseconds ms)
Convert milliseconds to sample frames for a track's current format.
Definition SDL3pp_mixer.h:5551
void Destroy()
Destroy the specified track.
Definition SDL3pp_mixer.h:4879
void ResumeTag(MixerRef mixer, StringParam tag)
Resume all tracks with a specific tag.
Definition SDL3pp_mixer.h:6256
Audio CreateSineWaveAudio(MixerRef mixer, int hz, float amplitude, Sint64 ms)
Create a Audio that generates a sinewave.
Definition SDL3pp_mixer.h:4626
void Unlock(MixerLock &&lock)
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:4125
void SetTrackStoppedCallback(TrackRef track, TrackStoppedCallback cb, void *userdata)
Set a callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:6930
PropertiesRef GetProperties()
Get the properties associated with a track.
Definition SDL3pp_mixer.h:4903
const char * GetAudioDecoder(int index)
Report the name of a specific audio decoders.
Definition SDL3pp_mixer.h:3851
void GetAudioDecoderFormat(AudioDecoderRef audiodecoder, AudioSpec *spec)
Query the initial audio format of a AudioDecoder.
Definition SDL3pp_mixer.h:7703
bool PlayAudio(AudioRef audio)
Play a Audio from start to finish without any management.
Definition SDL3pp_mixer.h:5962
ResourceRefT< GroupBase > GroupRef
Reference for Group.
Definition SDL3pp_mixer.h:170
int Generate(TargetBytes buffer)
Generate mixer output when not driving an audio device.
Definition SDL3pp_mixer.h:7330
bool Resume()
Resume a currently-paused track.
Definition SDL3pp_mixer.h:6202
void SetRawIOStream(IOStreamRef io, const AudioSpec &spec, bool closeio=false)
Set a Track's input to an IOStream providing raw PCM data.
Definition SDL3pp_mixer.h:5134
void DestroyAudioDecoder(AudioDecoderRaw audiodecoder)
Destroy the specified audio decoder.
Definition SDL3pp_mixer.h:7647
void UnlockMixer(MixerRef mixer)
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:4123
bool Playing()
Query if a track is currently playing.
Definition SDL3pp_mixer.h:6291
Track CreateTrack(MixerRef mixer)
Create a new track on a mixer.
Definition SDL3pp_mixer.h:4847
MakeFrontCallback< void(TrackRaw track, const AudioSpec *spec, float *pcm, int samples)> TrackMixCB
A callback that fires when a Track is mixing at various stages.
Definition SDL3pp_mixer.h:2111
void SetGain(float gain)
Set a track's gain control.
Definition SDL3pp_mixer.h:6402
void SetLoops(int num_loops)
Change the number of times a currently-playing track will loop.
Definition SDL3pp_mixer.h:5426
Point3D Get3DPosition()
Get a track's current position in 3D space.
Definition SDL3pp_mixer.h:6760
void SetGroupPostMixCallback(GroupRef group, GroupMixCallback cb, void *userdata)
Set a callback that fires when a mixer group has completed mixing.
Definition SDL3pp_mixer.h:7167
void Untag(StringParam tag)
Remove an arbitrary tag from a track.
Definition SDL3pp_mixer.h:5203
MixerLock(MixerRef resource)
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:4095
ResourceRefT< AudioDecoderBase > AudioDecoderRef
Reference for AudioDecoder.
Definition SDL3pp_mixer.h:186
bool Pause()
Pause a currently-playing track.
Definition SDL3pp_mixer.h:6116
void SetTrackAudioStream(TrackRef track, AudioStreamRef stream)
Set a Track's input to an AudioStream.
Definition SDL3pp_mixer.h:5009
Audio LoadRawAudio_IO(MixerRef mixer, IOStreamRef io, const AudioSpec &spec, bool closeio=false)
Load raw PCM data from an IOStream.
Definition SDL3pp_mixer.h:4473
int Generate(MixerRef mixer, TargetBytes buffer)
Generate mixer output when not driving an audio device.
Definition SDL3pp_mixer.h:7324
void SetAudioStream(AudioStreamRef stream)
Set a Track's input to an AudioStream.
Definition SDL3pp_mixer.h:5014
PropertiesRef GetProperties()
Get the properties associated with a mixer.
Definition SDL3pp_mixer.h:3995
void SetTrackOutputChannelMap(TrackRef track, std::span< const int > chmap)
Set the current output channel map of a track.
Definition SDL3pp_mixer.h:6634
Sint64 GetDuration()
Get the length of a Audio's playback in sample frames.
Definition SDL3pp_mixer.h:4767
void StopTag(StringParam tag, Sint64 fade_out_ms)
Halt all tracks with a specific tag, possibly fading out over time.
Definition SDL3pp_mixer.h:6087
void ResumeTag(StringParam tag)
Resume all tracks with a specific tag.
Definition SDL3pp_mixer.h:6261
Audio LoadAudioNoCopy(SourceBytes data, bool free_when_done)
Load audio for playback from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4343
Audio LoadAudio_IO(MixerRef mixer, IOStreamRef io, bool predecode, bool closeio=false)
Load audio for playback from an IOStream.
Definition SDL3pp_mixer.h:4194
MIX_AudioDecoder * AudioDecoderRaw
Alias to raw representation for AudioDecoder.
Definition SDL3pp_mixer.h:179
OwnArray< TrackRef > GetTaggedTracks(StringParam tag)
Get all tracks with a specific tag.
Definition SDL3pp_mixer.h:5248
void DestroyMixer(MixerRaw mixer)
Free a mixer.
Definition SDL3pp_mixer.h:3969
AudioStreamRef GetTrackAudioStream(TrackRef track)
Query the AudioStream assigned to a track.
Definition SDL3pp_mixer.h:5479
Sint64 GetFadeFrames()
Query whether a given track is fading.
Definition SDL3pp_mixer.h:5358
bool Stop(Sint64 fade_out_frames)
Halt a currently-playing track, possibly fading out over time.
Definition SDL3pp_mixer.h:6004
void SetTrackRawCallback(TrackRef track, TrackMixCallback cb, void *userdata)
Set a callback that fires when a Track has initial decoded audio.
Definition SDL3pp_mixer.h:7009
Milliseconds AudioFramesToMS(AudioRef audio, Sint64 frames)
Convert sample frames for a Audio's format to milliseconds.
Definition SDL3pp_mixer.h:5642
void SetTrackAudio(TrackRef track, AudioRef audio)
Set a Track's input to a Audio.
Definition SDL3pp_mixer.h:4959
void StopTag(MixerRef mixer, StringParam tag, Sint64 fade_out_ms)
Halt all tracks with a specific tag, possibly fading out over time.
Definition SDL3pp_mixer.h:6082
void SetGroup(GroupRef group)
Assign a track to a mixing group.
Definition SDL3pp_mixer.h:6896
void(SDLCALL *)(void *userdata, MixerRaw mixer, const AudioSpec *spec, float *pcm, int samples) PostMixCallback
A callback that fires when all mixing has completed.
Definition SDL3pp_mixer.h:224
void SetStereo(const StereoGains &gains)
Force a track to stereo output, with optionally left/right panning.
Definition SDL3pp_mixer.h:6680
Sint64 GetPlaybackPosition()
Get the current input position of a playing track.
Definition SDL3pp_mixer.h:5326
Sint64 MSToFrames(int sample_rate, Milliseconds ms)
Convert milliseconds to sample frames at a specific sample rate.
Definition SDL3pp_mixer.h:5668
constexpr Sint64 DURATION_INFINITE
Infinite duration, when the audio never runs out of sound to generate.
Definition SDL3pp_mixer.h:4773
bool ResumeTrack(TrackRef track)
Resume a currently-paused track.
Definition SDL3pp_mixer.h:6200
void SetPostMixCallback(GroupMixCallback cb, void *userdata)
Set a callback that fires when a mixer group has completed mixing.
Definition SDL3pp_mixer.h:7202
void PlayTag(StringParam tag, PropertiesRef options)
Start (or restart) mixing all tracks with a specific tag for playback.
Definition SDL3pp_mixer.h:5922
void DestroyAudio(AudioRaw audio)
Destroy the specified audio.
Definition SDL3pp_mixer.h:4821
bool StopTrack(TrackRef track, Sint64 fade_out_frames)
Halt a currently-playing track, possibly fading out over time.
Definition SDL3pp_mixer.h:5999
void SetTrackRawIOStream(TrackRef track, IOStreamRef io, const AudioSpec &spec, bool closeio=false)
Set a Track's input to an IOStream providing raw PCM data.
Definition SDL3pp_mixer.h:5126
bool PauseTrack(TrackRef track)
Pause a currently-playing track.
Definition SDL3pp_mixer.h:6114
float GetTrackGain(TrackRef track)
Get a track's gain control.
Definition SDL3pp_mixer.h:6420
void SetPostMixCallback(MixerRef mixer, PostMixCallback cb, void *userdata)
Set a callback that fires when all mixing has completed.
Definition SDL3pp_mixer.h:7230
PropertiesRef GetTrackProperties(TrackRef track)
Get the properties associated with a track.
Definition SDL3pp_mixer.h:4898
MakeFrontCallback< void(MixerRaw mixer, const AudioSpec *spec, float *pcm, int samples)> PostMixCB
A callback that fires when all mixing has completed.
Definition SDL3pp_mixer.h:264
MixerLock Lock()
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:4093
MIX_Track * TrackRaw
Alias to raw representation for Track.
Definition SDL3pp_mixer.h:147
float GetMixerGain(MixerRef mixer)
Get a mixer's master gain control.
Definition SDL3pp_mixer.h:6368
float GetFrequencyRatio()
Get a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6526
int GetNumAudioDecoders()
Report the number of audio decoders available for use.
Definition SDL3pp_mixer.h:3820
float GetFrequencyRatio()
Query the frequency ratio of a track.
Definition SDL3pp_mixer.h:6594
Sint64 GetAudioDuration(AudioRef audio)
Get the length of a Audio's playback in sample frames.
Definition SDL3pp_mixer.h:4762
void Destroy()
Destroy a mixing group.
Definition SDL3pp_mixer.h:6819
void SetAudio(AudioRef audio)
Set a Track's input to a Audio.
Definition SDL3pp_mixer.h:4964
Mixer CreateMixerDevice(AudioDeviceRef devid, OptionalRef< const AudioSpec > spec=std::nullopt)
Create a mixer that plays sound directly to an audio device.
Definition SDL3pp_mixer.h:3901
OwnArray< char * > GetTags()
Get the tags currently associated with a track.
Definition SDL3pp_mixer.h:5225
void StopAllTracks(MixerRef mixer, Sint64 fade_out_ms)
Halt all currently-playing tracks, possibly fading out over time.
Definition SDL3pp_mixer.h:6041
Sint64 GetTrackRemaining(TrackRef track)
Return the number of sample frames remaining to be mixed in a track.
Definition SDL3pp_mixer.h:5514
void SetOutputChannelMap(std::span< const int > chmap)
Set the current output channel map of a track.
Definition SDL3pp_mixer.h:6640
void TagTrack(TrackRef track, StringParam tag)
Assign an arbitrary tag to a track.
Definition SDL3pp_mixer.h:5168
PropertiesRef GetAudioProperties(AudioRef audio)
Get the properties associated with a Audio.
Definition SDL3pp_mixer.h:4684
Audio LoadAudio(MixerRef mixer, StringParam path, bool predecode)
Load audio for playback from a file.
Definition SDL3pp_mixer.h:4269
void PauseAllTracks(MixerRef mixer)
Pause all currently-playing tracks.
Definition SDL3pp_mixer.h:6138
Audio LoadAudio_IO(IOStreamRef io, bool predecode, bool closeio=false)
Load audio for playback from an IOStream.
Definition SDL3pp_mixer.h:4202
void SetFrequencyRatio(float ratio)
Set a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6500
void SetStoppedCallback(TrackStoppedCallback cb, void *userdata)
Set a callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:6969
MixerRef GetMixer()
Get the Mixer that owns a Group.
Definition SDL3pp_mixer.h:6866
AudioDecoder CreateAudioDecoder_IO(IOStreamRef io, bool closeio=false, PropertiesRef props=nullptr)
Create a AudioDecoder from an IOStream.
Definition SDL3pp_mixer.h:7629
void SetPlaybackPosition(Sint64 frames)
Seek a playing track to a new position in its input.
Definition SDL3pp_mixer.h:5293
Audio LoadAudioNoCopy(MixerRef mixer, SourceBytes data, bool free_when_done)
Load audio for playback from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4335
Sint64 AudioMSToFrames(AudioRef audio, Milliseconds ms)
Convert milliseconds to sample frames for a Audio's format.
Definition SDL3pp_mixer.h:5610
void LockMixer(MixerRef mixer)
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:4091
void GetFormat(AudioSpec *spec)
Query the initial audio format of a AudioDecoder.
Definition SDL3pp_mixer.h:7708
PropertiesRef GetMixerProperties(MixerRef mixer)
Get the properties associated with a mixer.
Definition SDL3pp_mixer.h:3990
void SetPostMixCallback(PostMixCallback cb, void *userdata)
Set a callback that fires when all mixing has completed.
Definition SDL3pp_mixer.h:7263
float GetMixerFrequencyRatio(MixerRef mixer)
Get a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6521
void SetTrackFrequencyRatio(TrackRef track, float ratio)
Change the frequency ratio of a track.
Definition SDL3pp_mixer.h:6554
void GetFormat(AudioSpec *spec)
Query the initial audio format of a Audio.
Definition SDL3pp_mixer.h:4796
bool TrackPlaying(TrackRef track)
Query if a track is currently playing.
Definition SDL3pp_mixer.h:6289
int GetLoops()
Query how many loops remain for a given track.
Definition SDL3pp_mixer.h:5391
Milliseconds TrackFramesToMS(TrackRef track, Sint64 frames)
Convert sample frames for a track's current format to milliseconds.
Definition SDL3pp_mixer.h:5581
void reset()
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:4131
void SetCookedCallback(TrackMixCallback cb, void *userdata)
Set a callback that fires when the mixer has transformed a track's audio.
Definition SDL3pp_mixer.h:7132
void Set3DPosition(const Point3D &position)
Set a track's position in 3D space.
Definition SDL3pp_mixer.h:6732
AudioDecoder CreateAudioDecoder(StringParam path, PropertiesRef props=nullptr)
Create a AudioDecoder from a path on the filesystem.
Definition SDL3pp_mixer.h:7575
Group CreateGroup(MixerRef mixer)
Create a mixing group.
Definition SDL3pp_mixer.h:6794
Sint64 GetTrackFadeFrames(TrackRef track)
Query whether a given track is fading.
Definition SDL3pp_mixer.h:5353
TrackRef CreateTrack()
Create a new track on a mixer.
Definition SDL3pp_mixer.h:4849
Sint64 MSToFrames(Milliseconds ms)
Convert milliseconds to sample frames for a Audio's format.
Definition SDL3pp_mixer.h:5615
Audio LoadRawAudio(SourceBytes data, const AudioSpec &spec)
Load raw PCM data from a memory buffer.
Definition SDL3pp_mixer.h:4529
PropertiesRef GetGroupProperties(GroupRef group)
Get the properties associated with a group.
Definition SDL3pp_mixer.h:6838
void SetMixerFrequencyRatio(MixerRef mixer, float ratio)
Set a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6495
constexpr Sint64 DURATION_UNKNOWN
Unknown duration, when the length of the audio can't be determined.
Definition SDL3pp_mixer.h:4770
Audio LoadRawAudio_IO(IOStreamRef io, const AudioSpec &spec, bool closeio=false)
Load raw PCM data from an IOStream.
Definition SDL3pp_mixer.h:4481
Audio LoadRawAudioNoCopy(MixerRef mixer, SourceBytes data, const AudioSpec &spec, bool free_when_done)
Load raw PCM data from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4574
void SetTrack3DPosition(TrackRef track, const Point3D &position)
Set a track's position in 3D space.
Definition SDL3pp_mixer.h:6727
MIX_Point3D Point3D
3D coordinates for SetTrack3DPosition.
Definition SDL3pp_mixer.h:1984
MIX_Audio * AudioRaw
Alias to raw representation for Audio.
Definition SDL3pp_mixer.h:131
bool PlayAudio(MixerRef mixer, AudioRef audio)
Play a Audio from start to finish without any management.
Definition SDL3pp_mixer.h:5957
void ResumeAllTracks(MixerRef mixer)
Resume all currently-paused tracks.
Definition SDL3pp_mixer.h:6224
void DestroyGroup(GroupRaw group)
Destroy a mixing group.
Definition SDL3pp_mixer.h:6817
Audio LoadAudio(StringParam path, bool predecode)
Load audio for playback from a file.
Definition SDL3pp_mixer.h:4274
void SetTrackGroup(TrackRef track, GroupRef group)
Assign a track to a mixing group.
Definition SDL3pp_mixer.h:6891
float GetGain()
Get a mixer's master gain control.
Definition SDL3pp_mixer.h:6370
MixerRef GetTrackMixer(TrackRef track)
Get the Mixer that owns a Track.
Definition SDL3pp_mixer.h:4921
MIX_Mixer * MixerRaw
Alias to raw representation for Mixer.
Definition SDL3pp_mixer.h:115
void GetFormat(AudioSpec *spec)
Get the audio format a mixer is generating.
Definition SDL3pp_mixer.h:4043
void PlayTag(MixerRef mixer, StringParam tag, PropertiesRef options)
Start (or restart) mixing all tracks with a specific tag for playback.
Definition SDL3pp_mixer.h:5917
void SetRawCallback(TrackMixCallback cb, void *userdata)
Set a callback that fires when a Track has initial decoded audio.
Definition SDL3pp_mixer.h:7048
void StopAllTracks(Sint64 fade_out_ms)
Halt all currently-playing tracks, possibly fading out over time.
Definition SDL3pp_mixer.h:6046
MixerRef GetMixer()
Get the Mixer that owns a Track.
Definition SDL3pp_mixer.h:4926
MixerRef GetGroupMixer(GroupRef group)
Get the Mixer that owns a Group.
Definition SDL3pp_mixer.h:6861
ResourceRefT< AudioBase > AudioRef
Reference for Audio.
Definition SDL3pp_mixer.h:138
bool TrackPaused(TrackRef track)
Query if a track is currently paused.
Definition SDL3pp_mixer.h:6316
void SetMixerGain(MixerRef mixer, float gain)
Set a mixer's master gain control.
Definition SDL3pp_mixer.h:6345
void SetTrackGain(TrackRef track, float gain)
Set a track's gain control.
Definition SDL3pp_mixer.h:6397
void PauseAllTracks()
Pause all currently-playing tracks.
Definition SDL3pp_mixer.h:6143
void Play(PropertiesRef options=nullptr)
Start (or restart) mixing a track for playback.
Definition SDL3pp_mixer.h:5820
GroupRef CreateGroup()
Create a mixing group.
Definition SDL3pp_mixer.h:6796
int GetTrackLoops(TrackRef track)
Query how many loops remain for a given track.
Definition SDL3pp_mixer.h:5389
ResourceRefT< MixerBase > MixerRef
Reference for Mixer.
Definition SDL3pp_mixer.h:122
void SetFrequencyRatio(float ratio)
Change the frequency ratio of a track.
Definition SDL3pp_mixer.h:6559
void Destroy()
Free a mixer.
Definition SDL3pp_mixer.h:3971
Sint64 GetTrackPlaybackPosition(TrackRef track)
Get the current input position of a playing track.
Definition SDL3pp_mixer.h:5321
void DestroyTrack(TrackRaw track)
Destroy the specified track.
Definition SDL3pp_mixer.h:4877
void Tag(StringParam tag)
Assign an arbitrary tag to a track.
Definition SDL3pp_mixer.h:5173
void SetTrackLoops(TrackRef track, int num_loops)
Change the number of times a currently-playing track will loop.
Definition SDL3pp_mixer.h:5421
Audio CreateSineWaveAudio(int hz, float amplitude, Sint64 ms)
Create a Audio that generates a sinewave.
Definition SDL3pp_mixer.h:4634
Point3D GetTrack3DPosition(TrackRef track)
Get a track's current position in 3D space.
Definition SDL3pp_mixer.h:6753
Mixer CreateMixer(const AudioSpec &spec)
Create a mixer that generates audio to a memory buffer.
Definition SDL3pp_mixer.h:3944
void GetAudioFormat(AudioRef audio, AudioSpec *spec)
Query the initial audio format of a Audio.
Definition SDL3pp_mixer.h:4791
float GetGain()
Get a track's gain control.
Definition SDL3pp_mixer.h:6422
MIX_StereoGains StereoGains
A set of per-channel gains for tracks using SetTrackStereo().
Definition SDL3pp_mixer.h:1972
OwnArray< TrackRef > GetTaggedTracks(MixerRef mixer, StringParam tag)
Get all tracks with a specific tag.
Definition SDL3pp_mixer.h:5241
Milliseconds FramesToMS(Sint64 frames)
Convert sample frames for a track's current format to milliseconds.
Definition SDL3pp_mixer.h:5586
int DecodeAudio(TargetBytes buffer, const AudioSpec &spec)
Decode more audio from a AudioDecoder.
Definition SDL3pp_mixer.h:7743
Milliseconds FramesToMS(Sint64 frames)
Convert sample frames for a Audio's format to milliseconds.
Definition SDL3pp_mixer.h:5647
int DecodeAudio(AudioDecoderRef audiodecoder, TargetBytes buffer, const AudioSpec &spec)
Decode more audio from a AudioDecoder.
Definition SDL3pp_mixer.h:7733
void(SDLCALL *)(void *userdata, GroupRaw group, const AudioSpec *spec, float *pcm, int samples) GroupMixCallback
A callback that fires when a Group has completed mixing.
Definition SDL3pp_mixer.h:3462
Sint64 GetRemaining()
Return the number of sample frames remaining to be mixed in a track.
Definition SDL3pp_mixer.h:5519
ResourceRefT< TrackBase > TrackRef
Reference for Track.
Definition SDL3pp_mixer.h:154
AudioRef GetTrackAudio(TrackRef track)
Query the Audio assigned to a track.
Definition SDL3pp_mixer.h:5451
void SetIOStream(IOStreamRef io, bool closeio=false)
Set a Track's input to an IOStream.
Definition SDL3pp_mixer.h:5073
::Sint64 Sint64
A signed 64-bit integer type.
Definition SDL3pp_stdinc.h:311
std::chrono::milliseconds Milliseconds
Duration in Miliseconds (Uint32).
Definition SDL3pp_stdinc.h:341
Metadata for audio.
Definition SDL3pp_mixer.h:4699
constexpr auto TOTAL_TRACKS_NUMBER
Number for total tracks.
Definition SDL3pp_mixer.h:4716
constexpr auto DURATION_FRAMES_NUMBER
Number for duration frames.
Definition SDL3pp_mixer.h:4722
constexpr auto YEAR_NUMBER
Number for year.
Definition SDL3pp_mixer.h:4719
constexpr auto ARTIST_STRING
String for artist.
Definition SDL3pp_mixer.h:4704
constexpr auto TITLE_STRING
String for title.
Definition SDL3pp_mixer.h:4701
constexpr auto COPYRIGHT_STRING
String for copyright.
Definition SDL3pp_mixer.h:4710
constexpr auto DURATION_INFINITE_BOOLEAN
Enable duration infinite.
Definition SDL3pp_mixer.h:4725
constexpr auto TRACK_NUMBER
Number for track.
Definition SDL3pp_mixer.h:4713
constexpr auto ALBUM_STRING
String for album.
Definition SDL3pp_mixer.h:4707
Properties for configuring audio loading.
Definition SDL3pp_mixer.h:4408
constexpr auto LOAD_IGNORE_LOOPS_BOOLEAN
Load ignore loops enabled.
Definition SDL3pp_mixer.h:4429
constexpr auto DECODER_STRING
String for decoder.
Definition SDL3pp_mixer.h:4434
constexpr auto LOAD_CLOSEIO_BOOLEAN
Load closeio enabled.
Definition SDL3pp_mixer.h:4413
constexpr auto LOAD_IOSTREAM_POINTER
Pointer to load iostream.
Definition SDL3pp_mixer.h:4410
constexpr auto LOAD_PREDECODE_BOOLEAN
Load predecode enabled.
Definition SDL3pp_mixer.h:4416
constexpr auto LOAD_SKIP_METADATA_TAGS_BOOLEAN
Enable load skip metadata tags.
Definition SDL3pp_mixer.h:4423
constexpr auto LOAD_PREFERRED_MIXER_POINTER
Pointer to load preferred mixer.
Definition SDL3pp_mixer.h:4419
Properties for Mixer.
Definition SDL3pp_mixer.h:4005
constexpr auto DEVICE_NUMBER
Device number.
Definition SDL3pp_mixer.h:4007
Properties that can be used in the options parameter of Track.Play().
Definition SDL3pp_mixer.h:5830
constexpr auto START_MILLISECOND_NUMBER
Number for start millisecond.
Definition SDL3pp_mixer.h:5843
constexpr auto LOOPS_NUMBER
Number for loops.
Definition SDL3pp_mixer.h:5832
constexpr auto START_ORDER_NUMBER
Number for start order.
Definition SDL3pp_mixer.h:5848
constexpr auto MAX_FRAME_NUMBER
Number for max frame.
Definition SDL3pp_mixer.h:5834
constexpr auto HALT_WHEN_EXHAUSTED_BOOLEAN
Halt when exhausted enabled.
Definition SDL3pp_mixer.h:5878
constexpr auto LOOP_START_FRAME_NUMBER
Number for loop start frame.
Definition SDL3pp_mixer.h:5853
constexpr auto FADE_IN_START_GAIN_FLOAT
Float for fade in start gain.
Definition SDL3pp_mixer.h:5867
constexpr auto APPEND_SILENCE_FRAMES_NUMBER
Number for append silence frames.
Definition SDL3pp_mixer.h:5870
constexpr auto FADE_IN_MILLISECONDS_NUMBER
Number for fade in milliseconds.
Definition SDL3pp_mixer.h:5863
constexpr auto FADE_IN_FRAMES_NUMBER
Number for fade in frames.
Definition SDL3pp_mixer.h:5860
constexpr auto START_FRAME_NUMBER
Number for start frame.
Definition SDL3pp_mixer.h:5840
constexpr auto MAX_MILLISECONDS_NUMBER
Number for max milliseconds.
Definition SDL3pp_mixer.h:5837
constexpr auto APPEND_SILENCE_MILLISECONDS_NUMBER
Number for append silence milliseconds.
Definition SDL3pp_mixer.h:5874
constexpr auto LOOP_START_MILLISECOND_NUMBER
Number for loop start millisecond.
Definition SDL3pp_mixer.h:5856
Main include header for the SDL3pp library.
Sint32 narrowS32(T value)
Narrows to Sint32.
Definition SDL3pp_stdinc.h:6262
Base class to Audio.
Definition SDL3pp_mixer.h:1527
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Base class to AudioDecoder.
Definition SDL3pp_mixer.h:7341
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque object that represents an audio decoder.
Definition SDL3pp_mixer.h:7435
constexpr AudioDecoder(AudioDecoderRaw resource) noexcept
Constructs from raw AudioDecoder.
Definition SDL3pp_mixer.h:7445
constexpr AudioDecoder & operator=(AudioDecoder &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:7535
~AudioDecoder()
Destructor.
Definition SDL3pp_mixer.h:7532
constexpr AudioDecoder(AudioDecoder &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:7451
An opaque object that represents audio data.
Definition SDL3pp_mixer.h:1707
constexpr Audio(Audio &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:1723
constexpr Audio(AudioRaw resource) noexcept
Constructs from raw Audio.
Definition SDL3pp_mixer.h:1717
constexpr Audio & operator=(Audio &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:1949
~Audio()
Destructor.
Definition SDL3pp_mixer.h:1946
Base class to Group.
Definition SDL3pp_mixer.h:3510
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque object that represents a grouping of tracks.
Definition SDL3pp_mixer.h:3605
~Group()
Destructor.
Definition SDL3pp_mixer.h:3659
constexpr Group & operator=(Group &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:3662
constexpr Group(GroupRaw resource) noexcept
Constructs from raw Group.
Definition SDL3pp_mixer.h:3615
constexpr Group(Group &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:3621
Definition SDL3pp_callbackWrapper.h:169
Base class to Mixer.
Definition SDL3pp_mixer.h:273
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque object that represents a mixer.
Definition SDL3pp_mixer.h:1249
constexpr Mixer(MixerRaw resource) noexcept
Constructs from raw Mixer.
Definition SDL3pp_mixer.h:1259
constexpr Mixer(Mixer &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:1265
~Mixer()
Destructor.
Definition SDL3pp_mixer.h:1348
constexpr Mixer & operator=(Mixer &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:1351
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
Base class to Track.
Definition SDL3pp_mixer.h:2120
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque object that represents a source of sound output to be mixed.
Definition SDL3pp_mixer.h:3372
constexpr Track & operator=(Track &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:3423
constexpr Track(TrackRaw resource) noexcept
Constructs from raw Track.
Definition SDL3pp_mixer.h:3382
constexpr Track(Track &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:3388
~Track()
Destructor.
Definition SDL3pp_mixer.h:3420