- Timestamp:
- 08/23/13 19:18:59 (9 years ago)
- Branches:
- master, Servo, Tab_Interface, pyramid
- Children:
- 37edfa3
- Parents:
- 8a0f920f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
android/src/info/puzzlebox/orbit/AudioService.java
ra546cc3 r548a60f 17 17 */ 18 18 AudioTrack track; 19 public int sampleRate = 44100; 19 // public int sampleRate = 44100; 20 public int sampleRate = 48000; 20 21 21 22 short[] audioData = new short[6144]; … … 112 113 /** 113 114 * Half periods in the audio code, in seconds. 114 */ 115 * 116 * Four periods exist in the wave 117 */ 118 // private final double longHIGH = 0.000829649; 119 // private final double longLOW = 0.000797027; 120 // private final double shortHIGH = 0.000412649; 121 // private final double shortLOW = 0.000378351; 122 115 123 private final double longHIGH = 0.000829649; 116 124 private final double longLOW = 0.000797027; … … 118 126 private final double shortLOW = 0.000378351; 119 127 128 120 129 /** 121 130 * Pre-calculated and stored half sine waves. … … 127 136 128 137 /** 129 * Pre-assembled audio code bit array in wave form. 138 * Pre-assembled audio code bit array in wave form. 139 * 140 * waveBit is an array of two wave, each an array of numbers 141 * waveBit[0] is the first wave, waveBit[1] is the second wave 130 142 */ 131 143 private final float[] waveBit[]= {concatFloat(waveShortHIGH,waveShortLOW),concatFloat(waveLongHIGH,waveLongLOW)}; … … 208 220 209 221 float[] wave = halfSineGen('d',longLOW); 222 223 // longHIGH-sampleTime*2 - float number used to tune the period of the wave 224 210 225 float[] tempWave = concatFloat(halfSineGen('u',longHIGH-sampleTime*2),halfSineGen('d',shortLOW+sampleTime*2)); 211 226 wave = concatFloat(wave,tempWave); 212 227 wave = concatFloat(wave,tempWave); 213 228 214 229 230 // Takes out each bit 215 231 for (int i=27; i>=0; i--) 216 232 wave=concatFloat(wave,waveBit[((code >>> i) & 1)]); … … 344 360 /** 345 361 * Generate half sine signal. 362 * This is the smallest component of the wave. 346 363 * @param dir: 'u' or 'd', means it's the upper half or lower half or sine wave. 347 364 * @param halfPeriod: half of the period of sine wave, in seconds
Note: See TracChangeset
for help on using the changeset viewer.