kwave  18.07.70
PlayBack-OSS.h
Go to the documentation of this file.
1 /***************************************************************************
2  PlayBack-OSS.h - playback device for standard linux OSS
3  -------------------
4  begin : Sat May 19 2001
5  copyright : (C) 2001 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef PLAY_BACK_OSS_H
19 #define PLAY_BACK_OSS_H
20 
21 #include "config.h"
22 #ifdef HAVE_OSS_SUPPORT
23 
24 #include <QByteArray>
25 #include <QList>
26 #include <QString>
27 
29 #include "libkwave/SampleArray.h"
30 #include "libkwave/SampleFormat.h"
31 
32 namespace Kwave
33 {
34 
35  class SampleEncoder;
36 
38  {
39  public:
40 
42  PlayBackOSS();
43 
45  virtual ~PlayBackOSS() Q_DECL_OVERRIDE;
46 
51  virtual QString open(const QString &device, double rate,
52  unsigned int channels, unsigned int bits,
53  unsigned int bufbase) Q_DECL_OVERRIDE;
54 
59  virtual int write(const Kwave::SampleArray &samples) Q_DECL_OVERRIDE;
60 
65  virtual int close() Q_DECL_OVERRIDE;
66 
68  virtual QStringList supportedDevices() Q_DECL_OVERRIDE;
69 
71  virtual QString fileFilter() Q_DECL_OVERRIDE;
72 
80  virtual QList<unsigned int> supportedBits(const QString &device)
81  Q_DECL_OVERRIDE;
82 
93  virtual int detectChannels(const QString &device,
94  unsigned int &min, unsigned int &max)
95  Q_DECL_OVERRIDE;
96 
97  protected:
98 
111  void format2mode(int format, int &compression,
112  int &bits,
113  Kwave::SampleFormat::Format &sample_format) const;
114 
121  int openDevice(const QString &device);
122 
124  void flush();
125 
127  QString m_device_name;
128 
130  int m_handle;
131 
133  double m_rate;
134 
136  unsigned int m_channels;
137 
139  unsigned int m_bits;
140 
142  unsigned int m_bufbase;
143 
146 
148  QByteArray m_raw_buffer;
149 
151  unsigned int m_buffer_size;
152 
154  unsigned int m_buffer_used;
155 
158 
161  };
162 }
163 
164 #endif /* HAVE_OSS_SUPPORT */
165 
166 #endif /* PLAY_BACK_OSS_H */
167 
168 //***************************************************************************
169 //***************************************************************************
Definition: App.h:33
virtual QString fileFilter() Q_DECL_OVERRIDE
unsigned int m_buffer_size
Definition: PlayBack-OSS.h:151
virtual int detectChannels(const QString &device, unsigned int &min, unsigned int &max) Q_DECL_OVERRIDE
virtual int write(const Kwave::SampleArray &samples) Q_DECL_OVERRIDE
QByteArray m_raw_buffer
Definition: PlayBack-OSS.h:148
unsigned int m_channels
Definition: PlayBack-OSS.h:136
Kwave::SampleArray m_buffer
Definition: PlayBack-OSS.h:145
unsigned int m_bufbase
Definition: PlayBack-OSS.h:142
int openDevice(const QString &device)
virtual ~PlayBackOSS() Q_DECL_OVERRIDE
unsigned int m_bits
Definition: PlayBack-OSS.h:139
virtual QStringList supportedDevices() Q_DECL_OVERRIDE
virtual int close() Q_DECL_OVERRIDE
virtual QList< unsigned int > supportedBits(const QString &device) Q_DECL_OVERRIDE
unsigned int m_buffer_used
Definition: PlayBack-OSS.h:154
Kwave::SampleEncoder * m_encoder
Definition: PlayBack-OSS.h:157
void format2mode(int format, int &compression, int &bits, Kwave::SampleFormat::Format &sample_format) const
virtual QString open(const QString &device, double rate, unsigned int channels, unsigned int bits, unsigned int bufbase) Q_DECL_OVERRIDE