Panda3D

Loading...
Searching...
No Matches
milesAudioStream.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 milesAudioStream.h
10 * @author drose
11 * @date 2007-07-26
12 */
13
14#ifndef MILESAUDIOSTREAM_H
15#define MILESAUDIOSTREAM_H
16
17#include "pandabase.h"
18#ifdef HAVE_RAD_MSS //[
19
20#include "milesAudioSound.h"
21#include "milesAudioManager.h"
22
23#include <mss.h>
24
25/**
26 * This represents a sound file played by the Miles Sound System, similar to
27 * MilesAudioSample, except that it is streamed from disk instead of preloaded
28 * into memory.
29 */
30 class EXPCL_MILES_AUDIO MilesAudioStream : public MilesAudioSound {
31 private:
32 MilesAudioStream(MilesAudioManager *manager, const std::string &file_name,
33 const Filename &path);
34
35 public:
36 virtual ~MilesAudioStream();
37
38 virtual void play();
39 virtual void stop();
40
41 virtual PN_stdfloat get_time() const;
42
43 virtual void set_volume(PN_stdfloat volume=1.0f);
44 virtual void set_balance(PN_stdfloat balance_right=0.0f);
45 virtual void set_play_rate(PN_stdfloat play_rate=1.0f);
46
47 virtual PN_stdfloat length() const;
48
49 virtual AudioSound::SoundStatus status() const;
50
51 virtual void cleanup();
52
53 private:
54 static void AILCALLBACK finish_callback(HSTREAM stream);
55 void do_set_time(PN_stdfloat time);
56
57 Filename _path;
58 HSTREAM _stream;
59 S32 _original_playback_rate;
60 mutable PN_stdfloat _length;
61 mutable bool _got_length;
62
63 public:
64 static TypeHandle get_class_type() {
65 return _type_handle;
66 }
67 static void init_type() {
68 MilesAudioSound::init_type();
69 register_type(_type_handle, "MilesAudioStream",
70 MilesAudioSound::get_class_type());
71 }
72 virtual TypeHandle get_type() const {
73 return get_class_type();
74 }
75 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
76
77 private:
78 static TypeHandle _type_handle;
79
80 friend class MilesAudioManager;
81};
82
83#include "milesAudioStream.I"
84
85#endif //]
86
87#endif
milesAudioManager.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
milesAudioSound.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
milesAudioStream.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