Android :: Is AudioTrack Fundamentally Designed To Be Singleton?
Dec 14, 2009
Is the AudioTrack fundamentally designed to be a singleton? Methods on the OnPlaybackPositionUpdateListener receive just one argument, which is the AudioTrack itself. And since the AudioTrack does not have getTag/setTag methods I don't see any way to distinguish among multiple AudioTracks in the OnPlaybackPositionUpdateListener methods short of keeping track of references. So, if it's so why it's not implemented as a singleton? Any thoughts. I am trying to implement concurrent use of the AudioTrack. Anybody has any experience with this approach? Am I wasting time?
View 3 Replies
Dec 25, 2009
I need to stop the AudioTrack, regardless what's in the buffer, immediately when executing the stop/release. The AudioTrack plays in the STREAM mode. It appears that the AudioTrack finishes playing what's in the buffer and than stops. It seems that it's such a fundamental flaw since there are so many audio applications out there.
View 4 Replies
View Related
Dec 11, 2009
My main Google account is a "Google Apps For Your Domain" (GAFYD) account. I have my Gmail, Calendar, etc. on this account. Unfortunately, GAFYD doesn't include Google Voice. Following the Google recommended method, I set up a regular Google Account for Google Voice (see here: Using your Google Apps address with Google Voice - Google Voice Help) that has the same username (but remains a distinct account). I do not have Gmail on this account because that would create issues. I set my phone up with my GAFYD account, as per this link: Android and G1 Forums, Mods, Hacks, News, Downloads, Skins, Themes, and more! | ModMyGphone - View Single Post - Primary Google Account in conjunction with Google Apps Account on Android Phone
Most functionality is there. In particular, Google Voice works with Gizmo and Sipdroid. However, there are some problems. Here's a thread discussing some of them: Anyone else having issues with your Google Apps for Domains account on the Droid? - Google Mobile Help
1. Cannot buy paid apps in the market.
2. Unable to use my maps layer in maps app.
3. Cannot login to google finance app.
I want to solve problem #1 - Cannot buy paid apps in the market. Many people are solving it by using another regular Gmail account. However, that's not working for me. I do have another regular Gmail account and I have been using it on my desktop computer for Check Out. However, Android on my Motorola Droid will not accept this account. I assume because it uses the same username as my GAFYD account (which is the way Google recommended doing it!). I have all my purchase history and credit card info in that account already. Creating YADGA ("yet another d*** Google account") is not an option.
View 2 Replies
View Related
Jan 9, 2014
I have a new Galaxy s4 version sgh-m919v. I want to root it and i am not sure if I can use a root protocol designed for the sgh-m919 version.
Will it work? I sure dont want to brick my new phone!
View 2 Replies
View Related
Dec 3, 2009
Can you recommend open source android applications that can be valuable to analyze, and to learn android programming from? Is any app from the Android open source project suitable for basic learning?
View 7 Replies
View Related
Apr 9, 2010
Android has such concept as a Service. It makes sense for interprocess communication. But if I need this service from Activities running in the same process regular singleton seems to be more convenient. No need to register, to bind. Are there any benefits to use service in the same process?
View 17 Replies
View Related
Aug 25, 2010
I'm quite new to Android development. When is it a good idea to create an Android Service instead of just using a simple Singleton class?
Take, for example, the data layer downloading information feeds from the internet. Using a Service seems too much for some cases but sometimes I might need access to a Context so I'm a little unsure about how to design the app.
View 1 Replies
View Related
Oct 10, 2010
I often run into the following dilemma: I need some singleton-like object in my app (typically some central manager-like thing) and this object needs a context for various things. This means that I either have to pass a context to all methods needing one or have some sort of init-pattern to the object. Neither is pretty I think. What is the correct way of doing this? Or is this simply (even the definition of) a Service?
View 15 Replies
View Related
May 3, 2010
I'm considering creating a singleton wrapper for a Context so my model objects, if necessary, can open and read from a database connection. My model objects do not have access to a Context, and I'd like to avoid needing to pass a reference to a Context from object to object.I was planning to place into this singleton a reference to the Context returned by Application.getApplicationContext(). This singleton object would be initialized in my custom Application instance before anything else would need to or have a chance to use it.Can anyone think of a reason to not do this?
View 3 Replies
View Related
Feb 11, 2010
I'd like to know if it's possible to create a Singleton Service throughout an application ? Let's say I'd like to cerate a Service to play some mp3... I'd like it to be a Singleton, we don't want two mp3 tracks playing through each other (well maybe some would want that, but in my case I'm not making a DJ app) :P Also this Service should be somewhat dynamic as in there should be some interface so that I can stop, pauze and play the mp3 file/ stream. Now I have a couple of questions : - is this feasible ? - should I be using a Service or something else ? - how can an interface be set up in between an application and a service so that I can start, stop, pauze stuff ? - can there be something like a Singleton Service?
View 9 Replies
View Related
Mar 23, 2010
I have a singleton class and I am using it to access databases. I would like to know how it would behave if I use the same from my remote service class which runs as a separate process. Will it create a new instance in that process or will it use the instance from the other process?
View 3 Replies
View Related
Aug 17, 2010
I'm adapting Image Downloader from Google Android blog. I want ImageDownloader to be singleton since I'll be using it in multiple places in my application. I want also to be able to manipulate Bitmaps using different Strategies (eg. produce transparent bitmaps).I want to be able to use ImageDownloader in one activity and set transparent bitmaps, and in another use the same ImageDownloader but get black&white bitmaps using different strategy object.
View 5 Replies
View Related
Sep 1, 2010
I have a singleton in an activity. When I end my application (like pressing back button), and start it again after some time, the singleton is not recreated, but is holding previous state. Singleton is not destroyed if the application is destroyed? Do I have to null its static members in onDestroy() to avoid memory leak.
View 1 Replies
View Related
Sep 1, 2010
On Wed, Sep 1, 2010 at 1:19 PM, siva <sivaraj.r...@gmail.com> wrote: > I have a singleton in an activity. When I end my application (like > pressing back button), and start it again after some time, the > singleton is not recreated, but is holding previous state. Singleton > is not destroyed if the application is destroyed?
View 4 Replies
View Related
Mar 17, 2009
In order to communicate with the server I need a huge global object (class with some hashmaps). all my activities (about 10) need that huge global object. which options do I have? I am thinking about passing the object using intends and about the possibility to make the object a singleton. using the db will be much too slow.
View 3 Replies
View Related
Sep 17, 2010
I have a singleton which stores some prudent information about the user of my application. At the moment, it stores the user's login and the user's location.The location is found via a Service. At the moment, the Service references my singleton directly to stuff the longitude and latitude into it. I would like to use a Broadcast Receiver to send a broadcast that the singleton hears and uses to update the values, instead. However, to register the Broadcast Receiver, I need a Context in my singleton. What is the slickest way to achieve what I'm wanting. Is Broadcast Receiver possibly not the appropriate object? Also, what problems am I looking at with using a singleton? I assume that Android will possibly reclaim this memory at any given time (which would obviously be bad); so how can I prevent that? Would passing in the application's Context and storing it in a member variable thwart this? The Android documentation states: "But, the life cycle of a static is not well under your control; so to abide by the life-cycle model, the application class should initiate and tear down these static objects in the onCreate() and on Terminate() methods of the Application Class," but I'm not entirely sure how to accomplish this.
View 1 Replies
View Related
Mar 25, 2009
I have two services, both of them lies in separate apk, which run in same process. The two service share same jar file by <uses-library> method. The jar file implement a class, say "test", is a singleton. But I found that two instance of test is created under this case, could anybody give me some tips? I want to ensure it's singleton. Code...
View 8 Replies
View Related
Nov 15, 2010
Let me give you the scenario.
Say that my first Activity that loads up, also creates a thread, which will run indefinitely in the background.
Now, if I move to another Activity, I assume that the thread that I initially created in the main activity will continue to run.
So, now to my main question - in order to manage this background thread from other Activities, is it safe to store a reference to that thread in a singleton object?
View 2 Replies
View Related
Sep 3, 2010
Can I pass a singleton class's object from one activity to another activity using intent? I am using singleton class as image class img = image class.get Instance();, so i need the img instance for another activity, how can i pass an object instance in Android.
View 2 Replies
View Related
Apr 30, 2009
I want to use AudioRecord and AudioTrack classes(in SDK 1.5) in my program. Where can I find how to use it. Is there any API demo program for this?. If not it is greatly appreciated if someone can post a sample code in this forum.
View 7 Replies
View Related
Apr 23, 2009
I'm currently initiating the AudioTrack() for MODE_STREAM. I load some bytes using the write() and I see that it is working but once hit the play() call nothing happens. what is the matter? should I do something else that is not obvious? Any tips Google friends? My settings: streamType - STREAM_MUSIC sampleRateInHz - 44100 channel Config - CHANNEL _CONFIGURATION_STEREO audioFormat - ENCODING_PCM_16BIT bufferSizeInBytes - 256K the total size (in bytes) of the buffer where audio data is read from for playback. mode - MODE_STREAM.
View 21 Replies
View Related
Nov 24, 2010
It would be nice if StackOverflow had a section where we could post tutorials like mine so that I can answer literally hundreds of questions that have been asked here with a single blow. See... every day I read questions about how to pass complex objects between activities, how to save state so that your app can resume after orientation change, how to update listviews when the data changes, etc, etc. Here is the second part of a tutorial series I posted on my blog... I hope that you actually read it... because I haven't seen any examples like it anywhere... and it has changed how I think about developing for Android across the board. The question is... is there a downside or negative affect of developing like this?
Beyond Smart Lists - How Observable Singletons change the game. Please read through both of these tutorials carefully... I will answer any questions about it here that I can... I really want to know what you think about this and if it might solve issues for you. NOTE TO MODERATORS: there are no advertisements of any kind on my blog.. so don't just close this because you think I am spamming somehow... I am not going to duplicate my post here.
View 1 Replies
View Related
Feb 15, 2010
I want to play music from online mp3 link.I am reading the music data into a stream and trying to play it using audio track. But itz giving only noise.No music i could listen.Same buffer I can play in Media Player,But i could not play in audio track.
View 16 Replies
View Related
Dec 15, 2009
I am getting this clicking sound when playing static pcm data. Anybody out there is having the same problem? This is not the data issue.
View 7 Replies
View Related
Jan 21, 2010
My application uses AudioTrack in streaming mode and AudioRecord simultaneously.My problem is that I start them at the same time, but I have no guarantee that they will actually start playback ecording in the same timestamp. The reason I need this kind of accuracy is because I use echo cancellation (subtracting audio played to speaker from the recording).My echo canceller doesn't require an exact delay, but the delay introduced between AudioTrack and AudioRecord moves in the range of 250ms (between different runs), and that's too much - each run is different because they start themselves asynchronously. The API doesn't provide me a way to make sure they start in the same time, so I thought about measuring this starting delay somehow and then using it in my calculation.Does anyone have an idea how to do that, utilizing their API or in any other way?
View 2 Replies
View Related
Apr 13, 2010
I'm in the process of wring a music player that can play SID tracks (music from the Commodore 64), and everything is progressing nicely, except that I sometimes get audio stuttering.The stuttering only happens when the player is in the background, and another application has focus. It's most noticeable when a cpu heavy app(like Google Earth) is running in the foreground.I have tried adjusting the priority of my thread and increasing the AudioTrack buffer size, but nothing has solved the stuttering problem.I believe the problem is that generating the audio takes quite a lot of cycles (I'm at 15-30% cpu load), and that my audio thread is being starved and cant keep up with AudioTrack's constant need for data.I'm must be doing something wrong, I can't imagine that gui threads should be able to starve a high priority audio thread.I hope someone have some ideas on how to get my player stutter free, as I'm at a loss :)
View 9 Replies
View Related
Jun 27, 2009
If I create and release multiple AudioTrack objects, the GREF count continually increases which eventually causes an application crash. Even with a forced garbage collection, I end up with the same high GREF count at the end of the loop.In my application, I continuously create AudioTracks from variable lenght buffers.I guess I can try and use a fixed size pool of AudioTracks each with a buffer large enough to fit my longest sound, and try and reuse them.Is there a better/correct way to completely clear resources used by an AudioTrack?
View 5 Replies
View Related
Aug 10, 2009
There is a AudioTrack Class in SDK 1.5 which can play PCM buffer directly.But it is not exist in SDK 1.1. I want to play PCM buffer in SDK1.1,but i don't know how.
View 2 Replies
View Related
Oct 2, 2009
I am trying to determine if I should go the ndk way to work on a music synth app, but first wanted to do a sanity check in the java layer by testing how many sine tones i could play concurrently, and so I tried this. And it's pretty low: I can only play about 4 or 5 tones before the obtainBuffer timeouts start increasing in number. Also, changing the media volume while the tones are playing disrupts the output.
View 3 Replies
View Related
Jan 21, 2010
I am trying to resolve the clicking problem while using the AudioTrack. It takes place only when playing the first part of the wave (pcm) buffer when the offset to the write is 0 (zero). track.write(buffer, offset, minBufferSize); It tells me that there is something wrong with the pcm data. Could it be because the wave data, I generate using Audacity, has some header as opposed to the pure pcm which does not? I was looking for the converter tools to generate pure pcm but found none. Applications I found generate only wave data so I am not able to test this assumption. At this point I am sure that filling the buffer is correct. Any ideas?
View 2 Replies
View Related