diff options
author | Andrew Cady <d@jerkface.net> | 2015-12-17 15:16:13 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2015-12-17 15:16:13 -0500 |
commit | c60236caa5ad92d1eb20959023e2f4a548c8d1a4 (patch) | |
tree | 735de42cbf1278d470b0122cbee34cd301df7cd9 | |
parent | d2f4cd39447783d6b983e81b5fb65cfdd3ff2ea2 (diff) |
Silence ALSA error messages
-rw-r--r-- | AlsaShutUp.c | 5 | ||||
-rw-r--r-- | AlsaShutUp.hs | 4 | ||||
-rw-r--r-- | midi-dump.hs | 2 |
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 | |||
4 | void sufferInSilence(const char *file, int line, const char *function, int err, const char *fmt,...) { return; } | ||
5 | int 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 @@ | |||
1 | module AlsaShutUp where | ||
2 | import Foreign.C | ||
3 | |||
4 | foreign 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 | |||
45 | import Data.Set (Set) | 45 | import Data.Set (Set) |
46 | 46 | ||
47 | import System.IO | 47 | import System.IO |
48 | import AlsaShutUp | ||
48 | 49 | ||
49 | verbose :: Bool | 50 | verbose :: Bool |
50 | verbose = False | 51 | verbose = 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 () |