From ae218c567a13baf81e1d9726783510bb970bd1b0 Mon Sep 17 00:00:00 2001 From: Conrad Parker Date: Mon, 12 Dec 2011 11:30:08 +0800 Subject: [PATCH] gen: generate a stream of 100 textures --- tools/texture-synthesis.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/texture-synthesis.hs b/tools/texture-synthesis.hs index c60be85..2a3dd99 100644 --- a/tools/texture-synthesis.hs +++ b/tools/texture-synthesis.hs @@ -7,7 +7,7 @@ module Main ( ) where import Control.Applicative ((<$>)) -import Control.Monad (foldM) +import Control.Monad (foldM, replicateM_) import Control.Monad.Trans (liftIO) import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as C @@ -141,18 +141,18 @@ texGenHandler = do texWriteFile :: Config -> [FilePath] -> IO () texWriteFile _ [] = return () texWriteFile Config{..} (path:_) = do - ss <- slices <$> flattenTexture 6 <$> genTexture 5 - -- ss <- slices <$> flattenTexture 5 <$> genTexture 4 - -- ss <- slices <$> flattenTexture 3 <$> genTexture 2 + let mk = slices <$> flattenTexture 6 <$> genTexture 5 + -- let mk = slices <$> flattenTexture 5 <$> genTexture 4 + -- let mk = slices <$> flattenTexture 3 <$> genTexture 2 if variable then do let spec = oneTrackMultichannel channels (undefined :: Float) delta zlib VariableSR rate' label - withFileWrite spec (not noRaw) (sW >> mapM_ (write track) - (zip (map SO [10000,10002..]) ss)) path + withFileWrite spec (not noRaw) (sW >> liftIO mk >>= (\ss -> mapM_ (write track) + (zip (map SO [10000,10002..]) ss))) path else do let spec = oneTrackMultichannel channels (undefined :: Float) delta zlib ConstantSR rate' label - withFileWrite spec (not noRaw) (sW >> mapM_ (write track) ss) path + withFileWrite spec (not noRaw) (sW >> replicateM_ 100 (liftIO mk >>= mapM_ (write track))) path where rate' = fromInteger rate sW = setWatermark 1 wmLevel