Add method to check if two AudioSpecs are equal

This commit is contained in:
Dmitry Marakasov 2014-11-30 00:45:36 +03:00
parent 7ebd613d01
commit 646380520f
2 changed files with 6 additions and 0 deletions

View File

@ -56,6 +56,8 @@ public:
void MergeChanges(const SDL_AudioSpec& obtained);
const SDL_AudioSpec* Get() const;
bool IsSameFormat(const AudioSpec& other) const;
};
class AudioDevice {

View File

@ -75,4 +75,8 @@ const SDL_AudioSpec* AudioSpec::Get() const {
return static_cast<const SDL_AudioSpec*>(this);
}
bool AudioSpec::IsSameFormat(const AudioSpec& other) const {
return freq == other.freq && format == other.format && channels == other.channels;
}
}