Patch for esound 0.2.24 - fixes "-nobeeps"



Hello,

On a few soundcards, esd -nobeeps sends endless noise. I've searched the
problem on google and usenet, but it was never fixed. The patch I have
attached fixes the problem for esound-0.2.24. On some systems, esd needs
to send some output, or it sends noise continously. I've changed it so
it sends a sound of 0 hz and 0 milliseconds duration if no_beeps is set
to 0.

Ivan Kozik

--- esd.c.orig	Fri Apr  5 12:59:19 2002
+++ esd.c	Fri Apr  5 12:49:04 2002
@@ -741,21 +741,34 @@
 
     /* send some sine waves just to check the sound connection */
     i = 0;
-    if ( esd_beeps ) {
+            if ( esd_beeps == 1 ) { 
+
+        magl = magr = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16)
+            ? 30000 : 100;
+
+        for ( freq = 55 ; freq < esd_audio_rate/2 ; freq *= 2, i++ ) {
+            /* repeat the freq for a few buffer lengths */
+            for ( j = 0 ; j < esd_audio_rate / 4 / esd_buf_size_samples ; j++ ) {
+                set_audio_buffer( output_buffer, esd_audio_format,
+                                  ( (i%2) ? magl : 0 ),  ( (i%2) ? 0 : magr ),
+                                  freq, esd_audio_rate, esd_buf_size_samples,
+                                  j * esd_buf_size_samples );
+                esd_audio_write( output_buffer, esd_buf_size_octets );
+            }
+        }
+
+	    } else if( esd_beeps == 0 ) {
+
 	magl = magr = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16)
 	    ? 30000 : 100;
 
-	for ( freq = 55 ; freq < esd_audio_rate/2 ; freq *= 2, i++ ) {
-	    /* repeat the freq for a few buffer lengths */
-	    for ( j = 0 ; j < esd_audio_rate / 4 / esd_buf_size_samples ; j++ ) {
 		set_audio_buffer( output_buffer, esd_audio_format,
-				  ( (i%2) ? magl : 0 ),  ( (i%2) ? 0 : magr ),
-				  freq, esd_audio_rate, esd_buf_size_samples,
-				  j * esd_buf_size_samples );
+				  ( (2%2) ? magl : 0 ),  ( (2%2) ? 0 : magr ),
+				  0, esd_audio_rate, esd_buf_size_samples,
+				  0 * esd_buf_size_samples );
 		esd_audio_write( output_buffer, esd_buf_size_octets );
+
 	    }
-	}
-    }
 
     /* pause the sound output */
     esd_audio_pause();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]