Sequencer.h
1 /*
2 
3 Copyright (c) 2018, Johnathan Corkery. (jcorkery@umich.edu)
4 All rights reserved.
5 
6 This file is part of the Dynacoe project (https://github.com/jcorks/Dynacoe)
7 Dynacoe was released under the MIT License, as detailed below.
8 
9 
10 
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is furnished
16 to do so, subject to the following conditions:
17 
18 The above copyright notice and this permission notice shall
19 be included in all copies or substantial portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 DEALINGS IN THE SOFTWARE.
28 
29 
30 
31 */
32 
33 
34 #ifndef H_DC_COMPONENT_SEQUENCER_INCLUDED
35 #define H_DC_COMPONENT_SEQUENCER_INCLUDED
36 
37 
38 #include <Dynacoe/Component.h>
39 #include <Dynacoe/Library.h>
40 #include <vector>
41 
42 
43 
44 namespace Dynacoe {
45 class Delay;
46 
47 class Sequencer : public Component {
48 
49  public:
50  Sequencer();
51  ~Sequencer();
54  void Pause();
55 
58  void Resume();
59 
62  uint32_t GetPlaybackTime();
63 
66  uint32_t GetPlaybackStart();
67 
70  bool IsPaused();
71 
76  void Start();
77 
81  void Stop();
82 
85  bool IsPlaying();
86 
89  int Queue(const Sequence &, double delay = 0.f);
90 
93  int GetDuration();
94 
97  void SkipPlayback(int millisecs);
98 
99 
100 
101  void OnStep();
102  private:
103 
104 
105 
106  std::vector<Delay*> playbackTrash;
107  std::vector<Delay*> playbackTrash_Wrapped;
108 
109 
110 
111  std::set <Delay *, bool(*)(const Delay *, const Delay *)> * soundQueue;
112  void sortDelays();
113  void AddDelay(uint32_t channel, AssetID, uint8_t volume, double delaySeconds, uint8_t panning,double duration);
114 
115  bool playbackActive;
116  bool lockPlayback;
117  bool pause;
118 
119  uint32_t playbackProgress;
120  uint32_t playbackStart;
121  uint32_t pauseTime;
122  uint32_t pauseStartTime;
123  uint32_t totalPauseTime;
124 
125 
126 
127 };
128 }
129 #endif
Definition: AssetID.h:37