1
0

Notification.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Notification.h
  3. * --------------
  4. * Purpose: GUI update notification struct
  5. * Notes : (currently none)
  6. * Authors: OpenMPT Devs
  7. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  8. */
  9. #pragma once
  10. #include "openmpt/all/BuildSettings.hpp"
  11. OPENMPT_NAMESPACE_BEGIN
  12. // struct Notification requires working copy constructor / copy assignment, keep in mind when extending
  13. struct Notification
  14. {
  15. enum Type
  16. {
  17. GlobalVU = 0x00, // Global VU meters (always enabled)
  18. Position = 0x01, // Pattern playback position
  19. Sample = 0x02, // pos[i] contains sample position on this channel
  20. VolEnv = 0x04, // pos[i] contains volume envelope position
  21. PanEnv = 0x08, // pos[i] contains panning envelope position
  22. PitchEnv = 0x10, // pos[i] contains pitch envelope position
  23. VUMeters = 0x20, // pos[i] contains pattern VU meter for this channel
  24. EOS = 0x40, // End of stream reached, the GUI should stop the audio device
  25. Stop = 0x80, // Audio device has been stopped -> reset GUI
  26. Default = GlobalVU,
  27. };
  28. typedef uint16 Item;
  29. static constexpr SmpLength PosInvalid = SmpLength(-1); // pos[i] is not valid (if it contains sample or envelope position)
  30. static constexpr uint32 ClipVU = 0x80000000; // Master VU clip indicator bit (sound output has previously clipped)
  31. int64 timestampSamples;
  32. FlagSet<Notification::Type> type;
  33. Item item; // Sample or instrument number, depending on type
  34. ROWINDEX row; // Always valid
  35. uint32 tick, ticksOnRow; // ditto
  36. ORDERINDEX order; // ditto
  37. PATTERNINDEX pattern; // ditto
  38. uint32 mixedChannels; // ditto
  39. std::array<uint32, 4> masterVUin; // ditto
  40. std::array<uint32, 4> masterVUout; // ditto
  41. uint8 masterVUinChannels; // ditto
  42. uint8 masterVUoutChannels; // ditto
  43. std::array<SmpLength, MAX_CHANNELS> pos; // Sample / envelope pos for each channel if != PosInvalid, or pattern channel VUs
  44. Notification(FlagSet<Notification::Type> t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, uint32 tir = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 0, uint8 inChannels = 0) : timestampSamples(s), type(t), item(i), row(r), tick(ti), ticksOnRow(tir), order(o), pattern(p), mixedChannels(x), masterVUinChannels(inChannels), masterVUoutChannels(outChannels)
  45. {
  46. masterVUin.fill(0);
  47. masterVUout.fill(0);
  48. pos.fill(0);
  49. }
  50. };
  51. DECLARE_FLAGSET(Notification::Type);
  52. OPENMPT_NAMESPACE_END