VstSyncController.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * VstSyncController.h - type declarations needed for VST to lmms host sync
  3. *
  4. * Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. * Copyright (c) 2013 Mike Choi <rdavidian71/at/gmail/dot/com>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef VST_SYNC_CONTROLLER_H
  26. #define VST_SYNC_CONTROLLER_H
  27. #include <QtCore/QObject>
  28. #include <QtCore/QSharedMemory>
  29. #include "VstSyncData.h"
  30. class VstSyncController : public QObject
  31. {
  32. Q_OBJECT
  33. public:
  34. VstSyncController();
  35. ~VstSyncController();
  36. void setAbsolutePosition( double ticks );
  37. void setPlaybackState( bool enabled )
  38. {
  39. m_syncData->isPlaying = enabled;
  40. }
  41. void setTempo( int newTempo );
  42. void setTimeSignature( int num, int denom )
  43. {
  44. m_syncData->timeSigNumer = num;
  45. m_syncData->timeSigDenom = denom;
  46. }
  47. void startCycle( int startTick, int endTick );
  48. void stopCycle()
  49. {
  50. m_syncData->isCycle = false;
  51. }
  52. void setPlaybackJumped( bool jumped )
  53. {
  54. m_syncData->m_playbackJumped = jumped;
  55. }
  56. void update();
  57. private slots:
  58. void updateSampleRate();
  59. private:
  60. VstSyncData* m_syncData;
  61. int m_shmID;
  62. QSharedMemory m_shm;
  63. };
  64. #endif