mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-09-08 06:48:56 -04:00
Add AudioSpec copy constructor
Since callback is non-copyable, new callback is specified
This commit is contained in:
parent
e034f6cd67
commit
7ebd613d01
@ -44,6 +44,7 @@ private:
|
||||
public:
|
||||
AudioSpec();
|
||||
AudioSpec(int freq, SDL_AudioFormat format, Uint8 channels, Uint16 samples, AudioCallback&& callback = AudioCallback());
|
||||
AudioSpec(const AudioSpec& other, AudioCallback&& callback = AudioCallback());
|
||||
~AudioSpec();
|
||||
|
||||
AudioSpec(AudioSpec&& other);
|
||||
|
@ -47,6 +47,13 @@ AudioSpec::AudioSpec(int freq, SDL_AudioFormat format, Uint8 channels, Uint16 sa
|
||||
}
|
||||
}
|
||||
|
||||
AudioSpec::AudioSpec(const AudioSpec& other, AudioSpec::AudioCallback&& callback) : SDL_AudioSpec(*other.Get()), callback_(std::move(callback)) {
|
||||
if (callback) {
|
||||
SDL_AudioSpec::callback = SDLCallback;
|
||||
SDL_AudioSpec::userdata = static_cast<void*>(this);
|
||||
}
|
||||
}
|
||||
|
||||
AudioSpec::~AudioSpec() {
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user