Changeset 548a60f in orbit for android


Ignore:
Timestamp:
08/23/13 19:18:59 (6 years ago)
Author:
Steve Castellotti <sc@…>
Branches:
master, Servo, Tab_Interface, pyramid
Children:
37edfa3
Parents:
8a0f920f
Message:

iOS Tutorial:

  • Added smooth transition between pages
  • Added Table of Contents
File:
1 edited

Legend:

Unmodified
Added
Removed
  • android/src/info/puzzlebox/orbit/AudioService.java

    ra546cc3 r548a60f  
    1717         */ 
    1818        AudioTrack track; 
    19         public int sampleRate = 44100; 
     19//      public int sampleRate = 44100; 
     20        public int sampleRate = 48000; 
    2021 
    2122        short[] audioData = new short[6144]; 
     
    112113        /** 
    113114         * 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         
    115123        private final double longHIGH = 0.000829649; 
    116124        private final double longLOW = 0.000797027; 
     
    118126        private final double shortLOW = 0.000378351; 
    119127 
     128         
    120129        /** 
    121130         * Pre-calculated and stored half sine waves. 
     
    127136 
    128137        /** 
    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 
    130142         */ 
    131143        private final float[] waveBit[]= {concatFloat(waveShortHIGH,waveShortLOW),concatFloat(waveLongHIGH,waveLongLOW)}; 
     
    208220 
    209221                float[] wave = halfSineGen('d',longLOW); 
     222                 
     223                // longHIGH-sampleTime*2 - float number used to tune the period of the wave 
     224                 
    210225                float[] tempWave = concatFloat(halfSineGen('u',longHIGH-sampleTime*2),halfSineGen('d',shortLOW+sampleTime*2)); 
    211226                wave = concatFloat(wave,tempWave); 
    212227                wave = concatFloat(wave,tempWave); 
    213228 
    214  
     229                 
     230                // Takes out each bit  
    215231                for (int i=27; i>=0; i--)  
    216232                        wave=concatFloat(wave,waveBit[((code >>> i) & 1)]); 
     
    344360        /** 
    345361         * Generate half sine signal. 
     362         * This is the smallest component of the wave. 
    346363         * @param dir: 'u' or 'd', means it's the upper half or lower half or sine wave.  
    347364         * @param halfPeriod: half of the period of sine wave, in seconds 
Note: See TracChangeset for help on using the changeset viewer.