Back
Class   Sample
   
Name  

getVolume()

   
Examples  
// print the default volume of the sample object. 
// Notes: Make sure to include the specified audio file in your project's 'data' folder. 
 
Sample mySample; 
 
void setup() { 
  size(100,100); 
  Sonia.start(this); 
  mySample = new Sample("sine.aiff"); 
  float vol = mySample.getVolume(); 
  println("the sample's volume is:" + vol); // prints '1.0' for default volume. 
} 
 
// safely stop the Sonia engine upon shutdown. 
public void stop(){ 
  Sonia.stop(); 
  super.stop(); 
} 

Description   Returns the sample's volume. If the sample is stereo, each channel can be read seperately. Values range from 0 to 1, 0 being muted and 1 being full volume.
   
Syntax  
mySample.getVolume()
mySample.getVolume(channel)
   
Parameters  
channel   int: 0 or Sonia.LEFT for Left channel, 1 or Sonia.RIGHT for Right channel

   
Returns   float
   
Usage   Web & Application
   
Related   setVolume()