swift
bufferedwaveprovider.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_SOUND_BUFFEREDWAVEPROVIDER_H
7 #define SWIFT_SOUND_BUFFEREDWAVEPROVIDER_H
8 
9 #include <QAudioFormat>
10 #include <QByteArray>
11 #include <QVector>
12 
14 #include "sound/swiftsoundexport.h"
15 
16 namespace swift::sound::sample_provider
17 {
20  {
21  Q_OBJECT
22 
23  public:
25  CBufferedWaveProvider(const QAudioFormat &format, QObject *parent = nullptr);
26 
28  void addSamples(const QVector<float> &samples);
29 
31  virtual int readSamples(QVector<float> &samples, qint64 count) override;
32 
34  int getBufferedBytes() const { return m_audioBuffer.size(); }
35 
37  void clearBuffer();
38 
39  private:
40  QVector<float> m_audioBuffer;
41  qint32 m_maxBufferSize;
42  };
43 } // namespace swift::sound::sample_provider
44 
45 #endif // SWIFT_SOUND_BUFFEREDWAVEPROVIDER_H
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.