]> gitweb @ CieloNegro.org - bindings-EsounD.git/commitdiff
esd.h (partway)
authorPHO <pho@cielonegro.org>
Tue, 19 Oct 2010 13:12:22 +0000 (22:12 +0900)
committerPHO <pho@cielonegro.org>
Tue, 19 Oct 2010 13:12:22 +0000 (22:12 +0900)
.gitignore [new file with mode: 0644]
Bindings/EsounD.hsc [new file with mode: 0644]
COPYING [new file with mode: 0644]
GNUmakefile [new file with mode: 0644]
Setup.hs [new file with mode: 0644]
bindings-EsounD.cabal [new file with mode: 0644]
cabal-package.mk [new file with mode: 0644]
cbits/helper_EsounD.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..f76a6e2
--- /dev/null
@@ -0,0 +1,5 @@
+*.hi
+*.o
+
+Setup
+dist
diff --git a/Bindings/EsounD.hsc b/Bindings/EsounD.hsc
new file mode 100644 (file)
index 0000000..dffe193
--- /dev/null
@@ -0,0 +1,167 @@
+#include <bindings.dsl.h>
+#include <esd.h>
+
+module Bindings.EsounD where
+#strict_import
+
+#globalarray ESD_UNIX_SOCKET_DIR , CChar
+#globalarray ESD_UNIX_SOCKET_NAME, CChar
+
+#num ESD_BUF_SIZE
+#num ESD_MAX_WRITE_SIZE
+#num ESD_KEY_LEN
+#num ESD_DEFAULT_PORT
+#num ESD_DEFAULT_RATE
+#num ESD_NAME_MAX
+#num ESD_ENDIAN_KEY
+#num ESD_VOLUME_BASE
+
+#num ESD_PROTO_CONNECT
+#num ESD_PROTO_LOCK
+#num ESD_PROTO_UNLOCK
+#num ESD_PROTO_STREAM_PLAY
+#num ESD_PROTO_STREAM_REC
+#num ESD_PROTO_STREAM_MON
+#num ESD_PROTO_SAMPLE_CACHE
+#num ESD_PROTO_SAMPLE_FREE
+#num ESD_PROTO_SAMPLE_PLAY
+#num ESD_PROTO_SAMPLE_LOOP
+#num ESD_PROTO_SAMPLE_STOP
+#num ESD_PROTO_SAMPLE_KILL
+#num ESD_PROTO_STANDBY
+#num ESD_PROTO_RESUME
+#num ESD_PROTO_SAMPLE_GETID
+#num ESD_PROTO_STREAM_FILT
+#num ESD_PROTO_SERVER_INFO
+#num ESD_PROTO_ALL_INFO
+#num ESD_PROTO_SUBSCRIBE
+#num ESD_PROTO_UNSUBSCRIBE
+#num ESD_PROTO_STREAM_PAN
+#num ESD_PROTO_SAMPLE_PAN
+#num ESD_PROTO_STANDBY_MODE
+#num ESD_PROTO_LATENCY
+#num ESD_PROTO_MAX
+
+#num ESD_MASK_BITS
+#num ESD_BITS8
+#num ESD_BITS16
+
+#num ESD_MASK_CHAN
+#num ESD_MONO
+#num ESD_STEREO
+
+#num ESD_MASK_MODE
+#num ESD_STREAM
+#num ESD_SAMPLE
+#num ESD_ADPCM
+
+#num ESD_MASK_FUNC
+#num ESD_PLAY
+#num ESD_MONITOR
+#num ESD_RECORD
+#num ESD_STOP
+#num ESD_LOOP
+
+#integral_t esd_format_t
+#integral_t esd_proto_t
+
+#integral_t octet
+
+#ccall esd_open_sound, Ptr CChar -> IO CInt
+#ccall esd_send_auth , CInt -> IO CInt
+#ccall esd_lock      , CInt -> IO CInt
+#ccall esd_unlock    , CInt -> IO CInt
+#ccall esd_standby   , CInt -> IO CInt
+#ccall esd_resume    , CInt -> IO CInt
+
+#ccall esd_play_stream           , <esd_format_t> -> CInt -> Ptr CChar -> Ptr CChar -> IO CInt
+#ccall esd_play_stream_fallback  , <esd_format_t> -> CInt -> Ptr CChar -> Ptr CChar -> IO CInt
+#ccall esd_monitor_stream        , <esd_format_t> -> CInt -> Ptr CChar -> Ptr CChar -> IO CInt
+#ccall esd_record_stream         , <esd_format_t> -> CInt -> Ptr CChar -> Ptr CChar -> IO CInt
+#ccall esd_record_stream_fallback, <esd_format_t> -> CInt -> Ptr CChar -> Ptr CChar -> IO CInt
+#ccall esd_filter_stream         , <esd_format_t> -> CInt -> Ptr CChar -> Ptr CChar -> IO CInt
+#ccall esd_sample_cache          , CInt -> <esd_format_t> -> CInt -> CInt -> Ptr CChar -> IO CInt
+#ccall esd_confirm_sample_cache  , CInt -> IO CInt
+#ccall esd_sample_getid          , CInt -> Ptr CChar -> IO CInt
+#ccall esd_sample_free           , CInt -> CInt -> IO CInt
+#ccall esd_sample_play           , CInt -> CInt -> IO CInt
+#ccall esd_sample_loop           , CInt -> CInt -> IO CInt
+#ccall esd_sample_stop           , CInt -> CInt -> IO CInt
+#ccall esd_sample_kill           , CInt -> CInt -> IO CInt
+#ccall esd_close                 , CInt -> IO CInt
+#ccall esd_get_latency           , CInt -> IO CInt
+
+#starttype struct esd_server_info
+#  field version, CInt
+#  field format , <esd_format_t>
+#  field rate   , CInt
+#stoptype
+#synonym_t esd_server_info_t, <esd_server_info>
+
+#starttype struct esd_player_info
+#  field next           , Ptr <esd_player_info>
+#  field server         , Ptr <esd_server_info_t>
+#  field source_id      , CInt
+#  array_field name     , CChar
+#  field rate           , CInt
+#  field left_vol_scale , CInt
+#  field right_vol_scale, CInt
+#  field format         , <esd_format_t>
+#stoptype
+#synonym_t esd_player_info_t, <esd_player_info>
+
+#starttype struct esd_sample_info
+#  field next           , Ptr <esd_sample_info>
+#  field server         , Ptr <esd_server_info_t>
+#  field sample_id      , CInt
+#  array_field name     , CChar
+#  field rate           , CInt
+#  field left_vol_scale , CInt
+#  field right_vol_scale, CInt
+#  field format         , <esd_format_t>
+#  field length         , CInt
+#stoptype
+#synonym_t esd_sample_info_t, <esd_sample_info>
+
+#starttype struct esd_info
+#  field server     , Ptr <esd_server_info_t>
+#  field player_list, Ptr <esd_player_info_t>
+#  field sample_list, Ptr <esd_sample_info_t>
+#stoptype
+#synonym_t esd_info_t, <esd_info>
+
+#num ESM_ERROR
+#num ESM_ON_STANDBY
+#num ESM_ON_AUTOSTANDBY
+#num ESM_RUNNING
+#integral_t esd_standby_mode_t
+
+#callback esd_new_player_callback_t, Ptr <esd_player_info_t> -> IO CInt
+#callback esd_old_player_callback_t, Ptr <esd_player_info_t> -> IO CInt
+#callback esd_new_sample_callback_t, Ptr <esd_sample_info_t> -> IO CInt
+#callback esd_old_sample_callback_t, Ptr <esd_sample_info_t> -> IO CInt
+
+#starttype struct esd_update_info_callbacks
+#  field esd_new_player_callback, Ptr <esd_new_player_callback_t>
+#  field esd_old_player_callback, Ptr <esd_old_player_callback_t>
+#  field esd_new_sample_callback, Ptr <esd_new_sample_callback_t>
+#  field esd_old_sample_callback, Ptr <esd_old_sample_callback_t>
+#stoptype
+#synonym_t esd_update_info_callbacks_t, <esd_update_info_callbacks>
+
+#ccall esd_print_server_info     , Ptr <esd_server_info_t> -> IO ()
+#ccall esd_print_player_info     , Ptr <esd_player_info_t> -> IO ()
+#ccall esd_print_sample_info     , Ptr <esd_sample_info_t> -> IO ()
+#ccall esd_print_all_info        , Ptr <esd_info_t> -> IO ()
+#ccall esd_get_server_info       , CInt -> IO (Ptr <esd_server_info_t>)
+#ccall esd_free_server_info      , Ptr <esd_server_info_t> -> IO ()
+#ccall esd_get_all_info          , CInt -> IO (Ptr <esd_info_t>)
+#ccall esd_subscribe_all_info    , CInt -> IO (Ptr <esd_info_t>)
+#ccall esd_update_info           , CInt -> Ptr <esd_info_t> -> Ptr <esd_update_info_callbacks_t> -> IO (Ptr <esd_info_t>)
+#ccall esd_unsubscribe_info      , CInt -> IO (Ptr <esd_info_t>)
+#ccall esd_free_all_info         , Ptr <esd_info_t> -> IO ()
+#ccall esd_set_stream_pan        , CInt -> CInt -> CInt -> CInt -> IO CInt
+#ccall esd_set_default_sample_pan, CInt -> CInt -> CInt -> CInt -> IO CInt
+#ccall esd_get_standby_mode      , CInt -> IO <esd_standby_mode_t>
+
+#ccall esd_send_file, CInt -> 
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..5d39aa7
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,29 @@
+<!-- -*- xml -*-
+
+bindings-EsounD はパブリックドメインに在ります。
+bindings-EsounD is in the public domain.
+
+See http://creativecommons.org/licenses/publicdomain/
+
+-->
+
+<rdf:RDF xmlns="http://web.resource.org/cc/"
+            xmlns:dc="http://purl.org/dc/elements/1.1/"
+            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <Work rdf:about="http://cielonegro.org/Bindings-EsounD.html">
+       <dc:title>bindings-EsounD</dc:title>
+       <dc:rights>
+      <Agent>
+           <dc:title>PHO</dc:title>
+         </Agent>
+    </dc:rights>
+       <license rdf:resource="http://web.resource.org/cc/PublicDomain" />
+  </Work>
+      
+  <License rdf:about="http://web.resource.org/cc/PublicDomain">
+       <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
+       <permits rdf:resource="http://web.resource.org/cc/Distribution" />
+       <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+  </License>
+
+</rdf:RDF>
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644 (file)
index 0000000..15098cd
--- /dev/null
@@ -0,0 +1,5 @@
+#RUN_COMMAND = $(MAKE) -C examples run
+
+CONFIGURE_ARGS = -O
+
+include cabal-package.mk
diff --git a/Setup.hs b/Setup.hs
new file mode 100644 (file)
index 0000000..bd92fff
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,4 @@
+#!/usr/bin/env runghc
+
+import Distribution.Simple
+main = defaultMain
diff --git a/bindings-EsounD.cabal b/bindings-EsounD.cabal
new file mode 100644 (file)
index 0000000..e8e2a9c
--- /dev/null
@@ -0,0 +1,38 @@
+Name: bindings-EsounD
+Synopsis: Low level bindings to EsounD (ESD; Enlightened Sound Daemon)
+Description:
+        Bindings to EsounD: <http://www.tux.org/~ricdude/EsounD.html>
+Version: 0.1
+License: PublicDomain
+License-File: COPYING
+Author: PHO <pho at cielonegro dot org>
+Maintainer: PHO <pho at cielonegro dot org>
+Stability: experimental
+Homepage: http://cielonegro.org/Bindings-EsounD.html
+Category: FFI
+Tested-With: GHC == 6.12.3
+Cabal-Version: >= 1.6
+Build-Type: Simple
+Extra-Source-Files:
+    COPYING
+
+Source-Repository head
+    Type: git
+    Location: git://git.cielonegro.org/bindings-EsounD.git
+
+Library
+    Build-Depends:
+        base         == 4.2.*,
+        bindings-DSL == 1.0.*
+
+    Exposed-Modules:
+        Bindings.EsounD
+
+    PkgConfig-Depends:
+        esound >= 0.2
+
+    C-Sources:
+        cbits/helper_EsounD.c
+
+    Extensions:
+        ForeignFunctionInterface
diff --git a/cabal-package.mk b/cabal-package.mk
new file mode 100644 (file)
index 0000000..d8bbaad
--- /dev/null
@@ -0,0 +1,95 @@
+# -*- makefile-gmake -*-
+#
+# Variables:
+#
+#   CONFIGURE_ARGS :: arguments to be passed to ./Setup configure
+#     default: --disable-optimization
+#
+#   RUN_COMMAND :: command to be run for "make run"
+#
+
+GHC      ?= ghc
+FIND     ?= find
+RM_RF    ?= rm -rf
+SUDO     ?= sudo
+AUTOCONF ?= autoconf
+HLINT    ?= hlint
+
+CONFIGURE_ARGS ?= --disable-optimization
+
+SETUP_FILE := $(wildcard Setup.*hs)
+CABAL_FILE := $(wildcard *.cabal)
+
+ifeq ($(shell ls configure.ac 2>/dev/null),configure.ac)
+  AUTOCONF_AC_FILE := configure.ac
+  AUTOCONF_FILE    := configure
+else
+  ifeq ($(shell ls configure.in 2>/dev/null),configure.in)
+    AUTOCONF_AC_FILE := configure.in
+    AUTOCONF_FILE    := configure
+  else
+    AUTOCONF_AC_FILE :=
+    AUTOCONF_FILE    :=
+  endif
+endif
+
+BUILDINFO_IN_FILE := $(wildcard *.buildinfo.in)
+BUILDINFO_FILE    := $(BUILDINFO_IN_FILE:.in=)
+
+all: build
+
+build: setup-config build-hook
+       ./Setup build
+
+build-hook:
+
+ifeq ($(RUN_COMMAND),)
+run:
+       @echo "cabal-package.mk: No command to run."
+       @echo "cabal-package.mk: If you want to run something, define RUN_COMMAND variable."
+else
+run: build
+       @echo ".:.:. Let's go .:.:."
+       $(RUN_COMMAND)
+endif
+
+setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE)
+
+setup-config-hook:
+
+dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE)
+       ./Setup configure $(CONFIGURE_ARGS)
+
+$(AUTOCONF_FILE): $(AUTOCONF_AC_FILE)
+       $(AUTOCONF)
+
+$(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure
+       ./Setup configure $(CONFIGURE_ARGS)
+
+Setup: $(SETUP_FILE)
+       $(GHC) --make Setup
+
+clean: clean-hook
+       $(RM_RF) dist Setup *.o *.hi .setup-config *.buildinfo
+       $(FIND) . -name '*~' -exec rm -f {} \;
+
+clean-hook:
+
+doc: setup-config
+       ./Setup haddock
+
+install: build
+       $(SUDO) ./Setup install
+
+sdist: setup-config
+       ./Setup sdist
+
+test: build
+       ./Setup test
+
+lint:
+       $(HLINT) . --report \
+               --ignore="Use string literal" \
+               --ignore="Use concatMap"
+
+.PHONY: build build-hook setup-config setup-config-hook run clean clean-hook install doc sdist test lint
diff --git a/cbits/helper_EsounD.c b/cbits/helper_EsounD.c
new file mode 100644 (file)
index 0000000..11788cd
--- /dev/null
@@ -0,0 +1,5 @@
+#include <bindings.cmacros.h>
+#include <esd.h>
+
+BC_GLOBALARRAY(ESD_UNIX_SOCKET_DIR , char)
+BC_GLOBALARRAY(ESD_UNIX_SOCKET_NAME, char)