Bug 59184

Summary: wanted: something like arts_init() that only suceeds if arts has DSP device open
Product: arts Reporter: David Walser <luigiwalser>
Component: generalAssignee: George Staikos <staikos>
Severity: wishlist    
Priority: NOR    
Version: 1.1.1   
Target Milestone: ---   
Platform: Mandrake RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: fixes this bug by adding arts_suspended() to the C API

Description David Walser 2003-05-31 19:29:43 UTC
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_init() will open a connection to the artsd daemon, and let you use it.  It suceeds (returns 0) if artsd is running.

You can use this to pick whether to output to arts or OSS in your application.  If you have to use arts_init() to do it, the only criteria you can use to make your choice is whether artsd is *running* or not.

It would be nice to make the choice based on whether artsd actually has the DSP device open or not, so you can choose to only use arts if it has the device open, and OSS otherwise.

What would be needed for that would be another call that would work like arts_init(), except it would only return 0 if artsd was running *and* had the DSP device open.
Comment 1 David Walser 2003-07-02 18:33:24 UTC
Another possibility is a function that you could run after arts_init(), maybe called 
arts_suspended() which would return 1 if it is suspended (not holding the device 
open), or 0 otherwise. 
I was just looking through the arts code, and it looks like that could be pretty easy to 
Comment 2 David Walser 2003-07-02 19:14:55 UTC
Ok, I've taken my advice, and implemented a patch.  I'll attach it. 
Comment 3 David Walser 2003-07-02 19:23:46 UTC
Created attachment 1920 [details]
fixes this bug by adding arts_suspended() to the C API
Comment 4 George Staikos 2003-07-02 20:06:48 UTC
The patch looks good, applies clean.  My one concern is that we shouldn't say that 
backend is no-good simply because this new method doesn't exist.  Therefore I made 
a slight change which should allow it to work with older revisions of the backend and 
newer revisions of the frontend.  Maybe this is unnecessary, but it seems reasonable 
to me.  What do you think? I"ll commit to 1.1-branch shortly and cc this report# 
Comment 5 George Staikos 2003-07-02 20:07:53 UTC
Subject: ARTS_1_1_BRANCH: arts

CVS commit by staikos: 

commit the patch attached to #59184 - allows the app to query if the server is
suspended.  Has a slight modification to work with older backends.  Looks ok?

CCMAIL: 59184@bugs.kde.org

  M +16 -1     artsc/artsc.c
  M +8 -0      artsc/artsc.h
  M +22 -0     artsc/artscbackend.cc
  M +8 -4      mcop/mcoputils.cc
  M +4 -1      mcop/startupmanager.cc
  M +5 -0      soundserver/soundserver.idl
  M +4 -0      soundserver/soundserver_impl.cc
  M +1 -0      soundserver/soundserver_impl.h

Comment 6 George Staikos 2003-07-02 20:23:03 UTC
My testing indicates that this patch is sufficient. 
Comment 7 David Walser 2003-07-02 20:24:23 UTC
I think that's perfectly reasonable, I was concerned about breaking compatibility and 
I'm glad you were able to address that. 
Thank you again.