Panda3D
Loading...
Searching...
No Matches
opusAudioCursor.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file opusAudioCursor.h
10 * @author rdb
11 * @date 2017-05-24
12 */
13
14#ifndef OPUSAUDIOCURSOR_H
15#define OPUSAUDIOCURSOR_H
16
17#include "pandabase.h"
18#include "movieAudioCursor.h"
19
20#ifdef HAVE_OPUS
21
22#include <ogg/ogg.h>
23
24typedef struct OggOpusFile OggOpusFile;
25
26class OpusAudio;
27
28/**
29 * Interfaces with the libopusfile library to implement decoding of Opus
30 * audio files.
31 *
32 * @see OpusAudio
33 * @since 1.10.0
34 */
35class EXPCL_PANDA_MOVIES OpusAudioCursor : public MovieAudioCursor {
36PUBLISHED:
37 explicit OpusAudioCursor(OpusAudio *src, std::istream *stream);
38 virtual ~OpusAudioCursor();
39 virtual void seek(double offset);
40
41public:
42 virtual void read_samples(int n, int16_t *data);
43
44 bool _is_valid;
45
46protected:
47 OggOpusFile *_op;
48
49 int _link;
50 double _byte_rate;
51 int _block_align;
52 int _bytes_per_sample;
53 bool _is_float;
54
55 std::streampos _data_start;
56 std::streampos _data_pos;
57 size_t _data_size;
58
59public:
60 static TypeHandle get_class_type() {
61 return _type_handle;
62 }
63 static void init_type() {
64 MovieAudioCursor::init_type();
65 register_type(_type_handle, "OpusAudioCursor",
66 MovieAudioCursor::get_class_type());
67 }
68 virtual TypeHandle get_type() const {
69 return get_class_type();
70 }
71 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
72
73private:
74 static TypeHandle _type_handle;
75};
76
77#include "opusAudioCursor.I"
78
79#endif // HAVE_OPUS
80
81#endif // OPUSAUDIOCURSOR_H
A MovieAudio is actually any source that provides a sequence of audio samples.
virtual void seek(double offset)
Skips to the specified offset within the file.
void read_samples(int n, Datagram *dg)
Read audio samples from the stream into a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...