0

I am writing a cross-platform game (Android, iOS, PC) where the player gets to record his own voice through the microphone. This results in big amounts of data even if LZMA compressed.

For my comfort, I am using the SharedObject. My question is, what happens if I fill it with tens of megabytes of data?

When I issue SharedObject.getLocal(xxx), does it load all its megabytes at that exactly point (slow and filling-up memory as well)? Or does it only load accessed data e.g var data:* = SharedObject.getLocal(xxx).data[recordingName];

If it isn't optimized in the way that I need it, would there be a problem if I had a different SharedObject for each file - accessed like

var so:SharedObject = SharedObject.getLocal(recordingName);

?

Bill Kotsias
  • 3,258
  • 6
  • 33
  • 60
  • IMHO better way is to use fast MP3 encoder as this one: https://github.com/kikko/Shine-MP3-Encoder-on-AS3-Alchemy and save MP3 directly on a card. As I remember SO supports only 100k of data, hence it's useless in this case. – gMirian Dec 01 '13 at 18:51
  • 1)I heard shine as3 is super slow! Won't solve my problem either. 2) forgot to say I am using Air, and have already written without prob several megs! – Bill Kotsias Dec 01 '13 at 19:26
  • @SantgMirian SO can be as big as local policy allows for a site to store data, check within Flash player with the opened SWF. But still IMHO SharedObjects are not the proper way to handle this kind of data :( – Vesper Dec 02 '13 at 04:27
  • 1
    @BillKotsias IMO no matter how would you load tens of megabytes of SharedObject data, the memory will still get filled, and the application will suspend while loading the store from disk. If your local storage settings will be unlimited, you will be able to operate SharedObjects this big. It should not be a problem if you store each record in its own shared object. – Vesper Dec 02 '13 at 04:32
  • @BillKotsias shinemp3Encoder isn't just AS3, it's written in C and works really fast, though take high CPU, used it already for Android app and worked like a charm, but I tested it on high end devices as Nexus 7, Galaxy S3 and Xperia T. – gMirian Dec 02 '13 at 08:37
  • I also tried the shinemp3Encoder on mobile and its OK for very short audio files but for anything little longer its just too slow.You can also try encoding the files to WAV [http://www.bytearray.org/?p=1858](http://www.bytearray.org/?p=1858) which works real time while recording. I personally ended up creating the application in native Dalvik Java (it was android only and very simple). – pulterao Dec 02 '13 at 16:46

1 Answers1

0

The data gets loaded when SharedObject.getLocal(xxx) is issued.

So in your case Bill, you should have a separate SharedObject for each of your samples. That way, you won't have to wait for all of them to be loaded at once.

Hopefully, the runtime will garbage collect the SharedObjects after you have used them and no longer have pointers to them, so that they won't take up all your RAM eventually..!

Bill Kotsias
  • 3,258
  • 6
  • 33
  • 60