NativeAudioPlay.cs 806 B

12345678910111213141516171819202122232425262728
  1. using Rokid.UXR.Native;
  2. namespace Rokid.UXR.Utility
  3. {
  4. public class NativeAudioPlay : MonoSingleton<NativeAudioPlay>
  5. {
  6. int buttonDown;
  7. int buttonClick;
  8. void Start()
  9. {
  10. NativeInterface.NativeAPI.makeSoundPool();
  11. buttonDown = NativeInterface.NativeAPI.loadSound("Android Native Audio/ButtonDown.wav");
  12. buttonClick = NativeInterface.NativeAPI.loadSound("Android Native Audio/ButtonUp.wav");
  13. }
  14. public void PlayAudioButtonDown()
  15. {
  16. if (buttonDown != 0)
  17. NativeInterface.NativeAPI.playSound(buttonDown);
  18. }
  19. public void PlayAudioButtonClick()
  20. {
  21. if (buttonClick != 0)
  22. NativeInterface.NativeAPI.playSound(buttonClick);
  23. }
  24. }
  25. }