Cutting a clip from iPod library file - ipod

My requirements are as follows:
I need to access a song from iPod library and play it(which is doable). I have implemented this using Assets library, and now I need to trim that song programmatically, so that I can get a clip of it. One application is already on the app store featuring same functionality, called "Ringtone Designer" Any thoughts?

I guess you are retrieving the ALAsset of the song (since you say that you already know how to play it start-to-stop).
Now, to select parts of it you want to extract you can call the Method defaultRepresentation on the ALAsset, then call getBytes:fromOffset:length:error: on that ALAssetRepresentation-Object.
http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAsset_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAssetRepresentation_Class/Reference/Reference.html#//apple_ref/doc/c_ref/ALAssetRepresentation
If the song is encoded you might have to decode it first.
Good Luck!

Related

as3 store an external variable and keep it

I dont know if this is possible, but i have an SWF file which i want it to get info from an xml file only one time and then store it(keep it) there until a "newer" data will push into it
I know it sounds stupid but maybe there is a solution i don't know of...
1) i don't want to load the xml every time because of loads of traffic we have(a lot...will cost a lot to refresh everytime from amazon s3)
but how do we get a newer data without checking the external xml file?
2) if there was a way to broadcast(to "ping") to the swf that an update of the xml is ready to load....
if anything i believe there should be an AS3 script for that.
thanks!
but how do we get a newer data without checking the external xml file?
You could implement data file versioning. For example: urlToXmlData + "?version=" + myCurrentVesion As soon you ship new version of the application with extended data, it will work. It's global solution, so every new version of your product will work with latest data.
As for ping, you could create update strategy, for example: link is valid for 1 day. Idea is the same, concatenate stuff to the link, so browser will evaluate it as new: urlToXmlData + "?stamp=" + timestampForToday Tomorrow will be another timestamp, and browser will download updated version.
Use second xml which will contain the version first xml
I think you don't get the real subject.
You can't update a flash project without using any external update platform.
Because you cannot save all new XML data to a shared object because of "limitation of mb per data", so, flash going to delete all loaded data when application closed.
You cannot make a "permament update" in flash for "big files"...
BUT
You can update your main swf file with "EMBEDDED XML" files. Only that keeps your data updated when application is closed.
BUT that's not enough alone, also you need a "PRE-CHECK for Version of SWF" file, and that's what you can't do alone. You need a web platform featuring that way.
Mochi's "Live Updates" was offering that, but i couldn't make it work. But mochi is shutdown now... So forget about it...
I understand that your XML is BIG and you want to save trafic.
But how about small calls ?
You can have a call just to get the MD5 of your xml which is stored on the server.
Something like: myserver.com/getMD5
Once the server will return you a different md5 than the one you have already stored, then you reload xml and save new MD5.

Java CS6 How to convert ai to fla + html + swf using a script

I would like some assistance with batch image processing - I need to save an vector ai image to fla+html+swf file formats using a script - What I have done is to open the software and open a folder with these image's in. Please advise how i can write a script to assist with this process as I have alot of images I have to save.
I need to save it in actionscript 3 and actionscript 2, so if there is a script that convert it from actionscript 3 to actionscipt 2 that can be usefull aswell.
Please help :)
If I understand you correctly, you want to be able to put an image found inside an .AI-file (Adobe Illustrator) and automatically place that image into two newly created .FLA-files (one with AS3 set as default programming language and one set with AS2 as the default programming language)?
There is no quick and easy solution for this, it would require a combination of a "main app (python, c#, java or similar)" combined with "JSFL" to do what you want. And in the end that app would probably become very complex.
If you can skip the requirement of each ai-file becoming a unique fla-file you can just import all the images into a newly created FLA-file. But if that's not an option, then you're most definitely out of luck :\

Windows Phone 8 , how to share code,xmal,asset between multiple projects

Now I have AppA finished. but I want to make AppB,AppC. and AppB,AppC share most of the code in AppA(including xaml, asset, code,etc.). only a few changes for the AppB,AppC respectively.I mean, the 3 apps can be installed on the same windows phone separately with different icons.
Does anybody know how to build AppB,AppC referring AppA in code?
thanks.
Either extract as much as you can in a shared/common project or use "Add as Link" to include files from AppA into AppB and AppC.
Note that XAML files don't support conditional compilation so they must be identical for all projects in order to link them. You can potentially extract XAML differences into App.xaml StaticResources (identical keys) in order to make them identical and link them.
Sharing XAML is very reasonable when targeting the same platform.
You can also link cs files even if they are similar (few changes) by using conditional compilation.
Partial classes can also spare you the conditional compilation ceremony in many cases.
Finally Resource files are very good candidate for reuse. If you decide to put them on a shared library remember to wrap the generated Resource class in another public one with a public constructor shown here in order to avoid the internal constructor issue.
You can put all your code in an external class library. As far as I know though your assets and pages need to exist in each project.
If you want to share code and assets between multiple assemblies, you can create a class library for Windows Phone and put all the code inside it. When you need to use that library, simply link it in your target applications.
When you want to navigate to a page in your library, use the following syntax:
NavigationService.Navigate(new Uri("/AssemblyName;component/page.xaml", UriKind.Relative));

how to I make my flash AS3 game save progress

I have this flash game that I've been working on that works out of the browser, and I'm looking to get it to save it's progress.
I've seen multiple flash games that have accomplished this, and It appears as though they've done this client-side, and I'd like to do the same.
My game consists of 1 mxml file and a number of .as files and I compile it from the command line using flex sdk.
What do I have to do to be able to save save my game's data?
As others have mentioned, SharedObject is the tool you'll use for this.
The basics of this are to initialize a reference to a SharedObject using its static method .getLocal() first:
var mySaveData:SharedObject = SharedObject.getLocal("SomeSaveName");
The String given to this method should not contain spaces.
Once you've done this, you'll be able to use mySaveData.data, which is basically a simple object that you can attach properties to on the fly (it's dynamic):
mySaveData.data.levelsComplete = 2;
Once you've done this, you'll be able to reference that value later on using the same process:
trace( mySaveData.data.levelsComplete );
For simple stuff you can use SharedObject
One way is to use flash's SharedObject to save values in to a 'flash cookie' on the client. Example can be found here: Actionscript 3 saving currentframe location to local hard drive?

write new id3v2-tags in mp3-headers (actionscript-3)

Hello is it possible to write new id3v2 tags to a mp3-file through actionscript?
Normally you can read/write tags like artist,album,genre...
But I would like to add for example the tag "atmosphere = smooth".
Thanks
Unfortunately, there is no working library to write/edit ID3 tags in ActionScript, or at least I wouldn't know of one.
But you can access and edit the file as ByteArray. Check the ID3v2.3 specification to find out which bytes to read and write.
There is a c/c++ project called id3lib on sourceforge. Should you consider porting this to ActionScript using Alchemy, I would be very much interested in the resulting product ;)