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
463 Audio LoadAudio_IO(IOStreamParam io, bool predecode);
464
492 Audio LoadAudio(StringParam path, bool predecode);
493
550 Audio LoadAudioNoCopy(SourceBytes data, bool free_when_done);
551
584
618 Audio LoadRawAudio(SourceBytes data, const AudioSpec& spec);
619
660 const AudioSpec& spec,
661 bool free_when_done = false);
662
698 Audio CreateSineWaveAudio(int hz, float amplitude, Sint64 ms);
699
724
739
774 void PlayTag(StringParam tag, PropertiesRef options);
775
805 bool PlayAudio(AudioRef audio);
806
839 void StopAllTracks(Sint64 fade_out_ms);
840
871 void StopTag(StringParam tag, Sint64 fade_out_ms);
872
892 void PauseAllTracks();
893
919 void PauseTag(StringParam tag);
920
940 void ResumeAllTracks();
941
967 void ResumeTag(StringParam tag);
968
993 void SetGain(float gain);
994
1010 float GetGain();
1011
1045 void SetTagGain(StringParam tag, float gain);
1046
1074 void SetFrequencyRatio(float ratio);
1075
1091 float GetFrequencyRatio();
1092
1123
1147 void SetPostMixCallback(PostMixCallback cb, void* userdata);
1148
1171
1223 int Generate(TargetBytes buffer);
1224};
1225
1243{
1244 using MixerBase::MixerBase;
1245
1253 constexpr explicit Mixer(MixerRaw resource) noexcept
1254 : MixerBase(resource)
1255 {
1256 }
1257
1259 constexpr Mixer(Mixer&& other) noexcept
1260 : Mixer(other.release())
1261 {
1262 }
1263
1310 Mixer(AudioDeviceRef devid, OptionalRef<const AudioSpec> spec = std::nullopt);
1311
1339 Mixer(const AudioSpec& spec);
1340
1342 ~Mixer() { MIX_DestroyMixer(get()); }
1343
1345 constexpr Mixer& operator=(Mixer&& other) noexcept
1346 {
1347 swap(*this, other);
1348 return *this;
1349 }
1350};
1351
1394{
1395 MixerRef m_lock;
1396
1397public:
1442
1444 MixerLock(const MixerLock& other) = delete;
1445
1447 MixerLock(MixerLock&& other) noexcept
1448 : m_lock(std::move(other.m_lock))
1449 {
1450 }
1451
1473
1474 MixerLock& operator=(const MixerLock& other) = delete;
1475
1477 MixerLock& operator=(MixerLock&& other) noexcept
1478 {
1479 std::swap(m_lock, other.m_lock);
1480 return *this;
1481 }
1482
1484 constexpr operator bool() const { return bool(m_lock); }
1485
1506 void reset();
1507
1509 MixerRef resource() const { return m_lock; }
1510
1512 void release() { m_lock.release(); }
1513};
1514
1520struct AudioBase : ResourceBaseT<AudioRaw>
1521{
1523
1542 void Destroy();
1543
1589
1622
1638 void GetFormat(AudioSpec* spec);
1639
1659
1682};
1683
1701{
1702 using AudioBase::AudioBase;
1703
1711 constexpr explicit Audio(AudioRaw resource) noexcept
1712 : AudioBase(resource)
1713 {
1714 }
1715
1717 constexpr Audio(Audio&& other) noexcept
1718 : Audio(other.release())
1719 {
1720 }
1721
1777 Audio(MixerRef mixer, IOStreamParam io, bool predecode);
1778
1808 Audio(MixerRef mixer, StringParam path, bool predecode);
1809
1860 Audio(PropertiesRef props);
1861
1894 Audio(MixerRef mixer, IOStreamParam io, const AudioSpec& spec);
1895
1930 Audio(MixerRef mixer, SourceBytes data, const AudioSpec& spec);
1931
1933 ~Audio() { MIX_DestroyAudio(get()); }
1934
1936 constexpr Audio& operator=(Audio&& other) noexcept
1937 {
1938 swap(*this, other);
1939 return *this;
1940 }
1941};
1942
1959using StereoGains = MIX_StereoGains;
1960
1971using Point3D = MIX_Point3D;
1972
1994using TrackStoppedCallback = void(SDLCALL*)(void* userdata, TrackRaw track);
1995
2019
2056using TrackMixCallback = void(SDLCALL*)(void* userdata,
2057 TrackRaw track,
2058 const AudioSpec* spec,
2059 float* pcm,
2060 int samples);
2061
2099 void(TrackRaw track, const AudioSpec* spec, float* pcm, int samples)>;
2100
2106struct TrackBase : ResourceBaseT<TrackRaw>
2107{
2109
2129 void Destroy();
2130
2148
2162
2193 void SetAudio(AudioRef audio);
2194
2234 void SetAudioStream(AudioStreamRef stream);
2235
2282 void SetIOStream(IOStreamParam io);
2283
2330 void SetRawIOStream(IOStreamParam io, const AudioSpec& spec);
2331
2358 void Tag(StringParam tag);
2359
2382 void Untag(StringParam tag);
2383
2397
2432 void SetPlaybackPosition(Sint64 frames);
2433
2458
2481
2507 int GetLoops();
2508
2537 void SetLoops(int num_loops);
2538
2560
2582
2608
2632
2659
2778 void Play(PropertiesRef options = nullptr);
2779
2811 bool Stop(Sint64 fade_out_frames);
2812
2834 bool Pause();
2835
2857 bool Resume();
2858
2881 bool Playing();
2882
2906 bool Paused();
2907
2932 void SetGain(float gain);
2933
2949 float GetGain();
2950
2973 void SetFrequencyRatio(float ratio);
2974
2999 float GetFrequencyRatio();
3000
3035 void SetOutputChannelMap(std::span<const int> chmap);
3036
3066 void SetStereo(const StereoGains& gains);
3067
3110 void Set3DPosition(const Point3D& position);
3111
3128
3151 void SetGroup(GroupRef group);
3152
3182 void SetStoppedCallback(TrackStoppedCallback cb, void* userdata);
3183
3212
3242 void SetRawCallback(TrackMixCallback cb, void* userdata);
3243
3271 void SetRawCallback(TrackMixCB cb);
3272
3305 void SetCookedCallback(TrackMixCallback cb, void* userdata);
3306
3338};
3339
3355{
3356 using TrackBase::TrackBase;
3357
3365 constexpr explicit Track(TrackRaw resource) noexcept
3366 : TrackBase(resource)
3367 {
3368 }
3369
3371 constexpr Track(Track&& other) noexcept
3372 : Track(other.release())
3373 {
3374 }
3375
3400 Track(MixerRef mixer);
3401
3403 ~Track() { MIX_DestroyTrack(get()); }
3404
3406 constexpr Track& operator=(Track&& other) noexcept
3407 {
3408 swap(*this, other);
3409 return *this;
3410 }
3411};
3412
3445using GroupMixCallback = void(SDLCALL*)(void* userdata,
3446 GroupRaw group,
3447 const AudioSpec* spec,
3448 float* pcm,
3449 int samples);
3450
3485 void(GroupRaw group, const AudioSpec* spec, float* pcm, int samples)>;
3486
3492struct GroupBase : ResourceBaseT<GroupRaw>
3493{
3495
3508 void Destroy();
3509
3527
3541
3567 void SetPostMixCallback(GroupMixCallback cb, void* userdata);
3568};
3569
3588{
3589 using GroupBase::GroupBase;
3590
3598 constexpr explicit Group(GroupRaw resource) noexcept
3599 : GroupBase(resource)
3600 {
3601 }
3602
3604 constexpr Group(Group&& other) noexcept
3605 : Group(other.release())
3606 {
3607 }
3608
3639 Group(MixerRef mixer);
3640
3642 ~Group() { MIX_DestroyGroup(get()); }
3643
3645 constexpr Group& operator=(Group&& other) noexcept
3646 {
3647 swap(*this, other);
3648 return *this;
3649 }
3650};
3651
3652#ifdef SDL3PP_DOC
3653
3661#define SDL_MIXER_MAJOR_VERSION
3662
3670#define SDL_MIXER_MINOR_VERSION
3671
3679#define SDL_MIXER_MICRO_VERSION
3680
3688#define SDL_MIXER_VERSION \
3689 SDL_VERSIONNUM( \
3690 SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)
3691
3697#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
3698 ((SDL_MIXER_MAJOR_VERSION >= X) && \
3699 (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION >= Y) && \
3700 (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION > Y || \
3701 SDL_MIXER_MICRO_VERSION >= Z))
3702
3703#endif // SDL3PP_DOC
3704
3705namespace MIX {
3706
3723inline int Version() { return MIX_Version(); }
3724
3743inline void Init() { CheckError(MIX_Init()); }
3744
3779inline void Quit() { MIX_Quit(); }
3780
3781} // namespace MIX
3782
3803inline int GetNumAudioDecoders() { return MIX_GetNumAudioDecoders(); }
3804
3834inline const char* GetAudioDecoder(int index)
3835{
3836 return MIX_GetAudioDecoder(index);
3837}
3838
3885 OptionalRef<const AudioSpec> spec = std::nullopt)
3886{
3887 return Mixer(devid, spec);
3888}
3889
3891 : Mixer(CheckError(MIX_CreateMixerDevice(devid, spec)))
3892{
3893}
3894
3895inline Mixer::Mixer(const AudioSpec& spec)
3896 : Mixer(CheckError(MIX_CreateMixer(&spec)))
3897{
3898}
3899
3927inline Mixer CreateMixer(const AudioSpec& spec) { return Mixer(spec); }
3928
3952inline void DestroyMixer(MixerRaw mixer) { MIX_DestroyMixer(mixer); }
3953
3955
3974{
3975 return CheckError(MIX_GetMixerProperties(mixer));
3976}
3977
3982
3988namespace prop::Mixer {
3989
3990constexpr auto DEVICE_NUMBER = MIX_PROP_MIXER_DEVICE_NUMBER;
3991
3992} // namespace prop::Mixer
3993
4021inline void GetMixerFormat(MixerRef mixer, AudioSpec* spec)
4022{
4023 CheckError(MIX_GetMixerFormat(mixer, spec));
4024}
4025
4027{
4028 SDL::GetMixerFormat(get(), spec);
4029}
4030
4074inline void LockMixer(MixerRef mixer) { MIX_LockMixer(mixer); }
4075
4076inline MixerLock MixerBase::Lock() { return {MixerRef(*this)}; }
4077
4079 : m_lock(std::move(resource))
4080{
4081 LockMixer(m_lock);
4082}
4083
4106inline void UnlockMixer(MixerRef mixer) { MIX_UnlockMixer(mixer); }
4107
4108inline void MixerBase::Unlock(MixerLock&& lock)
4109{
4110 SDL_assert_paranoid(lock.resource() == *this);
4111 std::move(lock).reset();
4112}
4113
4114inline void MixerLock::reset()
4115{
4116 if (!m_lock) return;
4117 UnlockMixer(m_lock);
4118 m_lock = {};
4119}
4120
4175inline Audio LoadAudio_IO(MixerRef mixer, IOStreamParam io, bool predecode)
4176{
4177 return Audio(mixer, io, predecode);
4178}
4179
4181{
4182 return Audio(get(), io, predecode);
4183}
4184
4185inline Audio::Audio(MixerRef mixer, IOStreamParam io, bool predecode)
4186 : Audio(CheckError(MIX_LoadAudio_IO(mixer, io.stream, predecode, io.closeio)))
4187{
4188}
4189
4190inline Audio::Audio(MixerRef mixer, StringParam path, bool predecode)
4191 : Audio(MIX_LoadAudio(mixer, path, predecode))
4192{
4193}
4194
4196 : Audio(CheckError(MIX_LoadAudioWithProperties(props)))
4197{
4198}
4199
4200inline Audio::Audio(MixerRef mixer, IOStreamParam io, const AudioSpec& spec)
4201 : Audio(CheckError(MIX_LoadRawAudio_IO(mixer, io.stream, &spec, io.closeio)))
4202{
4203}
4204
4205inline Audio::Audio(MixerRef mixer, SourceBytes data, const AudioSpec& spec)
4206 : Audio(CheckError(
4207 MIX_LoadRawAudio(mixer, data.data(), data.size_bytes(), &spec)))
4208{
4209}
4210
4239inline Audio LoadAudio(MixerRef mixer, StringParam path, bool predecode)
4240{
4241 return Audio(mixer, path, predecode);
4242}
4243
4244inline Audio MixerBase::LoadAudio(StringParam path, bool predecode)
4245{
4246 return Audio(get(), path, predecode);
4247}
4248
4306 SourceBytes data,
4307 bool free_when_done)
4308{
4309 return Audio(CheckError(MIX_LoadAudioNoCopy(
4310 mixer, data.data(), data.size_bytes(), free_when_done)));
4311}
4312
4313inline Audio MixerBase::LoadAudioNoCopy(SourceBytes data, bool free_when_done)
4314{
4315 return SDL::LoadAudioNoCopy(get(), std::move(data), free_when_done);
4316}
4317
4369{
4370 return Audio(props);
4371}
4372
4378namespace prop::Audio {
4379
4381 MIX_PROP_AUDIO_LOAD_IOSTREAM_POINTER;
4382
4383constexpr auto LOAD_CLOSEIO_BOOLEAN =
4384 MIX_PROP_AUDIO_LOAD_CLOSEIO_BOOLEAN;
4385
4387 MIX_PROP_AUDIO_LOAD_PREDECODE_BOOLEAN;
4388
4390 MIX_PROP_AUDIO_LOAD_PREFERRED_MIXER_POINTER;
4392
4394 MIX_PROP_AUDIO_LOAD_SKIP_METADATA_TAGS_BOOLEAN;
4396
4397#if SDL_MIXER_VERSION_ATLEAST(3, 2, 4)
4398
4400 MIX_PROP_AUDIO_LOAD_IGNORE_LOOPS_BOOLEAN;
4401
4402#endif // SDL_MIXER_VERSION_ATLEAST(3, 2, 4)
4403
4404constexpr auto DECODER_STRING =
4405 MIX_PROP_AUDIO_DECODER_STRING;
4406
4407} // namespace prop::Audio
4408
4442 IOStreamParam io,
4443 const AudioSpec& spec)
4444{
4445 return Audio(mixer, io, spec);
4446}
4447
4449{
4450 return Audio(get(), io, spec);
4451}
4452
4488 SourceBytes data,
4489 const AudioSpec& spec)
4490{
4491 return Audio(mixer, std::move(data), spec);
4492}
4493
4495{
4496 return Audio(get(), std::move(data), spec);
4497}
4498
4540 SourceBytes data,
4541 const AudioSpec& spec,
4542 bool free_when_done = false)
4543{
4544 return Audio(CheckError(MIX_LoadRawAudioNoCopy(
4545 mixer, data.data(), data.size_bytes(), &spec, free_when_done)));
4546}
4547
4549 const AudioSpec& spec,
4550 bool free_when_done)
4551{
4552 return SDL::LoadRawAudioNoCopy(get(), std::move(data), spec, free_when_done);
4553}
4554
4592 int hz,
4593 float amplitude,
4594 Sint64 ms)
4595{
4596 return Audio(CheckError(MIX_CreateSineWaveAudio(mixer, hz, amplitude, ms)));
4597}
4598
4599inline Audio MixerBase::CreateSineWaveAudio(int hz, float amplitude, Sint64 ms)
4600{
4601 return SDL::CreateSineWaveAudio(get(), hz, amplitude, ms);
4602}
4603
4650{
4651 return CheckError(MIX_GetAudioProperties(audio));
4652}
4653
4658
4665
4666constexpr auto TITLE_STRING =
4667 MIX_PROP_METADATA_TITLE_STRING;
4668
4669constexpr auto ARTIST_STRING =
4670 MIX_PROP_METADATA_ARTIST_STRING;
4671
4672constexpr auto ALBUM_STRING =
4673 MIX_PROP_METADATA_ALBUM_STRING;
4674
4675constexpr auto COPYRIGHT_STRING =
4676 MIX_PROP_METADATA_COPYRIGHT_STRING;
4677
4678constexpr auto TRACK_NUMBER =
4679 MIX_PROP_METADATA_TRACK_NUMBER;
4680
4681constexpr auto TOTAL_TRACKS_NUMBER =
4682 MIX_PROP_METADATA_TOTAL_TRACKS_NUMBER;
4683
4684constexpr auto YEAR_NUMBER =
4685 MIX_PROP_METADATA_YEAR_NUMBER;
4686
4688 MIX_PROP_METADATA_DURATION_FRAMES_NUMBER;
4689
4691 MIX_PROP_METADATA_DURATION_INFINITE_BOOLEAN;
4692
4693} // namespace prop::Audio::Metadata
4694
4728{
4729 return MIX_GetAudioDuration(audio);
4730}
4731
4733
4735constexpr Sint64 DURATION_UNKNOWN = MIX_DURATION_UNKNOWN;
4736
4738constexpr Sint64 DURATION_INFINITE = MIX_DURATION_INFINITE;
4739
4756inline void GetAudioFormat(AudioRef audio, AudioSpec* spec)
4757{
4758 CheckError(MIX_GetAudioFormat(audio, spec));
4759}
4760
4762{
4763 SDL::GetAudioFormat(get(), spec);
4764}
4765
4786inline void DestroyAudio(AudioRaw audio) { MIX_DestroyAudio(audio); }
4787
4789
4812inline Track CreateTrack(MixerRef mixer) { return Track(mixer); }
4813
4815
4817 : Track(CheckError(MIX_CreateTrack(mixer)))
4818{
4819}
4820
4842inline void DestroyTrack(TrackRaw track) { MIX_DestroyTrack(track); }
4843
4845
4864{
4865 return CheckError(MIX_GetTrackProperties(track));
4866}
4867
4872
4887{
4888 return CheckError(MIX_GetTrackMixer(track));
4889}
4890
4892
4924inline void SetTrackAudio(TrackRef track, AudioRef audio)
4925{
4926 CheckError(MIX_SetTrackAudio(track, audio));
4927}
4928
4930{
4931 SDL::SetTrackAudio(get(), audio);
4932}
4933
4975{
4976 CheckError(MIX_SetTrackAudioStream(track, stream));
4977}
4978
4980{
4981 SDL::SetTrackAudioStream(get(), stream);
4982}
4983
5031{
5032 CheckError(MIX_SetTrackIOStream(track, io.stream, io.closeio));
5033}
5034
5036{
5038}
5039
5088 IOStreamParam io,
5089 const AudioSpec& spec)
5090{
5091 CheckError(MIX_SetTrackRawIOStream(track, io.stream, &spec, io.closeio));
5092}
5093
5095{
5096 SDL::SetTrackRawIOStream(get(), io, spec);
5097}
5098
5126inline void TagTrack(TrackRef track, StringParam tag)
5127{
5128 CheckError(MIX_TagTrack(track, tag));
5129}
5130
5131inline void TrackBase::Tag(StringParam tag) { SDL::TagTrack(get(), tag); }
5132
5156inline void UntagTrack(TrackRef track, StringParam tag)
5157{
5158 MIX_UntagTrack(track, tag);
5159}
5160
5162
5177{
5178 int count;
5179 auto result = CheckError(MIX_GetTrackTags(track, &count));
5180 return OwnArray<char*>(result, count);
5181}
5182
5184
5200{
5201 int count;
5202 auto result = CheckError(MIX_GetTaggedTracks(mixer, tag, &count));
5203 return OwnArray<TrackRef>(reinterpret_cast<TrackRef*>(result), count);
5204}
5205
5210
5246inline void SetTrackPlaybackPosition(TrackRef track, Sint64 frames)
5247{
5248 CheckError(MIX_SetTrackPlaybackPosition(track, frames));
5249}
5250
5252{
5254}
5255
5280{
5281 return MIX_GetTrackPlaybackPosition(track);
5282}
5283
5288
5312{
5313 return MIX_GetTrackFadeFrames(track);
5314}
5315
5317{
5318 return SDL::GetTrackFadeFrames(get());
5319}
5320
5347inline int GetTrackLoops(TrackRef track) { return MIX_GetTrackLoops(track); }
5348
5349inline int TrackBase::GetLoops() { return SDL::GetTrackLoops(get()); }
5350
5379inline void SetTrackLoops(TrackRef track, int num_loops)
5380{
5381 CheckError(MIX_SetTrackLoops(track, num_loops));
5382}
5383
5384inline void TrackBase::SetLoops(int num_loops)
5385{
5386 SDL::SetTrackLoops(get(), num_loops);
5387}
5388
5410{
5411 return MIX_GetTrackAudio(track);
5412}
5413
5415
5438{
5439 return MIX_GetTrackAudioStream(track);
5440}
5441
5446
5473{
5474 return MIX_GetTrackRemaining(track);
5475}
5476
5478{
5479 return SDL::GetTrackRemaining(get());
5480}
5481
5505{
5506 return MIX_TrackMSToFrames(track, ms.count());
5507}
5508
5510{
5511 return SDL::TrackMSToFrames(get(), ms);
5512}
5513
5540{
5541 return Milliseconds(MIX_TrackFramesToMS(track, frames));
5542}
5543
5545{
5546 return SDL::TrackFramesToMS(get(), frames);
5547}
5548
5569{
5570 return MIX_AudioMSToFrames(audio, ms.count());
5571}
5572
5574{
5575 return SDL::AudioMSToFrames(get(), ms);
5576}
5577
5601{
5602 return Milliseconds(MIX_AudioFramesToMS(audio, frames));
5603}
5604
5606{
5607 return SDL::AudioFramesToMS(get(), frames);
5608}
5609
5626inline Sint64 MSToFrames(int sample_rate, Milliseconds ms)
5627{
5628 return MIX_MSToFrames(sample_rate, ms.count());
5629}
5630
5652inline Milliseconds FramesToMS(int sample_rate, Sint64 frames)
5653{
5654 return Milliseconds(MIX_FramesToMS(sample_rate, frames));
5655}
5656
5773inline void PlayTrack(TrackRef track, PropertiesRef options = nullptr)
5774{
5775 CheckError(MIX_PlayTrack(track, options));
5776}
5777
5778inline void TrackBase::Play(PropertiesRef options)
5779{
5780 SDL::PlayTrack(get(), options);
5781}
5782
5788namespace prop::Play {
5789
5790constexpr auto LOOPS_NUMBER = MIX_PROP_PLAY_LOOPS_NUMBER;
5791
5792constexpr auto MAX_FRAME_NUMBER =
5793 MIX_PROP_PLAY_MAX_FRAME_NUMBER;
5794
5796 MIX_PROP_PLAY_MAX_MILLISECONDS_NUMBER;
5797
5798constexpr auto START_FRAME_NUMBER =
5799 MIX_PROP_PLAY_START_FRAME_NUMBER;
5800
5802 MIX_PROP_PLAY_START_MILLISECOND_NUMBER;
5803
5804#if SDL_MIXER_VERSION_ATLEAST(3, 2, 2)
5805
5806constexpr auto START_ORDER_NUMBER =
5807 MIX_PROP_PLAY_START_ORDER_NUMBER;
5808
5809#endif // SDL_MIXER_VERSION_ATLEAST(3, 2, 2)
5810
5812 MIX_PROP_PLAY_LOOP_START_FRAME_NUMBER;
5813
5815 MIX_PROP_PLAY_LOOP_START_MILLISECOND_NUMBER;
5817
5819 MIX_PROP_PLAY_FADE_IN_FRAMES_NUMBER;
5820
5822 MIX_PROP_PLAY_FADE_IN_MILLISECONDS_NUMBER;
5824
5826 MIX_PROP_PLAY_FADE_IN_START_GAIN_FLOAT;
5827
5829 MIX_PROP_PLAY_APPEND_SILENCE_FRAMES_NUMBER;
5831
5833 MIX_PROP_PLAY_APPEND_SILENCE_MILLISECONDS_NUMBER;
5835
5837 MIX_PROP_PLAY_HALT_WHEN_EXHAUSTED_BOOLEAN;
5838
5839} // namespace prop::Play
5840
5875inline void PlayTag(MixerRef mixer, StringParam tag, PropertiesRef options)
5876{
5877 CheckError(MIX_PlayTag(mixer, tag, options));
5878}
5879
5881{
5882 SDL::PlayTag(get(), tag, options);
5883}
5884
5915inline bool PlayAudio(MixerRef mixer, AudioRef audio)
5916{
5917 return MIX_PlayAudio(mixer, audio);
5918}
5919
5921{
5922 return SDL::PlayAudio(get(), audio);
5923}
5924
5957inline bool StopTrack(TrackRef track, Sint64 fade_out_frames)
5958{
5959 return MIX_StopTrack(track, fade_out_frames);
5960}
5961
5962inline bool TrackBase::Stop(Sint64 fade_out_frames)
5963{
5964 return SDL::StopTrack(get(), fade_out_frames);
5965}
5966
5999inline void StopAllTracks(MixerRef mixer, Sint64 fade_out_ms)
6000{
6001 CheckError(MIX_StopAllTracks(mixer, fade_out_ms));
6002}
6003
6004inline void MixerBase::StopAllTracks(Sint64 fade_out_ms)
6005{
6006 SDL::StopAllTracks(get(), fade_out_ms);
6007}
6008
6040inline void StopTag(MixerRef mixer, StringParam tag, Sint64 fade_out_ms)
6041{
6042 CheckError(MIX_StopTag(mixer, tag, fade_out_ms));
6043}
6044
6045inline void MixerBase::StopTag(StringParam tag, Sint64 fade_out_ms)
6046{
6047 SDL::StopTag(get(), tag, fade_out_ms);
6048}
6049
6072inline bool PauseTrack(TrackRef track) { return MIX_PauseTrack(track); }
6073
6074inline bool TrackBase::Pause() { return SDL::PauseTrack(get()); }
6075
6096inline void PauseAllTracks(MixerRef mixer)
6097{
6098 CheckError(MIX_PauseAllTracks(mixer));
6099}
6100
6102
6129inline void PauseTag(MixerRef mixer, StringParam tag)
6130{
6131 CheckError(MIX_PauseTag(mixer, tag));
6132}
6133
6135
6158inline bool ResumeTrack(TrackRef track) { return MIX_ResumeTrack(track); }
6159
6160inline bool TrackBase::Resume() { return SDL::ResumeTrack(get()); }
6161
6182inline void ResumeAllTracks(MixerRef mixer)
6183{
6184 CheckError(MIX_ResumeAllTracks(mixer));
6185}
6186
6188
6214inline void ResumeTag(MixerRef mixer, StringParam tag)
6215{
6216 CheckError(MIX_ResumeTag(mixer, tag));
6217}
6218
6220{
6221 SDL::ResumeTag(get(), tag);
6222}
6223
6247inline bool TrackPlaying(TrackRef track) { return MIX_TrackPlaying(track); }
6248
6249inline bool TrackBase::Playing() { return SDL::TrackPlaying(get()); }
6250
6274inline bool TrackPaused(TrackRef track) { return MIX_TrackPaused(track); }
6275
6276inline bool TrackBase::Paused() { return SDL::TrackPaused(get()); }
6277
6303inline void SetMixerGain(MixerRef mixer, float gain)
6304{
6305 CheckError(MIX_SetMixerGain(mixer, gain));
6306}
6307
6308inline void MixerBase::SetGain(float gain) { SDL::SetMixerGain(get(), gain); }
6309
6326inline float GetMixerGain(MixerRef mixer) { return MIX_GetMixerGain(mixer); }
6327
6328inline float MixerBase::GetGain() { return SDL::GetMixerGain(get()); }
6329
6355inline void SetTrackGain(TrackRef track, float gain)
6356{
6357 CheckError(MIX_SetTrackGain(track, gain));
6358}
6359
6360inline void TrackBase::SetGain(float gain) { SDL::SetTrackGain(get(), gain); }
6361
6378inline float GetTrackGain(TrackRef track) { return MIX_GetTrackGain(track); }
6379
6380inline float TrackBase::GetGain() { return SDL::GetTrackGain(get()); }
6381
6416inline void SetTagGain(MixerRef mixer, StringParam tag, float gain)
6417{
6418 CheckError(MIX_SetTagGain(mixer, tag, gain));
6419}
6420
6421inline void MixerBase::SetTagGain(StringParam tag, float gain)
6422{
6423 SDL::SetTagGain(get(), tag, gain);
6424}
6425
6453inline void SetMixerFrequencyRatio(MixerRef mixer, float ratio)
6454{
6455 CheckError(MIX_SetMixerFrequencyRatio(mixer, ratio));
6456}
6457
6458inline void MixerBase::SetFrequencyRatio(float ratio)
6459{
6461}
6462
6480{
6481 return MIX_GetMixerFrequencyRatio(mixer);
6482}
6483
6485{
6487}
6488
6512inline void SetTrackFrequencyRatio(TrackRef track, float ratio)
6513{
6514 CheckError(MIX_SetTrackFrequencyRatio(track, ratio));
6515}
6516
6517inline void TrackBase::SetFrequencyRatio(float ratio)
6518{
6520}
6521
6548{
6549 return MIX_GetTrackFrequencyRatio(track);
6550}
6551
6553{
6555}
6556
6592inline void SetTrackOutputChannelMap(TrackRef track, std::span<const int> chmap)
6593{
6594 CheckError(
6595 MIX_SetTrackOutputChannelMap(track, chmap.data(), narrowS32(chmap.size())));
6596}
6597
6598inline void TrackBase::SetOutputChannelMap(std::span<const int> chmap)
6599{
6601}
6602
6633inline void SetTrackStereo(TrackRef track, const StereoGains& gains)
6634{
6635 CheckError(MIX_SetTrackStereo(track, &gains));
6636}
6637
6638inline void TrackBase::SetStereo(const StereoGains& gains)
6639{
6640 SDL::SetTrackStereo(get(), gains);
6641}
6642
6685inline void SetTrack3DPosition(TrackRef track, const Point3D& position)
6686{
6687 CheckError(MIX_SetTrack3DPosition(track, &position));
6688}
6689
6690inline void TrackBase::Set3DPosition(const Point3D& position)
6691{
6692 SDL::SetTrack3DPosition(get(), position);
6693}
6694
6712{
6713 Point3D position;
6714 CheckError(MIX_GetTrack3DPosition(track, &position));
6715 return position;
6716}
6717
6722
6752inline Group CreateGroup(MixerRef mixer) { return Group(mixer); }
6753
6755
6757 : Group(CheckError(MIX_CreateGroup(mixer)))
6758{
6759}
6760
6775inline void DestroyGroup(GroupRaw group) { MIX_DestroyGroup(group); }
6776
6778
6797{
6798 return CheckError(MIX_GetGroupProperties(group));
6799}
6800
6805
6820{
6821 return CheckError(MIX_GetGroupMixer(group));
6822}
6823
6825
6849inline void SetTrackGroup(TrackRef track, GroupRef group)
6850{
6851 CheckError(MIX_SetTrackGroup(track, group));
6852}
6853
6855{
6856 SDL::SetTrackGroup(get(), group);
6857}
6858
6890 void* userdata)
6891{
6892 CheckError(MIX_SetTrackStoppedCallback(track, cb, userdata));
6893}
6894
6923{
6924 SetTrackStoppedCallback(track, cb.wrapper, cb.data);
6925}
6926
6928 void* userdata)
6929{
6930 SDL::SetTrackStoppedCallback(get(), cb, userdata);
6931}
6932
6937
6969 void* userdata)
6970{
6971 CheckError(MIX_SetTrackRawCallback(track, cb, userdata));
6972}
6973
7002{
7003 SetTrackRawCallback(track, cb.wrapper, cb.data);
7004}
7005
7006inline void TrackBase::SetRawCallback(TrackMixCallback cb, void* userdata)
7007{
7008 SDL::SetTrackRawCallback(get(), cb, userdata);
7009}
7010
7012{
7014}
7015
7050 void* userdata)
7051{
7052 CheckError(MIX_SetTrackCookedCallback(track, cb, userdata));
7053}
7054
7086{
7087 SetTrackCookedCallback(track, cb.wrapper, cb.data);
7088}
7089
7090inline void TrackBase::SetCookedCallback(TrackMixCallback cb, void* userdata)
7091{
7092 SDL::SetTrackCookedCallback(get(), cb, userdata);
7093}
7094
7099
7127 void* userdata)
7128{
7129 CheckError(MIX_SetGroupPostMixCallback(group, cb, userdata));
7130}
7131
7156{
7157 SetGroupPostMixCallback(group, cb.wrapper, cb.data);
7158}
7159
7161{
7162 SDL::SetGroupPostMixCallback(get(), cb, userdata);
7163}
7164
7189 PostMixCallback cb,
7190 void* userdata)
7191{
7192 CheckError(MIX_SetPostMixCallback(mixer, cb, userdata));
7193}
7194
7217{
7218 SetPostMixCallback(mixer, cb.wrapper, cb.data);
7219}
7220
7221inline void MixerBase::SetPostMixCallback(PostMixCallback cb, void* userdata)
7222{
7223 SDL::SetPostMixCallback(get(), cb, userdata);
7224}
7225
7230
7282inline int Generate(MixerRef mixer, TargetBytes buffer)
7283{
7284 return CheckError(
7285 MIX_Generate(mixer, buffer.data(), narrowS32(buffer.size_bytes())), -1);
7286}
7287
7289{
7290 return SDL::Generate(get(), std::move(buffer));
7291}
7292
7298struct AudioDecoderBase : ResourceBaseT<AudioDecoderRaw>
7299{
7301
7311 void Destroy();
7312
7336
7352 void GetFormat(AudioSpec* spec);
7353
7374 int DecodeAudio(TargetBytes buffer, const AudioSpec& spec);
7375};
7376
7393{
7394 using AudioDecoderBase::AudioDecoderBase;
7395
7403 constexpr explicit AudioDecoder(AudioDecoderRaw resource) noexcept
7404 : AudioDecoderBase(resource)
7405 {
7406 }
7407
7409 constexpr AudioDecoder(AudioDecoder&& other) noexcept
7410 : AudioDecoder(other.release())
7411 {
7412 }
7413
7447 AudioDecoder(StringParam path, PropertiesRef props = nullptr);
7448
7480 AudioDecoder(IOStreamParam io, PropertiesRef props = nullptr);
7481
7483 ~AudioDecoder() { MIX_DestroyAudioDecoder(get()); }
7484
7486 constexpr AudioDecoder& operator=(AudioDecoder&& other) noexcept
7487 {
7488 swap(*this, other);
7489 return *this;
7490 }
7491};
7492
7527 PropertiesRef props = nullptr)
7528{
7529 return AudioDecoder(path, props);
7530}
7531
7533 : AudioDecoder(MIX_CreateAudioDecoder(path, props))
7534{
7535}
7536
7538 : AudioDecoder(MIX_CreateAudioDecoder_IO(io.stream, io.closeio, props))
7539{
7540}
7541
7574 PropertiesRef props = nullptr)
7575{
7576 return AudioDecoder(io, props);
7577}
7578
7590inline void DestroyAudioDecoder(AudioDecoderRaw audiodecoder)
7591{
7592 MIX_DestroyAudioDecoder(audiodecoder);
7593}
7594
7596
7621{
7622 return CheckError(MIX_GetAudioDecoderProperties(audiodecoder));
7623}
7624
7629
7646inline void GetAudioDecoderFormat(AudioDecoderRef audiodecoder, AudioSpec* spec)
7647{
7648 CheckError(MIX_GetAudioDecoderFormat(audiodecoder, spec));
7649}
7650
7652{
7654}
7655
7676inline int DecodeAudio(AudioDecoderRef audiodecoder,
7677 TargetBytes buffer,
7678 const AudioSpec& spec)
7679{
7680 return CheckError(
7681 MIX_DecodeAudio(
7682 audiodecoder, buffer.data(), narrowS32(buffer.size_bytes()), &spec),
7683 -1);
7684}
7685
7687 const AudioSpec& spec)
7688{
7689 return SDL::DecodeAudio(get(), std::move(buffer), spec);
7690}
7691
7693
7694} // namespace SDL
7695
7696#endif /* SDL3PP_ENABLE_MIXER */
7697
7698#endif /* SDL3PP_MIXER_H_ */
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:1394
MixerRef resource() const
Get the reference to locked resource.
Definition SDL3pp_mixer.h:1509
MixerLock(MixerLock &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:1447
void release()
Releases the lock without unlocking.
Definition SDL3pp_mixer.h:1512
~MixerLock()
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:1472
MixerLock(const MixerLock &other)=delete
Copy constructor.
MixerLock & operator=(MixerLock &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:1477
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr OwnArray(std::nullptr_t=nullptr)
Constructor.
Definition SDL3pp_ownPtr.h:50
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
void Quit()
Clean up all initialized subsystems.
Definition SDL3pp_init.h:329
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:56
void(SDLCALL *)(void *userdata, TrackRaw track) TrackStoppedCallback
A callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:1994
MakeFrontCallback< void(TrackRaw track)> TrackStoppedCB
A callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:2018
Audio LoadRawAudio(MixerRef mixer, SourceBytes data, const AudioSpec &spec)
Load raw PCM data from a memory buffer.
Definition SDL3pp_mixer.h:4487
void SetTrackStereo(TrackRef track, const StereoGains &gains)
Force a track to stereo output, with optionally left/right panning.
Definition SDL3pp_mixer.h:6633
Audio LoadAudioWithProperties(PropertiesRef props)
Load audio for playback through a collection of properties.
Definition SDL3pp_mixer.h:4368
void Destroy()
Destroy the specified audio.
Definition SDL3pp_mixer.h:4788
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:7048
AudioStreamRef GetAudioStream()
Query the AudioStream assigned to a track.
Definition SDL3pp_mixer.h:5442
bool Paused()
Query if a track is currently paused.
Definition SDL3pp_mixer.h:6276
PropertiesRef GetAudioDecoderProperties(AudioDecoderRef audiodecoder)
Get the properties associated with a AudioDecoder.
Definition SDL3pp_mixer.h:7620
AudioDecoder CreateAudioDecoder_IO(IOStreamParam io, PropertiesRef props=nullptr)
Create a AudioDecoder from an IOStream.
Definition SDL3pp_mixer.h:7573
float GetTrackFrequencyRatio(TrackRef track)
Query the frequency ratio of a track.
Definition SDL3pp_mixer.h:6547
void GetMixerFormat(MixerRef mixer, AudioSpec *spec)
Get the audio format a mixer is generating.
Definition SDL3pp_mixer.h:4021
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:3484
void SetTrackRawIOStream(TrackRef track, IOStreamParam io, const AudioSpec &spec)
Set a Track's input to an IOStream providing raw PCM data.
Definition SDL3pp_mixer.h:5087
void SetTagGain(StringParam tag, float gain)
Set the gain control of all tracks with a specific tag.
Definition SDL3pp_mixer.h:6421
void PauseTag(StringParam tag)
Pause all tracks with a specific tag.
Definition SDL3pp_mixer.h:6134
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:6308
void SetTagGain(MixerRef mixer, StringParam tag, float gain)
Set the gain control of all tracks with a specific tag.
Definition SDL3pp_mixer.h:6416
void SetTrackPlaybackPosition(TrackRef track, Sint64 frames)
Seek a playing track to a new position in its input.
Definition SDL3pp_mixer.h:5246
void UntagTrack(TrackRef track, StringParam tag)
Remove an arbitrary tag from a track.
Definition SDL3pp_mixer.h:5156
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:2056
void ResumeAllTracks()
Resume all currently-paused tracks.
Definition SDL3pp_mixer.h:6187
PropertiesRef GetProperties()
Get the properties associated with a group.
Definition SDL3pp_mixer.h:6801
PropertiesRef GetProperties()
Get the properties associated with a AudioDecoder.
Definition SDL3pp_mixer.h:7625
AudioRef GetAudio()
Query the Audio assigned to a track.
Definition SDL3pp_mixer.h:5414
Milliseconds FramesToMS(int sample_rate, Sint64 frames)
Convert sample frames, at a specific sample rate, to milliseconds.
Definition SDL3pp_mixer.h:5652
void PauseTag(MixerRef mixer, StringParam tag)
Pause all tracks with a specific tag.
Definition SDL3pp_mixer.h:6129
PropertiesRef GetProperties()
Get the properties associated with a Audio.
Definition SDL3pp_mixer.h:4654
void PlayTrack(TrackRef track, PropertiesRef options=nullptr)
Start (or restart) mixing a track for playback.
Definition SDL3pp_mixer.h:5773
Audio LoadAudio_IO(IOStreamParam io, bool predecode)
Load audio for playback from an IOStream.
Definition SDL3pp_mixer.h:4180
void Destroy()
Destroy the specified audio decoder.
Definition SDL3pp_mixer.h:7595
Sint64 TrackMSToFrames(TrackRef track, Milliseconds ms)
Convert milliseconds to sample frames for a track's current format.
Definition SDL3pp_mixer.h:5504
OwnArray< char * > GetTrackTags(TrackRef track)
Get the tags currently associated with a track.
Definition SDL3pp_mixer.h:5176
Sint64 MSToFrames(Milliseconds ms)
Convert milliseconds to sample frames for a track's current format.
Definition SDL3pp_mixer.h:5509
void Destroy()
Destroy the specified track.
Definition SDL3pp_mixer.h:4844
void ResumeTag(MixerRef mixer, StringParam tag)
Resume all tracks with a specific tag.
Definition SDL3pp_mixer.h:6214
Audio CreateSineWaveAudio(MixerRef mixer, int hz, float amplitude, Sint64 ms)
Create a Audio that generates a sinewave.
Definition SDL3pp_mixer.h:4591
void Unlock(MixerLock &&lock)
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:4108
void SetTrackStoppedCallback(TrackRef track, TrackStoppedCallback cb, void *userdata)
Set a callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:6888
PropertiesRef GetProperties()
Get the properties associated with a track.
Definition SDL3pp_mixer.h:4868
const char * GetAudioDecoder(int index)
Report the name of a specific audio decoders.
Definition SDL3pp_mixer.h:3834
void GetAudioDecoderFormat(AudioDecoderRef audiodecoder, AudioSpec *spec)
Query the initial audio format of a AudioDecoder.
Definition SDL3pp_mixer.h:7646
bool PlayAudio(AudioRef audio)
Play a Audio from start to finish without any management.
Definition SDL3pp_mixer.h:5920
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:7288
bool Resume()
Resume a currently-paused track.
Definition SDL3pp_mixer.h:6160
void DestroyAudioDecoder(AudioDecoderRaw audiodecoder)
Destroy the specified audio decoder.
Definition SDL3pp_mixer.h:7590
void UnlockMixer(MixerRef mixer)
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:4106
bool Playing()
Query if a track is currently playing.
Definition SDL3pp_mixer.h:6249
Track CreateTrack(MixerRef mixer)
Create a new track on a mixer.
Definition SDL3pp_mixer.h:4812
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:2098
Audio LoadRawAudio_IO(IOStreamParam io, const AudioSpec &spec)
Load raw PCM data from an IOStream.
Definition SDL3pp_mixer.h:4448
void SetGain(float gain)
Set a track's gain control.
Definition SDL3pp_mixer.h:6360
void SetLoops(int num_loops)
Change the number of times a currently-playing track will loop.
Definition SDL3pp_mixer.h:5384
Point3D Get3DPosition()
Get a track's current position in 3D space.
Definition SDL3pp_mixer.h:6718
void SetGroupPostMixCallback(GroupRef group, GroupMixCallback cb, void *userdata)
Set a callback that fires when a mixer group has completed mixing.
Definition SDL3pp_mixer.h:7125
void Untag(StringParam tag)
Remove an arbitrary tag from a track.
Definition SDL3pp_mixer.h:5161
MixerLock(MixerRef resource)
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:4078
ResourceRefT< AudioDecoderBase > AudioDecoderRef
Reference for AudioDecoder.
Definition SDL3pp_mixer.h:186
bool Pause()
Pause a currently-playing track.
Definition SDL3pp_mixer.h:6074
void SetTrackAudioStream(TrackRef track, AudioStreamRef stream)
Set a Track's input to an AudioStream.
Definition SDL3pp_mixer.h:4974
int Generate(MixerRef mixer, TargetBytes buffer)
Generate mixer output when not driving an audio device.
Definition SDL3pp_mixer.h:7282
void SetAudioStream(AudioStreamRef stream)
Set a Track's input to an AudioStream.
Definition SDL3pp_mixer.h:4979
PropertiesRef GetProperties()
Get the properties associated with a mixer.
Definition SDL3pp_mixer.h:3978
void SetTrackOutputChannelMap(TrackRef track, std::span< const int > chmap)
Set the current output channel map of a track.
Definition SDL3pp_mixer.h:6592
Sint64 GetDuration()
Get the length of a Audio's playback in sample frames.
Definition SDL3pp_mixer.h:4732
void StopTag(StringParam tag, Sint64 fade_out_ms)
Halt all tracks with a specific tag, possibly fading out over time.
Definition SDL3pp_mixer.h:6045
void ResumeTag(StringParam tag)
Resume all tracks with a specific tag.
Definition SDL3pp_mixer.h:6219
Audio LoadAudioNoCopy(SourceBytes data, bool free_when_done)
Load audio for playback from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4313
void SetRawIOStream(IOStreamParam io, const AudioSpec &spec)
Set a Track's input to an IOStream providing raw PCM data.
Definition SDL3pp_mixer.h:5094
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:5206
void DestroyMixer(MixerRaw mixer)
Free a mixer.
Definition SDL3pp_mixer.h:3952
AudioStreamRef GetTrackAudioStream(TrackRef track)
Query the AudioStream assigned to a track.
Definition SDL3pp_mixer.h:5437
Sint64 GetFadeFrames()
Query whether a given track is fading.
Definition SDL3pp_mixer.h:5316
bool Stop(Sint64 fade_out_frames)
Halt a currently-playing track, possibly fading out over time.
Definition SDL3pp_mixer.h:5962
void SetTrackRawCallback(TrackRef track, TrackMixCallback cb, void *userdata)
Set a callback that fires when a Track has initial decoded audio.
Definition SDL3pp_mixer.h:6967
Milliseconds AudioFramesToMS(AudioRef audio, Sint64 frames)
Convert sample frames for a Audio's format to milliseconds.
Definition SDL3pp_mixer.h:5600
void SetTrackAudio(TrackRef track, AudioRef audio)
Set a Track's input to a Audio.
Definition SDL3pp_mixer.h:4924
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:6040
void SetGroup(GroupRef group)
Assign a track to a mixing group.
Definition SDL3pp_mixer.h:6854
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:6638
Sint64 GetPlaybackPosition()
Get the current input position of a playing track.
Definition SDL3pp_mixer.h:5284
Sint64 MSToFrames(int sample_rate, Milliseconds ms)
Convert milliseconds to sample frames at a specific sample rate.
Definition SDL3pp_mixer.h:5626
constexpr Sint64 DURATION_INFINITE
Infinite duration, when the audio never runs out of sound to generate.
Definition SDL3pp_mixer.h:4738
bool ResumeTrack(TrackRef track)
Resume a currently-paused track.
Definition SDL3pp_mixer.h:6158
void SetPostMixCallback(GroupMixCallback cb, void *userdata)
Set a callback that fires when a mixer group has completed mixing.
Definition SDL3pp_mixer.h:7160
void PlayTag(StringParam tag, PropertiesRef options)
Start (or restart) mixing all tracks with a specific tag for playback.
Definition SDL3pp_mixer.h:5880
void DestroyAudio(AudioRaw audio)
Destroy the specified audio.
Definition SDL3pp_mixer.h:4786
bool StopTrack(TrackRef track, Sint64 fade_out_frames)
Halt a currently-playing track, possibly fading out over time.
Definition SDL3pp_mixer.h:5957
bool PauseTrack(TrackRef track)
Pause a currently-playing track.
Definition SDL3pp_mixer.h:6072
float GetTrackGain(TrackRef track)
Get a track's gain control.
Definition SDL3pp_mixer.h:6378
void SetPostMixCallback(MixerRef mixer, PostMixCallback cb, void *userdata)
Set a callback that fires when all mixing has completed.
Definition SDL3pp_mixer.h:7188
PropertiesRef GetTrackProperties(TrackRef track)
Get the properties associated with a track.
Definition SDL3pp_mixer.h:4863
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:4076
MIX_Track * TrackRaw
Alias to raw representation for Track.
Definition SDL3pp_mixer.h:147
Audio LoadAudio_IO(MixerRef mixer, IOStreamParam io, bool predecode)
Load audio for playback from an IOStream.
Definition SDL3pp_mixer.h:4175
float GetMixerGain(MixerRef mixer)
Get a mixer's master gain control.
Definition SDL3pp_mixer.h:6326
float GetFrequencyRatio()
Get a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6484
int GetNumAudioDecoders()
Report the number of audio decoders available for use.
Definition SDL3pp_mixer.h:3803
float GetFrequencyRatio()
Query the frequency ratio of a track.
Definition SDL3pp_mixer.h:6552
Sint64 GetAudioDuration(AudioRef audio)
Get the length of a Audio's playback in sample frames.
Definition SDL3pp_mixer.h:4727
void Destroy()
Destroy a mixing group.
Definition SDL3pp_mixer.h:6777
void SetAudio(AudioRef audio)
Set a Track's input to a Audio.
Definition SDL3pp_mixer.h:4929
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:3884
OwnArray< char * > GetTags()
Get the tags currently associated with a track.
Definition SDL3pp_mixer.h:5183
void StopAllTracks(MixerRef mixer, Sint64 fade_out_ms)
Halt all currently-playing tracks, possibly fading out over time.
Definition SDL3pp_mixer.h:5999
Sint64 GetTrackRemaining(TrackRef track)
Return the number of sample frames remaining to be mixed in a track.
Definition SDL3pp_mixer.h:5472
void SetOutputChannelMap(std::span< const int > chmap)
Set the current output channel map of a track.
Definition SDL3pp_mixer.h:6598
void TagTrack(TrackRef track, StringParam tag)
Assign an arbitrary tag to a track.
Definition SDL3pp_mixer.h:5126
PropertiesRef GetAudioProperties(AudioRef audio)
Get the properties associated with a Audio.
Definition SDL3pp_mixer.h:4649
Audio LoadAudio(MixerRef mixer, StringParam path, bool predecode)
Load audio for playback from a file.
Definition SDL3pp_mixer.h:4239
void PauseAllTracks(MixerRef mixer)
Pause all currently-playing tracks.
Definition SDL3pp_mixer.h:6096
void SetFrequencyRatio(float ratio)
Set a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6458
void SetStoppedCallback(TrackStoppedCallback cb, void *userdata)
Set a callback that fires when a Track is stopped.
Definition SDL3pp_mixer.h:6927
MixerRef GetMixer()
Get the Mixer that owns a Group.
Definition SDL3pp_mixer.h:6824
void SetPlaybackPosition(Sint64 frames)
Seek a playing track to a new position in its input.
Definition SDL3pp_mixer.h:5251
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:4305
Sint64 AudioMSToFrames(AudioRef audio, Milliseconds ms)
Convert milliseconds to sample frames for a Audio's format.
Definition SDL3pp_mixer.h:5568
void LockMixer(MixerRef mixer)
Lock a mixer by obtaining its internal mutex.
Definition SDL3pp_mixer.h:4074
void GetFormat(AudioSpec *spec)
Query the initial audio format of a AudioDecoder.
Definition SDL3pp_mixer.h:7651
PropertiesRef GetMixerProperties(MixerRef mixer)
Get the properties associated with a mixer.
Definition SDL3pp_mixer.h:3973
void SetPostMixCallback(PostMixCallback cb, void *userdata)
Set a callback that fires when all mixing has completed.
Definition SDL3pp_mixer.h:7221
float GetMixerFrequencyRatio(MixerRef mixer)
Get a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6479
void SetTrackFrequencyRatio(TrackRef track, float ratio)
Change the frequency ratio of a track.
Definition SDL3pp_mixer.h:6512
void GetFormat(AudioSpec *spec)
Query the initial audio format of a Audio.
Definition SDL3pp_mixer.h:4761
bool TrackPlaying(TrackRef track)
Query if a track is currently playing.
Definition SDL3pp_mixer.h:6247
int GetLoops()
Query how many loops remain for a given track.
Definition SDL3pp_mixer.h:5349
Milliseconds TrackFramesToMS(TrackRef track, Sint64 frames)
Convert sample frames for a track's current format to milliseconds.
Definition SDL3pp_mixer.h:5539
void reset()
Unlock a mixer previously locked by a call to LockMixer().
Definition SDL3pp_mixer.h:4114
void SetCookedCallback(TrackMixCallback cb, void *userdata)
Set a callback that fires when the mixer has transformed a track's audio.
Definition SDL3pp_mixer.h:7090
void Set3DPosition(const Point3D &position)
Set a track's position in 3D space.
Definition SDL3pp_mixer.h:6690
void SetIOStream(IOStreamParam io)
Set a Track's input to an IOStream.
Definition SDL3pp_mixer.h:5035
AudioDecoder CreateAudioDecoder(StringParam path, PropertiesRef props=nullptr)
Create a AudioDecoder from a path on the filesystem.
Definition SDL3pp_mixer.h:7526
Group CreateGroup(MixerRef mixer)
Create a mixing group.
Definition SDL3pp_mixer.h:6752
Sint64 GetTrackFadeFrames(TrackRef track)
Query whether a given track is fading.
Definition SDL3pp_mixer.h:5311
void SetTrackIOStream(TrackRef track, IOStreamParam io)
Set a Track's input to an IOStream.
Definition SDL3pp_mixer.h:5030
TrackRef CreateTrack()
Create a new track on a mixer.
Definition SDL3pp_mixer.h:4814
Sint64 MSToFrames(Milliseconds ms)
Convert milliseconds to sample frames for a Audio's format.
Definition SDL3pp_mixer.h:5573
Audio LoadRawAudio(SourceBytes data, const AudioSpec &spec)
Load raw PCM data from a memory buffer.
Definition SDL3pp_mixer.h:4494
PropertiesRef GetGroupProperties(GroupRef group)
Get the properties associated with a group.
Definition SDL3pp_mixer.h:6796
void SetMixerFrequencyRatio(MixerRef mixer, float ratio)
Set a mixer's master frequency ratio.
Definition SDL3pp_mixer.h:6453
constexpr Sint64 DURATION_UNKNOWN
Unknown duration, when the length of the audio can't be determined.
Definition SDL3pp_mixer.h:4735
void SetTrack3DPosition(TrackRef track, const Point3D &position)
Set a track's position in 3D space.
Definition SDL3pp_mixer.h:6685
MIX_Point3D Point3D
3D coordinates for SetTrack3DPosition.
Definition SDL3pp_mixer.h:1971
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:5915
void ResumeAllTracks(MixerRef mixer)
Resume all currently-paused tracks.
Definition SDL3pp_mixer.h:6182
void DestroyGroup(GroupRaw group)
Destroy a mixing group.
Definition SDL3pp_mixer.h:6775
Audio LoadAudio(StringParam path, bool predecode)
Load audio for playback from a file.
Definition SDL3pp_mixer.h:4244
void SetTrackGroup(TrackRef track, GroupRef group)
Assign a track to a mixing group.
Definition SDL3pp_mixer.h:6849
float GetGain()
Get a mixer's master gain control.
Definition SDL3pp_mixer.h:6328
MixerRef GetTrackMixer(TrackRef track)
Get the Mixer that owns a Track.
Definition SDL3pp_mixer.h:4886
MIX_Mixer * MixerRaw
Alias to raw representation for Mixer.
Definition SDL3pp_mixer.h:115
Audio LoadRawAudioNoCopy(SourceBytes data, const AudioSpec &spec, bool free_when_done=false)
Load raw PCM data from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4548
void GetFormat(AudioSpec *spec)
Get the audio format a mixer is generating.
Definition SDL3pp_mixer.h:4026
void PlayTag(MixerRef mixer, StringParam tag, PropertiesRef options)
Start (or restart) mixing all tracks with a specific tag for playback.
Definition SDL3pp_mixer.h:5875
void SetRawCallback(TrackMixCallback cb, void *userdata)
Set a callback that fires when a Track has initial decoded audio.
Definition SDL3pp_mixer.h:7006
Audio LoadRawAudioNoCopy(MixerRef mixer, SourceBytes data, const AudioSpec &spec, bool free_when_done=false)
Load raw PCM data from a memory buffer without making a copy.
Definition SDL3pp_mixer.h:4539
void StopAllTracks(Sint64 fade_out_ms)
Halt all currently-playing tracks, possibly fading out over time.
Definition SDL3pp_mixer.h:6004
MixerRef GetMixer()
Get the Mixer that owns a Track.
Definition SDL3pp_mixer.h:4891
MixerRef GetGroupMixer(GroupRef group)
Get the Mixer that owns a Group.
Definition SDL3pp_mixer.h:6819
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:6274
void SetMixerGain(MixerRef mixer, float gain)
Set a mixer's master gain control.
Definition SDL3pp_mixer.h:6303
void SetTrackGain(TrackRef track, float gain)
Set a track's gain control.
Definition SDL3pp_mixer.h:6355
void PauseAllTracks()
Pause all currently-playing tracks.
Definition SDL3pp_mixer.h:6101
void Play(PropertiesRef options=nullptr)
Start (or restart) mixing a track for playback.
Definition SDL3pp_mixer.h:5778
GroupRef CreateGroup()
Create a mixing group.
Definition SDL3pp_mixer.h:6754
int GetTrackLoops(TrackRef track)
Query how many loops remain for a given track.
Definition SDL3pp_mixer.h:5347
ResourceRefT< MixerBase > MixerRef
Reference for Mixer.
Definition SDL3pp_mixer.h:122
Audio LoadRawAudio_IO(MixerRef mixer, IOStreamParam io, const AudioSpec &spec)
Load raw PCM data from an IOStream.
Definition SDL3pp_mixer.h:4441
void SetFrequencyRatio(float ratio)
Change the frequency ratio of a track.
Definition SDL3pp_mixer.h:6517
void Destroy()
Free a mixer.
Definition SDL3pp_mixer.h:3954
Sint64 GetTrackPlaybackPosition(TrackRef track)
Get the current input position of a playing track.
Definition SDL3pp_mixer.h:5279
void DestroyTrack(TrackRaw track)
Destroy the specified track.
Definition SDL3pp_mixer.h:4842
void Tag(StringParam tag)
Assign an arbitrary tag to a track.
Definition SDL3pp_mixer.h:5131
void SetTrackLoops(TrackRef track, int num_loops)
Change the number of times a currently-playing track will loop.
Definition SDL3pp_mixer.h:5379
Audio CreateSineWaveAudio(int hz, float amplitude, Sint64 ms)
Create a Audio that generates a sinewave.
Definition SDL3pp_mixer.h:4599
Point3D GetTrack3DPosition(TrackRef track)
Get a track's current position in 3D space.
Definition SDL3pp_mixer.h:6711
Mixer CreateMixer(const AudioSpec &spec)
Create a mixer that generates audio to a memory buffer.
Definition SDL3pp_mixer.h:3927
void GetAudioFormat(AudioRef audio, AudioSpec *spec)
Query the initial audio format of a Audio.
Definition SDL3pp_mixer.h:4756
float GetGain()
Get a track's gain control.
Definition SDL3pp_mixer.h:6380
MIX_StereoGains StereoGains
A set of per-channel gains for tracks using SetTrackStereo().
Definition SDL3pp_mixer.h:1959
OwnArray< TrackRef > GetTaggedTracks(MixerRef mixer, StringParam tag)
Get all tracks with a specific tag.
Definition SDL3pp_mixer.h:5199
Milliseconds FramesToMS(Sint64 frames)
Convert sample frames for a track's current format to milliseconds.
Definition SDL3pp_mixer.h:5544
int DecodeAudio(TargetBytes buffer, const AudioSpec &spec)
Decode more audio from a AudioDecoder.
Definition SDL3pp_mixer.h:7686
Milliseconds FramesToMS(Sint64 frames)
Convert sample frames for a Audio's format to milliseconds.
Definition SDL3pp_mixer.h:5605
int DecodeAudio(AudioDecoderRef audiodecoder, TargetBytes buffer, const AudioSpec &spec)
Decode more audio from a AudioDecoder.
Definition SDL3pp_mixer.h:7676
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:3445
Sint64 GetRemaining()
Return the number of sample frames remaining to be mixed in a track.
Definition SDL3pp_mixer.h:5477
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:5409
::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:4664
constexpr auto TOTAL_TRACKS_NUMBER
Number for total tracks.
Definition SDL3pp_mixer.h:4681
constexpr auto DURATION_FRAMES_NUMBER
Number for duration frames.
Definition SDL3pp_mixer.h:4687
constexpr auto YEAR_NUMBER
Number for year.
Definition SDL3pp_mixer.h:4684
constexpr auto ARTIST_STRING
String for artist.
Definition SDL3pp_mixer.h:4669
constexpr auto TITLE_STRING
String for title.
Definition SDL3pp_mixer.h:4666
constexpr auto COPYRIGHT_STRING
String for copyright.
Definition SDL3pp_mixer.h:4675
constexpr auto DURATION_INFINITE_BOOLEAN
Enable duration infinite.
Definition SDL3pp_mixer.h:4690
constexpr auto TRACK_NUMBER
Number for track.
Definition SDL3pp_mixer.h:4678
constexpr auto ALBUM_STRING
String for album.
Definition SDL3pp_mixer.h:4672
Properties for configuring audio loading.
Definition SDL3pp_mixer.h:4378
constexpr auto LOAD_IGNORE_LOOPS_BOOLEAN
Load ignore loops enabled.
Definition SDL3pp_mixer.h:4399
constexpr auto DECODER_STRING
String for decoder.
Definition SDL3pp_mixer.h:4404
constexpr auto LOAD_CLOSEIO_BOOLEAN
Load closeio enabled.
Definition SDL3pp_mixer.h:4383
constexpr auto LOAD_IOSTREAM_POINTER
Pointer to load iostream.
Definition SDL3pp_mixer.h:4380
constexpr auto LOAD_PREDECODE_BOOLEAN
Load predecode enabled.
Definition SDL3pp_mixer.h:4386
constexpr auto LOAD_SKIP_METADATA_TAGS_BOOLEAN
Enable load skip metadata tags.
Definition SDL3pp_mixer.h:4393
constexpr auto LOAD_PREFERRED_MIXER_POINTER
Pointer to load preferred mixer.
Definition SDL3pp_mixer.h:4389
Properties for Mixer.
Definition SDL3pp_mixer.h:3988
constexpr auto DEVICE_NUMBER
Device number.
Definition SDL3pp_mixer.h:3990
Properties that can be used in the options parameter of Track.Play().
Definition SDL3pp_mixer.h:5788
constexpr auto START_MILLISECOND_NUMBER
Number for start millisecond.
Definition SDL3pp_mixer.h:5801
constexpr auto LOOPS_NUMBER
Number for loops.
Definition SDL3pp_mixer.h:5790
constexpr auto START_ORDER_NUMBER
Number for start order.
Definition SDL3pp_mixer.h:5806
constexpr auto MAX_FRAME_NUMBER
Number for max frame.
Definition SDL3pp_mixer.h:5792
constexpr auto HALT_WHEN_EXHAUSTED_BOOLEAN
Halt when exhausted enabled.
Definition SDL3pp_mixer.h:5836
constexpr auto LOOP_START_FRAME_NUMBER
Number for loop start frame.
Definition SDL3pp_mixer.h:5811
constexpr auto FADE_IN_START_GAIN_FLOAT
Float for fade in start gain.
Definition SDL3pp_mixer.h:5825
constexpr auto APPEND_SILENCE_FRAMES_NUMBER
Number for append silence frames.
Definition SDL3pp_mixer.h:5828
constexpr auto FADE_IN_MILLISECONDS_NUMBER
Number for fade in milliseconds.
Definition SDL3pp_mixer.h:5821
constexpr auto FADE_IN_FRAMES_NUMBER
Number for fade in frames.
Definition SDL3pp_mixer.h:5818
constexpr auto START_FRAME_NUMBER
Number for start frame.
Definition SDL3pp_mixer.h:5798
constexpr auto MAX_MILLISECONDS_NUMBER
Number for max milliseconds.
Definition SDL3pp_mixer.h:5795
constexpr auto APPEND_SILENCE_MILLISECONDS_NUMBER
Number for append silence milliseconds.
Definition SDL3pp_mixer.h:5832
constexpr auto LOOP_START_MILLISECOND_NUMBER
Number for loop start millisecond.
Definition SDL3pp_mixer.h:5814
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:1521
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Base class to AudioDecoder.
Definition SDL3pp_mixer.h:7299
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque object that represents an audio decoder.
Definition SDL3pp_mixer.h:7393
constexpr AudioDecoder(AudioDecoderRaw resource) noexcept
Constructs from raw AudioDecoder.
Definition SDL3pp_mixer.h:7403
constexpr AudioDecoder & operator=(AudioDecoder &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:7486
~AudioDecoder()
Destructor.
Definition SDL3pp_mixer.h:7483
constexpr AudioDecoder(AudioDecoder &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:7409
An opaque object that represents audio data.
Definition SDL3pp_mixer.h:1701
constexpr Audio(Audio &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:1717
constexpr Audio(AudioRaw resource) noexcept
Constructs from raw Audio.
Definition SDL3pp_mixer.h:1711
constexpr Audio & operator=(Audio &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:1936
~Audio()
Destructor.
Definition SDL3pp_mixer.h:1933
Base class to Group.
Definition SDL3pp_mixer.h:3493
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque object that represents a grouping of tracks.
Definition SDL3pp_mixer.h:3588
~Group()
Destructor.
Definition SDL3pp_mixer.h:3642
constexpr Group & operator=(Group &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:3645
constexpr Group(GroupRaw resource) noexcept
Constructs from raw Group.
Definition SDL3pp_mixer.h:3598
constexpr Group(Group &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:3604
Wrapper to be used as parameter to LoadFile_IO() and SaveFile_IO() and similar.
Definition SDL3pp_iostream.h:2243
IOStreamRef stream
The IOStream to read from or write to.
Definition SDL3pp_iostream.h:2244
bool closeio
Whether to close the IOStream after the operation.
Definition SDL3pp_iostream.h:2245
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:1243
constexpr Mixer(MixerRaw resource) noexcept
Constructs from raw Mixer.
Definition SDL3pp_mixer.h:1253
constexpr Mixer(Mixer &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:1259
~Mixer()
Destructor.
Definition SDL3pp_mixer.h:1342
constexpr Mixer & operator=(Mixer &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:1345
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
Base class to Track.
Definition SDL3pp_mixer.h:2107
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:3355
constexpr Track & operator=(Track &&other) noexcept
Assignment operator.
Definition SDL3pp_mixer.h:3406
constexpr Track(TrackRaw resource) noexcept
Constructs from raw Track.
Definition SDL3pp_mixer.h:3365
constexpr Track(Track &&other) noexcept
Move constructor.
Definition SDL3pp_mixer.h:3371
~Track()
Destructor.
Definition SDL3pp_mixer.h:3403