changeset 200:2e560bf4b2c0

Refactor player_for
author Amine Sehili <amine.sehili@gmail.com>
date Thu, 09 May 2019 20:28:03 +0100
parents f6ac8dbea102
children 5b4b9d58e897
files auditok/io.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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,
     )