/usr/include/SndObj/SyncGrain.h is in libsndobj-dev 2.6.7+ds1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
////////////////////////////////////////////////////////////////////////
// This file is part of the SndObj library
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Copyright (c)Victor Lazzarini, 1997-2004
// See License.txt for a disclaimer of all warranties
// and licensing information
///////////////////////////////////////////////
// SyncGrain.h: synchronous granular synthesis
// based on wavetable lookup
// VL, 2002
///////////////////////////////////////////////
#ifndef _SyncGrain_H
#define _SyncGrain_H
#include "SndObj.h"
#include "Table.h"
class SyncGrain: public SndObj {
protected:
Table* m_table; // wavetable
Table* m_envtable; // envelope table
float m_amp; // overall amp
SndObj* m_inputamp;
float m_fr; // fundamental freq
float m_frac; // fractional part
SndObj* m_inputfr;
float m_pitch; // grain pitch
SndObj* m_inputpitch;
double* m_index; // index into wavetable
double* m_envindex; // index into envtable
float m_start; // grain start index
float m_grsize; // size of grains (secs)
SndObj* m_inputgrsize;
int m_olaps; // max number of streams (overlaps)
float m_point; // grain start offset
int m_count; // sampling period counter
int m_numstreams; // curr num of streams
int m_firststream; // streams index (first stream)
int m_tablesize; // size of wavetable
int m_envtablesize; // size of envtable
short* m_streamon; // keeps track of the active streams
public:
// constructors / destructor
SyncGrain();
SyncGrain(Table* wavetable, Table* envtable, float fr, float amp,
float pitch, float grsize, float prate=1.f, SndObj* inputfr=0,
SndObj* inputamp=0, SndObj* inputpitch=0,
SndObj* inputgrsize=0, int olaps=100,
int vecisize=DEF_VECSIZE, float sr=DEF_SR);
~SyncGrain();
// Set...
void Offset(int pos){
m_start = pos;
}
void Offset(float secs){
m_start = secs*m_sr;
}
void
SetWaveTable(Table* wavetable){
m_table = wavetable;
m_tablesize = wavetable->GetLen();
}
void
SetEnvelopeTable(Table* envtable){
m_envtable = envtable;
m_envtablesize = envtable->GetLen();
}
void
SetFreq(float fr, SndObj* inputfr=0){
m_fr = fr; // fundamental freq
m_inputfr = inputfr;
}
void
SetAmp(float amp, SndObj* inputamp=0){
m_amp = amp; // overall amp
m_inputamp = inputamp;
}
void
SetPitch(float pitch, SndObj* inputpitch=0){
m_pitch = pitch; // grain pitch
m_inputpitch = inputpitch;
}
void
SetGrainSize(float grsize, SndObj* inputgrsize=0){
m_grsize = grsize; // size of grains (secs)
m_inputgrsize = inputgrsize;
}
void
SetPointerRate(float prate){ m_point = prate; }
// sets the reading
// pointer rate in relation to grain size:
// a value of 1 will make the read pointer read
// the wavetable skiping grainsize positions
// along it. A value of 0 will make the table be
// read always at the start.
int Set(char* mess, float value);
int Connect(char* mess, void* input);
short DoProcess();
char* ErrorMessage();
};
#endif
|