Audio.pkg 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $#include "Audio.h"
  2. enum SoundType
  3. {
  4. SOUND_EFFECT,
  5. SOUND_AMBIENT,
  6. SOUND_VOICE,
  7. SOUND_MUSIC,
  8. SOUND_MASTER,
  9. MAX_SOUND_TYPES
  10. };
  11. class Audio : public Object
  12. {
  13. bool SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolation = true);
  14. bool Play();
  15. void Stop();
  16. void SetMasterGain(SoundType type, float gain);
  17. void SetListener(SoundListener* listener);
  18. void StopSound(Sound* sound);
  19. unsigned GetSampleSize() const;
  20. int GetMixRate() const;
  21. bool GetInterpolation() const;
  22. bool IsStereo() const;
  23. bool IsPlaying() const;
  24. bool IsInitialized() const;
  25. float GetMasterGain(SoundType type) const;
  26. SoundListener* GetListener() const;
  27. const PODVector<SoundSource*>& GetSoundSources() const;
  28. void AddSoundSource(SoundSource* soundSource);
  29. void RemoveSoundSource(SoundSource* soundSource);
  30. float GetSoundSourceMasterGain(SoundType type) const;
  31. void MixOutput(void *dest, unsigned samples);
  32. tolua_readonly tolua_property__get_set unsigned sampleSize;
  33. tolua_readonly tolua_property__get_set int mixRate;
  34. tolua_readonly tolua_property__get_set bool interpolation;
  35. tolua_readonly tolua_property__is_set bool stereo;
  36. tolua_readonly tolua_property__is_set bool playing;
  37. tolua_readonly tolua_property__is_set bool initialized;
  38. tolua_property__get_set SoundListener* listener;
  39. };
  40. Audio* GetAudio();
  41. tolua_readonly tolua_property__get_set Audio* audio;
  42. ${
  43. #define TOLUA_DISABLE_tolua_AudioLuaAPI_GetAudio00
  44. static int tolua_AudioLuaAPI_GetAudio00(lua_State* tolua_S)
  45. {
  46. return ToluaGetSubsystem<Audio>(tolua_S);
  47. }
  48. #define TOLUA_DISABLE_tolua_get_audio_ptr
  49. #define tolua_get_audio_ptr tolua_AudioLuaAPI_GetAudio00
  50. $}