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 VOLUME
Number The volume setting. BASS
String The bass setting. MID
String The midrange setting. TREBLE
String The treble setting. BALANCE
Number The balance setting. FADE
String The fade setting.
Methods
-
<static> cancelWatch(watchId)
-
Stop watching audio mixer changes
Parameters:
Name Type Description watchId
Number 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 successCallback
Function The callback that is called with the result on success. errorCallback
Function <optional>
The callback that is called if there is an error. zone
String <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; i
REST - 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 setting
String A car.audiomixer.AudioMixerSetting value. zone
String A car.Zone value. value
Number The value to save. successCallback
Function <optional>
The callback that is called on success. errorCallback
Function <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 callback
Function 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);