summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2015-12-17 15:16:13 -0500
committerAndrew Cady <d@jerkface.net>2015-12-17 15:16:13 -0500
commitc60236caa5ad92d1eb20959023e2f4a548c8d1a4 (patch)
tree735de42cbf1278d470b0122cbee34cd301df7cd9
parentd2f4cd39447783d6b983e81b5fb65cfdd3ff2ea2 (diff)
Silence ALSA error messages
-rw-r--r--AlsaShutUp.c5
-rw-r--r--AlsaShutUp.hs4
-rw-r--r--midi-dump.hs2
3 files changed, 11 insertions, 0 deletions
diff --git a/AlsaShutUp.c b/AlsaShutUp.c
new file mode 100644
index 0000000..1d38891
--- /dev/null
+++ b/AlsaShutUp.c
@@ -0,0 +1,5 @@
1#include <stdarg.h>
2#include <alsa/error.h>
3
4void sufferInSilence(const char *file, int line, const char *function, int err, const char *fmt,...) { return; }
5int alsaShutUp() { return snd_lib_error_set_handler(sufferInSilence); }
diff --git a/AlsaShutUp.hs b/AlsaShutUp.hs
new file mode 100644
index 0000000..cf7436a
--- /dev/null
+++ b/AlsaShutUp.hs
@@ -0,0 +1,4 @@
1module AlsaShutUp where
2import Foreign.C
3
4foreign import ccall "alsaShutUp" shutUp :: IO CInt
diff --git a/midi-dump.hs b/midi-dump.hs
index 0082987..59a9df5 100644
--- a/midi-dump.hs
+++ b/midi-dump.hs
@@ -45,6 +45,7 @@ import qualified Data.Set as Set
45import Data.Set (Set) 45import Data.Set (Set)
46 46
47import System.IO 47import System.IO
48import AlsaShutUp
48 49
49verbose :: Bool 50verbose :: Bool
50verbose = False 51verbose = False
@@ -200,6 +201,7 @@ main' = withAlsaInit $ \h public private q publicAddr privateAddr -> do
200 201
201 let env = LoopEnv saver sqlite startTime startTimeReal h public private q publicAddr privateAddr doSave False lineReader 202 let env = LoopEnv saver sqlite startTime startTimeReal h public private q publicAddr privateAddr doSave False lineReader
202 203
204 void shutUp
203 putStrLn "Rock on!" 205 putStrLn "Rock on!"
204 (_, ()) <- execRWST mainLoop env $ initializeState startTimeReal 206 (_, ()) <- execRWST mainLoop env $ initializeState startTimeReal
205 return () 207 return ()