[Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Norbert Wojtowicz
Hello,

I am trying to use the SDL-mixer bindings to play wav files. I've hit
a wierd error and I can't figure out how to solve it:

Prelude import Graphics.UI.SDL.Mixer.Music
Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav
Loading package SDL-0.5.4 ... linking ... done.
Loading package SDL-mixer-0.5.2 ... linking ... interactive:
/home/norbert/bin/lib/SDL-mixer-0.5.2/ghc-6.8.2/HSSDL-mixer-0.5.2.o:
unknown symbol `Mix_LoadWAV'
ghc-6.8.2: unable to load package `SDL-mixer-0.5.2'

I've looked up the source code; Mix_LoadWAV seems to be #defined, so I
suspect it's some kind of library path issue but I don't grok the
whole system well enough to figure it out; maybe someone could point
me in the right direction?

Have the issue now on Ubuntu 8.04 and previously had the same issue
when I tested it on a FreeBSD box. I did install all of the
libsdl-*-dev in the Ubuntu repo.

- Norbert
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Henning Thielemann


On Tue, 24 Jun 2008, Norbert Wojtowicz wrote:


Hello,

I am trying to use the SDL-mixer bindings to play wav files. I've hit
a wierd error and I can't figure out how to solve it:

Prelude import Graphics.UI.SDL.Mixer.Music
Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav


Is the package installed? Otherwise you may have to give an -lSDL_mixer 
option when starting ghci.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Don Stewart
wojtowicz.norbert:
 Hello,
 
 I am trying to use the SDL-mixer bindings to play wav files. I've hit
 a wierd error and I can't figure out how to solve it:
 
 Prelude import Graphics.UI.SDL.Mixer.Music
 Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav
 Loading package SDL-0.5.4 ... linking ... done.
 Loading package SDL-mixer-0.5.2 ... linking ... interactive:
 /home/norbert/bin/lib/SDL-mixer-0.5.2/ghc-6.8.2/HSSDL-mixer-0.5.2.o:
 unknown symbol `Mix_LoadWAV'
 ghc-6.8.2: unable to load package `SDL-mixer-0.5.2'
 
 I've looked up the source code; Mix_LoadWAV seems to be #defined, so I
 suspect it's some kind of library path issue but I don't grok the
 whole system well enough to figure it out; maybe someone could point
 me in the right direction?
 
 Have the issue now on Ubuntu 8.04 and previously had the same issue
 when I tested it on a FreeBSD box. I did install all of the
 libsdl-*-dev in the Ubuntu repo.

Ah, well spotted. I get the same issue on Arch, in ghci:

Prelude import Graphics.UI.SDL.Mixer.Music
Prelude Graphics.UI.SDL.Mixer.Music loadMUS
/usr/share/hback-0.0.3/sounds/t.wav
interactive: /usr/lib/SDL-mixer-0.5.2/ghc-6.8.2/HSSDL-mixer-0.5.2.o:
unknown symbol `Mix_LoadWAV'
ghc-6.8.2: unable to load package `SDL-mixer-0.5.2'

Looking in the source we see:

foreign import ccall unsafe Mix_LoadWAV
mixLoadWAV :: CString - IO (Ptr ChunkStruct)
 
Lemmih, any ideas? -lSDL and -lSDL_mixer seem to be there.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Don Stewart
lemming:
 
 On Tue, 24 Jun 2008, Norbert Wojtowicz wrote:
 
 Hello,
 
 I am trying to use the SDL-mixer bindings to play wav files. I've hit
 a wierd error and I can't figure out how to solve it:
 
 Prelude import Graphics.UI.SDL.Mixer.Music
 Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav
 
 Is the package installed? Otherwise you may have to give an -lSDL_mixer 
 option when starting ghci.

That's not enough, for some reason:

$ ghci -lSDL_mixer
Prelude  import Graphics.UI.SDL.Mixer.Music
Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav
interactive:
/home/dons/.cabal/lib/SDL-mixer-0.5.2/ghc-6.8.2/HSSDL-mixer-0.5.2.o:
unknown symbol `Mix_LoadWAV'
ghc-6.8.2: unable to load package `SDL-mixer-0.5.2'

Despite it being defined in 

$ grep Mix_LoadWAV /usr/lib/*  
Binary file /usr/lib/libSDL_mixer-1.2.so.0 matches
Binary file /usr/lib/libSDL_mixer-1.2.so.0.2.6 matches
Binary file /usr/lib/libSDL_mixer.a matches
Binary file /usr/lib/libSDL_mixer.so matches

Hmm.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Marco Túlio Gontijo e Silva
Em Ter, 2008-06-24 às 14:57 -0500, Norbert Wojtowicz escreveu:
 Prelude import Graphics.UI.SDL.Mixer.Music
 Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav
 Loading package SDL-0.5.4 ... linking ... done.
 Loading package SDL-mixer-0.5.2 ... linking ... interactive:
 /home/norbert/bin/lib/SDL-mixer-0.5.2/ghc-6.8.2/HSSDL-mixer-0.5.2.o:
 unknown symbol `Mix_LoadWAV'
 ghc-6.8.2: unable to load package `SDL-mixer-0.5.2'

Hello.

SDL-mixer does not support the most recent SDL version.  The problem is
that in SDL now Mix_LoadWAV is a macro.

-- 
Marco Túlio Gontijo e Silva
Página: http://marcotmarcot.googlepages.com/
Blog: http://marcotmarcot.wordpress.com/
Correio: [EMAIL PROTECTED]
XMPP: [EMAIL PROTECTED]
IRC: [EMAIL PROTECTED]
Telefone: 25151920
Celular: 98116720
Endereço:
 Rua Turfa, 639/701
 Prado 30410-370
 Belo Horizonte/MG Brasil


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Don Stewart
marcot:
 Em Ter, 2008-06-24 às 14:57 -0500, Norbert Wojtowicz escreveu:
  Prelude import Graphics.UI.SDL.Mixer.Music
  Prelude Graphics.UI.SDL.Mixer.Music loadMUS test.wav
  Loading package SDL-0.5.4 ... linking ... done.
  Loading package SDL-mixer-0.5.2 ... linking ... interactive:
  /home/norbert/bin/lib/SDL-mixer-0.5.2/ghc-6.8.2/HSSDL-mixer-0.5.2.o:
  unknown symbol `Mix_LoadWAV'
  ghc-6.8.2: unable to load package `SDL-mixer-0.5.2'
 
 Hello.
 
 SDL-mixer does not support the most recent SDL version.  The problem is
 that in SDL now Mix_LoadWAV is a macro.

Ah ha, so it needs a cbits wrapper over the macro.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Norbert Wojtowicz
 SDL-mixer does not support the most recent SDL version.  The problem is
 that in SDL now Mix_LoadWAV is a macro.

I've tried it with SDL-0.5.2 from hackage as well with the same
problem. (Unless you mean an earlier version of the actual SDL
library?)

 Ah ha, so it needs a cbits wrapper over the macro.

This is above my head. If we know what the problem is, will this by
any chance hit someone's todo list soon or is this a big hurdle?

Are there any other cross-platform (windows + linux at the minimum)
ways of playing sounds that anyone can recommend?

- Norbert
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Don Stewart
wojtowicz.norbert:
  SDL-mixer does not support the most recent SDL version.  The problem is
  that in SDL now Mix_LoadWAV is a macro.
 
 I've tried it with SDL-0.5.2 from hackage as well with the same
 problem. (Unless you mean an earlier version of the actual SDL
 library?)
 
  Ah ha, so it needs a cbits wrapper over the macro.
 
 This is above my head. If we know what the problem is, will this by
 any chance hit someone's todo list soon or is this a big hurdle?
 
 Are there any other cross-platform (windows + linux at the minimum)
 ways of playing sounds that anyone can recommend?

Attached is a patched version of SDL_mixer 0.5.2 with a C wrapper
for this macro. I'm now able to run loadWAV in ghci.

We need to have the maintainer upload the amended version to Hackage,
or to give me leave to do so.

-- Don


SDL-mixer-0.5.2.1.tar.gz
Description: GNU Zip compressed data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Norbert Wojtowicz
 Attached is a patched version of SDL_mixer 0.5.2 with a C wrapper
 for this macro. I'm now able to run loadWAV in ghci.

Works for me, thanks!

Now I just need to learn how to make my WAVs sound not like
computer-generated children voices. For example, using the hback wav
files and this:

import Control.Concurrent (threadDelay)
import Graphics.UI.SDL.Mixer.General
import Graphics.UI.SDL.Mixer.Music

main = do
 openAudio 22050 AudioS16Sys 2 4096
 w - loadMUS c.wav
 playMusic w 1
 threadDelay 200
 freeMusic w
 closeAudio

It plays (which is an immense improvement), but I can't get it to
sound the way it does from eg. mplayer. I have almost no knowledge of
the inner workings of computer sound drivers, so if there is something
obvious I'm missing please do speak up.

- Norbert
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] sdl-mixer loading issue

2008-06-24 Thread Luke Palmer
On Tue, Jun 24, 2008 at 6:34 PM, Norbert Wojtowicz
[EMAIL PROTECTED] wrote:
 Attached is a patched version of SDL_mixer 0.5.2 with a C wrapper
 for this macro. I'm now able to run loadWAV in ghci.

 Works for me, thanks!

 Now I just need to learn how to make my WAVs sound not like
 computer-generated children voices. For example, using the hback wav
 files and this:

 import Control.Concurrent (threadDelay)
 import Graphics.UI.SDL.Mixer.General
 import Graphics.UI.SDL.Mixer.Music

 main = do
  openAudio 22050 AudioS16Sys 2 4096

This is probably the issue.  Most wavs are sampled at 44100, not
22050, and I think you have to ask mplayer specifically to downsample.
 Changing this to

  openAudio 44100 AudioS16Sys 2 4096

should do the trick.

Luke

  w - loadMUS c.wav
  playMusic w 1
  threadDelay 200
  freeMusic w
  closeAudio

 It plays (which is an immense improvement), but I can't get it to
 sound the way it does from eg. mplayer. I have almost no knowledge of
 the inner workings of computer sound drivers, so if there is something
 obvious I'm missing please do speak up.

 - Norbert
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe