[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: Noatun Suspending Arts
From:       Charles Samuels <charles () kde ! org>
Date:       2002-03-21 20:36:53
[Download RAW message or body]

Patch is attached, for noatun.

Should fix everything once and for all.  Stefan recently made a commit to Arts 
that fixes a couple things there.  You need that :)

As I currently can't compile noatun, I havn't tested this patch.  That's why 
it's going to the list instead of cvs.

Please test it for a day, as it's kinda important that it works!

-Charles

["noatunarts-suspend.diff" (text/x-diff)]

? noatunarts-suspend.diff
Index: Equalizer_impl.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/library/noatunarts/Equalizer_impl.cpp,v
retrieving revision 1.1
diff -u -3 -p -r1.1 Equalizer_impl.cpp
--- Equalizer_impl.cpp	2001/04/13 17:20:31	1.1
+++ Equalizer_impl.cpp	2002/03/21 20:31:05
@@ -237,6 +237,10 @@ public:
 	{
 	}
 
+	// speed hack! assume that someone else will
+	// suspend us
+	AutoSuspendState autoSuspend() { return asSuspend; }
+	
 };
 
 
@@ -440,6 +444,9 @@ public:
 	{
 	}
 
+	// speed hack! assume that someone else will
+	// suspend us
+	AutoSuspendState autoSuspend() { return asSuspend; }
 };
 
 
Index: FFTScopes.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/library/noatunarts/FFTScopes.cpp,v
retrieving revision 1.1
diff -u -3 -p -r1.1 FFTScopes.cpp
--- FFTScopes.cpp	2001/04/13 17:20:31	1.1
+++ FFTScopes.cpp	2002/03/21 20:31:05
@@ -149,6 +149,8 @@ public:
 		delete [] mInBufferLeft;
 		delete [] mInBufferRight;
 	}
+	
+	AutoSuspendState autoSuspend() { return asSuspend; }
 
 };
 	
@@ -234,6 +236,8 @@ public:
 		delete [] mWindow;
 		delete [] mInBuffer;
 	}
+	
+	AutoSuspendState autoSuspend() { return asSuspend; }
 };
 
 class RawScope_impl : public RawScope_skel, public StdSynthModule
@@ -302,6 +306,8 @@ public:
 	{
 		delete [] mScope;
 	}
+	
+	AutoSuspendState autoSuspend() { return asSuspend; }
 };
 
 class RawScopeStereo_impl : public RawScopeStereo_skel, public StdSynthModule
@@ -400,6 +406,8 @@ public:
 		delete [] mScopeRight;
 		delete [] mScopeLeft;
 	}
+
+	AutoSuspendState autoSuspend() { return asSuspend; }
 };
 
 
Index: StereoVolumeControl_impl.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/library/noatunarts/StereoVolumeControl_impl.cpp,v
retrieving revision 1.3
diff -u -3 -p -r1.3 StereoVolumeControl_impl.cpp
--- StereoVolumeControl_impl.cpp	2001/07/27 21:18:05	1.3
+++ StereoVolumeControl_impl.cpp	2002/03/21 20:31:05
@@ -17,8 +17,9 @@ class StereoVolumeControl_impl : virtual
                                  virtual public StdSynthModule
 {
 	float mPercent;
+	float level;
 public:
-	StereoVolumeControl_impl() : mPercent(1.0)
+	StereoVolumeControl_impl() : mPercent(1.0), level(0.0)
 	{ }
 
 	/*attribute float scaleFactor;*/
@@ -27,14 +28,16 @@ public:
 
 	void calculateBlock(unsigned long samples)
 	{
-		float *left=inleft;
-		float *right=inright;
-		float *oleft=outleft;
-		float *oright=outright;
+		register float *left=inleft;
+		register float *right=inright;
+		register float *oleft=outleft;
+		register float *oright=outright;
 
+		level = *right + *left;
+		
 		register float p=mPercent;
 
-		float *end=left+samples;
+		register float *end=left+samples;
 
 		while (left<end)
 		{
@@ -47,14 +50,21 @@ public:
 			++oright;
 		}
 	}
+	
+	AutoSuspendState autoSuspend()
+	{
+		return (level < 0.001) ? asSuspend : asNoSuspend;
+	}
 };
 	
 class StereoVolumeControlSSE_impl : virtual public Noatun::StereoVolumeControlSSE_skel,
                                     virtual public StdSynthModule
 {
 	float mPercent;
+	float level;
+	
 public:
-	StereoVolumeControlSSE_impl() : mPercent(1.0)
+	StereoVolumeControlSSE_impl() : mPercent(1.0), level(0.0)
 	{ }
 
 	/*attribute float scaleFactor;*/
@@ -68,6 +78,8 @@ public:
 		float *right=inright;
 		float *oleft=outleft;
 		float *oright=outright;
+		
+		level = *right + *left;
 
 		// need to copy the data members to locals to get enough
 		// spare registers (malte)
@@ -136,6 +148,11 @@ public:
 			: "eax", "ecx"
 		);
 #endif
+	
+	AutoSuspendState autoSuspend()
+	{
+		return (level < 0.001) ? asSuspend : asNoSuspend;
+	}
 	}
 };
 

_______________________________________________
kde-multimedia mailing list
kde-multimedia@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic