Panda3D
flacAudio.cxx
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 flacAudio.cxx
10 * @author rdb
11 * @date 2016-04-27
12 */
13
14#include "flacAudio.h"
15#include "flacAudioCursor.h"
16#include "virtualFileSystem.h"
17#include "dcast.h"
18
19TypeHandle FlacAudio::_type_handle;
20
21/**
22 * xxx
23 */
25FlacAudio(const Filename &name) :
26 MovieAudio(name)
27{
28 _filename = name;
29}
30
31/**
32 * xxx
33 */
35~FlacAudio() {
36}
37
38/**
39 * Open this audio, returning a MovieAudioCursor
40 */
41PT(MovieAudioCursor) FlacAudio::
42open() {
44 std::istream *stream = vfs->open_read_file(_filename, true);
45
46 if (stream == nullptr) {
47 return nullptr;
48 } else {
49 PT(FlacAudioCursor) cursor = new FlacAudioCursor(this, stream);
50 if (cursor == nullptr || !cursor->_is_valid) {
51 return nullptr;
52 } else {
53 return DCAST(MovieAudioCursor, cursor);
54 }
55 }
56}
57
58/**
59 * Obtains a MovieAudio that references a file.
60 */
61PT(MovieAudio) FlacAudio::
62make(const Filename &name) {
63 return DCAST(MovieAudio, new FlacAudio(name));
64}
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
Implements decoding of FLAC audio files.
FlacAudio(const Filename &name)
xxx
Definition: flacAudio.cxx:25
virtual ~FlacAudio()
xxx
Definition: flacAudio.cxx:35
A MovieAudio is actually any source that provides a sequence of audio samples.
A MovieAudio is actually any source that provides a sequence of audio samples.
Definition: movieAudio.h:44
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A hierarchy of directories and files that appears to be one continuous file system,...
std::istream * open_read_file(const Filename &filename, bool auto_unwrap) const
Convenience function; returns a newly allocated istream if the file exists and can be read,...
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PT(MovieAudioCursor) FlacAudio
Open this audio, returning a MovieAudioCursor.
Definition: flacAudio.cxx:41
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.