Mozzi  version v2.0
sound synthesis library for Arduino
WavePacketSample.h
1 /*
2  * WavePacketSample.h
3  *
4  * This file is part of Mozzi.
5  *
6  * Copyright 2013-2024 Tim Barrass and the Mozzi Team
7  *
8  * Mozzi is licensed under the GNU Lesser General Public Licence (LGPL) Version 2.1 or later.
9  *
10  */
11 
12 
13 #ifndef WAVEPACKETSAMPLE_H
14 #define WAVEPACKETSAMPLE_H
15 
16 
17 #include "WavePacket.h"
18 /** A WavePacket which allows a custom table to be set as the audio source for the wavepackets (or grains).
19 @tparam ALGORITHM options are SINGLE or DOUBLE, for a single non-overlapping stream of packets or a double, overlapping stream.
20 
21 */
22 template <int8_t ALGORITHM>
23 class WavePacketSample: public WavePacket<ALGORITHM>
24 {
25 public:
26  /** Change the sound table which will be played. Needs to be 8192 cells long for now.
27  @param TABLE_NAME is the name of the array in the table ".h" file you're using.
28  */
29  inline
30  void setTable(const int8_t * TABLE_NAME)
31  {
32  aWav.setTable(TABLE_NAME);
33  }
34 
35 private:
36  Oscil <8192, MOZZI_AUDIO_RATE> aWav;
37 };
38 
39 /** @example 06.Synthesis/WavePacket_Sample/WavePacket_Sample.ino
40 This is an example of how to use the WavePacketSample class.
41 */
42 #endif // #ifndef WAVEPACKETSAMPLE_H