Panda3D
flacAudioCursor.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 flacAudioCursor.h
10  * @author rdb
11  * @date 2013-08-23
12  */
13 
14 #ifndef FLACAUDIOCURSOR_H
15 #define FLACAUDIOCURSOR_H
16 
17 #include "pandabase.h"
18 #include "movieAudioCursor.h"
19 
20 #define DR_FLAC_NO_STDIO
21 extern "C" {
22  #include "dr_flac.h"
23 }
24 
25 class FlacAudio;
26 
27 /**
28  * Interfaces with the libvorbisfile library to implement decoding of Ogg
29  * Vorbis audio files.
30  */
31 class EXPCL_PANDA_MOVIES FlacAudioCursor : public MovieAudioCursor {
32 PUBLISHED:
33  explicit FlacAudioCursor(FlacAudio *src, std::istream *stream);
34  virtual ~FlacAudioCursor();
35  virtual void seek(double offset);
36 
37 public:
38  virtual void read_samples(int n, int16_t *data);
39 
40  bool _is_valid;
41 
42 protected:
43  drflac *_drflac;
44  std::istream *_stream;
45 
46 public:
47  static TypeHandle get_class_type() {
48  return _type_handle;
49  }
50  static void init_type() {
51  MovieAudioCursor::init_type();
52  register_type(_type_handle, "FlacAudioCursor",
53  MovieAudioCursor::get_class_type());
54  }
55  virtual TypeHandle get_type() const {
56  return get_class_type();
57  }
58  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
59 
60 private:
61  static TypeHandle _type_handle;
62 };
63 
64 #include "flacAudioCursor.I"
65 
66 #endif // FLACAUDIOCURSOR_H
Interfaces with the libvorbisfile library to implement decoding of Ogg Vorbis audio files...
void read_samples(int n, Datagram *dg)
Read audio samples from the stream into a Datagram.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(), along with zero to four record_derivation()s.
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A MovieAudio is actually any source that provides a sequence of audio samples.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Reads FLAC audio files.
Definition: flacAudio.h:25
virtual void seek(double offset)
Skips to the specified offset within the file.