Nsound  0.9.4
Functions
Triangle.cc File Reference
#include <Nsound/Buffer.h>
#include <Nsound/Generator.h>
#include <Nsound/Triangle.h>
#include <iostream>
Include dependency graph for Triangle.cc:

Go to the source code of this file.

Functions

Buffer drawTriangle (const float64 &sample_rate, const float64 &percent_lambda_1, const float64 &percent_lambda_2, const float64 &amplitude_2, const float64 &percent_lambda_3, const float64 &percent_lambda_4, const float64 &percent_lambda_5, const float64 &amplitude_5, const float64 &percent_lambda_6)
 

Function Documentation

Buffer drawTriangle ( const float64 sample_rate,
const float64 percent_lambda_1,
const float64 percent_lambda_2,
const float64 amplitude_2,
const float64 percent_lambda_3,
const float64 percent_lambda_4,
const float64 percent_lambda_5,
const float64 amplitude_5,
const float64 percent_lambda_6 
)

Definition at line 113 of file Triangle.cc.

References Nsound::Generator::drawLine().

Referenced by Nsound::Triangle::Triangle().

123 {
124  Buffer waveform;
125 
126  // Draw the 7 lines
127  Generator line(sample_rate);
128 
129  // Line 1
130  waveform << line.drawLine(percent_lambda_1,
131  0.0,
132  0.0);
133  // Line 2
134  waveform << line.drawLine(percent_lambda_2 - percent_lambda_1,
135  0.0,
136  amplitude_2);
137  // Line 3
138  waveform << line.drawLine(percent_lambda_3 - percent_lambda_2,
139  amplitude_2,
140  0.0);
141  // Line 4
142  waveform << line.drawLine(percent_lambda_4 - percent_lambda_3,
143  0.0,
144  0.0);
145  // Line 5
146  waveform << line.drawLine(percent_lambda_5 - percent_lambda_4,
147  0.0,
148  amplitude_5);
149  // Line 6
150  waveform << line.drawLine(percent_lambda_6 - percent_lambda_5,
151  amplitude_5,
152  0.0);
153  // Line 7
154  waveform << line.drawLine(1.0 - percent_lambda_6,
155  0.0,
156  0.0);
157 
158  return waveform;
159 }
A Buffer for storing audio samples.
Definition: Buffer.h:60
A class the provides draw utilities and a wavetable oscillator.
Definition: Generator.h:50