Mercurial > hg > auditok
changeset 159:3439ba35aba0
Normalize user_channel in _FileAudioSource and make it a property
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Tue, 26 Feb 2019 20:20:18 +0100 |
parents | 6ed3a1eea98d |
children | 017994445d87 |
files | auditok/io.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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