module Sound.Sox.Convert where

import qualified Sound.Sox.Private.Option as Option
import qualified Sound.Sox.Private.Arguments as Args
import Data.Monoid (mconcat, )

import qualified System.Process as Cmd
-- import qualified System.IO as IO
import System.Exit (ExitCode, )



{- |
> :load Sound.Sox.Convert
>
> simple Option.none "test.aiff" Option.none "test.wav"
-}
simple ::
   Option.T {- ^ source options -} ->
   FilePath {- ^ source file name -} ->
   Option.T {- ^ target options -} ->
   FilePath {- ^ target file name -} ->
   IO ExitCode
simple :: T -> FilePath -> T -> FilePath -> IO ExitCode
simple T
srcOpts FilePath
srcFile T
dstOpts FilePath
dstFile =
   FilePath -> [FilePath] -> IO ExitCode
Cmd.rawSystem FilePath
"sox"
      (T -> [FilePath]
Args.decons forall a b. (a -> b) -> a -> b
$ forall a. Monoid a => [a] -> a
mconcat forall a b. (a -> b) -> a -> b
$
       T -> T
Option.toArguments T
srcOpts forall a. a -> [a] -> [a]
:
       FilePath -> T
Args.fileName FilePath
srcFile forall a. a -> [a] -> [a]
:
       T -> T
Option.toArguments T
dstOpts forall a. a -> [a] -> [a]
:
       FilePath -> T
Args.fileName FilePath
dstFile forall a. a -> [a] -> [a]
:
       [])