-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keep AudioSubsystem
alive while AudioDevice
s or AudioStream
a are alive
#121
Conversation
pub fn new(device_id: AudioDeviceID, audio_subsystem: AudioSubsystem) -> Self { | ||
AudioDevice { | ||
device_id, | ||
audio_subsystem, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be part of the public API?
I will later today check if this actually fixes the problem Edit: it does |
} | ||
|
||
/// Create an `AudioStream` for this device with the specified spec. | ||
/// This device will be closed when the stream is dropped. | ||
/// The device begins paused, so you must call `stream.resume()` to start playback. | ||
#[doc(alias = "SDL_OpenAudioDeviceStream")] | ||
#[deprecated = "use `device.open_device_stream(spec)` (where device is an `AudioDevice`) instead"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should happen with this function? It is almost identical to AudioDevice::open_device_stream
(I added this in 57069b2 because it has 2 parameters that are fields of AudioDevice
, so it is easier to call with only 1 parameter excluding self
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a successful SDL_OpenAudioDeviceStream
call SDL will close the device when the stream is closed, so it makes sense to me to take an AudioDevice
by value (self
parameter there) in Rust.
breaking change because some functions allowed creating streams or devices without requiring an
AudioSubsystem
fixes #79