nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
audio
OggSound.hpp
1
#pragma once
2
3
#include <ogg/ogg.h>
4
#include <vorbis/codec.h>
5
#include <vorbis/vorbisenc.h>
6
#include <vorbis/vorbisfile.h>
7
8
#include "export.hpp"
9
#include "nomlib/audio/Sound.hpp"
10
#include "nomlib/types.hpp"
11
12
typedef
FILE file_handle;
13
typedef
OggVorbis_File OggFile;
14
15
#ifndef BUFFERLENGTH
16
#define BUFFERLENGTH 65536
// 64 kilobytes
17
#endif
18
19
namespace
nom {
20
namespace
audio {
21
22
class
NOM_EXPORT OggSound:
public
Sound
23
{
24
protected
:
25
file_handle* file_handle_;
26
OggFile sfp_;
27
private
:
28
// See also
29
// https://xiph.org/vorbis/doc/libvorbis/return.html
30
void
check_error(
const
std::string& filename,
int
error_code);
31
32
void
init(
const
std::string& filename);
33
void
init(nom::int16* samples, nom::uint32
format
,
int
num_channels);
34
//bool seek_stream(nom::real64 pos);
35
void
close();
36
37
public
:
38
typedef
Sound super;
39
40
virtual
~OggSound();
41
42
// NO-OP init
43
OggSound();
44
// init(filename);
45
OggSound(
const
std::string& filename);
46
// init(samples, fmt, num_channels);
47
OggSound(nom::int16* samples, nom::uint32
format
,
int
channels
);
48
49
// TODO(JEFF): Change return type of bool to void?
50
virtual
bool
open(
const
std::string& filename);
51
52
virtual
nom::real64 stream(nom::uint32
buffer
, nom::real64 pos);
53
virtual
bool
stream__(nom::uint32
buffer
, nom::real64 pos);
54
static
std::string vorbis_version_string();
55
};
56
57
}
// namespace audio
58
}
// namespace nom
nom::audio::Sound::channels
int channels() const
Obtain the number of audio channels of this sound instance.
nom::audio::Sound::format
int format() const
Obtain the audio channel format as expressed in AL_FORMAT_XXX.
nom::audio::Sound::buffer
nom::uint & buffer()
Identifier number for the implementation-defined buffer system.
Generated on
for nomlib by
1.18.0