[Vm-dev] [commit] r2168 - Use new sqSound.h prototypes.

commits at squeakvm.org commits at squeakvm.org
Fri Apr 2 03:02:01 UTC 2010


Author: piumarta
Date: 2010-04-01 20:02:01 -0700 (Thu, 01 Apr 2010)
New Revision: 2168

Modified:
   trunk/platforms/unix/plugins/SoundPlugin/sqUnixSound.c
   trunk/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
   trunk/platforms/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c
   trunk/platforms/unix/vm-sound-NAS/sqUnixSoundNAS.c
   trunk/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c
   trunk/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c
   trunk/platforms/unix/vm-sound-custom/sqUnixCustomSound.c
   trunk/platforms/unix/vm-sound-null/sqUnixSoundNull.c
   trunk/platforms/unix/vm/SqSound.h
Log:
Use new sqSound.h prototypes.

Modified: trunk/platforms/unix/plugins/SoundPlugin/sqUnixSound.c
===================================================================
--- trunk/platforms/unix/plugins/SoundPlugin/sqUnixSound.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/plugins/SoundPlugin/sqUnixSound.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -43,7 +43,7 @@
 #include "SqModule.h"
 #include "SqSound.h"
 
-extern int snd_Stop(void);
+extern sqInt snd_Stop(void);
 
 /*** module initialisation/shutdown ***/
 
@@ -52,7 +52,7 @@
 
 static struct SqSound *snd= 0;
 
-int soundInit(void)
+sqInt soundInit(void)
 {
   if (!soundModule
 #    if 0
@@ -83,7 +83,7 @@
 }
 
 
-int soundShutdown(void)
+sqInt soundShutdown(void)
 {
   if (snd) snd->snd_Stop();
   return 1;
@@ -92,44 +92,44 @@
 
 /* output */
 
-int snd_AvailableSpace(void)
+sqInt snd_AvailableSpace(void)
 {
   return snd->snd_AvailableSpace();
 }
 
-int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
+sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
 {
   return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
 }
 
-int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
+sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
-  return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
+  return snd->snd_PlaySamplesFromAtLength(frameCount, srcBufPtr, startIndex);
 }
 
-int snd_PlaySilence(void)
+sqInt snd_PlaySilence(void)
 {
   return snd->snd_PlaySilence();
 }
 
-int snd_Start(int frameCount, int samplesPerSec, int stereo, int semaIndex)
+sqInt snd_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sqInt semaIndex)
 {
   return snd->snd_Start(frameCount, samplesPerSec, stereo, semaIndex);
 }
 
-int snd_Stop(void)
+sqInt snd_Stop(void)
 {
   return snd->snd_Stop();
 }
 
 /* input */
 
-int snd_StartRecording(int desiredSamplesPerSec, int stereo, int semaIndex)
+sqInt snd_StartRecording(sqInt desiredSamplesPerSec, sqInt stereo, sqInt semaIndex)
 {
   return snd->snd_StartRecording(desiredSamplesPerSec, stereo, semaIndex);
 }
 
-int snd_StopRecording(void)
+sqInt snd_StopRecording(void)
 {
   return snd->snd_StopRecording();
 }
@@ -139,16 +139,16 @@
   return snd->snd_GetRecordingSampleRate();
 }
 
-int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
+sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
 }
 
 /* mixer */
 
-void snd_Volume(double *left, double *right)			{	 snd->snd_Volume(left, right); }
-void snd_SetVolume(double left, double right)			{	 snd->snd_SetVolume(left, right); }
-int  snd_SetRecordLevel(int level)				{ return snd->snd_SetRecordLevel(level); }
-int  snd_GetSwitch(int id, int captureFlag, int channel)	{ return snd->snd_GetSwitch(id, captureFlag, channel); }
-int  snd_SetSwitch(int id, int captureFlag, int parameter)	{ return snd->snd_SetSwitch(id, captureFlag, parameter); }
-int  snd_SetDevice(int id, char *name)				{ return snd->snd_SetDevice(id, name); }
+void snd_Volume(double *left, double *right)			  { snd->snd_Volume(left, right); }
+void snd_SetVolume(double left, double right)			  { snd->snd_SetVolume(left, right); }
+void snd_SetRecordLevel(sqInt level)				  { snd->snd_SetRecordLevel(level); }
+sqInt snd_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel)	  { return snd->snd_GetSwitch(id, captureFlag, channel); }
+sqInt snd_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter) { return snd->snd_SetSwitch(id, captureFlag, parameter); }
+sqInt snd_SetDevice(sqInt id, char *name)			  { return snd->snd_SetDevice(id, name); }

Modified: trunk/platforms/unix/vm/SqSound.h
===================================================================
--- trunk/platforms/unix/vm/SqSound.h	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm/SqSound.h	2010-04-02 03:02:01 UTC (rev 2168)
@@ -12,8 +12,8 @@
   int    version;
   /* output */
   sqInt  (*snd_AvailableSpace)(void);
-  sqInt  (*snd_InsertSamplesFromLeadTime)(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime);
-  sqInt  (*snd_PlaySamplesFromAtLength)(sqInt frameCount, sqInt arrayIndex, sqInt startIndex);
+  sqInt  (*snd_InsertSamplesFromLeadTime)(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime);
+  sqInt  (*snd_PlaySamplesFromAtLength)(sqInt frameCount, void *arrayIndex, sqInt startIndex);
   sqInt  (*snd_PlaySilence)(void);
   sqInt  (*snd_Start)(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sqInt semaIndex);
   sqInt  (*snd_Stop)(void);
@@ -21,14 +21,14 @@
   sqInt  (*snd_StartRecording)(sqInt desiredSamplesPerSec, sqInt stereo, sqInt semaIndex);
   sqInt  (*snd_StopRecording)(void);
   double (*snd_GetRecordingSampleRate)(void);
-  sqInt  (*snd_RecordSamplesIntoAtLength)(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes);
+  sqInt  (*snd_RecordSamplesIntoAtLength)(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes);
   /* mixer */
   void   (*snd_Volume)(double *left, double *right);
   void   (*snd_SetVolume)(double left, double right);
-  sqInt  (*snd_SetRecordLevel)(sqInt level);
-  int    (*snd_GetSwitch)(int id, int captureFlag, int channel);
-  int    (*snd_SetSwitch)(int id, int captureFlag, int parameter);
-  int    (*snd_SetDevice)(int id, char *name);
+  void   (*snd_SetRecordLevel)(sqInt level);
+  sqInt  (*snd_GetSwitch)(int id, int captureFlag, int channel);
+  sqInt  (*snd_SetSwitch)(int id, int captureFlag, int parameter);
+  sqInt  (*snd_SetDevice)(int id, char *name);
 };
 
 

Modified: trunk/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
===================================================================
--- trunk/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -2,7 +2,7 @@
  *
  * Author: Ian.Piumarta at squeakland.org
  * 
- * Last edited: 2009-12-17 10:26:20 by piumarta on ubuntu
+ * Last edited: 2010-04-01 13:48:37 by piumarta on emilia-2.local
  *
  *   Copyright (C) 2006 by Ian Piumarta
  *   All rights reserved.
@@ -196,13 +196,13 @@
 #endif
 }
 
-static sqInt  sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime)	FAIL(frameCount)
+static sqInt  sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)	FAIL(frameCount)
 
-static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
+static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
   if (output_handle)
     {
-      void *samples= (void *)arrayIndex + startIndex * output_channels * 2;
+      void *samples= srcBufPtr + startIndex * output_channels * 2;
       int   count=   snd_pcm_writei(output_handle, samples, frameCount);
       if (count < frameCount / 2)
 	{
@@ -299,11 +299,11 @@
   return (double)input_rate;
 }
 
-static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
+static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   if (input_handle)
     {
-      void *samples=    (void *)buf + (startSliceIndex * 2);
+      void *samples=    buf + (startSliceIndex * 2);
       int   frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels;
       int   count=      snd_pcm_readi(input_handle, samples, frameCount);
       if (count < 0)
@@ -515,10 +515,9 @@
     }
 }
 
-static sqInt sound_SetRecordLevel(sqInt level)
+static void sound_SetRecordLevel(sqInt level)
 {
   mixer_setVolume(sound_capture, 1, (double)level / 100.0, (double)level / 100.0);
-  return 1;
 }
 
 static sqInt sound_SetDevice(sqInt id, char *arg)

Modified: trunk/platforms/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c
===================================================================
--- trunk/platforms/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -2,7 +2,7 @@
  *
  * Author: Ian.Piumarta at squeakland.org
  * 
- * Last edited: 2009-08-19 04:34:40 by piumarta on emilia-2.local
+ * Last edited: 2010-04-01 13:54:58 by piumarta on emilia-2.local
  *
  *   Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors
  *                              listed elsewhere in this file.
@@ -644,7 +644,7 @@
 // Note: this is only used when the "sound quick start" preference is
 // enabled in the image.
 // 
-static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt framesOfLeadTime)
+static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt framesOfLeadTime)
 {
   Stream *s= output;
 
@@ -715,9 +715,9 @@
 
       if ((frontFrames + backFrames) >= (frameCount / 2))
 	{
-	  mixFrames((short *)frontData, (short *)pointerForOop(srcBufPtr), frontFrames);
+	  mixFrames((short *)frontData, (short *)srcBufPtr, frontFrames);	// mixFrames((short *)frontData, (short *)pointerForOop(srcBufPtr), frontFrames);
 	  srcBufPtr += frontFrames * SqueakFrameSize;
-	  mixFrames((short *)backData,  (short *)pointerForOop(srcBufPtr), backFrames);
+	  mixFrames((short *)backData,  (short *)srcBufPtr, backFrames);	// mixFrames((short *)backData,  (short *)pointerForOop(srcBufPtr), backFrames);
 	  framesDone= frontFrames + backFrames;
 	}
       return framesDone;
@@ -731,7 +731,7 @@
 // play (exactly) frameCount of samples (and no less, since the result is
 // ignored).
 // 
-static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
+static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
   if (output)
     {
@@ -739,7 +739,7 @@
       if (Buffer_free(output->buffer) >= byteCount)
 	{
 	  Buffer_write(output->buffer,
-		       pointerForOop(arrayIndex) + (startIndex * SqueakFrameSize),
+		       srcBufPtr + (startIndex * SqueakFrameSize),	// pointerForOop(arrayIndex) + (startIndex * SqueakFrameSize),
 		       byteCount);
 	  return frameCount;
 	}
@@ -861,7 +861,7 @@
 }
 
 
-static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
+static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   if (input)
     {
@@ -869,8 +869,9 @@
 	{
 	  int    start= startSliceIndex * SqueakFrameSize / 2;
 	  UInt32 count= min(input->cvtBufSize, bufferSizeInBytes - start);
-	  if (kAudioHardwareNoError == AudioConverterFillBuffer(input->converter, bufferDataProc, input,
-								&count, pointerForOop(buf) + start))
+	  if (kAudioHardwareNoError == AudioConverterFillBuffer(input->converter,
+								bufferDataProc, input, &count,
+								buf + start))	// pointerForOop(buf) + start))
 	    return count / (SqueakFrameSize / 2) / input->channels;
 	}
       return 0;

Modified: trunk/platforms/unix/vm-sound-NAS/sqUnixSoundNAS.c
===================================================================
--- trunk/platforms/unix/vm-sound-NAS/sqUnixSoundNAS.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-NAS/sqUnixSoundNAS.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -102,22 +102,22 @@
 static AuFlowID flow;          /* the NAS flow being used */
 static int semaIndex;          /* the semaphore to signal Squeak with */
 static int stereo;             /* whether Squeak sees stereo or not */
-static int bytesAvail;         /* current number of bytes that may be written
+static sqInt bytesAvail;       /* current number of bytes that may be written
 				  or read from the server */
 static int sampleRate;         /* the sample rate of the device.
 				  Currently not accurate. */
 
 
-static int sound_AvailableSpace(void) 
+static sqInt sound_AvailableSpace(void) 
 {
-  if(server == NULL)
+  if (server == NULL)
     return 0;
 
   return bytesAvail;
 }
 
-static int sound_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr,
-				  int samplesOfLeadTime)
+static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr,
+				  sqInt samplesOfLeadTime)
 {
   /* not possible, I don't think using NAS */
   success(false);
@@ -125,9 +125,9 @@
 }
 
 
-static int sound_Stop(void)
+static sqInt sound_Stop(void)
 {
-  if(server != NULL) {
+  if (server != NULL) {
     aioDisable(AuServerConnectionNumber(server));
 		    
     AuCloseServer(server);
@@ -141,14 +141,14 @@
      
 
      
-static int sound_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
+static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
   int bytesToPlay;
   int framesToPlay;
-  char *buf;   /* buffer to play from; it may not be arrayIndex if a
+  char *buf;   /* buffer to play from; it may not be srcBufPtr if a
                   conversion is necessary */
 
-  debugf("PlaySamples(frameCount=%d, arrayIndex=%d, startIndex=%d\n", frameCount, arrayIndex, startIndex);
+  debugf("PlaySamples(frameCount=%d, srcBufPtr=%d, startIndex=%d\n", frameCount, srcBufPtr, startIndex);
   
   /* figure out how much to play */
   bytesToPlay = frameCount * bytesPerPlayFrame();
@@ -160,9 +160,9 @@
   /* convert the buffer when not in stereo; when playing back, Squeak
      will send mono data as stereo, where the right channel is to be
      ignored */
-  if(stereo)
+  if (stereo)
     {
-      buf= (char *) (arrayIndex + 4*startIndex);
+      buf= (char *) (srcBufPtr+ 4*startIndex);
     }
   else
     {
@@ -172,7 +172,7 @@
       debugf("converting\n");
       
       buf= malloc(2 * frameCount);
-      if(buf == NULL)
+      if (buf == NULL)
 	{
 	  fprintf(stderr, "out of memory\n");
 	  return 0;
@@ -182,7 +182,7 @@
 
       for(i=0; i<frameCount; i++)
 	{
-	  sbuf[i]= ((short *) (arrayIndex + 4*startIndex)) [2*i];
+	  sbuf[i]= ((short *) (srcBufPtr + 4*startIndex)) [2*i];
 	}
     }
       
@@ -198,7 +198,7 @@
 
   bytesAvail -= bytesToPlay;
 
-  if(!stereo)
+  if (!stereo)
     {
       free(buf);
     }
@@ -211,7 +211,7 @@
    whether we are recording or playing back */
 static void handleAudioEvents(int fd, void *data, int flags)
 {
-  if(!server) {
+  if (!server) {
     debugf( "handleAudioEvents called while unconnected!\n");
     return;
   }
@@ -255,7 +255,7 @@
 	case AuElementNotifyKindState:
 	  debugf("state change (%d->%d)\n", enEvent->prev_state, enEvent->cur_state);
 	  bytesAvail += enEvent->num_bytes;
-	  if(enEvent->cur_state == AuStatePause) {
+	  if (enEvent->cur_state == AuStatePause) {
 	       /* if the flow has stopped, then arrange for it to get started again */
 	       /* XXX there is probably a more intelligent place to do
                   this, in case there is a real reason it has paused */
@@ -270,7 +270,7 @@
     }
   }
 
-  if(bytesAvail > 0) {
+  if (bytesAvail > 0) {
     debugf("bytesAvail: %d\n", bytesAvail);
     signalSemaphoreWithIndex(semaIndex);
   }
@@ -278,7 +278,7 @@
   aioHandle(fd, handleAudioEvents, flags & AIO_RW);
 }
 
-static int sound_PlaySilence(void) 
+static sqInt sound_PlaySilence(void) 
 {
      return 0;
 }
@@ -295,7 +295,7 @@
   
   /* look for a physical device of the proper kind, with the proper number of channels */
   for (i = 0; i < AuServerNumDevices(server); i++) {
-    if((AuDeviceKind(AuServerDevice(server, i))
+    if ((AuDeviceKind(AuServerDevice(server, i))
 	==  desiredDeviceKind)
        && (AuDeviceNumTracks(AuServerDevice(server, i))
 	   ==  desired_channels))
@@ -306,7 +306,7 @@
 
   /* look for a physical device of the proper kind; ignore number of channels */
   for (i = 0; i < AuServerNumDevices(server); i++) {
-    if(AuDeviceKind(AuServerDevice(server, i))
+    if (AuDeviceKind(AuServerDevice(server, i))
        ==  desiredDeviceKind)
 	 return AuDeviceIdentifier(AuServerDevice(server, i));
   }
@@ -316,7 +316,7 @@
   return AuNone;
 }
 
-static int sound_Start(int frameCount, int samplesPerSec, int stereo0, int semaIndex0)
+static sqInt sound_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo0, sqInt semaIndex0)
 {
   AuElement elements[2];  /* first is a client element, second is
 			     a device output element */
@@ -326,7 +326,7 @@
   /* open the server */
   debugf("opening server\n");
   server = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL);
-  if(server == NULL) {
+  if (server == NULL) {
     debugf("failed to open audio server\n");
     return false;
   }
@@ -340,7 +340,7 @@
   
   /* pick a device to play to */ 
   device = choose_nas_device(server, samplesPerSec, stereo, 0);
-  if(device == AuNone) {
+  if (device == AuNone) {
     debugf("no available device on the server!\n");
     AuCloseServer(server);
     server = NULL;
@@ -411,7 +411,7 @@
    XXX this routine is almost identical to snd_Start().  The two should
    be factored into a single function!
 */
-static int sound_StartRecording(int desiredSamplesPerSec, int stereo0, int semaIndex0)
+static sqInt sound_StartRecording(sqInt desiredSamplesPerSec, sqInt stereo0, sqInt semaIndex0)
 {
   AuElement elements[2];  /* elements for the NAS flow to assemble:
    			        element 0 = physical input
@@ -424,7 +424,7 @@
 
   debugf("opening server\n");
   server = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL);
-  if(server == NULL) {
+  if (server == NULL) {
     debugf("failed to open audio server\n");
     return false;
   }
@@ -436,7 +436,7 @@
   sampleRate= desiredSamplesPerSec;
 
   device= choose_nas_device(server, desiredSamplesPerSec, stereo, 1);
-  if(device == AuNone) {
+  if (device == AuNone) {
     debugf("no available device on the server!\n");
     AuCloseServer(server);
     server = NULL;
@@ -504,7 +504,7 @@
 }
 
 
-static int sound_StopRecording(void) 
+static sqInt sound_StopRecording(void) 
 {
      return sound_Stop();
 }
@@ -517,8 +517,8 @@
 }
 
      
-static int sound_RecordSamplesIntoAtLength(int buf, int startSliceIndex,
-				  int bufferSizeInBytes)
+static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex,
+				  sqInt bufferSizeInBytes)
 {
   int bytesToRead;
   int sliceSize= (stereo ? 4 : 2);   /* a "slice" seems to be a "frame": one sample from each channel */
@@ -528,17 +528,17 @@
 	 buf, startSliceIndex, bufferSizeInBytes);
   
   /* sanity checks */
-  if(server==NULL || !recording) {
+  if (server==NULL || !recording) {
     success(false);
     return 0;
   }
 
-  if(bytesAvail <= 0)
+  if (bytesAvail <= 0)
     return 0;
 
   /* figure out how much to read */
   bytesToRead= bufferSizeInBytes - (startSliceIndex * sliceSize);
-  if(bytesToRead > bytesAvail)
+  if (bytesToRead > bytesAvail)
     bytesToRead= bytesAvail;
 
   debugf("reading %d bytes\n", bytesToRead);
@@ -560,7 +560,7 @@
 
 
 /* mixer settings */
-static int sound_SetRecordLevel(int level) 
+static sqInt sound_SetRecordLevel(sqInt level) 
 {
   return level;
 }

Modified: trunk/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c
===================================================================
--- trunk/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -744,16 +744,16 @@
 }
 
 
-static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime)
+static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
 {
   return success(false);
 }
 
 
-static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
+static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
   assert(out->write != 0);
-  return out->write(out, pointerForOop(arrayIndex) + startIndex * out->sq.bpf, frameCount);
+  return out->write(out, srcBufPtr + startIndex * out->sq.bpf, frameCount);
 }
 
 
@@ -822,7 +822,7 @@
 }
 
 
-static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
+static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   /*PRINTF(("record %d %d %d\n", buf, startSliceIndex, bufferSizeInBytes));*/
 
@@ -848,7 +848,7 @@
       frameCount= min(frameCount, framesAvail);
       /*PRINTF(("<%d", frameCount * in->hw.bpf));*/
       return in->read(in,
-		      pointerForOop(buf) + startSliceIndex * 2,
+		      buf + startSliceIndex * 2,
 		      frameCount)
 	* in->sq.channels;
     }
@@ -1020,9 +1020,9 @@
 #endif
 
 
-static sqInt sound_SetRecordLevel(sqInt level)
+static void sound_SetRecordLevel(sqInt level)
 {
-  if (noSoundMixer) return 1;
+  if (noSoundMixer) return;
   if (mixer || (mixer= mixerOpen(&dev_mixer)))
     {
       level= level * LEVEL_MAX / 1000;
@@ -1031,10 +1031,9 @@
       else if (level > 255)
 	level= 255;
 
-      if (mixerSetLevel(mixer, SOUND_MIXER_RECLEV, level, level)) return 1;
-      if (mixerSetLevel(mixer, SOUND_MIXER_IGAIN,  level, level)) return 1;
+      if (mixerSetLevel(mixer, SOUND_MIXER_RECLEV, level, level)) return;
+      if (mixerSetLevel(mixer, SOUND_MIXER_IGAIN,  level, level)) return;
     }
-  return 0;
 }
 
 static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter)

Modified: trunk/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c
===================================================================
--- trunk/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-Sun/sqUnixSoundSun.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -71,14 +71,14 @@
 # define PRINTF(ARGS)
 #endif
 
-static int sound_Stop(void);
+static sqInt sound_Stop(void);
 static int sound_AvailableSpace(void);
 
 static int auFd=	       -1;   /* open on /dev/audio */
 static int auCtlFd=	       -1;   /* open on /dev/audioctl */
-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.
+static sqInt fmtStereo=		0;   /* whether we are playing in stereo or not */
+static sqInt auPlaySemaIndex=	0;   /* an index to signal when new data may be played */
+static sqInt auBufBytes=	0;   /*  buffer size to use for playback.
 					 unfortunately, this bears no relationship to
 					 whatever the kernel and soundcard are using  */
 static int auBuffersPlayed=	0;
@@ -103,7 +103,7 @@
 /*** exported sound output functions ***/
 
 
-static int sound_Stop(void)
+static sqInt sound_Stop(void)
 {
   PRINTF();
   if (auFd == -1) return 0;
@@ -122,7 +122,7 @@
 }
 
 
-static int sound_Start(int frameCount, int samplesPerSec, int stereo, int semaIndex)
+static sqInt sound_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sqInt semaIndex)
 {
   PRINTF(("(frameCount=%d, samplesPerSec=%d, stereo=%d, semaIndex=%d)",
 		frameCount, samplesPerSec, stereo, semaIndex));
@@ -194,7 +194,7 @@
 }
 
 
-static int sound_AvailableSpace(void)
+static sqInt sound_AvailableSpace(void)
 {
   PRINTF();
   struct audio_info info;
@@ -216,11 +216,11 @@
 }
 
 
-static int sound_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
+static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
   PRINTF(("(frameCount=%d, arrayIndex=%d, startIndex=%d)",
 		frameCount, arrayIndex, startIndex));
-  short *src= (short *) (arrayIndex + 4*startIndex);
+  short *src= (short *) (srcBufPtr + 4*startIndex);
   short buf[2*frameCount];
   int i;
   int bytes;
@@ -263,8 +263,8 @@
 }
 
 
-static int sound_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr,
-				  int samplesOfLeadTime)
+static sqInt sound_InsertSamplesFromLeadTime(sqint frameCount, void *srcBufPtr,
+				  sqInt samplesOfLeadTime)
 {
   PRINTF(("(frameCount=%d, srcBufPtr=%d, samplesOfLeadTime=%d)",
 		frameCount, srcBufPtr, samplesOfLeadTime));
@@ -272,7 +272,7 @@
 }
 
 
-static int sound_PlaySilence(void)
+static sqInt sound_PlaySilence(void)
 {
   PRINTF();
   success(false);
@@ -281,7 +281,7 @@
 
 
 /** recording not supported **/
-static int sound_SetRecordLevel(int level)
+static sqInt sound_SetRecordLevel(sqInt level)
 {
   PRINTF();
   success(false);
@@ -289,7 +289,7 @@
 }
 
 
-static int sound_StartRecording(int desiredSamplesPerSec, int stereo, int semaIndex)
+static sqInt sound_StartRecording(sqInt desiredSamplesPerSec, sqInt stereo, sqInt semaIndex)
 {
   PRINTF();
   success(false);
@@ -297,7 +297,7 @@
 }
 
 
-static int sound_StopRecording(void)
+static sqInt sound_StopRecording(void)
 {
   PRINTF();
   return 0;
@@ -312,7 +312,7 @@
 }
 
 
-static int sound_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
+static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   PRINTF();
   success(false);

Modified: trunk/platforms/unix/vm-sound-custom/sqUnixCustomSound.c
===================================================================
--- trunk/platforms/unix/vm-sound-custom/sqUnixCustomSound.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-custom/sqUnixCustomSound.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -28,13 +28,13 @@
   return 8192;
 }
 
-static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime)
+static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
 {
   trace();
   return frameCount;
 }
 
-static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
+static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)
 {
   trace();
   return frameCount;
@@ -80,7 +80,7 @@
   return 8192;
 }
 
-static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
+static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
 {
   trace();
   return 8192;
@@ -100,10 +100,9 @@
   trace();
 }
 
-static sqInt sound_SetRecordLevel(sqInt level)
+static void sound_SetRecordLevel(sqInt level)
 {
   trace();
-  return level;
 }
 
 static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter)

Modified: trunk/platforms/unix/vm-sound-null/sqUnixSoundNull.c
===================================================================
--- trunk/platforms/unix/vm-sound-null/sqUnixSoundNull.c	2010-04-02 02:59:50 UTC (rev 2167)
+++ trunk/platforms/unix/vm-sound-null/sqUnixSoundNull.c	2010-04-02 03:02:01 UTC (rev 2168)
@@ -44,8 +44,8 @@
 
 /* output */
 static sqInt  sound_AvailableSpace(void)									FAIL(8192)
-static sqInt  sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime)	FAIL(frameCount)
-static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)		FAIL(8192)
+static sqInt  sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)	FAIL(frameCount)
+static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, void *srcBufPtr, sqInt startIndex)		FAIL(8192)
 static sqInt  sound_PlaySilence(void)										FAIL(8192)
 static sqInt  sound_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sqInt semaIndex)			FAIL(1)
 static sqInt  sound_Stop(void)											FAIL(0)
@@ -53,11 +53,11 @@
 static sqInt  sound_StartRecording(sqInt desiredSamplesPerSec, sqInt stereo, sqInt semaIndex)			FAIL(0)
 static sqInt  sound_StopRecording(void)										FAIL(0)
 static double sound_GetRecordingSampleRate(void)								FAIL(0)
-static sqInt  sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)	FAIL(0)
+static sqInt  sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)	FAIL(0)
 /* mixer */
 static void   sound_Volume(double *left, double *right)								{ return; }
 static void   sound_SetVolume(double left, double right)							{ return; }
-static sqInt  sound_SetRecordLevel(sqInt level)									{ return level; }
+static void   sound_SetRecordLevel(sqInt level)									{ return; }
 
 static sqInt  sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter)					FAIL(-1)
 static sqInt  sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel)					FAIL(-1)



More information about the Vm-dev mailing list