Bug 60636

Summary: Standard output volume too high
Product: [Unmaintained] arts Reporter: Benedikt Gollatz <benedikt>
Component: artsdAssignee: George Staikos <staikos>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Benedikt Gollatz 2003-07-02 16:00:43 UTC
Version:           CVS (2003-07-01) (using KDE KDE 3.1.2)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc version 3.3.1 20030626 (Debian prerelease) 
OS:          Linux

At least on my box the standard output volume for artsd ist too high and the output signal is massively oversteering (red LED's in artscontrol).

The following patch by me adds a -V command line option to artsd which sets a different output volume than the default. The problem can be solved by applying the patch to the arts CVS tree and adding "-V {low volume}" to "Other custom options" on the "Sound I/O" tab of the "Sound System" kcontrol module.

_____

--- soundserver/artsd.cc	2003-03-07 23:07:30.000000000 +0100
+++ soundserver/artsd.cc	2003-07-01 20:35:23.000000000 +0200
@@ -66,6 +66,7 @@
 	fprintf(stderr,"-r <samplingrate>   set samplingrate to use\n");
 	fprintf(stderr,"-b <bits>           set number of bits (8 or 16)\n");
 	fprintf(stderr,"-d                  enable full duplex operation\n");
+	fprintf(stderr,"-V <volume>         set output volume\n");
 	fprintf(stderr,"-D <devicename>     audio device (usually /dev/dsp)\n");
 	fprintf(stderr,"-F <fragments>      number of fragments\n");
 	fprintf(stderr,"-S <size>           fragment size in bytes\n");
@@ -116,13 +117,14 @@
 #endif
 static int                      cfgAutoSuspend  = 0;
 static int                      cfgBuffers      = 0;
+static float                    cfgVolume       = 0;
 
 static bool						cmdListAudioIO  = false;
 
 static void handleArgs(int argc, char **argv)
 {
 	int optch;
-	while((optch = getopt(argc,argv,"r:p:nuF:S:hD:dl:a:Ab:s:m:vNw:f")) > 0)
+	while((optch = getopt(argc,argv,"r:p:nuF:S:hD:dl:a:Ab:s:m:vNw:fV:")) > 0)
 	{
 		switch(optch)
 		{
@@ -162,6 +164,8 @@
 				break;
 			case 'f': cfgForceStart = true;
 				break;
+			case 'V': cfgVolume = atof(optarg);
+				break;
 			case 'h':
 			default:
 					exitUsage(argc?argv[0]:"artsd");
@@ -286,6 +290,9 @@
 	SoundServerV2 server;
 	AudioManager audioManager;
 
+	if (cfgVolume)
+		server.outVolume().scaleFactor(cfgVolume);
+	
 	if (cfgAutoSuspend)
 		server.autoSuspendSeconds(cfgAutoSuspend);
Comment 1 George Staikos 2003-07-02 17:29:23 UTC
Subject: ARTS_1_1_BRANCH: arts/soundserver [POSSIBLY UNSAFE]

CVS commit by staikos: 

implement #60636 in slightly modified form to work around volume level problems.

Would appreciate if someone can put this in ARTS HEAD.  thanks.

CCMAIL: 60636-done@bugs.kde.org


  M +8 -0      artsd.cc   1.43.2.1 [POSSIBLY UNSAFE: printf]


--- arts/soundserver/artsd.cc  #1.43:1.43.2.1
@@ -26,4 +26,5 @@
 #include "mcoputils.h"
 #include <signal.h>
+#include <math.h>
 #include <iostream>
 #include <stdio.h>
@@ -67,4 +68,5 @@ static void exitUsage(const char *progna
         fprintf(stderr,"-b <bits>           set number of bits (8 or 16)\n");
         fprintf(stderr,"-d                  enable full duplex operation\n");
+        fprintf(stderr,"-V <volume>         set output volume\n");
         fprintf(stderr,"-D <devicename>     audio device (usually /dev/dsp)\n");
         fprintf(stderr,"-F <fragments>      number of fragments\n");
@@ -117,4 +119,5 @@ static const char              *cfgAudio
 static int                      cfgAutoSuspend  = 0;
 static int                      cfgBuffers      = 0;
+static float                    cfgVolume = 0.0;
 
 static bool                                             cmdListAudioIO  = false;
@@ -163,4 +166,6 @@ static void handleArgs(int argc, char **
                         case 'f': cfgForceStart = true;
                                 break;
+                        case 'V': cfgVolume = atof(optarg);
+                                break;
                         case 'h':
                         default:
@@ -286,4 +291,7 @@ int main(int argc, char **argv)
         SoundServerV2 server;
         AudioManager audioManager;
+
+        if (fabsf(cfgVolume) > 1e-10)
+                server.outVolume().scaleFactor(cfgVolume);
 
         if (cfgAutoSuspend)


Comment 2 Benedikt Gollatz 2003-07-02 18:55:51 UTC
Isn't the alteration of the getopt-call missing in this new patch? When using 
it, artsd says "invalid option -- V" if it's called with the -V option. 
Comment 3 George Staikos 2003-07-02 20:35:25 UTC
argh you're correct.  I'm sorry.  I patched it by hand.  I'll fix it asap. 
Comment 4 George Staikos 2003-07-02 20:37:19 UTC
Subject: ARTS_1_1_BRANCH: arts/soundserver

CVS commit by staikos: 

missed a part of this patch
CCMAIL: 60636-done@bugs.kde.org


  M +1 -1      artsd.cc   1.43.2.2


--- arts/soundserver/artsd.cc  #1.43.2.1:1.43.2.2
@@ -126,5 +126,5 @@ static void handleArgs(int argc, char **
 {
         int optch;
-        while((optch = getopt(argc,argv,"r:p:nuF:S:hD:dl:a:Ab:s:m:vNw:f")) > 0)
+        while((optch = getopt(argc,argv,"r:p:nuF:S:hD:dl:a:Ab:s:m:vNw:fV:")) > 0)
         {
                 switch(optch)


Comment 5 Svein Harald Soleim 2004-01-15 01:06:08 UTC
Resolved?
It is still way to loud and I'm using 3.1.94
Comment 6 Christian Loose 2004-01-15 10:50:47 UTC
Did you read the original report?

To fix this bug a new option (-V) was added to the arts daemon. This way you
can override the default volume.

You should find the option (derived from the original post) in KControl->Sound System->Sound I/O->Other custom options.

Christian