MCPcopy Index your code
hub / github.com/endbasic/endbasic / get_audio_device

Method get_audio_device

sdl/src/host.rs:338–353  ·  view source on GitHub ↗

Obtains the audio queue to use for tone playback.

(&mut self)

Source from the content-addressed store, hash-verified

336
337 /// Obtains the audio queue to use for tone playback.
338 fn get_audio_device(&mut self) -> io::Result<&mut AudioQueue<i16>> {
339 if self.audio_device.is_none() {
340 let audio = self.sdl.audio().map_err(string_error_to_io_error)?;
341 let desired_spec = AudioSpecDesired {
342 freq: Some(AUDIO_SAMPLE_RATE),
343 channels: Some(1),
344 samples: None,
345 };
346 let audio_device = audio
347 .open_queue::<i16, _>(None, &desired_spec)
348 .map_err(string_error_to_io_error)?;
349 self.audio_device = Some(audio_device);
350 }
351
352 Ok(self.audio_device.as_mut().expect("Audio device must have been initialized"))
353 }
354
355 /// Returns true if the point falls within the canvas bounds.
356 fn contains_pixel(&self, xy: PixelsXY) -> bool {

Callers 1

play_toneMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected