From c60236caa5ad92d1eb20959023e2f4a548c8d1a4 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 17 Dec 2015 15:16:13 -0500 Subject: Silence ALSA error messages --- AlsaShutUp.c | 5 +++++ AlsaShutUp.hs | 4 ++++ midi-dump.hs | 2 ++ 3 files changed, 11 insertions(+) create mode 100644 AlsaShutUp.c create mode 100644 AlsaShutUp.hs diff --git a/AlsaShutUp.c b/AlsaShutUp.c new file mode 100644 index 0000000..1d38891 --- /dev/null +++ b/AlsaShutUp.c @@ -0,0 +1,5 @@ +#include +#include + +void sufferInSilence(const char *file, int line, const char *function, int err, const char *fmt,...) { return; } +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 @@ +module AlsaShutUp where +import Foreign.C + +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 import Data.Set (Set) import System.IO +import AlsaShutUp verbose :: Bool verbose = False @@ -200,6 +201,7 @@ main' = withAlsaInit $ \h public private q publicAddr privateAddr -> do let env = LoopEnv saver sqlite startTime startTimeReal h public private q publicAddr privateAddr doSave False lineReader + void shutUp putStrLn "Rock on!" (_, ()) <- execRWST mainLoop env $ initializeState startTimeReal return () -- cgit v1.2.3