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
24 typedef struct OggOpusFile OggOpusFile;
25
26 class 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 */
35 class 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
41 public:
42 virtual void read_samples(int n, int16_t *data);
43
44 bool _is_valid;
45
46 protected:
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
59 public:
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
73 private:
74 static TypeHandle _type_handle;
75};
76
77#include "opusAudioCursor.I"
78
79#endif // HAVE_OPUS
80
81#endif // OPUSAUDIOCURSOR_H
MovieAudioCursor
A MovieAudio is actually any source that provides a sequence of audio samples.
Definition movieAudioCursor.h:34
MovieAudioCursor::seek
virtual void seek(double offset)
Skips to the specified offset within the file.
Definition movieAudioCursor.cxx:133
MovieAudioCursor::read_samples
void read_samples(int n, Datagram *dg)
Read audio samples from the stream into a Datagram.
Definition movieAudioCursor.cxx:73
movieAudioCursor.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
opusAudioCursor.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22