From 332de27c05d195598689979c035bd136a47f4394 Mon Sep 17 00:00:00 2001 From: PHO Date: Fri, 31 Dec 2010 23:54:55 +0900 Subject: [PATCH] EsdPlayerExample (only a skeleton for now) --- EsounD.cabal | 33 +++++++++++++++++++++++++++++---- GNUmakefile | 4 ++-- Sound/EsounD/Player.hs | 4 ++-- examples/EsdPlayerExample.hs | 9 +++++++++ 4 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 examples/EsdPlayerExample.hs diff --git a/EsounD.cabal b/EsounD.cabal index d921824..6add96a 100644 --- a/EsounD.cabal +++ b/EsounD.cabal @@ -20,14 +20,18 @@ Source-Repository head Type: git Location: git://git.cielonegro.org/EsounD.git +Flag build-examples + Description: Build example programs. + Default: False + Library Build-Depends: - base == 4.2.*, + base == 4.*, base-unicode-symbols == 0.2.*, bindings-EsounD == 0.1.*, - network == 2.2.*, - regions == 0.7.*, - safer-file-handles == 0.8.*, + network == 2.3.*, + regions == 0.8.*, + safer-file-handles == 0.9.*, storablevector == 0.2.*, transformers == 0.2.*, unix == 2.4.* @@ -48,3 +52,24 @@ Library GHC-Options: -Wall + +Executable hs-esd-player-example + if flag(build-examples) + Buildable: True + else + Buildable: False + + HS-Source-Dirs: + ., + examples + + Main-Is: EsdPlayerExample.hs + + Extensions: + EmptyDataDecls + KindSignatures + ScopedTypeVariables + UnicodeSyntax + + GHC-Options: + -Wall diff --git a/GNUmakefile b/GNUmakefile index 15098cd..a245964 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,5 +1,5 @@ -#RUN_COMMAND = $(MAKE) -C examples run +RUN_COMMAND = ./dist/build/hs-esd-player-example/hs-esd-player-example -CONFIGURE_ARGS = -O +CONFIGURE_ARGS = -O -fbuild-examples include cabal-package.mk diff --git a/Sound/EsounD/Player.hs b/Sound/EsounD/Player.hs index 0d2b209..b60eda0 100644 --- a/Sound/EsounD/Player.hs +++ b/Sound/EsounD/Player.hs @@ -25,9 +25,9 @@ data Player fr ch (r ∷ * → *) plRate ∷ !Int -- THINKME: We really want to use RegionalFileHandle but we -- can't, because safer-file-handles currently provides no ways - -- to wrap ordinary handles. + -- to wrap ordinary handles into safer handles. , plHandle ∷ !Handle - , plCloseH ∷ !(CloseHandle r) + , plCloseH ∷ !(FinalizerHandle r) } instance Dup (Player fr ch) where diff --git a/examples/EsdPlayerExample.hs b/examples/EsdPlayerExample.hs new file mode 100644 index 0000000..7de9ba9 --- /dev/null +++ b/examples/EsdPlayerExample.hs @@ -0,0 +1,9 @@ +module Main where +import Control.Monad.Trans.Region +import Sound.EsounD.Player + +main ∷ IO () +main = runRegionT $ + do pl ← openPlayer 44100 "localhost" Nothing + fail "FIXME" + -- 2.40.0