Audio.pkg 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. public:
  14. bool SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolation = true);
  15. bool Play();
  16. void Stop();
  17. void SetMasterGain(SoundType type, float gain);
  18. void SetListener(SoundListener* listener);
  19. void StopSound(Sound* sound);
  20. unsigned GetSampleSize() const;
  21. int GetMixRate() const;
  22. bool GetInterpolation() const;
  23. bool IsStereo() const;
  24. bool IsPlaying() const;
  25. bool IsInitialized() const;
  26. float GetMasterGain(SoundType type) const;
  27. SoundListener* GetListener() 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_property__get_set SoundListener* listener;
  36. tolua_readonly tolua_property__is_set bool stereo;
  37. tolua_readonly tolua_property__is_set bool playing;
  38. tolua_readonly tolua_property__is_set bool initialized;
  39. };