Controls the audio mixer
- Source:
Members
-
<static> AudioMixerSetting
-
Audio mixer settings enumeration
All values indicate a level within a range from 0 to 100%.
- Source:
Properties:
Name Type Description VOLUMENumber The volume setting. BASSString The bass setting. MIDString The midrange setting. TREBLEString The treble setting. BALANCENumber The balance setting. FADEString The fade setting.
Methods
-
<static> cancelWatch(watchId)
-
Stop watching audio mixer changes
Parameters:
Name Type Description watchIdNumber The watch ID returned by car.audiomixer.watchAudioMixer. - Source:
Example
car.audiomixer.cancelWatch(watchId); -
<static> get(successCallback, errorCallback, zone)
-
Return the audio mixer settings for a specific zone
If successful, get() calls the successCallback with a Zone object for the specific zone.
Parameters:
Name Type Argument Description successCallbackFunction The callback that is called with the result on success. errorCallbackFunction <optional>
The callback that is called if there is an error. zoneString <optional>
The Zone to filter the results by. - Source:
- See:
-
- car.Zone
Examples
//define your callback function(s) function successCallback(audioMixerItems) { //iterate through all the audio mixer items for (var i=0; iREST - single zone Request: http:///car/audiomixer/get?zone=all Response: { code: 1, data: [ { setting: 'volume', zone: 'all', value: 50 } ] } REST - multi zone Request: http:///car/audiomixer/get Success Response: { code: 1, data: [ { setting: 'volume', zone: 'all', value: 50 }, { setting: 'bass', zone: 'all', value: 6 }, ] } Error Response: { code: -1, msg: "An error has occurred" } -
<static> set(setting, zone, value, successCallback, errorCallback)
-
Save an audio mixer setting
Parameters:
Name Type Argument Description settingString A car.audiomixer.AudioMixerSetting value. zoneString A car.Zone value. valueNumber The value to save. successCallbackFunction <optional>
The callback that is called on success. errorCallbackFunction <optional>
The callback that is called if there is an error. - Source:
- See:
-
- car.audiomixer.AudioMixerSetting
- car.Zone
Examples
//option 1: set the volume in the entire car to 50 using constants car.audiomixer.set(car.audiomixer.AudioMixerSetting.VOLUME, car.Zone.ALL, 50); //option 2: set the volume in the entire car to 50 without using constants car.audiomixer.set('volume', 'all', 50);REST Request: http:///car/audiomixer/set?setting=volume&zone=all&value=50 Success Response: { code: 1 } Error Response: { code: -1, msg: "An error has occurred" } -
<static> watchAudioMixer(callback) → {Number}
-
Watch for audio mixer changes
Parameters:
Name Type Description callbackFunction The function to be called when a change is detected. - Source:
Returns:
An ID for the added watch.- Type
- Number
Example
//define a callback function function myCallback(audioMixerItems) { //iterate through the changed items for (var i=0; i<audioMixerItems.length; i++) { console.log("audio mixer item setting = " + audioMixerItems[i].setting + '\n' + //a car.audiomixer.AudioMixerSetting value "audio mixer item zone = " + audioMixerItems[i].zone + '\n' + //a car.Zone value "audio mixer item value = " + audioMixerItems[i].value + '\n\n'); //a numeric value } } var watchId = car.audiomixer.watchAudioMixer(myCallback);