gaWave(CONSTANT,float)

Syntax

gaWave(CONSTANT,float)

Example

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

function setup()
    gaWave(GA_SINE,440.0)
    gaWaveVolume(0,0.6)

    // 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 multi-channel (playing on all your output channels) wave oscillator. 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