gaMonoWave(CONSTANT,float,int)

Syntax

gaMonoWave(CONSTANT,float,int)

Example

dim = BUFFER_SIZE*AUDIO_OUTPUT_CHANNELS
outputBuffer = memarray('float', dim)
stretch = OUTPUT_W/(dim-1)
zeroOffset = OUTPUT_H/4

function setup()
    gaMonoWave(GA_SINE,440.0,0)
    gaWaveVolume(0,0.8)

    // init the buffer
    for i = 0, dim - 1 do
        outputBuffer[i] = 0.0 
    end
end

function update()
    for i = 0, dim - 1 do
        outputBuffer[i] = gaGetOutputBuffer(i) 
    end
end

function draw()
    gaBackground(0.0,1.0)

    ofTranslate(0,OUTPUT_H/2,0)
    // draw Audio Scope
    ofSetColor(255)
    ofNoFill()
    ofBeginShape()
    for i = 0, dim - 1 do
        ofVertex(i* stretch, outputBuffer[i] * zeroOffset)
    end
    ofEndShape(false)
    
end

Description

Create a mono-channel wave oscillator, initialized at the frequency and the output channel specified. Parameters available for wave type CONSTANTS are GA_SINE, GA_COSINE, GA_SAW, GA_TRI, GA_RECT, GA_NOISE, GA_PINK, GA_BROWN, GA_PHASOR, GA_PULSE.

Parameters

CONSTANT,float,int