Nsound  0.9.4
BufferWindowSearch.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: BufferWindowSearch.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) 2009-Present 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 #ifndef _NSOUND_BUFFER_WINDOW_SEARCH_H_
34 #define _NSOUND_BUFFER_WINDOW_SEARCH_H_
35 
36 #include <Nsound/Nsound.h>
37 
38 namespace Nsound
39 {
40 
41 // Forward
42 class Buffer;
43 
44 //-----------------------------------------------------------------------------
47 {
48  public:
49 
50  BufferWindowSearch(const Buffer & buffer, uint32 window_size = 2048);
51 
53 
55 
57  operator=(const BufferWindowSearch & rhs);
58 
60  Buffer
61  getNextWindow();
62 
64  uint32
65  getSamplesLeft() const;
66 
68  void
70  {position_ = 0;};
71 
73  void
74  setBuffer(const Buffer & buffer)
75  {
76  target_buffer_ = &buffer;
77  reset();
78  }
79 
80  protected:
81 
85 };
86 
87 };
88 
89 #endif
unsigned int uint32
Definition: Nsound.h:153
Buffer getNextWindow()
Searches the target Buffer for a zero crossing at or after the window_size position.
BufferWindowSearch & operator=(const BufferWindowSearch &rhs)
BufferWindowSearch(const Buffer &buffer, uint32 window_size=2048)
A Buffer for storing audio samples.
Definition: Buffer.h:60
Searches the target Buffer for zero crossings at or after the window_size position.
uint32 getSamplesLeft() const
Returns how many samples are left in the target Buffer.
void reset()
Resets the search.
void setBuffer(const Buffer &buffer)
Search a different Buffer.