Languages

Menu
Sites
Language
How to button click-sound play?

How to button click-sound play?
default style button has click-sound, but customized button has not.
i want play click-sound. how do that?

Responses

5 Replies
Vikram

try to play a tone in your click callback

such as:

#include <tone_player.h>
#include <sound_manager.h>

 int tone_player_id;
 tone_player_start(TONE_TYPE_ANSI_RINGTONE, SOUND_TYPE_RINGTONE, 1000, &tone_player_id);

try more different tone type and sound type, you can check all of them in the header file tone_player.h & sound_manager.h

pius lee

I think you make EDC file for change button style.

in EDC format, use "sounds" feature makes more easy than Vikram's way.

refer follow EDC code.

collections {
   sounds {
      sample { name: "sound" LOSSY 64;
         source: "btn.wav";
      }
   }
   group { name: "elm/button/base/default";
      parts {
         part { name: "rect";
            type: RECT;
            description { state: "default" 0.0;
               color: 0 136 170 255;
            }
         }
         part { name: "elm.text";
            type:TEXT;
            description { state: "default" 0.0;
               align: 0.5 0.5;
               text {
                  text: "CUSTOM";
                  size: 40;
               }
            }
         }
         part {name: "elm.swallow.content";
            type:SWALLOW;
            description { state: "default" 0.0;
               align: 0.5 0.5;
            }
         }
      }
      programs {
         program { name: "mouse_down";
            signal: "mouse,down,1";
            source: "rect";
            action: PLAY_SAMPLE "sound" 1.0;
         }
      }
   }
}

btn.wav must be plarce into [project]/edje/sounds

If you know about edje_cc, you know also upper path is insert with -sd option.

Anyway, EDC sound is easier than tone player.

hayden kang

답변달아 주셔서 감사합니다.

 

조금의 조언을 더 부탁드립니다. 해당 방법대로 해보았으나 재생이 되질 않습니다.

거기에 커스텀 사운드가 아닌 기본 버튼 음을 재생시키고 싶습니다. 

 

방법이 있을까요?

hayden kang

i want default button click-sound. 
how could do that?

Jeongsu Kim

default style has "touch_sound" program

https://git.tizen.org/cgit/framework/uifw/efl-theme-tizen.git/tree/2.3-mobile/widgets/button.edc?h=tizen_2.3#n280

you also need plugins section in the tizen.edc

https://git.tizen.org/cgit/framework/uifw/efl-theme-tizen.git/tree/2.3-mobile/tizen.edc?h=tizen_2.3#n52