outputbuffer.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 <QString>
  23. #include <QObject>
  24. #include <QThread>
  25. #include "audio/jackaudio.h"
  26. #include "../PluginInterfaces.h"
  27. class ISynth;
  28. class OutputBuffer : public QThread
  29. {
  30. private:
  31. void run() override;
  32. jack_ringbuffer_t* _ringbuffer=nullptr;
  33. int _datacount=0;
  34. int _jackSamplerate=0;
  35. SNDFILE* _sndfile=nullptr;
  36. bool _playbackIsStable=false;
  37. int _buffersize=0;
  38. ISynth* _scheduledSynth=nullptr;
  39. int _xruncount=0;
  40. int _runtime=0;
  41. bool _offline=false;
  42. Q_OBJECT
  43. signals:
  44. void startPlayback();
  45. void stopPlayback();
  46. public slots:
  47. public:
  48. OutputBuffer(JackAudio* jack);
  49. virtual void open(QString fileName,int samplerate);
  50. virtual void openReadFile(QString fileName);
  51. virtual void close();
  52. virtual void readData(float *data, int size);
  53. virtual void reset();
  54. void scheduleSynth(ISynth* synth);
  55. };
  56. #endif // OUTPUTBUFFER_H