Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 104 lines (85 sloc) 2.322 kb
fd65cee4 »
2012-09-09 o add basic zita filter.
1 // -------------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 Fons Adriaensen <fons@linuxaudio.org>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //
19 // -------------------------------------------------------------------------
20
21
22 #ifndef __AUDIOFILE_H
23 #define __AUDIOFILE_H
24
25
26 #include <stdio.h>
27 #include <stdint.h>
28 #include <sndfile.h>
29
30
31 class Audiofile
32 {
33 public:
34
35 enum
36 {
37 MODE_NONE,
38 MODE_READ,
39 MODE_WRITE
40 };
41
42 enum
43 {
44 TYPE_OTHER,
45 TYPE_CAF,
46 TYPE_WAV,
47 TYPE_AMB
48 };
49
50 enum
51 {
52 FORM_OTHER,
53 FORM_16BIT,
54 FORM_24BIT,
55 FORM_32BIT,
56 FORM_FLOAT
57 };
58
59 enum
60 {
61 ERR_NONE = 0,
62 ERR_MODE = -1,
63 ERR_TYPE = -2,
64 ERR_FORM = -3,
65 ERR_OPEN = -4,
66 ERR_SEEK = -5,
67 ERR_DATA = -6,
68 ERR_READ = -7,
69 ERR_WRITE = -8
70 };
71
72 Audiofile (void);
73 ~Audiofile (void);
74
75 int mode (void) const { return _mode; }
76 int type (void) const { return _type; }
77 int form (void) const { return _form; }
78 int rate (void) const { return _rate; }
79 int chan (void) const { return _chan; }
80 uint32_t size (void) const { return _size; }
81
82 int open_read (const char *name);
83 int open_write (const char *name, int type, int form, int rate, int chan);
84 int close (void);
85
86 int seek (uint32_t posit);
87 int read (float *data, uint32_t frames);
88 int write (float *data, uint32_t frames);
89
90 private:
91
92 void reset (void);
93
94 SNDFILE *_sndfile;
95 int _mode;
96 int _type;
97 int _form;
98 int _rate;
99 int _chan;
100 uint32_t _size;
101 };
102
103
104 #endif
105
Something went wrong with that request. Please try again.