<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>59183</bug_id>
          
          <creation_ts>2003-05-31 19:25:02 +0000</creation_ts>
          <short_desc>arts_suspend() returns 0 if arts doesn&apos;t have DSP device open</short_desc>
          <delta_ts>2004-02-22 02:26:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>arts</product>
          <component>general</component>
          <version>1.1.1</version>
          <rep_platform>Mandrake RPMs</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Walser">luigiwalser</reporter>
          <assigned_to name="George Staikos">staikos</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>136957</commentid>
    <comment_count>0</comment_count>
    <who name="David Walser">luigiwalser</who>
    <bug_when>2003-05-31 19:25:02 +0000</bug_when>
    <thetext>Version:           1.1.1 (using KDE KDE 3.1.1)
Installed from:    Mandrake RPMs
Compiler:          gcc version 3.2.2 (Mandrake Linux 9.2 3.2.2-5mdk) 
OS:          Linux

arts_suspend() will have artsd let go of the DSP device if it has it open.  If it&apos;s sucessful, the postcondition is that artsd doesn&apos;t have the DSP device open, and 1 is returned.

There is one condition where this postcondition is broken, that&apos;s when you call arts_suspend() and artsd didn&apos;t have the DSP device open in the first place.  As far as trying to get artsd to let go of the device, it shouldn&apos;t matter whether it had it open in the first place or not, if arts can manage to make sure it&apos;s not holding the device (whether it needs to do any work to make that happen or not), 1 should be returned.

0 should only be returned when, as it said in the header file, &quot;there were active non-suspendable modules,&quot; meaning artsd has the device open and is not going to give it up.

arts_suspend() should not return 0 when arts doesn&apos;t have the DSP device open.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>142623</commentid>
    <comment_count>1</comment_count>
    <who name="George Staikos">staikos</who>
    <bug_when>2003-06-27 09:32:39 +0000</bug_when>
    <thetext>This looks very easy to fix, but can you tell me what you think it should 
return in this case, and provide a testcase to verify the results?  I don&apos;t 
want to commit a fix without this information. 
 
Thanks 
 </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>142658</commentid>
    <comment_count>2</comment_count>
    <who name="David Walser">luigiwalser</who>
    <bug_when>2003-06-27 12:03:01 +0000</bug_when>
    <thetext>Subject: Re:  arts_suspend() returns 0 if arts doesn&apos;t have DSP device open         

Hi, I apologize for e-mailing you directly, but KDE
Bugzilla is broken at the moment.  When I try to
submit an update it says &quot;product was not defined;
this may indicate a bug in your browser.&quot;  It says
that whether I&apos;m in Konqueror or Mozilla.  I&apos;ll paste
what I was trying to write here (and attach the
mentioned patch to this e-mail).

Thank you. 
 
In the header file, it says &quot;asks aRtsd to free the
DSP device and return 1 if it was successful,&quot; so as
long as artsd isn&apos;t holding the device open after the
function is run, 1 should be returned. 
 
Here&apos;s a testcase: 
killall artsd 
artsd -s 45 
artsdsp play $(dirname $(dirname `which
startkde`))/share/sounds/KDE_Startup.wav 
 
Then wait one minute, and run a piece of C code that
runs arts_suspend().  It should return 1. 
 
If you want some code, if you&apos;re running RedHat or
Mandrake, get the newest TiMidity++ source RPM package
from RedHat Rawhide, or Mandrake Cooker, and replace
the patch that&apos;s name ends in detect.patch with the
one I attach here. 
 
If you want me to make you a tarball, let me know. 
 
When you compile and run timidity with this patch, it
will use arts output if arts_suspend returns 0, and
OSS output if it returns 1.  The easiest way I can
tell which output it&apos;s using is if it&apos;s using arts you
see the infamous arts error message: 
mcop warning: user defined signal handler found for
SIG_PIPE, overriding 
 
you could also just try playing something else with
arts simultaneously. 
 
Anyway, the expected behavior with this patched
timidity is this: 
arts is currently playing something, timidity uses
arts output 
arts is not currently playing something (whether 45
seconds have passed and it&apos;s already given up the
device or not), timidity uses OSS output 

--- George Staikos &lt;staikos@kde.org&gt; wrote:
&gt; ------- You are receiving this mail because: -------
&gt; You reported the bug, or are watching the reporter.
&gt;      
&gt; http://bugs.kde.org/show_bug.cgi?id=59183     
&gt; staikos@kde.org changed:
&gt; 
&gt;            What    |Removed                    
&gt; |Added
&gt;
----------------------------------------------------------------------------
&gt;              Status|UNCONFIRMED                 |NEW
&gt;       everconfirmed|0                           |1
&gt; 
&gt; 
&gt; 
&gt; ------- Additional Comments From staikos@kde.org 
&gt; 2003-06-27 09:32 -------
&gt; This looks very easy to fix, but can you tell me
&gt; what you think it should 
&gt; return in this case, and provide a testcase to
&gt; verify the results?  I don&apos;t 
&gt; want to commit a fix without this information. 
&gt;  
&gt; Thanks

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Created an attachment (id=1893)
TiMidity++-2.12.0-pre1-detect.patch.luigi
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>143509</commentid>
    <comment_count>3</comment_count>
    <who name="George Staikos">staikos</who>
    <bug_when>2003-07-02 18:00:07 +0000</bug_when>
    <thetext>Correct, it returns -2 right now.  I&apos;ll repair asap. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>143511</commentid>
    <comment_count>4</comment_count>
    <who name="George Staikos">staikos</who>
    <bug_when>2003-07-02 18:08:20 +0000</bug_when>
    <thetext>sorry, correction: it returns 0, not -2 :) </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>143518</commentid>
    <comment_count>5</comment_count>
    <who name="David Walser">luigiwalser</who>
    <bug_when>2003-07-02 18:26:31 +0000</bug_when>
    <thetext>I was about to say :o) 
 
I think I found the problem.  I&apos;m looking now at arts/soundserver/soundserver_impl.cc 
in the function SoundServer_impl::suspend() and it looks like this currently: 
bool SoundServer_impl::suspend() { 
        if(Dispatcher::the()-&gt;flowSystem()-&gt;suspendable() &amp;&amp; 
           !Dispatcher::the()-&gt;flowSystem()-&gt;suspended()) 
                { 
                        Dispatcher::the()-&gt;flowSystem()-&gt;suspend(); 
                        arts_info(&quot;sound server suspended by client&quot;); 
                        return true; 
                } 
        return false; 
} 
 
I believe it should look like the following: 
bool SoundServer_impl::suspend() { 
	if(Dispatcher::the()-&gt;flowSystem()-&gt;suspended() 
		return true; 
	if(Dispatcher::the()-&gt;flowSystem()-&gt;suspendable() { 
		Dispatcher::the()-&gt;flowSystem()-&gt;suspend(); 
		arts_info(&quot;sound server suspended by client&quot;); 
		return true; 
	} 
return false; 
} </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>143520</commentid>
    <comment_count>6</comment_count>
    <who name="George Staikos">staikos</who>
    <bug_when>2003-07-02 18:29:28 +0000</bug_when>
    <thetext>Subject: Re:  arts_suspend() returns 0 if arts doesn&apos;t have DSP device open

On Wednesday 02 July 2003 12:26, you wrote:
&gt; ------- I was about to say :o)
&gt;
&gt; I think I found the problem.  I&apos;m looking now at
&gt; arts/soundserver/soundserver_impl.cc in the function
&gt; SoundServer_impl::suspend() and it looks like this currently: bool
&gt; SoundServer_impl::suspend() {
&gt;         if(Dispatcher::the()-&gt;flowSystem()-&gt;suspendable() &amp;&amp;
&gt;            !Dispatcher::the()-&gt;flowSystem()-&gt;suspended())
&gt;                 {
&gt;                         Dispatcher::the()-&gt;flowSystem()-&gt;suspend();
&gt;                         arts_info(&quot;sound server suspended by client&quot;);
&gt;                         return true;
&gt;                 }
&gt;         return false;
&gt; }
&gt;
&gt; I believe it should look like the following:
&gt; bool SoundServer_impl::suspend() {
&gt; 	if(Dispatcher::the()-&gt;flowSystem()-&gt;suspended()
&gt; 		return true;
&gt; 	if(Dispatcher::the()-&gt;flowSystem()-&gt;suspendable() {
&gt; 		Dispatcher::the()-&gt;flowSystem()-&gt;suspend();
&gt; 		arts_info(&quot;sound server suspended by client&quot;);
&gt; 		return true;
&gt; 	}
&gt; return false;
&gt; }

  Hah I was *just* about to send the exact same thing back to you!  Ok I will 
commit this fix as I believe it to be correct too.  Thanks!

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>143522</commentid>
    <comment_count>7</comment_count>
    <who name="George Staikos">staikos</who>
    <bug_when>2003-07-02 18:33:35 +0000</bug_when>
    <thetext>Subject: ARTS_1_1_BRANCH: arts/soundserver

CVS commit by staikos: 

Fix 59183 with the excellent help of the reporter.
This could use a forward port for those who have arts-head checked out.  thanks.

CCMAIL: 59183-done@bugs.kde.org


  M +5 -2      soundserver_impl.cc   1.7.4.2


--- arts/soundserver/soundserver_impl.cc  #1.7.4.1:1.7.4.2
@@ -63,6 +63,9 @@ long SoundServer_impl::secondsUntilSuspe
 
 bool SoundServer_impl::suspend() {
-        if(Dispatcher::the()-&gt;flowSystem()-&gt;suspendable() &amp;&amp;
-           !Dispatcher::the()-&gt;flowSystem()-&gt;suspended())
+        if (Dispatcher::the()-&gt;flowSystem()-&gt;suspended())
+                {
+                        return true;
+                }
+        if(Dispatcher::the()-&gt;flowSystem()-&gt;suspendable())
                 {
                         Dispatcher::the()-&gt;flowSystem()-&gt;suspend();


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>208423</commentid>
    <comment_count>8</comment_count>
    <who name="Stefan Brüns">stefan.bruens</who>
    <bug_when>2004-02-22 02:26:53 +0000</bug_when>
    <thetext>This is a duplicate of BR 44566</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1893</attachid>
            <date>2003-06-27 12:03:01 +0000</date>
            <delta_ts>2003-06-27 12:03:01 +0000</delta_ts>
            <desc>TiMidity++-2.12.0-pre1-detect.patch.luigi
</desc>
            <filename>TiMidity++-2.12.0-pre1-detect.patch.luigi</filename>
            <type>application/octet-stream</type>
            <size>990</size>
            <attacher name="David Walser">luigiwalser</attacher>
            
              <data encoding="base64">ZGlmZiAtdU5yIFRpTWlkaXR5KystMi4xMi4wLXByZTEub3JpZy90aW1pZGl0eS90aW1pZGl0eS5j
IFRpTWlkaXR5KystMi4xMi4wLXByZTEvdGltaWRpdHkvdGltaWRpdHkuYwotLS0gVGlNaWRpdHkr
Ky0yLjEyLjAtcHJlMS5vcmlnL3RpbWlkaXR5L3RpbWlkaXR5LmMJMjAwMi0wMS0xNSAyMjozNjoz
MS4wMDAwMDAwMDAgLTA1MDAKKysrIFRpTWlkaXR5KystMi4xMi4wLXByZTEvdGltaWRpdHkvdGlt
aWRpdHkuYwkyMDAzLTA1LTI5IDIwOjE5OjAwLjAwMDAwMDAwMCAtMDQwMApAQCAtMzMxNyw2ICsz
MzE3LDcgQEAKICAgICBpbnQgbmZpbGVzOwogICAgIGNoYXIgKipmaWxlczsKICAgICBpbnQgbWFp
bl9yZXQ7CisgICAgaW50IG1vZGVfc2V0PTA7CiAKICNpZiBkZWZpbmVkKERBTkdFUk9VU19SRU5J
Q0UpICYmICFkZWZpbmVkKF9fVzMyX18pICYmICFkZWZpbmVkKG1haW4pCiAgICAgLyoKQEAgLTM0
MTMsNiArMzQxNCwyOSBAQAogICAgIH0KICNlbmRpZgogCisjaWZkZWYgQVVfQVJUUworICAgIGlm
KGFydHNfaW5pdCgpPT0wKSB7CisJICAgIGlmKGFydHNfc3VzcGVuZCgpPT0wKSB7CisJCSAgICBz
ZXRfcGxheV9tb2RlKCJrIik7CisJCSAgICBtb2RlX3NldD0xOworCSAgICB9CisJICAgIGFydHNf
ZnJlZSgpOworICAgIH0KKyNlbmRpZgorI2lmZGVmIEFVX0VTRAorICAgIGlmKCFtb2RlX3NldCkg
eworCSAgICBpZighYWNjZXNzKCIvdXNyL2xpYi9saWJlc2Quc28uMCIsIFJfT0spKSB7CisJCSAg
ICBzZXRlbnYoIkVTRF9OT19TUEFXTiIsICIxIiwgMCk7CisJCSAgICBzZXRfcGxheV9tb2RlKCJl
Iik7CisJCSAgICBtb2RlX3NldD0xOworCSAgICB9CisgICAgfQorI2VuZGlmCisjaWZkZWYgQVVf
T1NTCisgICAgaWYoIW1vZGVfc2V0KQorCSAgICBzZXRfcGxheV9tb2RlKCJkIik7CisjZW5kaWYK
KyAgICAKICAgICBpZigoZXJyID0gdGltaWRpdHlfcHJlX2xvYWRfY29uZmlndXJhdGlvbigpKSAh
PSAwKQogCXJldHVybiBlcnI7CiAK
</data>

          </attachment>
      

    </bug>

</bugzilla>