Esempio n. 1
0
void sample :: prepend(const sample& s) {
	if (!assertWarning(rate() == s.rate(), "prepend failed: different rates") ||
		!assertWarning(channels() == s.channels(),
			"prepend failed: different channel counts"))
		return;
	audioSample *snd = new audioSample[audioSize() + s.audioSize()];
	memcpy(snd, s.data, s.bytes());
	memcpy(snd + s.audioSize(), data, bytes());
	delete[] data;
	data = snd;
	info.length += s.length();
} // prepend()
Esempio n. 2
0
void sample :: paste(const sample& clip, int start, bool replaceFlag) {
	if (!assertWarning(rate() == clip.rate(),"paste failed: different rates") ||
		!assertWarning(channels() == clip.channels(),
			"paste failed: different channel counts"))
		return;
	int limit = clip.length();
	if (start + limit > length())
		limit = length() - start;
	if (replaceFlag)
		memcpy(data+start*channels(), clip.data,
				limit * channels() * sizeof(audioSample));
	else
		for (int i = 0; i < limit * channels(); i++, start++)
			data[start] = audioLimit(clip.data[i] + data[start]);
} // paste()
Esempio n. 3
0
int sample :: diff(const sample& t) const {
	if (!assertWarning(rate() == t.rate(),"diff: sample rates") ||
		!assertWarning(length() == t.length(),"diff: different lengths") ||
		!assertWarning(channels() == t.channels(), "diff: channel counts"))
		return 1;
	int diffs = 0;
	for (int i=0; (i<audioSize()) && (diffs<10); i++)
		if (data[i] != t.data[i]) {
			if (parameters->debug("sample", "basic"))
				cerr << "Data differs at " << i << " of " << audioSize() <<endl;
			diffs++;
		}
	if (parameters->debug("sample", "basic") && !diffs)
		cerr << "No diffs" << endl;
	return diffs;
} // diffs()
Esempio n. 4
0
void play(double *output) {//this is where the magic happens. Very slow magic.


	temp=beats.play(1.,0,beats.length());
	filtered=beat.play(1.);

	
//now we send the sounds to some stereo busses.
//	mymix.stereo(more+mixed+delayed, outputs, 1-pan);
	bobbins.stereo(temp+filtered, moreoutputs, 0.5);//invert the pan
		
	
	//mixing
	
	output[0]=moreoutputs[0];//stick it in the out!!
	output[1]=moreoutputs[1];
	
}