
15 Nov
2012
15 Nov
'12
6:18 a.m.
Hi guys, I'm building an application that needs to wrap an external mp3 player, in this case mpg123. Here is my code: import System.IO import System.Process import Control.Concurrent mpgLoop = do let sh = "mpg123 -R" (Just hin, Just hout, _, hdl) <- createProcess (shell sh){ std_in = CreatePipe, std_out=CreatePipe } --hPutStrLn hin "SILENCE" hPutStrLn hin "LOAD /home/rnons/Music/test.mp3" hFlush hin waitForProcess hdl return () main = do forkIO mpgLoop -- threadDelay 20000000 getChar I expected with "waitForProcess", this program will be able to run till the song ends. However, mpg123 plays for only 6 seconds. Maybe I missed something? rnons