hydrogen 1.2.6
AudioOutput.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#ifndef H2_AUDIO_OUTPUT_H
23#define H2_AUDIO_OUTPUT_H
24
25
26#include <core/config.h>
27#include <core/Object.h>
28
29namespace H2Core
30{
31
32typedef int ( *audioProcessCallback )( uint32_t, void * );
33
37
38class AudioOutput : public H2Core::Object<AudioOutput>
39{
41public:
42 AudioOutput() = default;
43 virtual ~AudioOutput() { }
44
45 virtual int init( unsigned nBufferSize ) = 0;
46 virtual int connect() = 0;
47 virtual void disconnect() = 0;
48 virtual unsigned getBufferSize() = 0;
49 virtual unsigned getSampleRate() = 0;
50
55 virtual int getLatency()
56 {
57 return getBufferSize();
58 }
59
62 virtual int getXRuns() const { return 0; }
63 virtual float* getOut_L() = 0;
64 virtual float* getOut_R() = 0;
65
66 static QStringList getDevices() { return QStringList(); }
67};
68
69};
70
71#endif
72
#define H2_OBJECT(name)
Definition Object.h:227
virtual int getLatency()
Approximate audio latency (in frames) A reasonable approximation is the buffer time on most audio sys...
Definition AudioOutput.h:55
static QStringList getDevices()
Definition AudioOutput.h:66
virtual unsigned getSampleRate()=0
virtual int init(unsigned nBufferSize)=0
virtual int getXRuns() const
Get the number of XRuns that occurred since the audio driver has started.
Definition AudioOutput.h:62
virtual ~AudioOutput()
Definition AudioOutput.h:43
virtual void disconnect()=0
virtual float * getOut_L()=0
virtual float * getOut_R()=0
virtual int connect()=0
virtual unsigned getBufferSize()=0
int(* audioProcessCallback)(uint32_t, void *)
Definition AudioOutput.h:32