Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Format.h
Go to the documentation of this file.
1
//
2
// C++ Interface: Audio::Codec
3
//
4
#ifndef __AUDIO_FORMAT_H__INCLUDED__
5
#define __AUDIO_FORMAT_H__INCLUDED__
6
7
namespace
Audio {
8
13
struct
Format
{
14
unsigned
int
sampleFrequency
;
15
unsigned
char
bitsPerSample
;
16
unsigned
char
channels
;
17
int
signedSamples
: 1;
18
int
nativeOrder
: 1;
19
20
Format
() {}
21
22
Format
(
unsigned
int
freq,
unsigned
char
bps,
unsigned
char
nch) :
23
sampleFrequency
(freq),
24
bitsPerSample
(bps),
25
channels
(nch),
26
signedSamples
((bps>=16)?1:0),
27
nativeOrder
(1)
28
{
29
}
30
31
unsigned
int
frameSize
()
const
32
{
33
return
(
bitsPerSample
*
channels
+ 7) / 8;
34
}
35
36
unsigned
int
bytesPerSecond
()
const
37
{
38
return
frameSize
() *
sampleFrequency
;
39
}
40
41
bool
operator==
(
const
Format
&o)
const
42
{
43
return
(
sampleFrequency
== o.
sampleFrequency
)
44
&& (
bitsPerSample
== o.
bitsPerSample
)
45
&& (
channels
== o.
channels
)
46
&& (
signedSamples
== o.
signedSamples
)
47
&& (
nativeOrder
== o.
nativeOrder
);
48
}
49
50
bool
operator!=
(
const
Format
&o)
const
51
{
52
return
!(*
this
== o);
53
}
54
};
55
56
};
57
58
#endif//__AUDIO_FORMAT_H__INCLUDED__
src
audio
Format.h
Generated on Fri May 29 2015 23:07:06 for Vegastrike 0.5.1 rc1 by
1.8.4