proteaaudio 0.6.4 → 0.6.5
raw patch · 3 files changed
+58/−5 lines, 3 filesdep +bytestringdep +filepathdep +proteaaudionew-component:exe:proteaaudio-play
Dependencies added: bytestring, filepath, proteaaudio
Files
- cbits/proteaaudio_binding.cpp +4/−0
- example/play.hs +27/−0
- proteaaudio.cabal +27/−5
cbits/proteaaudio_binding.cpp view
@@ -1,5 +1,9 @@ #include "proteaaudio_binding.h" #include "proAudioRt.h"+#include <cstring>+#include <cstdlib>++using namespace std; typedef struct { unsigned char * data;
+ example/play.hs view
@@ -0,0 +1,27 @@+import Control.Monad+import System.Environment+import System.FilePath+import qualified Data.ByteString as SB+import Control.Concurrent++import Sound.ProteaAudio++main = do+ args <- getArgs+ initAudio 64 44100 1024+ let fname = head args+ -- load from file+ smp <- sampleFromFile fname 1.0 -- volume++ buf <- SB.readFile fname+ -- load from memory buffer+ smp' <- case takeExtension fname of+ ".ogg" -> SB.useAsCStringLen buf $ \(p,i) -> sampleFromMemoryOgg p i 1+ ".wav" -> SB.useAsCStringLen buf $ \(p,i) -> sampleFromMemoryWav p i 1++ soundPlay smp' 1 1 0 1+ let loop = do+ n <- soundActive+ when (n > 0) $ threadDelay 1000000 >> loop+ loop+ finishAudio
proteaaudio.cabal view
@@ -1,7 +1,7 @@ Name: proteaaudio-Version: 0.6.4-Synopsis: Simple audio library for Windows/Linux/OSX.-Description: Simple audio library for Windows/Linux/OSX. Supports Ogg and Wav playback and multichannel mixing.+Version: 0.6.5+Synopsis: Simple audio library for Windows, Linux, OSX.+Description: Simple audio library for Windows, Linux, OSX. Supports Ogg and Wav playback and multichannel mixing. License: BSD3 License-file: LICENSE Author: Csaba Hruska@@ -9,7 +9,7 @@ Stability: Experimental Category: Sound Tested-With: GHC == 7.10.3-Cabal-Version: >= 1.6+Cabal-Version: >= 1.10 Build-Type: Simple Extra-Source-Files:@@ -40,17 +40,23 @@ Sound/ProteaAudio.chs + example/play.hs++Flag example+ Description: Build with example+ Default: False+ source-repository head type: git location: https://github.com/csabahruska/proteaaudio Library Build-Depends: base >= 4 && < 5+ default-language: Haskell2010 Build-tools: c2hs Exposed-Modules: Sound.ProteaAudio Hs-Source-Dirs: .- Extensions: ForeignFunctionInterface C-Sources: cbits/RtAudio.cpp cbits/proAudio.cpp@@ -72,3 +78,19 @@ Frameworks: CoreFoundation CoreAudio ghc-options: -O2++executable proteaaudio-play+ if flag(example)+ Buildable: True+ else+ Buildable: False++ hs-source-dirs: example+ main-is: play.hs+ default-language: Haskell2010++ build-depends:+ base >= 4 && < 5,+ filepath >=1.4 && <1.5,+ bytestring == 0.10.*,+ proteaaudio