28 const Cc = Components.classes;
29 const Cu = Components.utils;
30 const Ci = Components.interfaces;
31 Cu.import(
"resource://gre/modules/XPCOMUtils.jsm");
32 Cu.import(
"resource://app/jsmodules/ArrayConverter.jsm");
33 Cu.import(
"resource://app/jsmodules/DebugUtils.jsm");
35 const LOG = DebugUtils.generateLogFunction(
"ngDefaultPresetProvider", 2);
46 var stringBundle =
Cc[
"@mozilla.org/intl/stringbundle;1"]
47 .getService(
Ci.nsIStringBundleService)
48 .createBundle(
"chrome://songbird/locale/songbird.properties");
51 this._presets.push(this._createPreset(
"songbird.eq.currentPreset", stringBundle, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
52 this._presets.push(this._createPreset(
"equalizer.preset.classical", stringBundle, [0, 0, 0, 0, 0, 0, -0.2, -0.2, -0.2, -0.4]));
53 this._presets.push(this._createPreset(
"equalizer.preset.club", stringBundle, [0, 0, 0.15, 0.2, 0.2, 0.2, 0.15, 0, 0, 0]));
54 this._presets.push(this._createPreset(
"equalizer.preset.dance", stringBundle, [0.5, 0.25, 0.05, 0, 0, -0.2, -0.3, -0.3, 0, 0]));
55 this._presets.push(this._createPreset(
"equalizer.preset.full_bass", stringBundle, [0.4, 0.4, 0.4, 0.2, 0, -0.2, -0.3, -0.35, -0.4, -0.4]));
56 this._presets.push(this._createPreset(
"equalizer.preset.full_treble", stringBundle, [-0.4, -0.4, -0.4, -0.15, 0.1, 0.4, 0.8, 0.8, 0.8, 0.8]));
57 this._presets.push(this._createPreset(
"equalizer.preset.small_speakers", stringBundle, [0.2, 0.4, 0.2, -0.2, -0.15, 0, 0.2, 0.4, 0.6, 0.7]));
58 this._presets.push(this._createPreset(
"equalizer.preset.large_hall", stringBundle, [0.45, 0.45, 0.2, 0.2, 0, -0.2, -0.2, -0.2, 0, 0]));
59 this._presets.push(this._createPreset(
"equalizer.preset.live", stringBundle, [-0.2, 0, 0.15, 0.2, 0.2, 0.2, 0.1, 0.05, 0.05, 0]));
60 this._presets.push(this._createPreset(
"equalizer.preset.party", stringBundle, [0.25, 0.25, 0, 0, 0, 0, 0, 0, 0.25, 0.25]));
61 this._presets.push(this._createPreset(
"equalizer.preset.pop", stringBundle, [-0.15, 0.15, 0.2, 0.25, 0.15, -0.15, -0.15, -0.15, -0.1, -0.1]));
62 this._presets.push(this._createPreset(
"equalizer.preset.reggae", stringBundle, [0, 0, -0.1, -0.2, 0, 0.2, 0.2, 0, 0, 0]));
63 this._presets.push(this._createPreset(
"equalizer.preset.rock", stringBundle, [0.3, 0.15, -0.2, -0.3, -0.1, 0.15, 0.3, 0.35, 0.35, 0.35]));
64 this._presets.push(this._createPreset(
"equalizer.preset.ska", stringBundle, [-0.1, -0.15, -0.12, -0.05, 0.15, 0.2, 0.3, 0.3, 0.4, 0.3]));
65 this._presets.push(this._createPreset(
"equalizer.preset.soft", stringBundle, [0.2, 0, -0.1, -0.15, -0.1, 0.2, 0.3, 0.35, 0.4, 0.5]));
66 this._presets.push(this._createPreset(
"equalizer.preset.soft_rock", stringBundle, [0.2, 0.2, 0, -0.1, -0.2, -0.3, -0.2, -0.1, 0.2, 0.4]));
67 this._presets.push(this._createPreset(
"equalizer.preset.techno", stringBundle, [0.3, 0.25, 0, -0.25, -0.2, 0, 0.3, 0.35, 0.35, 0.3]));
71 classDescription:
"Preset provider that provides the default equalizer presets",
72 classID: Components.ID(
"{1f3b39da-c169-49df-af70-eaec9c10640a}"),
73 contractID:
"@getnightingale.com/equalizer-presets/defaults;1",
78 _createPreset:
function(property, strBundle, values) {
79 LOG(
"_createPreset("+property+
", "+strBundle+
", "+values+
")");
80 var preset =
Cc[
"@getnightingale.com/equalizer-presets/localizable;1"]
81 .createInstance(
Ci.ngILocalizableEqualizerPreset);
82 preset.stringBundle = strBundle;
83 preset.property = property;
84 preset.setValues(ArrayConverter.nsIArray(
85 this._makeArraySupportDouble(values)));
89 _makeArraySupportDouble:
function(
array) {
90 return array.map(
function(item) {
91 var
double =
Cc[
"@mozilla.org/supports-double;1"]
92 .createInstance(
Ci.nsISupportsDouble);
101 return ArrayConverter.nsIArray(this._presets);
103 throw Components.results.NS_ERROR_UNEXPECTED;
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function ngDefaultPresetProvider()
sbDeviceFirmwareAutoCheckForUpdate prototype classID