import System.Time
import System.Environment (getArgs)
import Control.Monad (forever)
import Graphics.UI.SDL as SDL
import Graphics.UI.SDL.Mixer
main = do
SDL.init [InitAudio]
openAudio 22050 AudioS16Sys 2 4096
h:m:_ <- fmap (map read) getArgs
wait h m
wait h m = do
now <- toCalendarTime =<< getClockTime
if h == ctHour now && m == ctMin now
then alarm
else delay 5000 >> wait h m
alarm = do
mus <- loadMUS "sawtooth.ogg"
forever $ playMusic mus 1 >> delay 7000