Skip to content

Instantly share code, notes, and snippets.

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;
@chandujr
chandujr / RadialSprite.java
Created August 2, 2016 10:21
This class helps to create a circular progress indicator. This is 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
/**
* 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;