hydrogen 1.2.6
DiskWriterDriver.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2025 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef DISK_WRITER_DRIVER_H
24#define DISK_WRITER_DRIVER_H
25
26#include <sndfile.h>
27
28#include <inttypes.h>
29
30#include <core/IO/AudioOutput.h>
31#include <core/Object.h>
32
33namespace H2Core
34{
35
36 void* diskWriterDriver_thread( void *param );
40
41class DiskWriterDriver : public Object<DiskWriterDriver>, public AudioOutput
42{
44 public:
45
46 unsigned m_nSampleRate;
47 QString m_sFilename;
48 unsigned m_nBufferSize;
54 float* m_pOut_L;
55 float* m_pOut_R;
56
57 DiskWriterDriver( audioProcessCallback processCallback );
59
60 virtual int init( unsigned nBufferSize ) override;
61
62 virtual int connect() override;
63 virtual void disconnect() override;
64
65 void write();
66 bool isDoneWriting() const {
67 return m_bDoneWriting;
68 }
69 bool writingFailed() const {
70 return m_bWritingFailed;
71 }
74
75 virtual unsigned getBufferSize() override {
76 return m_nBufferSize;
77 }
78
79 virtual unsigned getSampleRate() override;
80 void setSampleRate( unsigned nNewRate ) {
81 m_nSampleRate = nNewRate;
82 }
83 void setSampleDepth( int nNewDepth ) {
84 m_nSampleDepth = nNewDepth;
85 }
86 void setCompressionLevel( double fCompressionLevel );
87
88 virtual float* getOut_L() override {
89 return m_pOut_L;
90 }
91 virtual float* getOut_R() override {
92 return m_pOut_R;
93 }
94
95 void setFileName( const QString& sFilename ){
96 m_sFilename = sFilename;
97 }
98
99 private:
100
101
102};
103
104};
105
106#endif
#define H2_OBJECT(name)
Definition Object.h:227
virtual void disconnect() override
disconnect
void setCompressionLevel(double fCompressionLevel)
void setSampleRate(unsigned nNewRate)
virtual float * getOut_L() override
virtual float * getOut_R() override
virtual int init(unsigned nBufferSize) override
DiskWriterDriver(audioProcessCallback processCallback)
void setSampleDepth(int nNewDepth)
void setFileName(const QString &sFilename)
virtual int connect() override
virtual unsigned getBufferSize() override
audioProcessCallback m_processCallback
virtual unsigned getSampleRate() override
double m_fCompressionLevel
A value between 0.0 (maximum quality) and 1.0 (maximum compression).
int(* audioProcessCallback)(uint32_t, void *)
Definition AudioOutput.h:32
void * diskWriterDriver_thread(void *param)