SoundPlayer.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. 
  2. #ifndef MODULE_SOUND_PLAYER
  3. #define MODULE_SOUND_PLAYER
  4. #include "../../DFPSR/api/soundAPI.h"
  5. #include "Envelope.h"
  6. namespace dsr {
  7. struct SoundPlayer {
  8. SoundBuffer soundBuffer;
  9. int32_t soundIndex;
  10. int64_t playerID;
  11. bool repeat = false;
  12. bool sustained = true;
  13. // TODO: Use a union for the location to allow switching between fixed and interpolating implementations.
  14. // Fixed
  15. uint32_t location = 0;
  16. // Optional volume to be applied externally, because the player does not duplicate channels.
  17. bool fadeLeft, fadeRight; // True iff the corresponding volume is not 1.0.
  18. float leftVolume, rightVolume;
  19. // Optional Envelope
  20. Envelope envelope;
  21. SoundPlayer(const SoundBuffer &soundBuffer, int32_t soundIndex, int64_t playerID, bool repeat, uint32_t startLocation, float leftVolume, float rightVolume, const EnvelopeSettings &envelopeSettings);
  22. };
  23. void player_getNextSamples(SoundPlayer &source, SafePointer<float> target, int32_t playedSamplesPerChannel, double secondsPerSample);
  24. }
  25. #endif