Permalink
Browse files

Merge branch 'develop' of https://github.com/openframeworks/openFrame…

…works into bugfix-readme.android
  • Loading branch information...
2 parents a9231a1 + b9a60c7 commit 524a3fd7e6b49aa356bcc2bd215f21ef025367db @thiagohersan thiagohersan committed Jan 2, 2013
Showing with 9 additions and 8 deletions.
  1. +9 −8 addons/ofxAndroid/ofAndroidLib/src/cc/openframeworks/OFAndroidSoundPlayer.java
@@ -77,14 +77,14 @@ void stop(){
void setVolume(float vol){
volume = vol;
- // calculates left/right volumes from pan-value (constant panning law)
- // see: Curtis Roads: Computer Music Tutorial p 460
+ // calculates left/right volumes from pan-value (constant panning law)
+ // see: Curtis Roads: Computer Music Tutorial p 460
// thanks to jasch
- float angle = pan * 0.7853981633974483f; // in radians from -45. to +45.
- float cosAngle = FloatMath.cos(angle);
- float sinAngle = FloatMath.sin(angle);
- leftVolume = (float)((cosAngle - sinAngle) * 0.7071067811865475) * vol; // multiplied by sqrt(2)/2
- rightVolume = (float)((cosAngle + sinAngle) * 0.7071067811865475) * vol; // multiplied by sqrt(2)/2
+ float angle = pan * 0.7853981633974483f; // in radians from -45. to +45.
+ float cosAngle = FloatMath.cos(angle);
+ float sinAngle = FloatMath.sin(angle);
+ leftVolume = (float)((cosAngle - sinAngle) * 0.7071067811865475) * vol; // multiplied by sqrt(2)/2
+ rightVolume = (float)((cosAngle + sinAngle) * 0.7071067811865475) * vol; // multiplied by sqrt(2)/2
if(stream){
if(player!=null) player.setVolume(leftVolume, rightVolume);
}else if(streamID!=-1){
@@ -98,6 +98,7 @@ float getVolume(){
void setPan(float vol){
pan = vol;
+ // in Android, panning is done by setting the volume on individual channels
setVolume(volume);
}
@@ -179,7 +180,7 @@ float getSpeed(){
}
float getPan(){
- return pan/2.f+1;
+ return pan;
}
boolean isLoaded(){

0 comments on commit 524a3fd

Please sign in to comment.