# HG changeset patch # User Amine Sehili # Date 1557430083 -3600 # Node ID 2e560bf4b2c0e43af1faf35f8042511c92bff3de # Parent f6ac8dbea102c7026426225f7d9900d8629f0d3d Refactor player_for diff -r f6ac8dbea102 -r 2e560bf4b2c0 auditok/io.py --- a/auditok/io.py Wed May 08 20:12:31 2019 +0100 +++ b/auditok/io.py Thu May 09 20:28:03 2019 +0100 @@ -749,25 +749,25 @@ start += chunk_size -def player_for(audio_source): +def player_for(source): """ - Return a :class:`PyAudioPlayer` that can play data from `audio_source`. + Return a :class:`AudioPlayer` that can play data from `source`. :Parameters: - `audio_source` : - an `AudioSource` object. + `source` : + a objects that has `sampling_rate`, `sample_width` and + `sample_width` attributes. :Returns: - `PyAudioPlayer` that has the same sampling rate, sample width and number of channels - as `audio_source`. + An `AudioPlayer` that has the same sampling rate, sample width + and number of channels as `source`. """ - return PyAudioPlayer( - audio_source.get_sampling_rate(), - audio_source.get_sample_width(), - audio_source.get_channels(), + source.sampling_rate, + source.sample_width, + source.channels, )