/// Prepares for playback
///
/// Note: Currently this will load the audio file on the audio-thread.
/// It'd be an interesting exercise to perform this on a background thread.
Prepares for playback
Note: Currently this will load the audio file on the audio-thread.
It'd be an interesting exercise to perform this on a background thread.
Prepares for playback Note : Currently this will load the audio file on the audio - thread . It ' d be an interesting exercise to perform this on a background thread .
pub fn prepare(&mut self, audio_settings: AudioProcessorSettings) {
        log::info!("Preparing for audio file playback");
        self.audio_settings = audio_settings;
        self.buffer.clear();
        self.buffer.reserve(self.audio_settings.input_channels());
        let start = Instant::now();
        log::info!("Reading audio file onto memory");
        let audio_file_contents =
            file_io::read_file_contents(&mut self.audio_file_settings.audio_file);
        match audio_file_contents {
            Ok(audio_file_contents) => {
                log::info!("Read input file duration={}ms", start.elapsed().as_millis());
                self.set_audio_file_contents(audio_file_contents)
            }
            Err(err) => {
                log::error!("Failed to read input file {}", err);
            }
        }
    }
pub fn prepare ( & mut self , audio_settings : AudioProcessorSettings ) { log :: info ! ( " " ) ; self . audio_settings = audio_settings ; self . buffer . clear ( ) ; self . buffer . reserve ( self . audio_settings . input_channels ( ) ) ; let start = Instant :: now ( ) ; log :: info ! ( " " ) ; let audio_file_contents = file_io :: read_file_contents ( & mut self . audio_file_settings . audio_file ) ; match audio_file_contents { Ok ( audio_file_contents ) => { log :: info ! ( " " start elapsed ( ) as_millis ( ) ) ; self . set_audio_file_contents ( audio_file_contents ) } Err ( err ) => { log :: error ! ( " " err ) ; } } }
Prepares for playback
Note: Currently this will load the audio file on the audio-thread.
Prepares for playback Note : Currently this will load the audio file on the audio - thread .
&mut self
audio_settings
AudioProcessorSettings