From 646380520f01dd9ea7f70b9bc792c3c7469e1e81 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Sun, 30 Nov 2014 00:45:36 +0300 Subject: [PATCH] Add method to check if two AudioSpecs are equal --- SDL2pp/Audio.hh | 2 ++ SDL2pp/AudioSpec.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/SDL2pp/Audio.hh b/SDL2pp/Audio.hh index 6239cdd..73c316a 100644 --- a/SDL2pp/Audio.hh +++ b/SDL2pp/Audio.hh @@ -56,6 +56,8 @@ public: void MergeChanges(const SDL_AudioSpec& obtained); const SDL_AudioSpec* Get() const; + + bool IsSameFormat(const AudioSpec& other) const; }; class AudioDevice { diff --git a/SDL2pp/AudioSpec.cc b/SDL2pp/AudioSpec.cc index e91edee..455d146 100644 --- a/SDL2pp/AudioSpec.cc +++ b/SDL2pp/AudioSpec.cc @@ -75,4 +75,8 @@ const SDL_AudioSpec* AudioSpec::Get() const { return static_cast(this); } +bool AudioSpec::IsSameFormat(const AudioSpec& other) const { + return freq == other.freq && format == other.format && channels == other.channels; +} + }