Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-23-2009, 08:14 PM   #9 (permalink)
Nitrex88
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 21
Posts: 84
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default

Quote:
Originally Posted by smithdale87 View Post
This should get you on the right track. Mix and match pseudo code

Code:
-(void) concatFiles( NSString* path1, NSString* path2, NSString* combinedPath )
{
 NSFileHandle * f1Handle = [NSFileHandle fileHandleForReadingAtPath: path1];
 NSFileHandle *f2Handle = [NSFileHandle fielHandleForReadingAtPath: path2];

//might need to check if file exists first, if not create it using NSFileManager's createFileAtPath

 NSFileHandle * combinedHandle = [NSFileHandle fileHandleForWritingAtPath: combinedPath];



   // read data in small chunks to avoid hogging memory. 
   NSData* read  = [f1Handle readDataOfLength: CHUNK_SIZE] ;
      
    while( length of read != 0 )   

   {
       [combineHandle writeData: read];
       read = [f1Handle readDataOfLength: CHUNK_SIZE] ;
   }


   [f1Handle close];
   

    //now do the same for f2Handle

    //might need to ignore a few bytes in the front of file2 that isnt audio
    [f2Handle readDataOfLength: HEADER_LENGTH];


     NSData* read  = [f2Handle readDataOfLength: CHUNK_SIZE] ;
     while (... )
    {
    }
     [f2Handle close];
     [combineHandle close];
  
}
Wow thank you so much that will probably do it. That is so awesome! I haven't done anything with the NSFileHandle yet so I didn't know about it and it's methods. What do you recommend for the values of CHUNK_SIZE and HEADER_LENGTH?

Also in reference to me not being here for a while I have been very busy making tons of apps for the app store with various companies. I am also involved with the creation of highly developed new tutorial website that will be ready soon. Also busy finishing high school =P.

Nick
Nitrex88 is offline   Reply With Quote
 

» Advertisements
» Online Users: 770
18 members and 752 guests
ADY, at0m87, chaseacton, Dalia, Don, fgreg2692log, foolshityella, jakerocheleau, KarlJay, Morrisone, mystic.purple, PetarPM, smarkmee, suresk, Touchmint, Vineesh, yufengts
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,632
Threads: 89,149
Posts: 380,345
Top Poster: BrianSlick (7,110)
Welcome to our newest member, foolshityella
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:45 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.