gaWaveVolume(int,float)

Syntax

gaWaveVolume(int,float)

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

    gaWaveVolume(0,gaMouseY()/OUTPUT_H)
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

Set the volume for the specified, previously created, wave oscillator. Volume is represented in 0.0 - 1.0 normalized range. When an oscillator is created it's automatically indexed with a number id, starting from 0; so if you have created 100 oscillator, the first one will have an id of 0 and the last one an id of 99.

Parameters

int,float