packages feed

mmsyn7ukr 0.10.0.0 → 0.11.0.0

raw patch · 9 files changed

+82/−73 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- FinalException: ExecutableNotProperlyInstalled :: FinalException
- FinalException: InitialFileNotChanged :: String -> FinalException
- FinalException: MaybePartiallyTrimmed :: FinalException
- FinalException: NeededInfoIsShown :: FinalException
- FinalException: NoiseProfileNotCreatedB :: String -> FinalException
- FinalException: NoiseProfileNotCreatedE :: String -> FinalException
- FinalException: NotCreated :: String -> FinalException
- FinalException: NotCreatedWithEffect :: String -> FinalException
- FinalException: NotCreatedWithEffects :: String -> FinalException
- FinalException: NotEnoughData :: String -> FinalException
- FinalException: NotRecorded :: String -> FinalException
- FinalException: catchEnd :: FinalException -> IO ()
- FinalException: data FinalException
- FinalException: instance GHC.Exception.Type.Exception FinalException.FinalException
- FinalException: instance GHC.Show.Show FinalException.FinalException
+ Control.Exception.FinalException: DataFileNotClosed :: String -> FinalException
+ Control.Exception.FinalException: DataSoundFileNotRead :: String -> FinalException
+ Control.Exception.FinalException: ExecutableNotProperlyInstalled :: FinalException
+ Control.Exception.FinalException: InitialFileNotChanged :: String -> FinalException
+ Control.Exception.FinalException: MaybePartiallyTrimmed :: FinalException
+ Control.Exception.FinalException: NeededInfoIsShown :: FinalException
+ Control.Exception.FinalException: NoiseProfileNotCreatedB :: String -> FinalException
+ Control.Exception.FinalException: NoiseProfileNotCreatedE :: String -> FinalException
+ Control.Exception.FinalException: NotCreated :: String -> FinalException
+ Control.Exception.FinalException: NotCreatedWithEffect :: String -> FinalException
+ Control.Exception.FinalException: NotCreatedWithEffects :: String -> FinalException
+ Control.Exception.FinalException: NotEnoughData :: String -> FinalException
+ Control.Exception.FinalException: NotFileNameGiven :: FinalException
+ Control.Exception.FinalException: NotRecorded :: String -> FinalException
+ Control.Exception.FinalException: StrangeAnswer :: String -> String -> FinalException
+ Control.Exception.FinalException: catchEnd :: FinalException -> IO ()
+ Control.Exception.FinalException: data FinalException
+ Control.Exception.FinalException: instance GHC.Exception.Type.Exception Control.Exception.FinalException.FinalException
+ Control.Exception.FinalException: instance GHC.Show.Show Control.Exception.FinalException.FinalException

Files

ChangeLog.md view
@@ -165,3 +165,8 @@  * Tenth version. Data type changed to FinalException and it is now a separate module FinalException. The error functions in the package is now rewritten using the new datatype.++## 0.11.0.0 -- 2020-01-28++* Eleventh version. Changed the structure of modules. The module FinalException is now Control.Exception.FinalException. Added new contstuctors to+the module. Now the FinalException datatype includes all the needed exceptions for mmsyn7 series of program.
+ Control/Exception/FinalException.hs view
@@ -0,0 +1,71 @@+-- |+-- Module      :  Control.Exception.FinalException+-- Copyright   :  (c) OleksandrZhabenko 2020+-- License     :  MIT+-- Stability   :  Experimental+-- +-- Maintainer  :  olexandr543@yahoo.com+--+-- A program and a library that can be used as a simple +-- basic interface to some SoX functionality or for producing +-- the approximately Ukrainian speech with your own recorded +-- voice (actually it produces the needed sound representations).+--++{-# LANGUAGE DeriveDataTypeable #-}++module Control.Exception.FinalException (+  FinalException(..)+  -- * Exception+  , catchEnd+) where++import Data.Typeable+import Control.Exception (Exception, catch, throw)+import System.Environment (getProgName)+import System.IO+import GHC.IO.Handle.Types (Newline( CRLF ), nativeNewline)++-- | Data type 'FinalException' is used to terminate the not needed further execution.+data FinalException = NeededInfoIsShown | ExecutableNotProperlyInstalled | MaybePartiallyTrimmed | NotCreatedWithEffect String+  | InitialFileNotChanged String | NotCreated String | NotRecorded String | NoiseProfileNotCreatedB String | NoiseProfileNotCreatedE String+    | NotEnoughData String | NotCreatedWithEffects String | StrangeAnswer String String | NotFileNameGiven | DataFileNotClosed String+       | DataSoundFileNotRead String +          deriving ( Typeable )++instance Exception FinalException++instance Show FinalException where+  show NeededInfoIsShown = "NeededInfoIsShown: the program has given you the asked information." ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show ExecutableNotProperlyInstalled = "ExecutableNotProperlyInstalled: SoX is not properly installed in your system. Please, install it properly and then call the function again." ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show MaybePartiallyTrimmed = "MaybePartiallyTrimmed: The function did not create the needed file, but may be it trimmed the initial one (not enough)!"+    ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NotCreatedWithEffect xs) = "NotCreatedWithEffect: File was not created with " ++ show xs ++ " effect!" ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (InitialFileNotChanged xs) = "InitialFileNotChanged: The initial file " ++ show xs ++ " was not changed!" ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NotCreated xs) = "NotCreated: The function did not create the needed file " ++ show xs ++ "!" ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NotRecorded xs) = "NotRecorded: The file " ++ show xs ++ " was not recorded!" ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NoiseProfileNotCreatedB xs) = "NoiseProfileNotCreatedB: The noise profile " ++ xs ++ ".b.prof was not created!"+    ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NoiseProfileNotCreatedE xs) = "NoiseProfileNotCreatedE: The noise profile " ++ xs ++ ".e.prof was not created!"+    ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NotEnoughData xs) = "NotEnoughData: SoX cannot determine the number of the samples in the file " ++ show xs +++    "! May be it is a RAW file and it needs additional parameters to be processed." ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (NotCreatedWithEffects xs) = "NotCreatedWithEffects: File was not created with " ++ (init . unwords . map ((++ ",") . show) . words $ xs) ++ " effects!"+    ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (StrangeAnswer xs ys) = xs ++ ": the " ++ show ys ++ " function gave a strange result!" ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show NotFileNameGiven = "Please, specify as a command line argument at least a name of the resulting file (without its extension)! "+    ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (DataFileNotClosed xs) = "File " ++ show xs ++ " is not closed!" ++ (if nativeNewline == CRLF then "\r\n" else "\n")+  show (DataSoundFileNotRead xs) = "Data sound file " ++ show xs ++ " is not read!"  ++ (if nativeNewline == CRLF then "\r\n" else "\n")++-- | Function to work with exception 'FinalException' similarly to the example in the documentation for the 'catch' function. It throws an exception+-- to the thread where it is called. Basically, the function is intended to terminate the program with the informational message (if used in the main thread+-- without exception handler). Because 'NeededInfoIsShown' is exception that actually only is a signal that the needed information is given and is not+-- any exceptional but rather standard situation the output of the function in such a case is printed to the 'stdout' handle (with the default to 'stderr'+-- in all other cases). +catchEnd :: FinalException -> IO ()+catchEnd e = do+  progName <- getProgName+  case e of+    NeededInfoIsShown -> catch (throw e) (\e0 -> hPutStr stdout (progName ++ ": " ++ show (e0 :: FinalException)))+    _                 -> catch (throw e) (\e0 -> hPutStr stderr (progName ++ ": " ++ show (e0 :: FinalException)))
− FinalException.hs
@@ -1,60 +0,0 @@--- |--- Module      :  FinalException--- Copyright   :  (c) OleksandrZhabenko 2020--- License     :  MIT--- Stability   :  Experimental--- --- Maintainer  :  olexandr543@yahoo.com------ A program and a library that can be used as a simple --- basic interface to some SoX functionality or for producing --- the approximately Ukrainian speech with your own recorded --- voice (actually it produces the needed sound representations).-----{-# LANGUAGE DeriveDataTypeable #-}--module FinalException (-  FinalException(..)-  -- * Exception-  , catchEnd-) where--import Data.Typeable-import Control.Exception (Exception, catch, throw)-import System.Environment (getProgName)-import System.IO---- | Data type 'FinalException' is used to terminate the not needed further execution.-data FinalException = NeededInfoIsShown | ExecutableNotProperlyInstalled | MaybePartiallyTrimmed | NotCreatedWithEffect String-  | InitialFileNotChanged String | NotCreated String | NotRecorded String | NoiseProfileNotCreatedB String | NoiseProfileNotCreatedE String-    | NotEnoughData String | NotCreatedWithEffects String -       deriving ( Typeable )--instance Exception FinalException--instance Show FinalException where-  show NeededInfoIsShown = "NeededInfoIsShown: the program has given you the asked information.\n"-  show (ExecutableNotProperlyInstalled) = "ExecutableNotProperlyInstalled: SoX is not properly installed in your system. Please, install it properly and then call the function again.\n"-  show MaybePartiallyTrimmed = "MaybePartiallyTrimmed: The function did not create the needed file, but may be it trimmed the initial one (not enough)!\n"-  show (NotCreatedWithEffect xs) = "NotCreatedWithEffect: File was not created with " ++ show xs ++ " effect!\n"-  show (InitialFileNotChanged xs) = "InitialFileNotChanged: The initial file " ++ show xs ++ " was not changed!\n"-  show (NotCreated xs) = "NotCreated: The function did not create the needed file " ++ show xs ++ "!\n"-  show (NotRecorded xs) = "NotRecorded: The file " ++ show xs ++ " was not recorded!\n"-  show (NoiseProfileNotCreatedB xs) = "NoiseProfileNotCreatedB: The noise profile " ++ xs ++ ".b.prof was not created!\n"-  show (NoiseProfileNotCreatedE xs) = "NoiseProfileNotCreatedE: The noise profile " ++ xs ++ ".e.prof was not created!\n"-  show (NotEnoughData xs) = "NotEnoughData: SoX cannot determine the number of the samples in the file " ++ show xs ++-    "! May be it is a RAW file and it needs additional parameters to be processed.\n"-  show (NotCreatedWithEffects xs) = "NotCreatedWithEffects: File was not created with " ++ (init . unwords . map ((++ ",") . show) . words $ xs) ++ " effects!\n"---- | Function to work with exception 'FinalException' similarly to the example in the documentation for the 'catch' function. It throws an exception--- to the thread where it is called. Basically, the function is intended to terminate the program with the informational message (if used in the main thread--- without exception handler). Because 'NeededInfoIsShown' is exception that actually only is a signal that the needed information is given and is not--- any exceptional but rather standard situation the output of the function in such a case is printed to the 'stdout' handle (with the default to 'stderr'--- in all other cases). -catchEnd :: FinalException -> IO ()-catchEnd e = do-  progName <- getProgName-  case e of-    NeededInfoIsShown -> catch (throw e) (\e0 -> hPutStr stdout (progName ++ ": " ++ show (e0 :: FinalException)))-    _                 -> catch (throw e) (\e0 -> hPutStr stderr (progName ++ ": " ++ show (e0 :: FinalException)))
Main.hs view
@@ -3,7 +3,6 @@ -- Copyright   :  (c) OleksandrZhabenko 2019-2020 -- License     :  MIT -- Stability   :  Experimental--- -- Maintainer  :  olexandr543@yahoo.com -- -- A program and a library that can be used as a simple @@ -17,7 +16,6 @@  import Processing_mmsyn7ukr import System.Environment (getArgs)-import FinalException  -- | Function responds for general @mmsyn7ukr@ program execution.  main :: IO ()@@ -37,8 +35,6 @@        putStrLn "amplitude that are trimmed for the sound file. "        putStr "list-of-produced-sound-representations (if any) -- a list of sound representations, which the program will try to produce while being executed. "        putStrLn "The default one (if not specified) is a full range of needed sound representations. "-       catchEnd NeededInfoIsShown     "-v" -> do-       putStrLn "mmsyn7ukr version: 0.10.0.0"-       catchEnd NeededInfoIsShown+       putStrLn "mmsyn7ukr version: 0.11.0.0"     _    -> main7ukr args
Processing_mmsyn7ukr.hs view
@@ -48,7 +48,7 @@ import CaseBi (getBFst') import ReplaceP (replaceP, replaceP4) import Paths_mmsyn6ukr-import FinalException+import Control.Exception.FinalException  -- | Function that being given a tuple of @String@ and a path to the installed by the @mmsyn6ukr@ package file produces the corresponding analogous sound with your created  -- voicing. The tuple controls the function behaviour. The first @String@ in it specifies the actions that will be performed to produce a sound file and the second one 
ReplaceP.hs view
@@ -3,7 +3,6 @@ -- Copyright   :  (c) OleksandrZhabenko 2020 -- License     :  MIT -- Stability   :  Experimental--- -- Maintainer  :  olexandr543@yahoo.com -- -- A program and a library that can be used as a simple 
SoXBasics.hs view
@@ -3,7 +3,6 @@ -- Copyright   :  (c) OleksandrZhabenko 2019-2020 -- License     :  MIT -- Stability   :  Experimental--- -- Maintainer  :  olexandr543@yahoo.com -- -- A program and a library that can be used as a simple @@ -68,7 +67,7 @@ import Control.Concurrent (threadDelay) import Control.Exception (onException) import System.Info (os)-import FinalException+import Control.Exception.FinalException  -- | Function 'maxAbs' allows to choose a maximum by absolute value if the values are written as @String@. Bool @True@ corresponds to maximum value, @False@ - to minimum value maxAbs :: (String, String) -> (String, Bool)
SoXBasics1.hs view
@@ -3,7 +3,6 @@ -- Copyright   :  (c) OleksandrZhabenko 2020 -- License     :  MIT -- Stability   :  Experimental--- -- Maintainer  :  olexandr543@yahoo.com -- -- A program and a library that can be used as a simple @@ -44,7 +43,7 @@ import EndOfExe import System.Exit import qualified SoXBasics as SB (extremeS1,upperBnd,selMA,maxAbs,norm)-import FinalException+import Control.Exception.FinalException  -- | Function 'norm' applies a SoX normalization effect on the audio file.  -- The function must be used with the @FilePath@ parameter containing no directories in its name (that means the file of the @FilePath@ parameter must be 
mmsyn7ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn7ukr-version:             0.10.0.0+version:             0.11.0.0 synopsis:            A simple basic interface to some SoX functionality or to produce a voice that can be used by mmsyn7h description:         A program and a library that can be used as a simple basic interface to some SoX functionality or to produce your voice in Ukrainian (if you pronounce the sounds properly) represented by the separate sounds or something special like soft sign. homepage:            https://hackage.haskell.org/package/mmsyn7ukr@@ -17,7 +17,7 @@ cabal-version:       >=1.10  library-  exposed-modules:     SoXBasics, SoXBasics1, Processing_mmsyn7ukr, Main, ReplaceP, FinalException+  exposed-modules:     SoXBasics, SoXBasics1, Processing_mmsyn7ukr, Main, ReplaceP, Control.Exception.FinalException   -- other-modules:   -- other-extensions:   build-depends:       base >=4.7 && <4.14, process >=1.4 && <1.8, vector >=0.11 && <0.14, bytestring >=0.10 && < 0.12, mmsyn2 >=0.1.7 && <1, directory >=1.2.5 && <1.4, mmsyn6ukr >=0.6.2 && <1, mmsyn3 >=0.1.4 && <1