System Sounds

The System Sounds service (com.palm.audio/systemsounds) plays audio feedback in response to user interaction. The sounds play as soon as the message is played, with low latency.


playFeedback

Plays a system sound by using the "feedback" stream class. Intended for UI feedback, such as UI button clicks, keypad clicks, and other similar sounds.

Syntax

{
    "name" : string
}

Parameters

Parameter Required Type Description
name Yes string The sample name. The following are the supported names, which are subject to change:
  • appclose
  • back_01
  • browser_01
  • card_01
  • card_02
  • card_03
  • card_04
  • card_05
  • default_425hz
  • delete_01
  • discardingapp_01
  • down2
  • dtmf_0
  • dtmf_1
  • dtmf_2
  • dtmf_3
  • dtmf_4
  • dtmf_5
  • dtmf_6
  • dtmf_7
  • dtmf_8
  • dtmf_9
  • dtmf_asterisk
  • dtmf_pound
  • error_01
  • error_02
  • error_03
  • focusing
  • launch_01
  • launch_02
  • launch_03
  • pagebacwards
  • pageforward_01
  • shuffle_02
  • shuffle_03
  • shuffle_04
  • shuffle_05
  • shuffle_06
  • shuffle_07
  • shuffle_08
  • shuffling_01
  • shutter
  • switchingapps_01
  • switchingapps_02
  • switchingapps_03
  • tones_3beeps_otasp_done
  • unassigned
  • up2

Returns

{
    returnValue : boolean,
    errorText   : string
}
Attribute Required Type Description
returnValue Yes boolean true (success) or false (failure)
errorText No string Error message returned on failure.

Examples

luna-send

 luna-send -n 1   luna://com.palm.audio/systemsounds/playFeedback '{"name": "card_01"}'
{"returnValue":true}

Enyo

enyo.kind({
   name : "enyo.SysSounds",
   kind : enyo.VFlexBox,
   components : [ 
     { flex : 1,
      kind : "Pane",
      components : [{
         flex : 1,
         kind : "Scroller",
         components : [{
            name : "makeSysSound",
            kind : "PalmService",
            service : "palm://com.palm.audio/systemsounds",
            method : "playFeedback",
            onSuccess : "makeSoundSuccess",
            onFailure : "makeSoundFailure"
         },
         {kind : "Button", name : "makeSoundButton", caption : "Make Sound", onclick : "makeSoundClick"}
        ]
      }]
    }],
    makeSoundClick: function() {        
         this.$.makeSysSound.call({"name": "appclose"});
    },
    makeSoundSuccess: function(inSender, inResponse) {
        this.log("Make sound success, results=" + enyo.json.stringify(inResponse));
    },          
    // Log errors to the console for debugging
    makeSoundFailure: function(inSender, inError, inRequest) {
        this.log(enyo.json.stringify(inError));
    }
});

Mojo

this.controller.serviceRequest("palm://com.palm.audio/systemsounds", {
    method: "playFeedback",
    parameters: {
        name: "dtmf_2"
    },
    onSuccess:{},
    onFailure:{}
});                 

Sample Code

See Services Sample.