2022년 6월 22일 수요일

[FMX] Firemonkey delphi android beep sound

 Uses

   Androidapi.Helpers,

   Androidapi.JNIBridge,

   Androidapi.JNI.Media,

   AndroidApi.Jni.JavaTypes,

   AndroidApi.Jni.App;


procedure BeepSound();

{$IFDEF ANDROID}

var

  AudioObj: JObject;

  Audio: JAudioManager;

{$ENDIF}

begin

{$IFDEF ANDROID}

  AudioObj:= TAndroidHelper.Activity.getSystemService( TJActivity.JavaClass.AUDIO_SERVICE);

  Audio := TJAudioManager.Wrap((AudioObj as ILocalObject).GetObjectID);

  Audio.loadSoundEffects;

  Audio.playSoundEffect( 8 );  // 0 ~ 9 

{$ENDIF}

end;


댓글 없음:

댓글 쓰기