I don't know if this will help you much, since you said you were
pretty new to haskell, but I wrote a portmidi wrapper a while ago.
The catch is that eventually I wrote a CoreMidi wrapper and stopped
using portmidi so I haven't touched it for ages... but I just compiled
the test program and it seems to still work.  I'm also on OSX 10.5.7,
but I haven't updated portmidi since I stopped using it, so I probably
have an old version.

Anyway, it's definitely not complete tested code, not packaged up with
cabal or anything like that, and in fact it's quite dusty and I
haven't touched it for a long time, but there's example code in
Midi/TestMidi.hs that does simple thru, plays some scales, etc. if you
uncomment the right stuff.  Maybe it would be interesting to look at,
if not useful.  There are also CoreMIDI bindings in the same
directory, which are in active use and should be less dusty.

High-level portmidi interface is in Midi.PortMidiC, CoreMIDI in Midi.CoreMidi.

http://ofb.net/~elaforge/hs/hsmidi.tgz

On Thu, Jul 30, 2009 at 12:03 PM, erik flister<erik.flis...@gmail.com> wrote:
> hey paul-
> i found your project at http://code.haskell.org/PortMidi/.  i've
> downloaded it and am trying to get it working on osx 10.5.7 intel with
> ghc 6.10.3.  when trying to build i get a bunch of errors (attached
> below).
>
> i can build/install portmidi release 82, but not 131, from
> http://sourceforge.net/projects/portmedia/files/, due to
> incompatibilities with osx 10.5 that stephen pope posted to this list.
>  i also tried the svn head (rev 156) at
> https://portmedia.svn.sourceforge.net/svnroot/portmedia.  with that, i
> can build the static .a libraries without errors, but not the .dylib
> (errors attached below).  roger, i was wondering whether you'd have
> time to look into the 10.5 issues?
>
> i think the errors building the haskell bindings might be due to the
> portmidi 10.5 incompatibility, and indeed i can get them to work after
> installing the dylib from release 82 (i don't know how to try the
> static .a's).  i have to make the following changes to the .cabal file
> for it to build and link:
> -comment out the c-sources tag and files
> -add a line "extra-libraries: portmidi"
>
> that is enough to get things working:
> erik-flisters-macbook-pro:~ eflister$ ghci
> GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer ... linking ... done.
> Loading package base ... linking ... done.
> Prelude> :m Sound.PortMidi
> Prelude Sound.PortMidi> PMMsg { status = 0x90, data1 = 60, data2 = 100 }
> Loading package PortMidi-0.1 ... linking ... done.
> PMMsg {status = 144, data1 = 60, data2 = 100}
> Prelude Sound.PortMidi> time
> 557159217
>
> it seems cabal wants you to make the following changes to get rid of
> warnings, but i'm not sure of the implications:
> -in Setup.hs, replace defaultUserHooks with simpleUserHooks
> -in .cabal file, add "build-type: Simple"
>
> i am now trying to make a version of portmidi's pm_test/test.c
> (especially simple realtime midi output) -- see attached.  i am pretty
> new to haskell (only a couple weeks), so i am wondering if paul has
> any demo code he could share, or could share a few quick tips?  i am
> trying to figure out how to deal with all the monad wrappers.  :)  so
> the issue is getting the device from getDefaultOutputDeviceID
> connected to getDeviceInfo and openOutput, the stream from openOutput
> connected to writeEvents and close, etc.  the Maybe and Either monads
> are getting in my way -- i know there's a nice way to lift into them,
> i just can't figure out how.  also, i have a hunch that there is a
> better way to force the evaluation of initialize and terminate than
> the printing i'm doing.
>
> finally, i am getting a bus error sometimes when calling initialize or
> terminate, even though i am pretty sure i am forcing their evaluation
> (they are printing "NoError").  i can load the program, run main
> several times, reload it, run main several times again, etc.  but if i
> load it, run main a few times, then let it sit for a couple seconds,
> initialize crashes with the bus error.  roger, could this be because
> of using the old release 82?  or is it indicative that terminate is
> not actually evaluating?  or something else?
>
> thanks for your help!
> -erik
>
>
>
> *****errors from building haskell bindings********
> erik-flisters-macbook-pro:PortMidi eflister$ runhaskell Setup.hs configure
> Setup.hs:3:0:
>     Warning: In the use of `defaultUserHooks'
>              (imported from Distribution.Simple):
>              Deprecated: "Use simpleUserHooks or autoconfUserHooks,
> unless you need Cabal-1.2
>              compatibility in which case you must stick with defaultUserHooks"
> Warning: defaultUserHooks in Setup script is deprecated.
> Configuring PortMidi-0.1...
> Warning: No 'build-type' specified. If you do not need a custom Setup.hs or
> ./configure script then use 'build-type: Simple'.
> erik-flisters-macbook-pro:PortMidi eflister$ runhaskell Setup.hs build
> Setup.hs:3:0:
>     Warning: In the use of `defaultUserHooks'
>              (imported from Distribution.Simple):
>              Deprecated: "Use simpleUserHooks or autoconfUserHooks,
> unless you need Cabal-1.2
>              compatibility in which case you must stick with defaultUserHooks"
> Preprocessing library PortMidi-0.1...
> Building PortMidi-0.1...
> [1 of 1] Compiling Sound.PortMidi   ( Sound/PortMidi.hs,
> dist/build/Sound/PortMidi.o )
> In file included from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:29,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:125,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
>                  from portmidi/pm_mac/pmmacosxcm.c:38:0:
> /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/xmmintrin.h:35:3:
>      error: #error "SSE instruction set not enabled"
> In file included from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:125,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,
>                  from
> /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
>                  from portmidi/pm_mac/pmmacosxcm.c:38:0:
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:216:0:
>      error: syntax error before ‘__m128’
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:218:0:
>      error: syntax error before ‘sd’
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:220:0:
>      error: syntax error before ‘}’ token
> /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:264:0:
>      error: array type has incomplete element type
>
>
>
>
>
> ******errors from building portmidi from svn revision 156*******
> erik-flisters-macbook-pro:trunk eflister$ make -f pm_mac/Makefile.osx install
> cc -single_module -g  -Iporttime -Ipm_common -arch ppc -arch i386 \
>           -dynamiclib pm_mac/pmmac.c pm_common/pmutil.c
> pm_common/portmidi.c pm_mac/pmmacosxcm.c pm_mac/readbinaryplist.c
> pm_mac/finddefault.c porttime/porttime.c porttime/ptmacosx_mach.c -o
> pm_mac/libportmidi.dylib \
>  -flat_namespace -undefined suppress \
>  -framework CoreMIDI -framework CoreFoundation \
>  -framework CoreAudio -framework CoreServices
> pm_mac/readbinaryplist.c:77:21: error: Folders.h: No such file or directory
> pm_mac/readbinaryplist.c:125: error: syntax error before ‘abort_parsing’
> pm_mac/readbinaryplist.c:125: warning: data definition has no type or
> storage class
> pm_mac/readbinaryplist.c:203: error: syntax error before ‘OSType’
> pm_mac/readbinaryplist.c:371: error: syntax error before ‘OSType’
> pm_mac/readbinaryplist.c: In function ‘bplist_read_pref’:
> pm_mac/readbinaryplist.c:373: error: ‘FSRef’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:373: error: (Each undeclared identifier is
> reported only once
> pm_mac/readbinaryplist.c:373: error: for each function it appears in.)
> pm_mac/readbinaryplist.c:373: error: syntax error before ‘prefdir’
> pm_mac/readbinaryplist.c:376: error: ‘OSErr’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:376: error: syntax error before ‘err’
> pm_mac/readbinaryplist.c:378: error: ‘err’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:382: error: ‘prefdir’ undeclared (first use
> in this function)
> pm_mac/readbinaryplist.c:382: error: ‘UInt8’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:382: error: syntax error before ‘)’ token
> pm_mac/readbinaryplist.c:388: error: ‘filename’ undeclared (first use
> in this function)
> pm_mac/readbinaryplist.c: In function ‘bplist_read_system_pref’:
> pm_mac/readbinaryplist.c:394: error: ‘kSystemPreferencesFolderType’
> undeclared (first use in this function)
> pm_mac/readbinaryplist.c: In function ‘bplist_read_user_pref’:
> pm_mac/readbinaryplist.c:399: error: ‘kPreferencesFolderType’
> undeclared (first use in this function)
> pm_mac/readbinaryplist.c:77:21: error: Folders.h: No such file or directory
> pm_mac/readbinaryplist.c:125: error: syntax error before ‘abort_parsing’
> pm_mac/readbinaryplist.c:125: warning: data definition has no type or
> storage class
> pm_mac/readbinaryplist.c:203: error: syntax error before ‘OSType’
> pm_mac/readbinaryplist.c:371: error: syntax error before ‘OSType’
> pm_mac/readbinaryplist.c: In function ‘bplist_read_pref’:
> pm_mac/readbinaryplist.c:373: error: ‘FSRef’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:373: error: (Each undeclared identifier is
> reported only once
> pm_mac/readbinaryplist.c:373: error: for each function it appears in.)
> pm_mac/readbinaryplist.c:373: error: syntax error before ‘prefdir’
> pm_mac/readbinaryplist.c:376: error: ‘OSErr’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:376: error: syntax error before ‘err’
> pm_mac/readbinaryplist.c:378: error: ‘err’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:382: error: ‘prefdir’ undeclared (first use
> in this function)
> pm_mac/readbinaryplist.c:382: error: ‘UInt8’ undeclared (first use in
> this function)
> pm_mac/readbinaryplist.c:382: error: syntax error before ‘)’ token
> pm_mac/readbinaryplist.c:388: error: ‘filename’ undeclared (first use
> in this function)
> pm_mac/readbinaryplist.c: In function ‘bplist_read_system_pref’:
> pm_mac/readbinaryplist.c:394: error: ‘kSystemPreferencesFolderType’
> undeclared (first use in this function)
> pm_mac/readbinaryplist.c: In function ‘bplist_read_user_pref’:
> pm_mac/readbinaryplist.c:399: error: ‘kPreferencesFolderType’
> undeclared (first use in this function)
> lipo: can't figure out the architecture type of:
> /var/folders/4+/4+GHEJIzHHeQA8JIOysFPE+++TI/-Tmp-//cc1hLL7r.out
> make: *** [pm_mac/libportmidi.dylib] Error 1
>
> _______________________________________________
> media_api mailing list
> media_api@create.ucsb.edu
> http://lists.create.ucsb.edu/mailman/listinfo/media_api
>
>
_______________________________________________
media_api mailing list
media_api@create.ucsb.edu
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to