/[svn]/jsampler/trunk/src/org/jsampler/HF.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/HF.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1539 by iliev, Thu May 24 21:43:45 2007 UTC revision 1540 by iliev, Mon Dec 3 23:22:02 2007 UTC
# Line 275  public class HF { Line 275  public class HF {
275                  return true;                  return true;
276          }          }
277                    
278            /**
279             * Converts the volume value specified in percents to decibels.
280             */
281            public static double
282            percentsToDecibels(int vol) {
283                    if(vol == 0) return Double.NEGATIVE_INFINITY;
284                    double i = vol;
285                    i /= 100;
286                    i = 20 * Math.log10(i);
287                    return i;
288            }
289            
290            
291            
292            /**
293             * Converts the volume value specified in decibels to percents.
294             */
295            public static int
296            decibelsToPercents(double vol) {
297                    if(vol == Double.NEGATIVE_INFINITY) return 0;
298                    double i = Math.pow(10, vol/20);
299                    i *= 100;
300                    return (int)i;
301            }
302            
303            /**
304             * Converts the volume value specified in decibels to volume factor.
305             */
306            public static float
307            decibelsToFactor(double vol) {
308                    if(vol == Double.NEGATIVE_INFINITY) return 0;
309                    double i = Math.pow(10, vol/20);
310                    return (float)i;
311            }
312                    
313            /**
314             * Converts the volume value specified in percents to volume factor.
315             */
316            public static float
317            percentsToFactor(int vol) {
318                    float f = vol;
319                    f /= 100;
320                    return f;
321            }
322  }  }

Legend:
Removed from v.1539  
changed lines
  Added in v.1540

  ViewVC Help
Powered by ViewVC