Isomet Modular Synthesiser (iMS) API  v1.4.2
iMS API
Image.h
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------------
2 / Title : Isomet Image Header
3 / Project : Isomet Modular Synthesiser System
4 /------------------------------------------------------------------------------
5 / File : $URL: http://nutmeg.qytek.lan/svn/sw/trunk/09-Isomet/iMS_SDK/API/ImageOps/h/Image.h $
6 / Author : $Author: dave $
7 / Company : Isomet (UK) Ltd
8 / Created : 2015-04-09
9 / Last update: $Date: 2017-10-06 15:33:32 +0100 (Fri, 06 Oct 2017) $
10 / Platform :
11 / Standard : C++11
12 / Revision : $Rev: 302 $
13 /------------------------------------------------------------------------------
14 / Description:
15 /------------------------------------------------------------------------------
16 / Copyright (c) 2015 Isomet (UK) Ltd. All Rights Reserved.
17 /------------------------------------------------------------------------------
18 / Revisions :
19 / Date Version Author Description
20 / 2015-04-09 1.0 dc Created
21 /
22 /----------------------------------------------------------------------------*/
23 
34 
35 #ifndef IMS_IMAGE_H__
36 #define IMS_IMAGE_H__
37 
38 #include "IMSTypeDefs.h"
39 #include "Containers.h"
40 #include <deque>
41 #include <list>
42 #include <array>
43 #include <chrono>
44 #include <ctime>
45 
47 #if defined _WIN32 || defined __CYGWIN__
48  #ifdef __GNUC__
49  #define DLL_EXPORT __attribute__ ((dllexport))
50  #define DLL_IMPORT __attribute__ ((dllimport))
51  #else
52  #define DLL_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
53  #define DLL_IMPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
54  #endif
55  #define DLL_LOCAL
56 #else
57  #if __GNUC__ >= 4
58  #define DLL_EXPORT __attribute__ ((visibility ("default")))
59  #define DLL_IMPORT __attribute__ ((visibility ("default")))
60  #define DLL_LOCAL __attribute__ ((visibility ("hidden")))
61  #else
62  #define DLL_EXPORT
63  #define DLL_IMPORT
64  #define DLL_LOCAL
65  #endif
66 #endif
67 
68 #if defined(_EXPORTING_IMS)
69  #define LIBSPEC DLL_EXPORT
70  #define LIBLOCAL DLL_LOCAL
71  #define EXPIMP_TEMPLATE
72 #elif defined(_STATIC_IMS)
73  #define LIBSPEC
74  #define LIBLOCAL
75  #define EXPIMP_TEMPLATE
76 #else
77  #define LIBSPEC DLL_IMPORT
78  #define LIBLOCAL DLL_LOCAL
79  #define EXPIMP_TEMPLATE extern
80 #endif
81 
83 namespace iMS {
99  class LIBSPEC ImagePoint
100  {
101  public:
105  ImagePoint() : ImagePoint(FAP(0.0, 0.0, 0.0)) {};
111  ImagePoint(FAP fap);
117  ImagePoint(FAP ch1, FAP ch2, FAP ch3, FAP ch4);
123  ImagePoint(FAP fap, float synca, unsigned int syncd);
129  ImagePoint(FAP ch1, FAP ch2, FAP ch3, FAP ch4, float synca_1, float synca_2, unsigned int syncd);
130 
131  ~ImagePoint() {};
132 
138  bool operator==(ImagePoint const& rhs) const;
141 
142  const FAP& GetFAP(const RFChannel) const;
147 
151  void SetFAP(const RFChannel, const FAP&);
152 
156  FAP& SetFAP(const RFChannel);
157 
161  void SetAll(const FAP&);
163 
167 
168  const float& GetSyncA(int index) const;
174 
179  void SetSyncA(int index, const float& value);
180 
185  const unsigned int& GetSyncD() const;
186 
190  void SetSyncD(const unsigned int& value);
191 
192  private:
193  FAP m_fap[4];
194  float m_synca[2];
195  unsigned int m_syncd;
196  };
197 
228  class LIBSPEC Image : public DequeBase<ImagePoint> {
267  public:
270 
271  Image(const std::string& name = "");
285  Image(size_t nPts, const ImagePoint& pt, const std::string& name = "");
297  Image(size_t nPts, const ImagePoint& pt, const Frequency& f, const std::string& name = "");
309  Image(size_t nPts, const ImagePoint& pt, const int div, const std::string& name = "");
327  Image(const_iterator first, const_iterator last, const std::string& name = "");
340  Image(const_iterator first, const_iterator last, const Frequency& f, const std::string& name = "");
353  Image(const_iterator first, const_iterator last, const int div, const std::string& name = "");
354 
358  Image(const Image &);
362  Image &operator =(const Image &);
363 
367  ~Image();
369 
370 
374 
375  void AddPoint(const ImagePoint& pt);
395  iterator InsertPoint(iterator it, const ImagePoint& pt);
405  void InsertPoint(iterator it, size_t nPts, const ImagePoint& pt);
427  void InsertPoint(iterator it, const_iterator first, const_iterator last);
429 
432 
433  iterator RemovePoint(iterator it);
455  iterator RemovePoint(iterator first, iterator last);
462  void Clear();
464 
467 
468  int Size() const;
475 
479 
480  void ClockRate(const Frequency& f);
503  const Frequency& ClockRate() const;
505 
508 
509  void ExtClockDivide(const int div);
532  const int ExtClockDivide() const;
534 
537 
538  std::string& Description();
547  const std::string& Description() const;
548 
549  private:
550  class Impl;
551  Impl * p_Impl;
552  };
553 
555  using ImageIndex = int;
556 
579  struct LIBSPEC ImageTableEntry
580  {
586 
587  ImageTableEntry();
591  ImageTableEntry(ImageIndex handle, std::uint32_t address, int n_pts, int size, std::uint32_t fmt, std::array<std::uint8_t, 16> uuid, std::string name);
593  ImageTableEntry(ImageIndex handle, const std::vector<std::uint8_t>&);
595  ~ImageTableEntry();
597  ImageTableEntry(const ImageTableEntry &);
599  ImageTableEntry &operator =(const ImageTableEntry &);
601 
604 
605  const ImageIndex& Handle() const;
617  const std::uint32_t& Address() const;
620  const int& NPts() const;
623  const int& Size() const;
633  const std::uint32_t& Format() const;
645  const std::array<std::uint8_t, 16>& UUID() const;
655  const std::string& Name() const;
656  private:
657  class Impl;
658  Impl *p_Impl;
659  };
660 
665  enum class ImageRepeats {
667  NONE,
669  PROGRAM,
671  FOREVER
672  };
673 
691  struct LIBSPEC ImageSequenceEntry
692  {
696 
711  ImageSequenceEntry(const Image& img, const ImageRepeats& Rpt = ImageRepeats::NONE, const int rpts = 0);
725  ImageSequenceEntry(const ImageTableEntry& ite, const kHz& InternalClock = kHz(1.0), const ImageRepeats& Rpt = ImageRepeats::NONE, const int rpts = 0);
739  ImageSequenceEntry(const ImageTableEntry& ite, const int ExtClockDivide = 1, const ImageRepeats& Rpt = ImageRepeats::NONE, const int rpts = 0);
741  ~ImageSequenceEntry();
743  ImageSequenceEntry(const ImageSequenceEntry &);
745  ImageSequenceEntry &operator =(const ImageSequenceEntry &);
747 
752  bool operator==(ImageSequenceEntry const& rhs) const;
753 
756 
757  std::chrono::duration<double>& PostImgDelay();
770  const std::chrono::duration<double>& PostImgDelay() const;
771 
783  std::chrono::duration<double>& SyncOutDelay();
786  const std::chrono::duration<double>& SyncOutDelay() const;
788 
791 
792  const std::array<std::uint8_t, 16>& UUID() const;
804  const int& ExtDiv() const;
807  const Frequency& IntOsc() const;
810  const ImageRepeats& RptType() const;
813  const int& NumRpts() const;
815  private:
816  class Impl;
817  Impl *p_Impl;
818  };
819 
823  enum class SequenceTermAction : std::uint8_t
824  {
826  DISCARD = 0,
828  RECYCLE = 1,
830  STOP_DISCARD = 2,
832  STOP_RECYCLE = 3,
834  REPEAT = 4,
836  REPEAT_FROM = 5
837  };
838 
857  class LIBSPEC ImageSequence : public ListBase < ImageSequenceEntry >
858  {
859  public:
861 
862  ImageSequence();
867  ImageSequence(SequenceTermAction action, int val = 0);
869  ~ImageSequence();
871  ImageSequence(const ImageSequence &);
873  ImageSequence &operator =(const ImageSequence &);
875 
876 
878 
879  void OnTermination(SequenceTermAction act, int val = 0);
885  const SequenceTermAction& TermAction() const;
888  const int& TermValue() const;
890 
891 
892  private:
893  class Impl;
894  Impl *p_Impl;
895  };
896 
910  class LIBSPEC ImageGroup : public DequeBase<Image> {
911  public:
912 
914 
915  ImageGroup(const std::string& name = "", const std::time_t& create_time = std::time(nullptr), const std::time_t& modified_time = std::time(nullptr));
926  ImageGroup(const ImageGroup &);
930  ImageGroup &operator =(const ImageGroup &);
934  ~ImageGroup();
936 
937 
939 
940  void AddImage(const Image& img);
948  iterator InsertImage(iterator it, const Image& img);
952  iterator RemoveImage(iterator it);
957  iterator RemoveImage(iterator first, iterator last);
958 
962  void Clear();
966  int Size() const;
968 
972 
973  const std::time_t& CreatedTime() const;
985  std::string CreatedTimeFormat() const;
987 
991 
992  std::string& Author();
1002  const std::string& Author() const;
1007  std::string& Company();
1011  const std::string& Company() const;
1019  std::string& Revision();
1023  const std::string& Revision() const;
1028  std::string& Description();
1032  const std::string& Description() const;
1034 
1038 
1039  ImageSequence& Sequence();
1047  const ImageSequence& Sequence() const;
1049 
1051  private:
1052  class Impl;
1053  Impl *p_Impl;
1054  };
1055 
1058 }
1059 
1060 #undef EXPIMP_TEMPLATE
1061 #undef LIBSPEC
1062 #endif
No effect on the Sequence Queue. Repeat the current Sequence.
Move the ImageSequence to the end of Sequence Queue and move on to the next Sequence, if it exists, otherwise repeat this ImageSequence.
The Image is played back repeatedly until stopped by the application.
No effect on the Sequence Queue. Repeat the current Sequence starting from the ImageSequenceEntry ind...
int ImageIndex
Each ImageIndex is an offset into the Image Index Table that uniquely refers to an Image stored in Co...
Definition: Image.h:555
A sequence of ImagePoints played out sequentially by the Controller and driven by the Synthesiser...
Definition: Image.h:228
Template Class encapsulating a list object and acting as a base list class for other classes in the l...
Definition: Containers.h:91
std::deque< ImagePoint >::const_iterator const_iterator
Const Iterator defined for user readback of DequeBase.
Definition: Containers.h:318
ImageRepeats
Each Image can be repeated, either a programmable number of times, or indefinitely.
Definition: Image.h:665
ImagePoint()
Default Constructor.
Definition: Image.h:105
An ImageSequence object completely defines a sequence to be played back on an iMS Controller in terms...
Definition: Image.h:857
FAP (Frequency/Amplitude/Phase) triad stores the instantaneous definition of a single RF output...
Definition: IMSTypeDefs.h:387
An ImageGroup collects together multiple associated images and a single ImageSequence for controlling...
Definition: Image.h:910
The Image is played back a programmable number of times according to the value set in the PlayConfigu...
SequenceTermAction
Operation to perform on the completion of the last repeat of the last entry in a Sequence.
Definition: Image.h:823
The entire API is encapsulated by the iMS namespace.
Definition: Auxiliary.h:95
Container Classes for storing various types of data related to Image classes and others.
ImageGroup ImageFile
For backwards compatibility with code written against SDK 1.2.6 or earlier.
Definition: Image.h:1057
Template Class encapsulating a deque object and acting as a base deque class for other classes in the...
Definition: Containers.h:302
The Image is played back only once.
An ImageSequenceEntry object can be created by application software to specify the parameters by whic...
Definition: Image.h:691
Type Definition for all operations that require a frequency specification in kiloHertz.
Definition: IMSTypeDefs.h:148
Move the ImageSequence to the end of Sequence Queue and stop playback.
Delete the ImageSequence from the Sequence Queue and move on to the next Sequence, if it exists, otherwise Stop.
Useful Type Definitions for working with iMS Systems.
Stores 4 FAP Triads containing frequency, amplitude and phase data for 4 RF channels.
Definition: Image.h:99
An ImageTableEntry is created by the SDK on connecting to an iMS System, one for each Image that is s...
Definition: Image.h:579
Delete the ImageSequence from the Sequence Queue and stop playback.
Type Definition for all operations that require a frequency specification.
Definition: IMSTypeDefs.h:96
std::deque< ImagePoint >::iterator iterator
Iterator defined for user manipulation of DequeBase.
Definition: Containers.h:316