Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-23-2009, 07:14 PM   #9 (permalink)
Nitrex88
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 19
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
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,333
Threads: 39,129
Posts: 171,562
Top Poster: smasher (2,577)
Welcome to our newest member, SteveMc
Powered by vBadvanced CMPS v3.1.0

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