sbBaseMediacoreMultibandEqualizer.h
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2009 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
32 #ifndef __SB_BASEMEDIACOREMULTIBANDEQUALIZER_H__
33 #define __SB_BASEMEDIACOREMULTIBANDEQUALIZER_H__
34 
35 #include <sbIMediacoreMultibandEqualizer.h>
36 
37 #include <nsAutoLock.h>
38 #include <nsCOMPtr.h>
39 #include <nsHashKeys.h>
40 #include <nsInterfaceHashtable.h>
41 #include <nsEmbedString.h>
42 
43 class nsIPrefBranch;
45 
46 double
47 SB_ClampDouble(double aGain, double aMin, double aMax);
48 
49 void
50 SB_ConvertFloatEqGainToJSStringValue(double aGain, nsCString &aGainStr);
51 
53 {
54 public:
56  NS_DECL_SBIMEDIACOREMULTIBANDEQUALIZER
57 
59 
61 
66  static const nsEmbedString NO_PRESET;
71  static const PRUint32 EQUALIZER_BAND_COUNT_DEFAULT;
75  static const PRUint32 EQUALIZER_BANDS_10[10];
76 
77  /* override me, see cpp file for implementation notes */
78  virtual nsresult OnInitBaseMediacoreMultibandEqualizer();
79  /* override me, see cpp file for implementation notes */
80  virtual nsresult OnSetEqEnabled(PRBool aEqEnabled);
81  /* override me, see cpp file for implementation notes */
82  virtual nsresult OnGetBandCount(PRUint32 *aBandCount);
83  /* override me, see cpp file for implementation notes */
84  virtual nsresult OnGetBand(PRUint32 aBandIndex, sbIMediacoreEqualizerBand *aBand);
85  /* override me, see cpp file for implementation notes */
86  virtual nsresult OnSetBand(sbIMediacoreEqualizerBand *aBand);
87 
88 protected:
90 
91  template<class T>
92  static NS_HIDDEN_(PLDHashOperator)
93  EnumerateIntoArrayUint32Key(const PRUint32 &aKey,
94  T* aData,
95  void* aArray);
96 
98 
99  PRMonitor* mMonitor;
100  PRPackedBool mEqEnabled;
101 
102  typedef nsInterfaceHashtable<nsUint32HashKey, sbIMediacoreEqualizerBand> eqbands_t;
103  eqbands_t mBands;
104 
105 private:
106  nsEmbedString mCurrentPresetName;
107  bool mSettingPreset;
108  nsCOMPtr<nsIPrefBranch> mPrefs;
109  nsCOMPtr<ngIEqualizerPresetCollection> mPresets;
110 };
111 
112 #endif /* __SB_BASEMEDIACOREMULTIBANDEQUALIZER_H__ */
static NS_HIDDEN_(PLDHashOperator) EnumerateIntoArrayUint32Key(const PRUint32 &aKey
virtual nsresult OnSetBand(sbIMediacoreEqualizerBand *aBand)
static const PRUint32 EQUALIZER_BANDS_10[10]
Suggested bands for a 10 band equalizer.
double SB_ClampDouble(double aGain, double aMin, double aMax)
NS_DECL_ISUPPORTS NS_DECL_SBIMEDIACOREMULTIBANDEQUALIZER sbBaseMediacoreMultibandEqualizer()
const nsIPrefBranch
static const nsEmbedString NO_PRESET
Value of currentPResetName if the equalizer is not set by a preset. This value is set as empty string...
Specific accessors to preset collections.
static const PRUint32 EQUALIZER_BAND_COUNT_DEFAULT
Suggested default band count for the equalizer. This value is defined as 10.
virtual nsresult OnGetBandCount(PRUint32 *aBandCount)
virtual nsresult OnGetBand(PRUint32 aBandIndex, sbIMediacoreEqualizerBand *aBand)
nsInterfaceHashtable< nsUint32HashKey, sbIMediacoreEqualizerBand > eqbands_t
virtual nsresult OnSetEqEnabled(PRBool aEqEnabled)
void SB_ConvertFloatEqGainToJSStringValue(double aGain, nsCString &aGainStr)
nsresult EnsureBandIsCached(sbIMediacoreEqualizerBand *aBand)