Sound on 3.7-7 for solaris 8 on intel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Sound on 3.7-7 for solaris 8 on intel

Wolfgang Helbig
Hi,

after installing successfully the 3.7-7 stuff from squeakvm.org on my sol8-i386
system, playing music using the vm-sound-Sun plugin is kind of disappointing:
If I hit the play button to play the example midi file it plays less then
a second. If I hit the play button again, nothing happens.

So what can be done? I tried to apply NAS, but I didn't find a vm-sound-NAS
plugin for solaris 8 on intel.

thanks for any help!

Wolfgang


Reply | Threaded
Open this post in threaded view
|

Re: Sound on 3.7-7 for solaris 8 on intel

Wolfgang Helbig

>Hi,
>
>after installing successfully the 3.7-7 stuff from squeakvm.org on my sol8-i386
>system, playing music using the vm-sound-Sun plugin is kind of disappointing:
>If I hit the play button to play the example midi file it plays less then
>a second. If I hit the play button again, nothing happens.
>
>So what can be done? I tried to apply NAS, but I didn't find a vm-sound-NAS
>plugin for solaris 8 on intel.
>
>thanks for any help!
>
>Wolfgang
Guess I had to help myself :-)
Now both vm-sound-NAS and vm-sound-Sun work on solaris x86, but I had to
patch around little bit the contents of Squeak-3.7-7.src.tar.gz
- To make it compile:
  I had to get rid of MAKEFLAGS that are not understood by Sun's make.

- To make configure enable NAS
  export CPPFLAGS='-I /usr/openwin/include'
 
- To make sqUnixExternalPrims.c accept the NAS module, I had to make it
  lazy (dlopen flag RTLD_NOW replayced by RTLD_LAZY.
 
- To make NAS sound nice, I had to swap bytes, in fact I had to lie
  to it and tell him, that our format is MSB, but it is LSB in fact.
  (I think x86 is little endian, isn't it?)
 
Thats all to make NAS work with squeak.

Now the vm-sound-Sun module nearly worked out of the box, but it only played
two buffers (about 200 ms). The asynch callback didn't work. I had to replace
the aioHandle flag AIO_RX by AIO_RWX.

I prefer the Sun module. It has no delay as apposed the NAS module, that has
a delay of about 3 seconds, which is kind of irritating when you watch an
MPEG move.

Anyway, squeak is a great thing ...

Thanks to all, who made it happen!

Wolfgang


*** Squeak-3.7-7/platforms/unix/config/make.cfg.in Sat Mar 19 21:38:28 2005
--- Squeak-3.7-7/platforms/unix/config/make.cfg.in Tue Jan 17 08:07:45 2006
***************
*** 37,43 ****
  #
  # Last edited: 2003-08-31 19:55:21 by piumarta on emilia.inria.fr
 
! MAKEFLAGS= --no-print-directory
 
  @SET_MAKE@
 
--- 37,43 ----
  #
  # Last edited: 2003-08-31 19:55:21 by piumarta on emilia.inria.fr
 
! MAKEFLAGS=
 
  @SET_MAKE@
 
*** Squeak-3.7-7/platforms/unix/vm/sqUnixExternalPrims.c Sat Mar 19 21:38:22 2005
--- Squeak-3.7-7/platforms/unix/vm/sqUnixExternalPrims.c Tue Jan 17 13:57:16 2006
***************
*** 143,149 ****
  else
   {
     dprintf((stderr, "tryLoading %s\n", libName));
!    handle= dlopen(libName, RTLD_NOW | RTLD_GLOBAL);
     if (handle == 0)
       {
  if ((!err) && !(sqIgnorePluginErrors))
--- 143,149 ----
  else
   {
     dprintf((stderr, "tryLoading %s\n", libName));
!    handle= dlopen(libName, RTLD_LAZY | RTLD_GLOBAL);
     if (handle == 0)
       {
  if ((!err) && !(sqIgnorePluginErrors))
*** Squeak-3.7-7/platforms/unix/vm-sound-NAS/sqUnixSoundNAS.c Sat Mar 19 21:38:26 2005
--- Squeak-3.7-7/platforms/unix/vm-sound-NAS/sqUnixSoundNAS.c Fri Jan 20 03:23:24 2006
***************
*** 48,58 ****
    static void dprintf(char *fmt, ...) {}
  #endif
 
!
  #ifdef WORDS_BIGENDIAN
- # define AU_FORMAT AuFormatLinearSigned16MSB
- #else
  # define AU_FORMAT AuFormatLinearSigned16LSB
  #endif
 
 
--- 48,58 ----
    static void dprintf(char *fmt, ...) {}
  #endif
 
! /* NAS sounds better on Solaris x86 if you lie to it: */
  #ifdef WORDS_BIGENDIAN
  # define AU_FORMAT AuFormatLinearSigned16LSB
+ #else
+ # define AU_FORMAT AuFormatLinearSigned16MSB
  #endif
 
 
***************
*** 65,74 ****
 
  #define BYTES_PER_SAMPLE 2 /* Squeak always uses 16-bit samples */
 
! #ifdef HAS_MSB_FIRST
! # define IS_BIGENDIAN 1
! #else
  # define IS_BIGENDIAN 0
  #endif
 
 
--- 65,74 ----
 
  #define BYTES_PER_SAMPLE 2 /* Squeak always uses 16-bit samples */
 
! #ifdef LSB_FIRST
  # define IS_BIGENDIAN 0
+ #else
+ # define IS_BIGENDIAN 1
  #endif
 
 
***************
*** 157,163 ****
    char *buf;   /* buffer to play from; it may not be arrayIndex if a
                    conversion is necessary */
 
!   dprintf("PlaySamples(frameCount=%d, arrayIndex=%d, startIndex=%d\n",
   frameCount, arrayIndex, startIndex);
   
    /* figure out how much to play */
--- 157,163 ----
    char *buf;   /* buffer to play from; it may not be arrayIndex if a
                    conversion is necessary */
 
!   dprintf("PlaySamples(frameCount=%d, arrayIndex=%u, startIndex=%d\n",
   frameCount, arrayIndex, startIndex);
   
    /* figure out how much to play */
***************
*** 378,384 ****
  frameCount, frameCount / 4);
    AuMakeElementImportClient(&elements[0],
     samplesPerSec,
!    AuFormatLinearSigned16LSB,  /* XXX this should be chosen based on the platform */
     stereo ? 2 : 1,
     AuTrue,
     2*frameCount,   /* max: 2 buffers */
--- 378,384 ----
  frameCount, frameCount / 4);
    AuMakeElementImportClient(&elements[0],
     samplesPerSec,
!    AU_FORMAT,
     stereo ? 2 : 1,
     AuTrue,
     2*frameCount,   /* max: 2 buffers */
***************
*** 484,490 ****
    AuMakeElementExportClient(&elements[1],
     0,
     desiredSamplesPerSec,
!    AuFormatLinearSigned16LSB,  /* XXX this should be chosen based on the platform */
     stereo ? 2 : 1,
     AuTrue,
     1000000,  /* was AuUnlimitedSamples */
--- 484,490 ----
    AuMakeElementExportClient(&elements[1],
     0,
     desiredSamplesPerSec,
!    AU_FORMAT,
     stereo ? 2 : 1,
     AuTrue,
     1000000,  /* was AuUnlimitedSamples */
diff -rbc Squeak-3.7-7/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c Squeak-3.7-7/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c
*** Squeak-3.7-7/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c Sat Mar 19 21:38:51 2005
--- Squeak-3.7-7/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c Fri Jan 20 03:06:41 2006
***************
*** 65,71 ****
 
  static int sound_Stop(void);
 
! static int auFd=       -1;   /* open on /dev/dsp */
  static int fmtStereo= 0;   /* whether we are playing in stereo or not */
  static int auPlaySemaIndex= 0;   /* an index to signal when new data may be played */
  static int auBufBytes= 0;   /*  buffer size to use for playback.
--- 65,71 ----
 
  static int sound_Stop(void);
 
! static int auFd=       -1;   /* open on /dev/audio */
  static int fmtStereo= 0;   /* whether we are playing in stereo or not */
  static int auPlaySemaIndex= 0;   /* an index to signal when new data may be played */
  static int auBufBytes= 0;   /*  buffer size to use for playback.
***************
*** 121,127 ****
        perror("AUDIO_GETINFO");
        goto closeAndFail;
      }
!   info.play.gain= 100;
    info.play.precision= 16;
    info.play.encoding= AUDIO_ENCODING_LINEAR;
    info.play.channels= fmtStereo ? 2 : 1;
--- 121,127 ----
        perror("AUDIO_GETINFO");
        goto closeAndFail;
      }
!   info.play.gain= 255; /* this is 100 percent */
    info.play.precision= 16;
    info.play.encoding= AUDIO_ENCODING_LINEAR;
    info.play.channels= fmtStereo ? 2 : 1;
***************
*** 137,143 ****
        goto closeAndFail;
      }
    aioEnable(auFd, 0, 0);
!   aioHandle(auFd, auHandle, AIO_RX);
    return true;
   
   closeAndFail:
--- 137,143 ----
        goto closeAndFail;
      }
    aioEnable(auFd, 0, 0);
!   aioHandle(auFd, auHandle, AIO_RWX);
    return true;
   
   closeAndFail: