outputbuffer.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. This file is part of QTau
  3. Copyright (C) 2013-2018 Tobias "Tomoko" Platen <tplaten@posteo.de>
  4. Copyright (C) 2013 digited <https://github.com/digited>
  5. Copyright (C) 2010-2013 HAL@ShurabaP <https://github.com/haruneko>
  6. QTau is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. SPDX-License-Identifier: GPL-3.0+
  17. */
  18. #ifndef OUTPUTBUFFER_H
  19. #define OUTPUTBUFFER_H
  20. #include <jack/ringbuffer.h>
  21. #include <sndfile.h>
  22. #include <QObject>
  23. #include <QString>
  24. #include <QThread>
  25. #include "../PluginInterfaces.h"
  26. #include "audio/jackaudio.h"
  27. class ISynth;
  28. class OutputBuffer : public QThread {
  29. private:
  30. void run() override;
  31. jack_ringbuffer_t* _ringbuffer = nullptr;
  32. int _datacount = 0;
  33. int _jackSamplerate = 0;
  34. SNDFILE* _sndfile = nullptr;
  35. bool _playbackIsStable = false;
  36. int _buffersize = 0;
  37. ISynth* _scheduledSynth = nullptr;
  38. int _xruncount = 0;
  39. int _runtime = 0;
  40. bool _offline = false;
  41. Q_OBJECT
  42. signals:
  43. void startPlayback();
  44. void stopPlayback();
  45. public slots:
  46. public:
  47. OutputBuffer(JackAudio* jack);
  48. virtual void open(QString fileName, int samplerate);
  49. virtual void openReadFile(QString fileName);
  50. virtual void close();
  51. virtual void readData(float* data, int size);
  52. virtual void reset();
  53. void scheduleSynth(ISynth* synth);
  54. };
  55. #endif // OUTPUTBUFFER_H