Browse Source

fmt

pull/83/head
Andrea Ciliberti 2 years ago
parent
commit
429e60c878
  1. 6
      ctru-rs/examples/audio_filters.rs
  2. 8
      ctru-rs/src/services/ndsp/wave.rs

6
ctru-rs/examples/audio_filters.rs

@ -84,8 +84,10 @@ fn main() {
fill_buffer(&mut audio_data1[..], NOTEFREQ[4]); fill_buffer(&mut audio_data1[..], NOTEFREQ[4]);
let mut audio_data2 = audio_data1.clone(); let mut audio_data2 = audio_data1.clone();
let mut audio_buffer1 = WaveBuffer::new(audio_data1, AudioFormat::PCM16Stereo).expect("Couldn't sync DSP cache"); let mut audio_buffer1 =
let mut audio_buffer2 = WaveBuffer::new(audio_data2, AudioFormat::PCM16Stereo).expect("Couldn't sync DSP cache"); WaveBuffer::new(audio_data1, AudioFormat::PCM16Stereo).expect("Couldn't sync DSP cache");
let mut audio_buffer2 =
WaveBuffer::new(audio_data2, AudioFormat::PCM16Stereo).expect("Couldn't sync DSP cache");
let mut wave_info1 = WaveInfo::new(&mut audio_buffer1, false); let mut wave_info1 = WaveInfo::new(&mut audio_buffer1, false);
let mut wave_info2 = WaveInfo::new(&mut audio_buffer2, false); let mut wave_info2 = WaveInfo::new(&mut audio_buffer2, false);

8
ctru-rs/src/services/ndsp/wave.rs

@ -93,7 +93,11 @@ impl<'b> WaveInfo<'b> {
next: std::ptr::null_mut(), next: std::ptr::null_mut(),
}; };
Self { buffer, raw_data, played_on_channel: None,} Self {
buffer,
raw_data,
played_on_channel: None,
}
} }
pub fn get_mut_wavebuffer(&mut self) -> &mut WaveBuffer { pub fn get_mut_wavebuffer(&mut self) -> &mut WaveBuffer {
@ -144,7 +148,7 @@ impl<'b> Drop for WaveInfo<'b> {
// If the status flag is "unfinished" // If the status flag is "unfinished"
_ => { _ => {
// The unwrap is safe, since it must have a value in the case the status is "unfinished". // The unwrap is safe, since it must have a value in the case the status is "unfinished".
unsafe { ndspChnWaveBufClear(self.played_on_channel.unwrap().into() )}; unsafe { ndspChnWaveBufClear(self.played_on_channel.unwrap().into()) };
} }
} }
} }

Loading…
Cancel
Save