gaWaveType(int,CONSTANT)

Syntax

gaWaveType(int,CONSTANT)

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.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

function keyReleased()
 if gaKey() == string.byte('1') then
 gaWaveType(0,GA_SINE)
 elseif gaKey() == string.byte('2') then
 gaWaveType(0,GA_COSINE)
 elseif gaKey() == string.byte('3') then
 gaWaveType(0,GA_SAW)
 elseif gaKey() == string.byte('4') then
 gaWaveType(0,GA_TRI)
 elseif gaKey() == string.byte('5') then
 gaWaveType(0,GA_RECT)
 elseif gaKey() == string.byte('6') then
 gaWaveType(0,GA_NOISE)
 elseif gaKey() == string.byte('7') then
 gaWaveType(0,GA_PINK)
 elseif gaKey() == string.byte('8') then
 gaWaveType(0,GA_BROWN)
 elseif gaKey() == string.byte('9') then
 gaWaveType(0,GA_PHASOR)
 end
end

Description

Set the wave type of a previously created wave oscillator. Wave types are GA_SINE, GA_COSINE, GA_SAW, GA_TRI, GA_RECT, GA_NOISE, GA_PINK, GA_BROWN, GA_PHASOR, GA_PULSE. 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 wil have an id of 0 and the last one an id of 99.

Parameters

int,CONSTANT