nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
audio
SoundFile.hpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, 2014, 2015, 2016 Jeffrey Carpenter <i8degrees@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
#ifndef NOMLIB_AUDIO_SOUND_FILE_HPP
30
#define NOMLIB_AUDIO_SOUND_FILE_HPP
31
32
#include <string>
33
34
#include "export.hpp"
35
#include "nomlib/config.hpp"
36
37
#define BUFFERLENGTH 65536
// 64KB // Part 2
38
39
namespace
nom {
40
namespace
audio {
41
42
// This enumeration is filled in by libsndfile
43
enum
NOM_EXPORT AudioTags
44
{
45
SOUND_TAG_UNDEFINED = 0,
46
SOUND_TAG_TITLE,
47
SOUND_TAG_COPYRIGHT,
48
SOUND_TAG_SOFTWARE,
49
SOUND_TAG_ARTIST,
50
SOUND_TAG_COMMENT,
51
SOUND_TAG_DATE,
52
SOUND_TAG_ALBUM,
53
SOUND_TAG_LICENSE,
54
SOUND_TAG_TRACK_NUMBER,
55
SOUND_TAG_GENRE,
56
};
57
58
// This enumeration is filled in by libsndfile
59
enum
NOM_EXPORT AudioFormat
60
{
61
AUDIO_FORMAT_UNKNOWN = 0,
62
64
AUDIO_FORMAT_S8,
65
67
AUDIO_FORMAT_U8,
68
70
AUDIO_FORMAT_S16,
71
73
AUDIO_FORMAT_S24,
74
76
AUDIO_FORMAT_S32,
77
79
AUDIO_FORMAT_R32,
80
82
AUDIO_FORMAT_R64,
83
};
84
85
#if 0
86
enum
AudioChannels
87
{
88
// Mono
89
ONE_CHANNELS = 1,
90
TWO_CHANNELS,
91
FOUR_CHANNELS,
92
FIVE_CHANNELS,
93
SIX_CHANNELS,
94
SEVEN_CHANNELS
95
};
96
#endif
97
98
// This struct is filled in by libsndfile
99
// TODO(JEFF): Rename struct to SoundFile?
100
struct
NOM_EXPORT
SoundInfo
101
{
105
nom::size_type
frame_count
= 0;
106
108
int64
sample_count
= 0;
109
111
uint32
sample_rate
= 0;
112
114
int
channel_count
= 0;
115
117
real32
duration
= 0.0f;
118
120
nom::int64
total_bytes
= 0;
121
123
uint32
channel_format
= 0;
124
126
int
byte_rate
= -1;
127
129
int
bitrate
= -1;
130
131
bool
seekable =
false
;
132
133
// TODO(JEFF): Rename struct to SoundFileMetadata and relocate outside of the main
134
// struct?
135
struct
Metadata
136
{
137
const
char
* title =
"\0"
;
138
const
char
* copyright =
"\0"
;
139
const
char
* software =
"\0"
;
140
const
char
* artist =
"\0"
;
141
const
char
* comment =
"\0"
;
142
const
char
* date =
"\0"
;
143
const
char
* album =
"\0"
;
144
const
char
* license =
"\0"
;
145
const
char
* track_number =
"\0"
;
146
const
char
* genre =
"\0"
;
147
};
148
149
Metadata
tags;
150
};
151
152
}
// namespace audio
153
}
// namespace nom
154
155
#endif
// NOMLIB_AUDIO_SOUND_FILE_HPP defined
nom::audio::SoundInfo::Metadata
Definition
SoundFile.hpp:136
nom::audio::SoundInfo
Definition
SoundFile.hpp:101
nom::audio::SoundInfo::total_bytes
nom::int64 total_bytes
The total number of bytes represented by the audio samples.
Definition
SoundFile.hpp:120
nom::audio::SoundInfo::bitrate
int bitrate
Filled in by sndfile.
Definition
SoundFile.hpp:129
nom::audio::SoundInfo::channel_count
int channel_count
The number of audio channels.
Definition
SoundFile.hpp:114
nom::audio::SoundInfo::duration
real32 duration
The total time, in seconds, of the audio samples.
Definition
SoundFile.hpp:117
nom::audio::SoundInfo::frame_count
nom::size_type frame_count
The total number of frames.
Definition
SoundFile.hpp:105
nom::audio::SoundInfo::sample_count
int64 sample_count
The total number of samples.
Definition
SoundFile.hpp:108
nom::audio::SoundInfo::channel_format
uint32 channel_format
Definition
SoundFile.hpp:123
nom::audio::SoundInfo::byte_rate
int byte_rate
Filled in by sndfile.
Definition
SoundFile.hpp:126
nom::audio::SoundInfo::sample_rate
uint32 sample_rate
The number of samples per second.
Definition
SoundFile.hpp:111
Generated on
for nomlib by
1.18.0