On 03/05/2013 09:50 PM, Tim Munro wrote:
> I hope that someone else might actually find such a feature useful, and that 
> it
> wouldn't serve only to add more clutter and confusion to an already 
> complicated
> project.

   This feature should be very straightforward.  I don't think it will 
have any sort of negative impact at all.  It's easy to grasp quite 
quickly.  I could see two functions:

   double leftPanAmp(double pan);
   double rightPanAmp(double pan);

   They take a pan value (-100 to 100) and return appropriate channel 
amplitudes.  Maybe normalized 0-1 or something similar which is easily 
converted to whatever is needed.

   These two would need to share the audioPanLaw value (-6, -3, 0) from 
the config file.  That could be cached someplace, or the whole thing 
could be wrapped up in a class.  Probably just a PanLaw utility class 
with statics to avoid the need to create an object.  Something like this:

class PanLaw
{
public:
   // pan = -100 (Left) to 100 (Right)
   // returns normalized amplitude (1.0 = unity gain)
   static double leftAmp(double pan);
   static double rightAmp(double pan);

private:
   // Called by the above.  Initializes values from config
   // if needed.
   static void init() {
     if (!initialized) {
        audioPanLaw = value from config;
        initialized = true;
     }
   }

   static bool initialized = false;  // in the .cpp, actually
   // Or maybe an enum?
   static double audioPanLaw;
};

   Lots of options, but in the end, the concepts are simple, so this 
should be pretty painless.  Even if there is a special case that we need 
that doesn't exactly fit the usual definitions, that can be added to 
this PanLaw class and explained in the comments.

Ted.

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to