summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2015-12-11 10:10:38 -0500
committerAndrew Cady <d@jerkface.net>2015-12-11 10:10:38 -0500
commitc012a42e53c1bccd5e113fea5f616115f6f85835 (patch)
treeaaf2c6ae9370fedb9cd157728ea25ceb619bc78f
parentfb2de6dfe362f62f3dde0027833f09caf3e71529 (diff)
Output a message whenever a midi file is saved.
-rw-r--r--midi-dump.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/midi-dump.hs b/midi-dump.hs
index 56a1d50..5084258 100644
--- a/midi-dump.hs
+++ b/midi-dump.hs
@@ -240,7 +240,6 @@ processCommand "save" = do
240 recording <- gets _replay 240 recording <- gets _replay
241 filename <- chooseFileName recording 241 filename <- chooseFileName recording
242 saveRecording filename recording 242 saveRecording filename recording
243 liftIO $ putStrLn $ "Saved to " ++ filename
244processCommand "dump" = sqlSelectEVERYTHING >>= saveRecording "dumped.mid" . mconcat 243processCommand "dump" = sqlSelectEVERYTHING >>= saveRecording "dumped.mid" . mconcat
245processCommand "C" = do 244processCommand "C" = do
246 let notes = (Event.NoteEv Event.NoteOn . mkNote) <$> [60, 64, 67] 245 let notes = (Event.NoteEv Event.NoteOn . mkNote) <$> [60, 64, 67]
@@ -280,7 +279,9 @@ backgroundWithWait fn = do
280 modify $ \s -> s { _waitThreads = wait:_waitThreads s } 279 modify $ \s -> s { _waitThreads = wait:_waitThreads s }
281 280
282saveEvents :: FilePath -> [RecordedEvent] -> MidiController () 281saveEvents :: FilePath -> [RecordedEvent] -> MidiController ()
283saveEvents file evts@(_:_) = backgroundWithWait $ Codec.Midi.exportFile file (toSingleTrackMidi evts) 282saveEvents file evts@(_:_) = backgroundWithWait $ do
283 Codec.Midi.exportFile file (toSingleTrackMidi evts)
284 liftIO $ putStrLn $ "Saved to " ++ file
284saveEvents _ _ = return () 285saveEvents _ _ = return ()
285 286
286-- NOTE: The list must be in ascending order for this to work 287-- NOTE: The list must be in ascending order for this to work