synthclone  0.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
context.h
Go to the documentation of this file.
1 /*
2  * libsynthclone - a plugin API for `synthclone`
3  * Copyright (C) 2011 Devin Anderson
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation; either version 2.1 of the License, or (at your
8  * option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __SYNTHCLONE_CONTEXT_H__
21 #define __SYNTHCLONE_CONTEXT_H__
22 
23 #include <QtCore/QDir>
24 #include <QtCore/QStringList>
25 
26 #include <synthclone/effect.h>
27 #include <synthclone/effectjob.h>
28 #include <synthclone/menuaction.h>
31 #include <synthclone/sampler.h>
32 #include <synthclone/target.h>
34 
35 namespace synthclone {
36 
37  class Participant;
38 
45  class Context: public QObject {
46 
47  Q_OBJECT
48 
49  public:
50 
59  virtual const EffectJob *
60  getCurrentEffectJob() const = 0;
61 
69  virtual const SamplerJob *
70  getCurrentSamplerJob() const = 0;
71 
82  virtual const Effect *
83  getEffect(int index) const = 0;
84 
92  virtual int
93  getEffectCount() const = 0;
94 
105  virtual int
106  getEffectIndex(const Effect *effect) const = 0;
107 
118  virtual const EffectJob *
119  getEffectJob(int index) const = 0;
120 
128  virtual int
129  getEffectJobCount() const = 0;
130 
141  virtual int
142  getEffectJobIndex(const synthclone::EffectJob *job) const = 0;
143 
151  virtual const Component *
152  getFocusedComponent() const = 0;
153 
161  virtual int
162  getMajorVersion() const = 0;
163 
171  virtual int
172  getMinorVersion() const = 0;
173 
184  virtual const Participant *
185  getParticipant(const QByteArray &id) const = 0;
186 
201  virtual const Participant *
202  getParticipant(int index, const Participant *parent=0) const = 0;
203 
216  virtual int
217  getParticipantCount(const Participant *parent=0) const = 0;
218 
229  virtual QByteArray
230  getParticipantId(const Participant *participant) const = 0;
231 
243  virtual const Participant *
244  getParticipantParent(const Participant *participant) const = 0;
245 
253  virtual int
254  getRevision() const = 0;
255 
263  virtual SampleChannelCount
264  getSampleChannelCount() const = 0;
265 
274  virtual const Sampler *
275  getSampler() const = 0;
276 
287  virtual const SamplerJob *
288  getSamplerJob(int index) const = 0;
289 
297  virtual int
298  getSamplerJobCount() const = 0;
299 
310  virtual int
311  getSamplerJobIndex(const synthclone::SamplerJob *job) const = 0;
312 
320  virtual SampleRate
321  getSampleRate() const = 0;
322 
330  virtual const Effect *
331  getSelectedEffect() const = 0;
332 
340  virtual const Target *
341  getSelectedTarget() const = 0;
342 
353  virtual Zone *
354  getSelectedZone(int index) = 0;
355 
363  virtual int
364  getSelectedZoneCount() const = 0;
365 
374  virtual const QDir *
375  getSessionDirectory() const = 0;
376 
384  virtual SessionState
385  getSessionState() const = 0;
386 
397  virtual const Target *
398  getTarget(int index) const = 0;
399 
407  virtual int
408  getTargetCount() const = 0;
409 
420  virtual int
421  getTargetIndex(const Target *target) const = 0;
422 
433  virtual Zone *
434  getZone(int index) = 0;
435 
443  virtual int
444  getZoneCount() const = 0;
445 
456  virtual int
457  getZoneIndex(const Zone *zone) const = 0;
458 
467  virtual bool
468  isAftertouchPropertyVisible() const = 0;
469 
478  virtual bool
480 
489  virtual bool
490  isChannelPropertyVisible() const = 0;
491 
503  virtual bool
504  isControlPropertyVisible(MIDIData control) const = 0;
505 
514  virtual bool
515  isDrySamplePropertyVisible() const = 0;
516 
525  virtual bool
526  isNotePropertyVisible() const = 0;
527 
538  virtual bool
539  isParticipantActivated(const Participant *participant) const = 0;
540 
549  virtual bool
550  isReleaseTimePropertyVisible() const = 0;
551 
560  virtual bool
561  isSampleTimePropertyVisible() const = 0;
562 
574  virtual bool
575  isSessionDirectory(const QDir &directory) const = 0;
576 
585  virtual bool
586  isStatusPropertyVisible() const = 0;
587 
596  virtual bool
597  isVelocityPropertyVisible() const = 0;
598 
607  virtual bool
608  isWetSamplePropertyVisible() const = 0;
609 
620  virtual bool
621  isZoneSelected(const Zone *zone) const = 0;
622 
633  virtual bool
634  isZoneSelected(int index) const = 0;
635 
636  public slots:
637 
642  virtual void
644 
653  virtual void
654  activateParticipant(const synthclone::Participant *participant) = 0;
655 
669  virtual const Registration &
670  addEffect(Effect *effect, int index=-1) = 0;
671 
683  virtual const EffectJob *
684  addEffectJob(Zone *zone) = 0;
685 
703  virtual const Registration &
704  addMenuAction(MenuAction *action, Menu menu,
705  const QStringList &subMenus=QStringList()) = 0;
706 
724  virtual const Registration &
725  addMenuAction(MenuAction *action, const Effect *effect,
726  const QStringList &subMenus=QStringList()) = 0;
727 
746  virtual const Registration &
747  addMenuAction(MenuAction *action, const Sampler *sampler,
748  const QStringList &subMenus=QStringList()) = 0;
749 
767  virtual const Registration &
768  addMenuAction(MenuAction *action, const Target *target,
769  const QStringList &subMenus=QStringList()) = 0;
770 
788  virtual const Registration &
789  addMenuSeparator(MenuSeparator *separator, Menu menu,
790  const QStringList &subMenus=QStringList()) = 0;
791 
810  virtual const Registration &
811  addMenuSeparator(MenuSeparator *separator, const Effect *effect,
812  const QStringList &subMenus=QStringList()) = 0;
813 
832  virtual const Registration &
833  addMenuSeparator(MenuSeparator *separator, const Sampler *sampler,
834  const QStringList &subMenus=QStringList()) = 0;
835 
854  virtual const Registration &
855  addMenuSeparator(MenuSeparator *separator, const Target *target,
856  const QStringList &subMenus=QStringList()) = 0;
857 
886  virtual const Registration &
887  addParticipant(Participant *participant, const QByteArray &subId) = 0;
888 
900  virtual const Registration &
901  addSampler(Sampler *sampler) = 0;
902 
919  virtual const SamplerJob *
920  addSamplerJob(SamplerJob::Type type, Zone *zone) = 0;
921 
935  virtual const Registration &
936  addTarget(Target *target, int index=-1) = 0;
937 
948  virtual Zone *
949  addZone(int index=-1) = 0;
950 
955  virtual void
956  buildTargets() = 0;
957 
971  virtual void
972  createSession(const QDir &directory, SampleRate sampleRate,
973  SampleChannelCount count) = 0;
974 
983  virtual void
984  deactivateParticipant(const Participant *participant) = 0;
985 
997  virtual void
998  loadSession(const QDir &directory) = 0;
999 
1010  virtual void
1011  moveEffect(int fromIndex, int toIndex) = 0;
1012 
1023  virtual void
1024  moveEffectJob(int fromIndex, int toIndex) = 0;
1025 
1036  virtual void
1037  moveSamplerJob(int fromIndex, int toIndex) = 0;
1038 
1049  virtual void
1050  moveTarget(int fromIndex, int toIndex) = 0;
1051 
1062  virtual void
1063  moveZone(int fromIndex, int toIndex) = 0;
1064 
1074  virtual void
1075  quit() = 0;
1076 
1084  virtual void
1085  removeEffect(const Effect *effect) = 0;
1086 
1094  virtual void
1095  removeEffect(int index) = 0;
1096 
1104  virtual void
1105  removeEffectJob(const EffectJob *job) = 0;
1106 
1114  virtual void
1115  removeEffectJob(int index) = 0;
1116 
1124  virtual void
1125  removeMenuAction(const MenuAction *action) = 0;
1126 
1134  virtual void
1135  removeMenuSeparator(const MenuSeparator *separator) = 0;
1136 
1144  virtual void
1145  removeParticipant(const Participant *participant) = 0;
1146 
1151  virtual void
1152  removeSampler() = 0;
1153 
1161  virtual void
1162  removeSamplerJob(const SamplerJob *job) = 0;
1163 
1171  virtual void
1172  removeSamplerJob(int index) = 0;
1173 
1181  virtual void
1182  removeTarget(const Target *target) = 0;
1183 
1191  virtual void
1192  removeTarget(int index) = 0;
1193 
1201  virtual void
1202  removeZone(Zone *zone) = 0;
1203 
1211  virtual void
1212  removeZone(int index) = 0;
1213 
1222  virtual void
1223  reportError(const QString &message) = 0;
1224 
1230  virtual void
1231  saveSession() = 0;
1232 
1241  virtual void
1242  saveSession(const QDir &directory) = 0;
1243 
1251  virtual void
1252  setAftertouchPropertyVisible(bool visible) = 0;
1253 
1261  virtual void
1262  setChannelPressurePropertyVisible(bool visible) = 0;
1263 
1271  virtual void
1272  setChannelPropertyVisible(bool visible) = 0;
1273 
1284  virtual void
1285  setControlPropertyVisible(MIDIData control, bool visible) = 0;
1286 
1294  virtual void
1295  setDrySamplePropertyVisible(bool visible) = 0;
1296 
1305  virtual void
1306  setFocusedComponent(const Component *component) = 0;
1307 
1315  virtual void
1316  setNotePropertyVisible(bool visible) = 0;
1317 
1325  virtual void
1326  setReleaseTimePropertyVisible(bool visible) = 0;
1327 
1345  virtual void
1346  setSampleChannelCount(SampleChannelCount sampleChannelCount) = 0;
1347 
1358  virtual void
1359  setSampleRate(SampleRate sampleRate) = 0;
1360 
1368  virtual void
1369  setSampleTimePropertyVisible(bool visible) = 0;
1370 
1379  virtual void
1380  setSelectedEffect(const Effect *effect) = 0;
1381 
1390  virtual void
1391  setSelectedEffect(int index) = 0;
1392 
1401  virtual void
1402  setSelectedTarget(const Target *target) = 0;
1403 
1412  virtual void
1413  setSelectedTarget(int index) = 0;
1414 
1423  virtual void
1424  setSessionModified() = 0;
1425 
1433  virtual void
1434  setStatusPropertyVisible(bool visible) = 0;
1435 
1443  virtual void
1444  setVelocityPropertyVisible(bool visible) = 0;
1445 
1453  virtual void
1454  setWetSamplePropertyVisible(bool visible) = 0;
1455 
1466  virtual void
1467  setZoneSelected(const Zone *zone, bool selected) = 0;
1468 
1479  virtual void
1480  setZoneSelected(int index, bool selected) = 0;
1481 
1492  virtual void
1493  sortZones(const ZoneComparer &comparer, bool ascending=true) = 0;
1494 
1505  virtual void
1506  unloadSession() = 0;
1507 
1508  signals:
1509 
1525  void
1527  const synthclone::Participant *parent,
1528  const QByteArray &id);
1529 
1540  void
1541  addingEffect(const synthclone::Effect *effect, int index);
1542 
1553  void
1554  addingEffectJob(const synthclone::EffectJob *job, int index);
1555 
1570  void
1572  synthclone::Menu menu, const QStringList &subMenus);
1573 
1588  void
1590  const synthclone::Effect *effect,
1591  const QStringList &subMenus);
1592 
1608  void
1610  const synthclone::Sampler *sampler,
1611  const QStringList &subMenus);
1612 
1627  void
1629  const synthclone::Target *target,
1630  const QStringList &subMenus);
1631 
1646  void
1648  synthclone::Menu menu,
1649  const QStringList &subMenus);
1650 
1666  void
1668  const synthclone::Effect *effect,
1669  const QStringList &subMenus);
1670 
1686  void
1688  const synthclone::Sampler *sampler,
1689  const QStringList &subMenus);
1690 
1706  void
1708  const synthclone::Target *target,
1709  const QStringList &subMenus);
1710 
1726  void
1727  addingParticipant(const synthclone::Participant *participant,
1728  const synthclone::Participant *parent,
1729  const QByteArray &id);
1730 
1738  void
1739  addingSampler(const synthclone::Sampler *sampler);
1740 
1751  void
1752  addingSamplerJob(const synthclone::SamplerJob *job, int index);
1753 
1764  void
1765  addingTarget(const synthclone::Target *target, int index);
1766 
1777  void
1778  addingZone(const synthclone::Zone *zone, int index);
1779 
1787  void
1789 
1797  void
1798  buildingTarget(const synthclone::Target *target);
1799 
1804  void
1805  buildingTargets();
1806 
1815  void
1817 
1825  void
1826  channelPropertyVisibilityChanged(bool visible);
1827 
1838  void
1840  bool visible);
1841 
1849  void
1851 
1859  void
1861 
1877  void
1879  const synthclone::Participant *parent,
1880  const QByteArray &id);
1881 
1889  void
1890  drySamplePropertyVisibilityChanged(bool visible);
1891 
1902  void
1903  effectAdded(const synthclone::Effect *effect, int index);
1904 
1915  void
1916  effectJobAdded(const synthclone::EffectJob *job, int index);
1917 
1931  void
1932  effectJobMoved(const synthclone::EffectJob *job, int fromIndex,
1933  int toIndex);
1934 
1945  void
1946  effectJobRemoved(const synthclone::EffectJob *job, int index);
1947 
1961  void
1962  effectMoved(const synthclone::Effect *effect, int fromIndex,
1963  int toIndex);
1964 
1975  void
1976  effectRemoved(const synthclone::Effect *effect, int index);
1977 
1985  void
1986  errorReported(const QString &message);
1987 
1996  void
1998 
2013  void
2015  synthclone::Menu menu, const QStringList &subMenus);
2016 
2031  void
2033  const synthclone::Effect *effect,
2034  const QStringList &subMenus);
2035 
2050  void
2052  const synthclone::Sampler *sampler,
2053  const QStringList &subMenus);
2054 
2069  void
2071  const synthclone::Target *target,
2072  const QStringList &subMenus);
2073 
2088  void
2090  synthclone::Menu menu, const QStringList &subMenus);
2091 
2106  void
2108  const synthclone::Effect *effect,
2109  const QStringList &subMenus);
2110 
2125  void
2127  const synthclone::Sampler *sampler,
2128  const QStringList &subMenus);
2129 
2144  void
2146  const synthclone::Target *target,
2147  const QStringList &subMenus);
2148 
2163  void
2165  synthclone::Menu menu, const QStringList &subMenus);
2166 
2181  void
2183  const synthclone::Effect *effect,
2184  const QStringList &subMenus);
2185 
2200  void
2202  const synthclone::Sampler *sampler,
2203  const QStringList &subMenus);
2204 
2219  void
2221  const synthclone::Target *target,
2222  const QStringList &subMenus);
2223 
2238  void
2240  synthclone::Menu menu,
2241  const QStringList &subMenus);
2242 
2258  void
2260  const synthclone::Effect *effect,
2261  const QStringList &subMenus);
2262 
2278  void
2280  const synthclone::Sampler *sampler,
2281  const QStringList &subMenus);
2282 
2298  void
2300  const synthclone::Target *target,
2301  const QStringList &subMenus);
2302 
2316  void
2317  movingEffect(const synthclone::Effect *effect, int fromIndex,
2318  int toIndex);
2319 
2333  void
2334  movingEffectJob(const synthclone::EffectJob *job, int fromIndex,
2335  int toIndex);
2336 
2350  void
2351  movingSamplerJob(const synthclone::SamplerJob *job, int fromIndex,
2352  int toIndex);
2353 
2367  void
2368  movingTarget(const synthclone::Target *target, int fromIndex,
2369  int toIndex);
2370 
2384  void
2385  movingZone(const synthclone::Zone *zone, int fromIndex, int toIndex);
2386 
2394  void
2395  notePropertyVisibilityChanged(bool visible);
2396 
2412  void
2413  participantActivated(const synthclone::Participant *participant,
2414  const synthclone::Participant *parent,
2415  const QByteArray &id);
2416 
2431  void
2432  participantAdded(const synthclone::Participant *participant,
2433  const synthclone::Participant *parent,
2434  const QByteArray &id);
2435 
2451  void
2453  const synthclone::Participant *parent,
2454  const QByteArray &id);
2455 
2471  void
2472  participantRemoved(const synthclone::Participant *participant,
2473  const synthclone::Participant *parent,
2474  const QByteArray &id);
2475 
2483  void
2485 
2496  void
2497  removingEffect(const synthclone::Effect *effect, int index);
2498 
2509  void
2510  removingEffectJob(const synthclone::EffectJob *job, int index);
2511 
2526  void
2528  synthclone::Menu menu, const QStringList &subMenus);
2529 
2544  void
2546  const synthclone::Effect *effect,
2547  const QStringList &subMenus);
2548 
2563  void
2565  const synthclone::Sampler *sampler,
2566  const QStringList &subMenus);
2567 
2582  void
2584  const synthclone::Target *target,
2585  const QStringList &subMenus);
2586 
2601  void
2603  synthclone::Menu menu,
2604  const QStringList &subMenus);
2605 
2621  void
2623  const synthclone::Effect *effect,
2624  const QStringList &subMenus);
2625 
2641  void
2643  const synthclone::Sampler *sampler,
2644  const QStringList &subMenus);
2645 
2661  void
2663  const synthclone::Target *target,
2664  const QStringList &subMenus);
2665 
2681  void
2682  removingParticipant(const synthclone::Participant *participant,
2683  const synthclone::Participant *parent,
2684  const QByteArray &id);
2685 
2693  void
2694  removingSampler(const synthclone::Sampler *sampler);
2695 
2707  void
2708  removingSamplerJob(const synthclone::SamplerJob *job, int index);
2709 
2720  void
2721  removingTarget(const synthclone::Target *target, int index);
2722 
2733  void
2734  removingZone(const synthclone::Zone *zone, int index);
2735 
2744  void
2746 
2754  void
2755  samplerAdded(const synthclone::Sampler *sampler);
2756 
2764  void
2766 
2777  void
2778  samplerJobAdded(const synthclone::SamplerJob *job, int index);
2779 
2793  void
2794  samplerJobMoved(const synthclone::SamplerJob *job, int fromIndex,
2795  int toIndex);
2796 
2808  void
2809  samplerJobRemoved(const synthclone::SamplerJob *job, int index);
2810 
2818  void
2819  samplerRemoved(const synthclone::Sampler *sampler);
2820 
2828  void
2830 
2841  void
2842  selectedEffectChanged(const synthclone::Effect *effect, int index);
2843 
2854  void
2855  selectedTargetChanged(const synthclone::Target *target, int index);
2856 
2868  void
2870  const QDir *directory);
2871 
2879  void
2880  statusPropertyVisibilityChanged(bool visible);
2881 
2892  void
2893  targetAdded(const synthclone::Target *target, int index);
2894 
2905  void
2906  targetBuildError(const synthclone::Target *target,
2907  const QString &message);
2908 
2916  void
2917  targetBuilt(const synthclone::Target *target);
2918 
2923  void
2924  targetsBuilt();
2925 
2939  void
2940  targetMoved(const synthclone::Target *target, int fromIndex,
2941  int toIndex);
2942 
2953  void
2954  targetRemoved(const synthclone::Target *target, int index);
2955 
2963  void
2964  velocityPropertyVisibilityChanged(bool visible);
2965 
2973  void
2974  wetSamplePropertyVisibilityChanged(bool visible);
2975 
2986  void
2987  zoneAdded(const synthclone::Zone *zone, int index);
2988 
3002  void
3003  zoneMoved(const synthclone::Zone *zone, int fromIndex, int toIndex);
3004 
3015  void
3016  zoneRemoved(const synthclone::Zone *zone, int index);
3017 
3028  void
3029  zoneSelectionChanged(const synthclone::Zone *zone, bool selected);
3030 
3031  protected:
3032 
3042  explicit
3043  Context(QObject *parent=0);
3044 
3050  virtual
3051  ~Context();
3052 
3053  };
3054 
3055 }
3056 
3057 #endif