# HG changeset patch # User Amine Sehili # Date 1551208818 -3600 # Node ID 3439ba35aba05aaabcce26df4548d34088f1bf41 # Parent 6ed3a1eea98dd6fb07c48870875e2bafd84b7566 Normalize user_channel in _FileAudioSource and make it a property diff -r 6ed3a1eea98d -r 3439ba35aba0 auditok/io.py --- a/auditok/io.py Mon Feb 25 20:16:56 2019 +0100 +++ b/auditok/io.py Tue Feb 26 20:20:18 2019 +0100 @@ -457,12 +457,13 @@ def __init__(self, sampling_rate, sample_width, channels, use_channel): AudioSource.__init__(self, sampling_rate, sample_width, channels) self._audio_stream = None + self._use_channel = _normalize_use_channel(use_channel) if channels > 1: self._extract_selected_channel = partial( _extract_selected_channel, channels=channels, sample_width=sample_width, - use_channel=use_channel, + use_channel=self._use_channel, ) else: self._extract_selected_channel = lambda x: x @@ -471,6 +472,10 @@ if self.is_open(): self.close() + @property + def use_channel(self): + return self._use_channel + def is_open(self): return self._audio_stream is not None