CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Data
BasicProcessing
Audio.hxx
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3
* UNIVERSITAT POMPEU FABRA
4
*
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
*/
21
22
#ifndef _AUDIO_HXX
23
#define _AUDIO_HXX
24
25
#include <typeinfo>
26
27
//
28
// Finally, we have decided to use a single buffer of TDatas, all
29
// previously existing data formats have proven useless and have
30
// been removed.
31
//
32
33
34
#include "
DynamicType.hxx
"
35
#include "
Array.hxx
"
36
#include "
ProcessingData.hxx
"
37
#include "
ProcessingDataConfig.hxx
"
38
#include "
DataTypes.hxx
"
39
40
namespace
CLAM {
41
42
48
class
Audio
:
public
ProcessingData
{
49
public
:
50
DYNAMIC_TYPE_USING_INTERFACE
(
Audio
, 3,
ProcessingData
);
51
53
DYN_ATTRIBUTE
(0,
public
,
TData
, SampleRate);
55
DYN_ATTRIBUTE
(1,
public
,
TTime
, BeginTime);
57
DYN_ATTRIBUTE
(2,
public
,
DataArray
, Buffer);
58
59
protected
:
60
61
void
DefaultInit
();
// To be used from the dynamic-type-generated constructor.
62
63
public
:
64
~Audio
();
65
67
int
GetSize
()
const
{
return
GetBuffer().Size();}
68
71
TTime
GetEndTime
()
const
{
return
GetBeginTime()+GetTimeFromIndex(
GetSize
());}
72
75
TTime
GetDuration
()
const
{
return
GetTimeFromIndex(
GetSize
());}
76
82
void
SetSize
(
int
s);
83
87
void
SetEndTime
(
TTime
time);
88
95
void
ResizeToEndTime
(
TTime
time);
96
100
void
SetDuration
(
TTime
duration);
101
109
void
ResizeToDuration
(
TTime
duration);
110
117
void
GetAudioChunk
(
TTime
beginTime,
TTime
endTime,
Audio
& chunk,
bool
configureChunk=
true
)
const
;
118
125
void
GetAudioChunk
(
TIndex
beginIndex,
TIndex
endIndex,
Audio
& chunk,
bool
configureChunk=
true
)
const
;
126
135
void
GetAudioSlice
(
TTime
beginTime,
TTime
endTime,
Audio
& slice,
bool
configureSlice=
true
)
const
;
136
137
145
void
GetAudioSlice
(
TIndex
beginIndex,
TIndex
endIndex,
Audio
& slice,
bool
configureSlice=
true
)
const
;
146
151
void
SetAudioChunk
(
TTime
beginTime,
const
Audio
& chunk);
152
157
void
SetAudioChunk
(
TIndex
beginIndex,
const
Audio
& chunk);
158
159
private
:
164
TTime
GetTimeFromIndex(
TIndex
index)
const
;
165
170
TIndex
GetIndexFromTime(
TTime
time)
const
;
171
};
172
};
//namespace
173
174
#endif
175
Generated by
1.8.1