audiosourceif.h 850 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * Copyright (c) 2011 Nokia Corporation.
  3. *
  4. * Part of the Qt GameEnabler.
  5. */
  6. #ifndef GEINTERFACES_H
  7. #define GEINTERFACES_H
  8. namespace GE {
  9. #define AUDIO_FREQUENCY 22050
  10. #define AUDIO_SAMPLE_TYPE short
  11. #define AUDIO_SAMPLE_BITS 16
  12. #define AUDIO_CHANNELS 2
  13. // Constants
  14. const float GEMaxAudioVolumeValue(4096.0f);
  15. class AudioSource
  16. {
  17. public:
  18. explicit AudioSource();
  19. virtual ~AudioSource();
  20. public:
  21. virtual bool canBeDestroyed();
  22. // sampleCount is the count of short, should be always divisible by AUDIO_CHANNELS
  23. // For example, when sampleCount is 20,
  24. // - 40 bytes (20 shorts) are written
  25. // - 10 voice samples are provided for each channel
  26. virtual int pullAudio(AUDIO_SAMPLE_TYPE *target, int sampleCount ) = 0;
  27. };
  28. } // namespace GE
  29. #endif // GEINTERFACES_H