summaryrefslogtreecommitdiffstats
path: root/include/media/ToneGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* C++11 compatibility.Dan Albert2014-11-201-4/+5
| | | | | | | | | | | | | | * Fix string literal concatenation to not be interpreted as UD literals. * Add constexpr compatibility for non-integral static members. * Use __typeof__ instead of typeof (should become decltype once this actually becomes C++11). * Add an appropriate cast for atomic_uintptr_t, since moving to C++11 means moving from <stdatomic.h> to <atomic>, which has better typechecking (hooray for not macros!). Bug: 18466763 Change-Id: I9561dcb2526578687819ff85421ba80d8e1a9694
* Use sp<AudioTrack> instead of raw AudioTrack *Glenn Kasten2013-06-031-2/+2
| | | | | | | | | | | | | | | | | | | | | This change prepares for the new implementation of AudioTrack client, which will require clients to use only sp<AudioTrack>, not raw AudioTrack *. A raw delete will cause a race condition during AudioTrack destruction. AudioTrack was made a RefBase by commit b68a91a70bc8d0d18e7404e14443d4e4020b3635 on 2011/11/15, when it was needed by OpenSL ES (for the callback protector). At that time, the only other client that was also converted from AudioTrack * to sp<AudioTrack> was android.media.AudioTrack JNI in project frameworks/base (file android_media_AudioTrack.cpp). Details: * Use .clear() instead of delete followed by = NULL. * ALOG %p need .get(). * sp<> don't need to be listed in constructor initializer, if initially 0. * Use == 0 for sp<> vs == NULL for raw pointers. * Use if (sp != 0) instead of if (raw). Change-Id: Ic7cad25795d6e862e112abdc227b6d33afdfce17
* ToneGenerator: fix truncated tonesEric Laurent2013-03-271-0/+1
| | | | | | | | | | | | | | | | | | | | The first DTMF tone after a silent period is truncated. This is because the phone app starts and stops the tone when the user presses and releases the key. This combined to the fact that the tones use the low latency path and that when the output stream exists standby there is a period of several milliseconds during which no audio is mixed until the stream is "warmed up". The result is that much less audio is generated than the actual key press duration. The fix consists in storing the tone start time and making sure that the number of samples generated corresponds at least to the time difference between the tone start and stop commands. Bug 6607077 Change-Id: I070d20dd8600c25a9e5d5a60c1d3313b7917b00d
* Use uint32_t for sample rateGlenn Kasten2012-11-141-1/+1
| | | | Change-Id: Ie240b48fb54b08359f69ecd4e5f8bda3d15cbe80
* implemented synchronous audio captureEric Laurent2012-03-291-0/+3
| | | | | | | | | | | | | | Added the infrastructure to support the synchronization of playback and capture actions on specific events. The first requirement for this feature is to synchronize the audio capture start with the full rendering of a given audio content. The applications can further be extended to other use cases (synchronized playback start...) by adding new synchronization events and new synchronous control methods on player or recorders. Also added a method to query the audio session from a ToneGenerator. Change-Id: I51f1167290d9cafdf2fbcdf9e4785156973af44c
* Use ToneGenerator::tone_type consistentlyGlenn Kasten2012-01-271-2/+2
| | | | | | | Also remove defaults in startToneCommand(), they're not needed and the default for tone type was nonsense. Change-Id: I70fa8cee4f3dbb8c66ceb3719c8d3d2f447f05b9
* Use audio_stream_type_t consistentlyGlenn Kasten2012-01-131-2/+2
| | | | | | | | | At native level it was a mixture of audio_stream_type_t, int, uint32_t, and uint8_t. Java is still int. Also fixed a couple of hard-coded -1 instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0 instead of AUDIO_STREAM_VOICE_CALL. Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83
* Revert "Use AudioTrack::event_type not int in callback"Glenn Kasten2011-06-011-1/+1
| | | This reverts commit 2225e4b7049fa3fb9d39a068b8268b63c952d7c1
* Use AudioTrack::event_type not int in callbackGlenn Kasten2011-06-011-1/+1
| | | | Change-Id: Ifefc708d46874e04fd0d01cb6e2d43b987ee796c
* Fix issue 2203561: Sholes: audio playing out of earpiece.Eric Laurent2009-11-041-1/+2
| | | | | | | | | | | Create a new IAudioTrack interface to AudioFlinger when start() fails due to a broken pipe error. Do the same if start fails due to the same error after time out in obtainBuffer(). Do not indicate that the AudioTrack is started to AudioPolicyManager if IAudioTrack start fails. This avoids that an AudioTrack keeps a dead IAudioTrack after a media server crash. Same modifications for AudioRecord. Add a flag to ToneGenerator indicating that the callback thread can call Java. Without it, when the media server crashes and restarts, the AudioSystem error callback will crash in JNI if the IAudiotrack is created from AudioTrack callback thread.
* Fix issue 2139634: DTMF tones on Sholes popping, hissing (audio latency too ↵Eric Laurent2009-10-061-0/+1
| | | | | | | | | | high). This change is a complement to the main fix in kernel driver for the same issue (partner change #1250). It removes clicks sometimes heard after the end of the tones while audio flinger is sending 0s to the audio output stream. The problem was that the sleep time between two writes was more than the duration of one audio output stream buffer which could cause some underrun. Also fixed a recent regression in ToneGenerator that made that the end of previous tone was repeated at the beginning of current one under certain timing circumstances when the maximum tone duration was specified.
* Fix issue 2142613: ToneGenerator: short tones sometimes don't play on sholes ↵Eric Laurent2009-09-241-1/+2
| | | | | | | | | | or over A2DP. When the AudioTrack callback notification size is relatively high (Which is the case on Sholes and over A2DP), it is likely that the end of tone is reached during the first callback. In this case, the AudioTrack is stopped before exiting the callback which causes 2 problems: - 1: If the AudioFlinger thread is scheduled before we exit the ToneGenerator callback, the track can be stopped and reset before the data is actually marked as present in the buffer by the AudioTrack callback => no audio will be processed by AudioFlinger. - 2: In this case, the data write index in the AudioTrack buffer is incremented after the track was reset by the AudioFlinger which leaves unplayed data in the buffer. This data will be played the next time the AudioTrack is started if not flushed in between. The fix consists in adding an intermediate state to ToneGenerator state machine so that we exit the callback function when the stop condition is reached and stop the AudioTrack the next time we execute the callback.
* Fix issue 1992233: DTMF tones on Sholes is really long.Eric Laurent2009-09-081-1/+2
| | | | | Add a parameter to ToneGenerator.startTone() allowing the caller to specify the tone duration. This is used by the phone application to have a precise control on the DTMF tone duration which was not possible with the use of delayed messaged. Also modified AudioFlinger output threads so that 0s are written to the audio output stream when no more tracks are ready to mix instead of just sleeping. This avoids an issue where the end of a previous DTMF tone could stay in audio hardware buffers and be played just before the beginning of the next DTMF tone.
* Fill in CDMA gaps and clean up ToneGenerator codeDavid Krause2009-06-231-1/+83
|
* Fixed issue 1709450: Requirements for CDMA Tone GeneratorEric Laurent2009-05-061-19/+70
| | | | | | | | | | Added new tone types for CDMA IS-95 specific tones. Automatic selection between IS-95, CEPT and JAPAN version base on operator country code for call supervisory tones. Also improved tone generator capabilities: - Each tone segment can now generate its own set of frequencies - A tone does not have to be a succession of alternating ON/OFF segments - The sequence repetition does not have to start from first segment
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+176
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-176/+0
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-101-3/+0
|
* auto import from //branches/cupcake/...@127101The Android Open Source Project2009-01-201-1/+1
|
* auto import from //branches/cupcake/...@125939The Android Open Source Project2009-01-091-0/+1
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-3/+6
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+175