Thank you Dan and Niko. Both very useful pieces of info. I don't have a Moment anymore (had to borrow one from a user), but I'm almost certain it was on the older firmware based on the release date of that update.
Just for clarification in case others find this thread helpful: You are supposed to do the check through AudioRecord.GetMinBufferSize, and not AudioTrack.GetMinBufferSize Again, thanks for the help. On Jan 24, 7:21 pm, niko20 <[email protected]> wrote: > You're supposed to query the device with a GetMinBufferSize call > first, and then check that for any error codes. I'm guessing if you do > that you will get correct error codes. Don't rely on the AudioTrack > creation to give you the error codes for testing the device's > capabilities. Use AudioTrack.GetMinBufferSize first before you try to > create the AudioTrack. > > -niko > > On Jan 20, 9:51 pm, dan raaka <[email protected]> wrote: > > > What build does this device have? > > > There is new update for this device. Did you try on this build > > ?http://community.sprint.com/baw/thread/26322?featured=true > > > -Dan > > > On Mon, Jan 18, 2010 at 12:02 PM, Rico <[email protected]> wrote: > > > When switching between the emulator (which supports 8KHz) and a real > > > phone like the G1 (which supports 16KHz), I used the following code to > > > set up a valid AudioRecord object: > > > > AudioRecord ar; > > > > // Try to construct at 16KHz > > > ar = new AudioRecord( > > > MediaRecorder.AudioSource.MIC, > > > 16000, > > > AudioFormat.CHANNEL_CONFIGURATION_MONO, > > > AudioFormat.ENCODING_PCM_16BIT, > > > AUDIO_BUFFER_SIZE); > > > > if (ar.getState() != AudioRecord.STATE_INITIALIZED) { > > > // Unable to set up at 16KHz, try at 8KHz > > > ar = new AudioRecord( > > > MediaRecorder.AudioSource.MIC, > > > 8000, > > > AudioFormat.CHANNEL_CONFIGURATION_MONO, > > > AudioFormat.ENCODING_PCM_16BIT, > > > AUDIO_BUFFER_SIZE); > > > } > > > > This seems to work just fine, and a 16KHz AudioRecord object is > > > instantiated on the G1, and a 8KHz object is instantiated on the > > > emulator. > > > > However, on theSamsungMoment, which only supports 8KHz, > > > AudioRecord.getState() returns STATE_INITIALIZED when trying to > > > construct with 16KHz. This ends up causing recording to fail since > > > it's trying to record at 16KHz, even though the phone doesn't support > > > it. Also, I don't see any exceptions thrown when I try to wrap the > > > construction in a try-catch. > > > > Does anyone know of a better way to detect 16KHz vs. 8KHz capabilities > > > on the device? > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%[email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

