some audio problems

by [EMAIL PROTECTED] » Mon, 03 Nov 2008 13:40:26 GMT


Sponsored Links
 dear all,

I've been writing a game and need to play an audio effect with some
event trigged,
and i use MediaPlayer class and mp3 source files to implement it.

i first create the MediaPlayer instance in the constructor and invoke
play() when the event is trigged.

but it happened again oftentimes to show the warning message in the
DDMS

obtainBuffer timed out (is CPU pegged?) user=00000101, server=00000001
write blocked for XX msecs

these two message,  the sound would still played, but delayed, so the
sound and visual  effect won't synchronized.

please give some commons to help, thanks!

--~--~---------~--~----~------------~-------~--~----~



some audio problems

by Dave » Tue, 04 Nov 2008 04:09:50 GMT


 It's likely that the CPU is saturated and can't keep up with audio. If
you have a choice, I suggest using OGG files because there is less
overhead involved in playing them.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


some audio problems

by Robert Green » Tue, 04 Nov 2008 05:24:39 GMT


 For games use small, low bitrate OGGs with SoundPool.




--~--~---------~--~----~------------~-------~--~----~



some audio problems

by Dave » Tue, 04 Nov 2008 08:59:38 GMT


 SoundPool is not recommended in 1.0. There are deadlock issues that
can cause your app thread to lock up.





--~--~---------~--~----~------------~-------~--~----~



some audio problems

by [EMAIL PROTECTED] » Tue, 04 Nov 2008 09:39:49 GMT


 thanks a lot, I'll keep trying with that stuff!






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Causing onMeasure() to be called for an EditView

Using the hack doesn't work.
if i call to the setMeasuredDimension() with the dimensions i want
from the onLayout() of the layout it wont change the measured values.

So i need some help here :-)





-- 

2. Decryption "pad block corrupted" error ???

Hello,

Anyone know what night be causing a "pad block corrupted" exception to
be raised with decryption on Android? Here is the scenario:

1. On Windows Java app (NetBeans) read a small file, encrypt its
contents and write it as a new encrypted file.
2. adb push the encrypted file to an Android
3. On Android, open the encrypted file and try to decrypt using same
cipher parameters as set on the Windows side and it gets the "pad
block corrupted" error.

(Running the decryption code on within the Windows Java app decrypts
OK, no "pad block corrupted" error)


Thank you for any ideas!


Here are the relevant code fragments with the trying/catching removed
for clarity.


On Windows Java app (NetBeans)

        KeyGenerator kgen = KeyGenerator.getInstance("AES");
        SecureRandom secureRandom = new
SecureRandom("MyKey".getBytes());
        kgen.init(128, secureRandom);
        SecretKey skey = kgen.generateKey();
        rawKey = skey.getEncoded();
        SecretKeySpec skeySpec = new SecretKeySpec(rawKey, "AES");
        cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

        FileOutputStream fileOutputStream = new FileOutputStream(new
File("filename"));
        CipherOutputStream cipherOutputStream = new
CipherOutputStream(fileOutputStream, cipher);

        int numRead = 0;
        byte[] buf = new byte[1024];
        while ((numRead = iS.read(buf)) >= 0) // iS is an input stream
        {
            cipherOutputStream.write(buf, 0, numRead);
        }
        cipherOutputStream.close();


Use ADB to push the encrypted file to the Android


On Android

        String cryptKey = "MyKey";
        KeyGenerator kgen = KeyGenerator.getInstance("AES");
        SecureRandom secureRandom = new
SecureRandom(cryptKey.getBytes());
        kgen.init(128, secureRandom);
        SecretKey skey = kgen.generateKey();
        rawKey = skey.getEncoded();
        SecretKeySpec skeySpec = new SecretKeySpec(rawKey, "AES");
        cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.DECRYPT_MODE, skeySpec);


        FileInputStream fileInputStream = new FileInputStream("filename");
        CipherInputStream cipherInputStream = new
CipherInputStream(fileInputStream, cipher);
        int numRead;
        byte[] buf = new byte[1024];
        try {
                while ((numRead = cipherInputStream.read(buf)) >= 0)
                {
                    if (retStr==null)
                                retStr = new String(buf, 0, numRead);
                        else
                                retStr = retStr.concat(new String(buf, 0, 
numRead));
                }
                cipherInputStream.close();
                } catch (IOException e1) {

                        // *************
                        // This exception is raised with message "pad block 
corrupted"
                        // *************

                }

-- 

3. Is it possible to launch an activity on a certain key sequence?

4. Is it possible to launch an activity on a certain key sequence?

5. howto extend LinearLayout?

6. Lunch and Compiling

7. Installing the ADT Plugin