kwave  18.07.70
VirtualAudioFile.h
Go to the documentation of this file.
1 /*************************************************************************
2  VirtualAudioFile.h - adapter between QIODevice and libaudiofile
3  -------------------
4  begin : Mon May 06 2002
5  copyright : (C) 2002 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 VIRTUAL_AUDIO_FILE_H
19 #define VIRTUAL_AUDIO_FILE_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QMap>
25 
26 extern "C" {
27 }
28 #include <af_vfs.h>
29 #include <audiofile.h>
30 
31 class QIODevice;
32 
33 namespace Kwave
34 {
35 
40  class Q_DECL_EXPORT VirtualAudioFile
41  {
42  public:
47  explicit VirtualAudioFile(QIODevice &device);
48 
50  virtual ~VirtualAudioFile();
51 
53  virtual void open(Kwave::VirtualAudioFile *x, AFfilesetup setup);
54 
61  virtual void close();
62 
64  inline AFfilehandle &handle() { return m_file_handle; }
65 
67  inline AFvirtualfile *file() { return m_virtual_file; }
68 
70  inline long int lastError() { return m_last_error; }
71 
76  inline QString lastErrorText() { return m_last_error_text; }
77 
79  virtual qint64 read(char *data, unsigned int nbytes);
80 
82  virtual qint64 length();
83 
85  virtual qint64 write(const char *data, unsigned int nbytes);
86 
88  virtual void destroy();
89 
91  virtual qint64 seek(qint64 offset, bool is_relative);
92 
94  virtual qint64 tell();
95 
97  static Kwave::VirtualAudioFile *adapter(AFvirtualfile *vfile);
98 
99  private:
100 
102  QIODevice &m_device;
103 
105  AFfilehandle m_file_handle;
106 
108  AFvirtualfile *m_virtual_file;
109 
111  long int m_last_error;
112 
115 
116  };
117 }
118 
119 #endif /* VIRTUAL_AUDIO_FILE_H */
120 
121 //***************************************************************************
122 //***************************************************************************
AFfilehandle & handle()
AFvirtualfile * file()
Definition: App.h:33
AFvirtualfile * m_virtual_file