Nsound  0.9.4
Mixer.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: Mixer.h 874 2014-09-08 02:21:29Z weegreenblobbie $
4 //
5 // Nsound is a C++ library and Python module for audio synthesis featuring
6 // dynamic digital filters. Nsound lets you easily shape waveforms and write
7 // to disk or plot them. Nsound aims to be as powerful as Csound but easy to
8 // use.
9 //
10 // Copyright (c) 2005-2006 Nick Hilton
11 //
12 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13 //
14 //-----------------------------------------------------------------------------
15 
16 //-----------------------------------------------------------------------------
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 // This program is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 // GNU Library General Public License for more details.
27 //
28 // You should have received a copy of the GNU General Public License
29 // along with this program; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 //
32 //-----------------------------------------------------------------------------
33 
34 #ifndef _NSOUND_MIXER_H_
35 #define _NSOUND_MIXER_H_
36 
37 #include <Nsound/Nsound.h>
38 
39 #include <iostream>
40 #include <set>
41 #include <string>
42 
43 namespace Nsound
44 {
45 
46 // Forward declaration
47 class AudioStream;
48 class MixerNode;
49 
50 typedef std::set<MixerNode> MixerSet;
51 //typedef std::set<MixerNode>::iterator MixerIterator;
52 //typedef std::set<MixerNode>::const_iterator ConstMixerIterator;
53 
54 //-----------------------------------------------------------------------------
55 //
57 //
60 //
61 //-----------------------------------------------------------------------------
62 
63 class Mixer
64 {
65  public:
66 
67  //
69  //
71  //
72  Mixer();
73 
74  //
76  //
78  //
79  ~Mixer();
80 
81  // add()
82  //
84  //
96  //
97  void add(float64 first_beat_time,
98  float64 beats_per_minute,
99  const AudioStream & audio_stream);
100 
101  //
102  // getStream()
103  //
105  //
108  //
109  AudioStream getStream(float64 end_time);
111 
112  //
113  // clear()
114  //
116  //
117  void clear();
118 
119  //
120  // size()
121  //
123  //
124  uint32 size() const { return static_cast<uint32>(mixer_set_.size()); };
125 
126  private:
127 
132 
133 
134 }; // Mixer
135 
136 }; // Nsound
137 
138 #endif
unsigned int uint32
Definition: Nsound.h:153
void add(float64 first_beat_time, float64 beats_per_minute, const AudioStream &audio_stream)
This method inserts the AudioStream to the Mixer's LinkList.
Definition: Mixer.cc:59
~Mixer()
Destuctor.
Definition: Mixer.cc:54
Nsound::uint32 max_channels_
Stores the maximum number of channels.
Definition: Mixer.h:124
This class enables easy scheduling and mixing of multiple AudioStreams.
Definition: Mixer.h:63
double float64
Definition: Nsound.h:146
static double start_time
Definition: TicToc.cc:35
Nsound::MixerSet mixer_set_
This stores all the MixerNodes.
Definition: Mixer.h:131
AudioStream getStream(float64 end_time)
This method returns one AudioStream composed of all AudioStreams stored in the Mixer's LinkList...
Definition: Mixer.cc:91
Mixer()
Constructor.
Definition: Mixer.cc:47
This class holds the nodes for use with the Mixer class.
Definition: MixerNode.h:55
void clear()
This method removes all streams from the mixer.
Definition: Mixer.cc:84
std::set< MixerNode > MixerSet
Definition: Mixer.h:48
uint32 size() const
This method returns the number of stream stored in it.
Definition: Mixer.h:124