This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* An updated version of the code by forum user Xoppa. | |
* You can see the original code here: https://github.com/xoppa/world/blob/master/src/com/xoppa/android/misc/RadialSprite.java | |
**/ | |
import com.badlogic.gdx.graphics.Color; | |
import com.badlogic.gdx.graphics.Texture; | |
import com.badlogic.gdx.graphics.g2d.Batch; | |
import com.badlogic.gdx.graphics.g2d.SpriteBatch; | |
import com.badlogic.gdx.graphics.g2d.TextureRegion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void genTone(){ | |
// fill out the array | |
for (int i = 0; i < numSamples; ++i) { | |
// sample[i] = Math.sin(2 * Math.PI * i / (sampleRate/freqOfTone)); | |
sample[i] = Math.sin((2 * Math.PI - .001) * i / (sampleRate/freqOfTone)); | |
} | |
// convert to 16 bit pcm sound array | |
// assumes the sample buffer is normalised. | |
int idx = 0; |