nomlib
Loading...
Searching...
No Matches
SoundFile.hpp
1/******************************************************************************
2
3 nomlib - C++11 cross-platform game engine
4
5Copyright (c) 2013, 2014, 2015, 2016 Jeffrey Carpenter <i8degrees@gmail.com>
6All rights reserved.
7
8Redistribution and use in source and binary forms, with or without
9modification, are permitted provided that the following conditions are met:
10
111. Redistributions of source code must retain the above copyright notice, this
12 list of conditions and the following disclaimer.
132. 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
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24ON 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
26SOFTWARE, 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 "nomlib/config.hpp"
35
36namespace nom {
37namespace audio {
38
39enum AudioTags
40{
41 SOUND_TAG_UNDEFINED = 0,
42 SOUND_TAG_TITLE,
43 SOUND_TAG_COPYRIGHT,
44 SOUND_TAG_SOFTWARE,
45 SOUND_TAG_ARTIST,
46 SOUND_TAG_COMMENT,
47 SOUND_TAG_DATE,
48 SOUND_TAG_ALBUM,
49 SOUND_TAG_LICENSE,
50 SOUND_TAG_TRACK_NUMBER,
51 SOUND_TAG_GENRE,
52};
53
54enum AudioFormat
55{
56 AUDIO_FORMAT_UNKNOWN = 0,
57
59 AUDIO_FORMAT_S8,
60
62 AUDIO_FORMAT_U8,
63
65 AUDIO_FORMAT_S16,
66
68 AUDIO_FORMAT_S24,
69
71 AUDIO_FORMAT_S32,
72
74 AUDIO_FORMAT_R32,
75
77 AUDIO_FORMAT_R64,
78};
79
80#if 0
81enum AudioChannels
82{
83 // Mono
84 ONE_CHANNELS = 1,
85 TWO_CHANNELS,
86 FOUR_CHANNELS,
87 FIVE_CHANNELS,
88 SIX_CHANNELS,
89 SEVEN_CHANNELS
90};
91#endif
92
93enum SoundSeek
94{
95 SOUND_SEEK_SET = 0,
96 SOUND_SEEK_CUR,
97 SOUND_SEEK_END
98};
99
101{
105 nom::size_type frame_count = 0;
106
108 int64 sample_count = 0;
109
111 uint32 sample_rate = 0;
112
114 uint32 channel_count = 0;
115
117 real32 duration = 0.0f;
118
120 nom::size_type total_bytes = 0;
121
123 uint32 channel_format = 0;
124
125 bool seekable = false;
126
127 struct Metadata
128 {
129 const char* title = "\0";
130 const char* copyright = "\0";
131 const char* software = "\0";
132 const char* artist = "\0";
133 const char* comment = "\0";
134 const char* date = "\0";
135 const char* album = "\0";
136 const char* license = "\0";
137 const char* track_number = "\0";
138 const char* genre = "\0";
139 };
140
141 Metadata tags;
142};
143
144} // namespace audio
145} // namespace nom
146
147#endif // NOMLIB_AUDIO_SOUND_FILE_HPP defined
real32 duration
The total time, in seconds, of the audio samples.
nom::size_type frame_count
The total number of frames.
int64 sample_count
The total number of samples.
uint32 channel_count
The number of audio channels.
nom::size_type total_bytes
The total number of bytes represented by the audio samples.
uint32 sample_rate
The number of samples per second.