Well, I'm trying to work with it. I think I have understood how to use
it (there's some sound going out), but that's not perfectly.

Here's my testing code:

(There's some strange things in it because now I'm trying to use
Producer/Consumer Threads whit it)


private void makeAll(double frequencyLeft, double frequencyRight) {
                final double RAD = 6.283185307179586476925286766559;// 2.0 *
Math.PI
                int size = android.media.AudioTrack.getMinBufferSize(44100,
                        AudioFormat.CHANNEL_CONFIGURATION_STEREO,
AudioFormat.ENCODING_PCM_16BIT) * 2;

                AudioTrack oTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 
44100,
                                AudioFormat.CHANNEL_CONFIGURATION_STEREO,
AudioFormat.ENCODING_PCM_16BIT, size,
                                AudioTrack.MODE_STREAM);
                oTrack.play();

                int i = 0;
                short[] vai = new short[size * 2];
                int j = 0;
                for (j = 0; j < vai.length; j++) {
                        vai[j] = (short) (Math.sin(RAD * frequencyLeft / 
44100.0 * i) *
32767.0);
                        i++;
                        j++;
                        vai[j] = (short) (Math.sin(RAD * frequencyRight / 
44100.0 * i) *
32767.0);
                        i++;
                }

                while (true) {

                        oTrack.write(vai, 0, vai.length);
                        i = i * 2;
                        if (i >= 44100 * 2) {
                                return;
                        }
                }
        }

Maybe this will help you.


On May 5, 8:11 am, Reghu <regh...@gmail.com> wrote:
> Hi All.
>
> did any one use AudioTrack in sdk 1.5. Any one tried using streaming
> in it?
> Is it working properly or there is some bugs. Until now i never seen
> any one
> post any success on it.
>
> It is not documented well, so i am not able to use it.Anybody know how
> to configure
> Audio buffer, read/write buffer and frame in it.
>
> Thank You
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to