Re: F11-for-XO1.5 Release 10.1.1 Release Candidate 2

2010-06-14 Thread Derek O'Connell

Hi Peter,

I don't have much experience creating patches so please let me know if 
the attached is the wrong format for your purposes. Created using:


diff -cB 
/home/doc/std/dev/squeak/vm/3.10-5/unix-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c 
/home/doc/std/dev/squeak/vm/3.11.3/src/squeak-svn/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c 
sqUnixSoundALSA.patch


-D




On 14/06/10 11:58, Peter Robinson wrote:

On Mon, Jun 14, 2010 at 9:58 AM, Bert Freudenbergb...@freudenbergs.de  wrote:
   

On 14.06.2010, at 06:24, Chris Ball wrote:

 

Hi Bert,

   

Copied ~olpc/Activities/Sratch.activity/vm-sound-ALSA plugin to
/usr/lib/squeak/3.10-5/.

After that, in Etoys playback sounds a bit worse, but it's still
okay (hard to tell actually). And no freeze after suspend,
playing just resumes. So it would be a good idea to use that ALSA
plugin for Squeak in general, me thinks.
 

Could we get a squeak/etoys package with a fixed alsa-plugin ASAP, please?
   

Someone would need to rebuild Fedora's squeak-vm-3.10-5 package with Derek's 
patched sqUnixSoundALSA.c file (attached to the forwarded msg below). The etoys 
package is unaffected.
 

I'm happy to apply a patch to the etoys package in Fedora if someone
can provide me a patch rather than a complete new source file.

Peter
   


*** /home/doc/std/dev/squeak/vm/3.10-5/unix-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c	2008-04-28 20:04:11.0 +0100
--- /home/doc/std/dev/squeak/vm/3.11.3/src/squeak-svn/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c	2010-06-14 12:22:13.0 +0100
***
*** 135,141 
if ((err= snd_pcm_start(output_handle))  0)
  {
if (err != -EPIPE)
! 	{
  	  fprintf(stderr, snd_pcm_start(1): %s\n, snd_strerror(err));
  	  success(false);
  	  return 0;
--- 136,143 
if ((err= snd_pcm_start(output_handle))  0)
  {
if (err != -EPIPE)
! /*  if ((err != -EPIPE)  (err != -ESTRPIPE))
! */	{
  	  fprintf(stderr, snd_pcm_start(1): %s\n, snd_strerror(err));
  	  success(false);
  	  return 0;
***
*** 148,154 
if ((err= snd_pcm_start(output_handle))  0)
  {
if (err != -EPIPE)
! 	{
  	  fprintf(stderr, snd_pcm_start(2): %s\n, snd_strerror(err));
  	  success(false);
  	  return 0;
--- 150,157 
if ((err= snd_pcm_start(output_handle))  0)
  {
if (err != -EPIPE)
! /*  if ((err != -EPIPE)  (err != -ESTRPIPE))
! */	{
  	  fprintf(stderr, snd_pcm_start(2): %s\n, snd_strerror(err));
  	  success(false);
  	  return 0;
***
*** 168,173 
--- 171,177 
if (!output_handle) return 0;
  
snd_pcm_delay(output_handle, delay);
+   snd_pcm_avail_update(output_handle);
state= snd_pcm_state (output_handle);
  
/* if underrun causes, max delay is loosened */
***
*** 199,226 
  
  static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
  {
!   if (output_handle)
! {
!   void *samples= (void *)arrayIndex + startIndex * output_channels * 2;
!   int   count=   snd_pcm_writei(output_handle, samples, frameCount);
!   if (count  frameCount / 2)
! 	{
! 	  output_buffer_frames_available= 0;
! 	}
!   if (count  0)
! 	{
! 	  if (count == -EPIPE)/* underrun */
! 	{
! 	  int err;
! 	  snd(pcm_prepare(output_handle), sound_PlaySamples: snd_pcm_prepare);
! 	  return 0;
! 	}
! 	  fprintf(stderr, snd_pcm_writei returned %i\n, count);
! 	  return 0;
! 	}
!   return count;
  }
!   success(false);
return 0;
  }
  
--- 203,246 
  
  static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
  {
!   if (!output_handle) 
!   {
! success(false);
! return 0;
!   }
! 
!   void *samples= (void *)arrayIndex + startIndex * output_channels * 2;
!   int   count=   snd_pcm_writei(output_handle, samples, frameCount);
!   if (count  frameCount / 2)
! output_buffer_frames_available= 0;
! 
!   if (count = 0)
! return count;
! 
!   if (count != -EPIPE  count != -ESTRPIPE)
!   {
! fprintf(stderr, snd_pcm_writei returned %i\n, count);
! return 0;
!   }
! 
!   int err;
!   if (count == -EPIPE) {  /* under-run */
! err = snd_pcm_prepare (output_handle);
! if (err  0)
! 	  printf(Can't recovery from underrun, prepare failed: %s, snd_strerror (err));
! return 0;
!   } else if (count == -ESTRPIPE) {
! while ((err = snd_pcm_resume (output_handle)) == -EAGAIN)
!   sleep(1);   /* wait until the suspend flag is released */
! 
! if (err  0) {
!   err = snd_pcm_prepare (output_handle);
!   if (err  0)
! 		printf(Can't recovery from suspend, prepare failed: %s, snd_strerror (err));
  }
! return 0;
!   }
!   
return 0;
  }
  
***
*** 306,318 
int   frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels;
int   count=  snd_pcm_readi(input_handle, 

Re: F11-for-XO1.5 Release 10.1.1 Release Candidate 2

2010-06-14 Thread Derek O'Connell
On 14/06/10 12:56, Peter Robinson wrote:
 On Mon, Jun 14, 2010 at 12:29 PM, Derek O'Connelld...@doconnel.f9.co.uk  
 wrote:

 Hi Peter,

 I don't have much experience creating patches so please let me know if the
 attached is the wrong format for your purposes. Created using:

 diff -cB
 /home/doc/std/dev/squeak/vm/3.10-5/unix-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
 /home/doc/std/dev/squeak/vm/3.11.3/src/squeak-svn/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
  
 sqUnixSoundALSA.patch

 If you could use 'diff -u origfile newfile  output.patch' from the
 root of the source tree that would be better.


Which source tree root are you referring to? Chris mentioned 3.10-5 and 
I do most my development on 3.11.3 so I diff'ed between them. It's a bad 
state of affairs but I keep several versions of the VM source around and 
would normally simply email the complete source file to Ian Piumarta (as 
he requests).

-D

 Thanks,
 Peter


 On 14/06/10 11:58, Peter Robinson wrote:
  
 On Mon, Jun 14, 2010 at 9:58 AM, Bert Freudenbergb...@freudenbergs.de
   wrote:


 On 14.06.2010, at 06:24, Chris Ball wrote:


  
 Hi Bert,



 Copied ~olpc/Activities/Sratch.activity/vm-sound-ALSA plugin to
 /usr/lib/squeak/3.10-5/.

 After that, in Etoys playback sounds a bit worse, but it's still
 okay (hard to tell actually). And no freeze after suspend,
 playing just resumes. So it would be a good idea to use that ALSA
 plugin for Squeak in general, me thinks.

  
 Could we get a squeak/etoys package with a fixed alsa-plugin ASAP,
 please?


 Someone would need to rebuild Fedora's squeak-vm-3.10-5 package with
 Derek's patched sqUnixSoundALSA.c file (attached to the forwarded msg
 below). The etoys package is unaffected.

  
 I'm happy to apply a patch to the etoys package in Fedora if someone
 can provide me a patch rather than a complete new source file.

 Peter



  

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: F11-for-XO1.5 Release 10.1.1 Release Candidate 2

2010-06-14 Thread Derek O'Connell
On 14/06/10 13:21, Bert Freudenberg wrote:
 On 14.06.2010, at 14:15, Derek O'Connell wrote:


 On 14/06/10 12:56, Peter Robinson wrote:
  
 On Mon, Jun 14, 2010 at 12:29 PM, Derek O'Connelld...@doconnel.f9.co.uk   
 wrote:


 Hi Peter,

 I don't have much experience creating patches so please let me know if the
 attached is the wrong format for your purposes. Created using:

 diff -cB
 /home/doc/std/dev/squeak/vm/3.10-5/unix-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
 /home/doc/std/dev/squeak/vm/3.11.3/src/squeak-svn/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c

  
 sqUnixSoundALSA.patch


 If you could use 'diff -u origfile newfile   output.patch' from the
 root of the source tree that would be better.


 Which source tree root are you referring to?
  
 The sources for the current Fedora package. A source rpm has a tarball of the 
 sources, and optionally a series of patch files relative to that upstream 
 tarball.

 Not sure where to find those sources though, I'm not too familiar with Fedora 
 procedures.


Me neither but thanks for the pointer.

 - Bert -




___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: F11-for-XO1.5 Release 10.1.1 Release Candidate 2

2010-06-14 Thread Derek O'Connell

Hi Peter,

sorry for the delay, hopefully the attach is what you want.

-D

On 14/06/10 12:56, Peter Robinson wrote:

On Mon, Jun 14, 2010 at 12:29 PM, Derek O'Connelld...@doconnel.f9.co.uk  
wrote:
   

Hi Peter,

I don't have much experience creating patches so please let me know if the
attached is the wrong format for your purposes. Created using:

diff -cB
/home/doc/std/dev/squeak/vm/3.10-5/unix-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
/home/doc/std/dev/squeak/vm/3.11.3/src/squeak-svn/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
 

sqUnixSoundALSA.patch
   

If you could use 'diff -u origfile newfile  output.patch' from the
root of the source tree that would be better.

Thanks,
Peter

   

On 14/06/10 11:58, Peter Robinson wrote:
 

On Mon, Jun 14, 2010 at 9:58 AM, Bert Freudenbergb...@freudenbergs.de
  wrote:

   

On 14.06.2010, at 06:24, Chris Ball wrote:


 

Hi Bert,


   

Copied ~olpc/Activities/Sratch.activity/vm-sound-ALSA plugin to
/usr/lib/squeak/3.10-5/.

After that, in Etoys playback sounds a bit worse, but it's still
okay (hard to tell actually). And no freeze after suspend,
playing just resumes. So it would be a good idea to use that ALSA
plugin for Squeak in general, me thinks.

 

Could we get a squeak/etoys package with a fixed alsa-plugin ASAP,
please?

   

Someone would need to rebuild Fedora's squeak-vm-3.10-5 package with
Derek's patched sqUnixSoundALSA.c file (attached to the forwarded msg
below). The etoys package is unaffected.

 

I'm happy to apply a patch to the etoys package in Fedora if someone
can provide me a patch rather than a complete new source file.

Peter

   


 


--- Squeak-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c	2008-04-21 22:48:26.0 +0100
+++ Squeak-3.10-5/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA-100614.c	2010-06-14 12:22:13.0 +0100
@@ -77,6 +77,7 @@
 static snd_pcm_uframes_t	 output_buffer_size= 0;
 static double			 max_delay_frames= 0;
 
+
 static void output_callback(snd_async_handler_t *handler)
 {
   signalSemaphoreWithIndex(output_semaphore);
@@ -135,7 +136,8 @@
   if ((err= snd_pcm_start(output_handle))  0)
 {
   if (err != -EPIPE)
-	{
+/*  if ((err != -EPIPE)  (err != -ESTRPIPE))
+*/	{
 	  fprintf(stderr, snd_pcm_start(1): %s\n, snd_strerror(err));
 	  success(false);
 	  return 0;
@@ -148,7 +150,8 @@
   if ((err= snd_pcm_start(output_handle))  0)
 {
   if (err != -EPIPE)
-	{
+/*  if ((err != -EPIPE)  (err != -ESTRPIPE))
+*/	{
 	  fprintf(stderr, snd_pcm_start(2): %s\n, snd_strerror(err));
 	  success(false);
 	  return 0;
@@ -168,6 +171,7 @@
   if (!output_handle) return 0;
 
   snd_pcm_delay(output_handle, delay);
+  snd_pcm_avail_update(output_handle);
   state= snd_pcm_state (output_handle);
 
   /* if underrun causes, max delay is loosened */
@@ -199,28 +203,44 @@
 
 static sqInt  sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex)
 {
-  if (output_handle)
-{
-  void *samples= (void *)arrayIndex + startIndex * output_channels * 2;
-  int   count=   snd_pcm_writei(output_handle, samples, frameCount);
-  if (count  frameCount / 2)
-	{
-	  output_buffer_frames_available= 0;
-	}
-  if (count  0)
-	{
-	  if (count == -EPIPE)/* underrun */
-	{
-	  int err;
-	  snd(pcm_prepare(output_handle), sound_PlaySamples: snd_pcm_prepare);
-	  return 0;
-	}
-	  fprintf(stderr, snd_pcm_writei returned %i\n, count);
-	  return 0;
-	}
-  return count;
+  if (!output_handle) 
+  {
+success(false);
+return 0;
+  }
+
+  void *samples= (void *)arrayIndex + startIndex * output_channels * 2;
+  int   count=   snd_pcm_writei(output_handle, samples, frameCount);
+  if (count  frameCount / 2)
+output_buffer_frames_available= 0;
+
+  if (count = 0)
+return count;
+
+  if (count != -EPIPE  count != -ESTRPIPE)
+  {
+fprintf(stderr, snd_pcm_writei returned %i\n, count);
+return 0;
+  }
+
+  int err;
+  if (count == -EPIPE) {  /* under-run */
+err = snd_pcm_prepare (output_handle);
+if (err  0)
+	  printf(Can't recovery from underrun, prepare failed: %s, snd_strerror (err));
+return 0;
+  } else if (count == -ESTRPIPE) {
+while ((err = snd_pcm_resume (output_handle)) == -EAGAIN)
+  sleep(1);   /* wait until the suspend flag is released */
+
+if (err  0) {
+  err = snd_pcm_prepare (output_handle);
+  if (err  0)
+		printf(Can't recovery from suspend, prepare failed: %s, snd_strerror (err));
 }
-  success(false);
+return 0;
+  }
+  
   return 0;
 }
 
@@ -306,13 +326,28 @@
   int   frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels;
   int   count=  snd_pcm_readi(input_handle, samples, frameCount);
   if (count  0)
-	{
-	  if (count == -EPIPE)
-	snd_pcm_prepare(input_handle);
-	  else if (count != -EAGAIN)
-	fprintf(stderr, snd_pcm_readi