From 4917c9b2acb2f6a0185a19aff86b44d5512a1d91 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 6 Dec 2016 23:02:54 +0100 Subject: [PATCH 1/3] move generic to dummy, fix return value, fix codestyle --- src/fenrir/speechDriver/espeak.py | 2 +- src/fenrir/speechDriver/generic.py | 66 ------------------------------ src/fenrir/speechDriver/speechd.py | 2 +- 3 files changed, 2 insertions(+), 68 deletions(-) delete mode 100644 src/fenrir/speechDriver/generic.py diff --git a/src/fenrir/speechDriver/espeak.py b/src/fenrir/speechDriver/espeak.py index 0bae1503..7d9bef65 100644 --- a/src/fenrir/speechDriver/espeak.py +++ b/src/fenrir/speechDriver/espeak.py @@ -8,7 +8,7 @@ from core import debug class driver(): - def __init__(self ): + def __init__(self): self._es = None self._isInitialized = False diff --git a/src/fenrir/speechDriver/generic.py b/src/fenrir/speechDriver/generic.py deleted file mode 100644 index 1afb8717..00000000 --- a/src/fenrir/speechDriver/generic.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# generic driver - -from core import debug - -class driver(): - def __init__(self ): - pass - def initialize(self, environment): - self._isInitialized = False - self.env = environment - def shutdown(self): - pass - - def speak(self,text, queueable=True): - if not self._isInitialized: - return False - if not queueable: - self.cancel() - return True - - def cancel(self): - if not self._isInitialized: - return False - return True - - def setCallback(self, callback): - pass - - def clear_buffer(self): - if not self._isInitialized: - return False - return True - - def setVoice(self, voice): - if not self._isInitialized: - return False - return True - - def setPitch(self, pitch): - if not self._isInitialized: - return False - return True - - def setRate(self, rate): - if not self._isInitialized: - return False - return True - - def setModule(self, module): - if not self._isInitialized: - return False - - def setLanguage(self, language): - if not self._isInitialized: - return False - return True - - def setVolume(self, volume): - if not self._isInitialized: - return False - return True diff --git a/src/fenrir/speechDriver/speechd.py b/src/fenrir/speechDriver/speechd.py index 49fc7894..8a7ef856 100644 --- a/src/fenrir/speechDriver/speechd.py +++ b/src/fenrir/speechDriver/speechd.py @@ -8,7 +8,7 @@ from core import debug class driver(): - def __init__(self ): + def __init__(self): self._sd = None self._isInitialized = False self._language = '' From 7a3daeefdfa52e3c1adfbc199e6b51fe7a36e7ca Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 6 Dec 2016 23:03:03 +0100 Subject: [PATCH 2/3] move generic to dummy, fix return value, fix codestyle --- src/fenrir/speechDriver/dummy.py | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/fenrir/speechDriver/dummy.py diff --git a/src/fenrir/speechDriver/dummy.py b/src/fenrir/speechDriver/dummy.py new file mode 100644 index 00000000..085a07d0 --- /dev/null +++ b/src/fenrir/speechDriver/dummy.py @@ -0,0 +1,67 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. +# generic driver + +from core import debug + +class driver(): + def __init__(self): + pass + def initialize(self, environment): + self._isInitialized = False + self.env = environment + def shutdown(self): + pass + + def speak(self,text, queueable=True): + if not self._isInitialized: + return False + if not queueable: + self.cancel() + return True + + def cancel(self): + if not self._isInitialized: + return False + return True + + def setCallback(self, callback): + pass + + def clear_buffer(self): + if not self._isInitialized: + return False + return True + + def setVoice(self, voice): + if not self._isInitialized: + return False + return True + + def setPitch(self, pitch): + if not self._isInitialized: + return False + return True + + def setRate(self, rate): + if not self._isInitialized: + return False + return True + + def setModule(self, module): + if not self._isInitialized: + return False + return True + + def setLanguage(self, language): + if not self._isInitialized: + return False + return True + + def setVolume(self, volume): + if not self._isInitialized: + return False + return True From ce0d6163bf99ebd508ea17ba36ba0919072e9c62 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 6 Dec 2016 23:05:29 +0100 Subject: [PATCH 3/3] create dummy sounddriver --- src/fenrir/soundDriver/dummy.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/fenrir/soundDriver/dummy.py diff --git a/src/fenrir/soundDriver/dummy.py b/src/fenrir/soundDriver/dummy.py new file mode 100644 index 00000000..6c45bd35 --- /dev/null +++ b/src/fenrir/soundDriver/dummy.py @@ -0,0 +1,27 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug + +class driver(): + def __init__(self): + self.volume = None + def initialize(self, environment): + self.env = environment + def shutdown(self): + self.cancel() + def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0): + if interrupt: + self.cancel() + def playSoundFile(self, filePath, interrupt = True): + if interrupt: + self.cancel() + def cancel(self): + pass + def setCallback(self, callback): + pass + def setVolume(self, volume): + self.volume = volume