2008-05-29 18:54:30 +00:00
|
|
|
//
|
|
|
|
// File: VLAIFFDocument.mm - Export document in AIFF format
|
|
|
|
//
|
|
|
|
// Author(s):
|
|
|
|
//
|
|
|
|
// (MN) Matthias Neeracher
|
|
|
|
//
|
2011-07-24 03:32:13 +00:00
|
|
|
// Copyright © 2008-2011 Matthias Neeracher
|
2008-05-29 18:54:30 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "VLAIFFDocument.h"
|
|
|
|
#import "VLSoundOut.h"
|
|
|
|
|
|
|
|
#import <CoreAudio/CoreAudio.h>
|
|
|
|
|
|
|
|
@implementation VLDocument (AIFF)
|
|
|
|
|
|
|
|
- (NSFileWrapper *)aiffFileWrapperWithError:(NSError **)outError
|
|
|
|
{
|
2011-07-24 03:32:13 +00:00
|
|
|
[self createTmpFileWithExtension:@"mid" ofType:VLMIDIType];
|
2008-05-29 18:54:30 +00:00
|
|
|
|
|
|
|
NSURL * midiURL = [self fileURLWithExtension:@"mid"];
|
|
|
|
NSURL * aiffURL = [self fileURLWithExtension:@"aiff"];
|
|
|
|
VLSoundOut *writer =
|
|
|
|
VLSoundOut::FileWriter((CFURLRef)aiffURL, kAudioFormatLinearPCM);
|
|
|
|
writer->PlayFile(CFDataRef([NSData dataWithContentsOfURL:midiURL]));
|
|
|
|
delete writer;
|
|
|
|
|
|
|
|
return [[[NSFileWrapper alloc]
|
|
|
|
initWithPath:[[self fileURLWithExtension:@"aiff"] path]]
|
|
|
|
autorelease];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|