Audaspace 1.10.0
A high level audio library.
Loading...
Searching...
No Matches
Specification.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright 2009-2016 Jörg Müller
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
16
17#pragma once
18
24
25#include "Audaspace.h"
26
28#define AUD_FORMAT_SIZE(format) (format & 0x0F)
30#define AUD_DEVICE_SAMPLE_SIZE(specs) (specs.channels * (specs.format & 0x0F))
32#define AUD_SAMPLE_SIZE(specs) (specs.channels * sizeof(sample_t))
33
35#define AUD_COMPARE_SPECS(s1, s2) ((s1.rate == s2.rate) && (s1.channels == s2.channels))
36
38#define AUD_CHANNEL_BIT(channel) (0x01 << channel)
39
41
47{
48 FORMAT_INVALID = 0x00,
49 FORMAT_U8 = 0x01,
50 FORMAT_S16 = 0x12,
51 FORMAT_S24 = 0x13,
52 FORMAT_S32 = 0x14,
55};
56
70
73{
74 CHANNEL_FRONT_LEFT = 0,
75 CHANNEL_FRONT_RIGHT,
76 CHANNEL_FRONT_CENTER,
77 CHANNEL_LFE,
78 CHANNEL_REAR_LEFT,
79 CHANNEL_REAR_RIGHT,
80 CHANNEL_REAR_CENTER,
81 CHANNEL_SIDE_LEFT,
82 CHANNEL_SIDE_RIGHT,
83 CHANNEL_MAX
84};
85
88{
89 FASTEST = 0,
93};
94
96typedef double SampleRate;
97
103constexpr SampleRate RATE_8000 = 8000;
104constexpr SampleRate RATE_16000 = 16000;
105constexpr SampleRate RATE_11025 = 11025;
106constexpr SampleRate RATE_22050 = 22050;
107constexpr SampleRate RATE_32000 = 32000;
108constexpr SampleRate RATE_44100 = 44100;
109constexpr SampleRate RATE_48000 = 48000;
110constexpr SampleRate RATE_88200 = 88200;
111constexpr SampleRate RATE_96000 = 96000;
112constexpr SampleRate RATE_192000 = 192000;
113
123
126{
129
130 union
131 {
132 struct
133 {
136
139 };
140 Specs specs;
141 };
142};
143
The main header file of the library defining the namespace and basic data types.
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition Audaspace.h:119
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition Audaspace.h:116
constexpr SampleRate RATE_INVALID
The sample rate tells how many samples are played back within one second.
Definition Specification.h:102
double SampleRate
Sample rate type.
Definition Specification.h:96
constexpr SampleRate RATE_44100
32000 Hz.
Definition Specification.h:108
Channel
The channel names.
Definition Specification.h:73
constexpr SampleRate RATE_11025
16000 Hz.
Definition Specification.h:105
constexpr SampleRate RATE_22050
11025 Hz.
Definition Specification.h:106
constexpr SampleRate RATE_8000
Invalid sample rate.
Definition Specification.h:103
constexpr SampleRate RATE_48000
44100 Hz.
Definition Specification.h:109
constexpr SampleRate RATE_192000
96000 Hz.
Definition Specification.h:112
ResampleQuality
Resampling algorithm and quality.
Definition Specification.h:88
@ LOW
Linear resample, very fast but lowest quality.
Definition Specification.h:90
@ HIGH
JOS resample at medium quality preset.
Definition Specification.h:92
@ MEDIUM
JOS resample at low quality preset.
Definition Specification.h:91
constexpr SampleRate RATE_16000
8000 Hz.
Definition Specification.h:104
constexpr SampleRate RATE_96000
88200 Hz.
Definition Specification.h:111
Channels
The channel count.
Definition Specification.h:59
@ CHANNELS_SURROUND61
5.1 surround sound.
Definition Specification.h:67
@ CHANNELS_SURROUND5
4 channel surround sound.
Definition Specification.h:65
@ CHANNELS_SURROUND71
6.1 surround sound.
Definition Specification.h:68
@ CHANNELS_MONO
Invalid channel count.
Definition Specification.h:61
@ CHANNELS_SURROUND51
5 channel surround sound.
Definition Specification.h:66
@ CHANNELS_STEREO
Mono.
Definition Specification.h:62
@ CHANNELS_STEREO_LFE
Stereo.
Definition Specification.h:63
@ CHANNELS_SURROUND4
Stereo with LFE channel.
Definition Specification.h:64
constexpr SampleRate RATE_32000
22050 Hz.
Definition Specification.h:107
SampleFormat
The format of a sample.
Definition Specification.h:47
@ FORMAT_U8
Invalid sample format.
Definition Specification.h:49
@ FORMAT_FLOAT64
4 byte float.
Definition Specification.h:54
@ FORMAT_S32
3 byte signed integer.
Definition Specification.h:52
@ FORMAT_FLOAT32
4 byte signed integer.
Definition Specification.h:53
@ FORMAT_S24
2 byte signed integer.
Definition Specification.h:51
@ FORMAT_S16
1 byte unsigned byte.
Definition Specification.h:50
constexpr SampleRate RATE_88200
48000 Hz.
Definition Specification.h:110
Specification of a sound device.
Definition Specification.h:126
Channels channels
Channel count.
Definition Specification.h:138
SampleFormat format
Sample format.
Definition Specification.h:128
SampleRate rate
Sample rate in Hz.
Definition Specification.h:135
192000 Hz.
Definition Specification.h:116
SampleRate rate
Sample rate in Hz.
Definition Specification.h:118
Channels channels
Channel count.
Definition Specification.h:121