mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Update deprecated calls
This commit is contained in:
parent
5fa9b02909
commit
3567608c0c
|
@ -133,12 +133,12 @@
|
||||||
//
|
//
|
||||||
// Look for running copies of Lilypond first
|
// Look for running copies of Lilypond first
|
||||||
//
|
//
|
||||||
NSArray * runningApps = [[NSWorkspace sharedWorkspace] launchedApplications];
|
NSArray * runningApps = [[NSWorkspace sharedWorkspace] runningApplications];
|
||||||
for (NSDictionary * app in runningApps)
|
for (NSRunningApplication * app in runningApps)
|
||||||
if ([[app objectForKey:@"NSApplicationBundleIdentifier"] isEqual:@"org.lilypond.lilypond"]
|
if ([[app bundleIdentifier] isEqual:@"org.lilypond.lilypond"]
|
||||||
|| [[app objectForKey:@"NSApplicationName"] isEqual:@"LilyPond"]
|
|| [[app localizedName] isEqual:@"LilyPond"]
|
||||||
)
|
)
|
||||||
if ((appPath = [[app objectForKey:@"NSApplicationPath"] stringByAppendingPathComponent:@"Contents/Resources/bin/lilypond"]))
|
if ((appPath = [[[app bundleURL] path] stringByAppendingPathComponent:@"Contents/Resources/bin/lilypond"]))
|
||||||
break;
|
break;
|
||||||
if (!appPath)
|
if (!appPath)
|
||||||
appPath =
|
appPath =
|
||||||
|
|
|
@ -54,7 +54,7 @@ enum {
|
||||||
float chordPadding;
|
float chordPadding;
|
||||||
float lyricPadding;
|
float lyricPadding;
|
||||||
int playElements;
|
int playElements;
|
||||||
NSString * tmpPath;
|
NSURL * tmpURL;
|
||||||
NSFileWrapper * vcsWrapper;
|
NSFileWrapper * vcsWrapper;
|
||||||
NSMutableArray* observers;
|
NSMutableArray* observers;
|
||||||
NSMutableDictionary*validTmpFiles;
|
NSMutableDictionary*validTmpFiles;
|
||||||
|
@ -96,8 +96,8 @@ enum {
|
||||||
- (IBAction) adjustTempo:(id)sender;
|
- (IBAction) adjustTempo:(id)sender;
|
||||||
- (IBAction) togglePlayElements:(id)sender;
|
- (IBAction) togglePlayElements:(id)sender;
|
||||||
|
|
||||||
- (NSString *) tmpPath;
|
- (NSURL *) tmpURL;
|
||||||
- (NSString *) workPath;
|
- (NSURL *) workURL;
|
||||||
- (NSString *) baseName;
|
- (NSString *) baseName;
|
||||||
- (NSURL *) fileURLWithExtension:(NSString*)extension;
|
- (NSURL *) fileURLWithExtension:(NSString*)extension;
|
||||||
- (void) createTmpFileWithExtension:(NSString*)ext ofType:(NSString*)type;
|
- (void) createTmpFileWithExtension:(NSString*)ext ofType:(NSString*)type;
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
sheetWin = nil;
|
sheetWin = nil;
|
||||||
pdfWin = nil;
|
pdfWin = nil;
|
||||||
logWin = nil;
|
logWin = nil;
|
||||||
tmpPath = nil;
|
tmpURL = nil;
|
||||||
vcsWrapper = nil;
|
vcsWrapper = nil;
|
||||||
repeatVolta = 2;
|
repeatVolta = 2;
|
||||||
brandNew = true;
|
brandNew = true;
|
||||||
|
@ -154,9 +154,9 @@
|
||||||
[undo release];
|
[undo release];
|
||||||
[observers release];
|
[observers release];
|
||||||
|
|
||||||
if (tmpPath) {
|
if (tmpURL) {
|
||||||
[[NSFileManager defaultManager] removeFileAtPath:tmpPath handler:nil];
|
[[NSFileManager defaultManager] removeItemAtURL:tmpURL error:nil];
|
||||||
[tmpPath release];
|
[tmpURL release];
|
||||||
}
|
}
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -363,34 +363,33 @@
|
||||||
repeatVolta = volta;
|
repeatVolta = volta;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) tmpPath
|
- (NSURL *) tmpURL
|
||||||
{
|
{
|
||||||
if (!tmpPath) {
|
if (!tmpURL) {
|
||||||
tmpPath = [[NSString alloc] initWithFormat:@"/var/tmp/VocalEasel.%08x",
|
NSString * tmpPath = [NSString stringWithFormat:@"/var/tmp/VocalEasel.%08x", self];
|
||||||
self];
|
tmpURL = [[NSURL alloc] initFileURLWithPath:tmpPath];
|
||||||
[[NSFileManager defaultManager] createDirectoryAtPath:tmpPath attributes:nil];
|
[[NSFileManager defaultManager] createDirectoryAtURL:tmpURL withIntermediateDirectories:NO attributes:nil error:nil];
|
||||||
}
|
}
|
||||||
return tmpPath;
|
return tmpURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) workPath
|
- (NSURL *) workURL
|
||||||
{
|
{
|
||||||
if ([self fileURL]) // Prefer our wrapper directory
|
if (NSURL * url = [self fileURL]) // Prefer our wrapper directory
|
||||||
return [[self fileURL] path];
|
return url;
|
||||||
else
|
else
|
||||||
return [self tmpPath];
|
return [self tmpURL];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) baseName
|
- (NSString *) baseName
|
||||||
{
|
{
|
||||||
return [[[self workPath] lastPathComponent] stringByDeletingPathExtension];
|
return [[[self workURL] lastPathComponent] stringByDeletingPathExtension];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *) fileURLWithExtension:(NSString*)extension
|
- (NSURL *) fileURLWithExtension:(NSString*)extension
|
||||||
{
|
{
|
||||||
return [NSURL fileURLWithPath:
|
return [[[self workURL] URLByAppendingPathComponent:[self baseName]]
|
||||||
[[[self workPath] stringByAppendingPathComponent:[self baseName]]
|
URLByAppendingPathExtension:extension];
|
||||||
stringByAppendingPathExtension:extension]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError
|
- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError
|
||||||
|
@ -478,12 +477,11 @@
|
||||||
|
|
||||||
- (void) changedFileWrapper
|
- (void) changedFileWrapper
|
||||||
{
|
{
|
||||||
if (NSURL * url = [self fileURL])
|
if (NSURL * url = [self workURL]) {
|
||||||
if (NSDate * modDate =
|
NSDate * modDate;
|
||||||
[[[NSFileManager defaultManager] fileAttributesAtPath:[url path]
|
if ([url getResourceValue:&modDate forKey:NSURLAttributeModificationDateKey error:nil])
|
||||||
traverseLink:YES]
|
|
||||||
objectForKey:NSFileModificationDate])
|
|
||||||
[self setFileModificationDate:modDate];
|
[self setFileModificationDate:modDate];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) createTmpFileWithExtension:(NSString*)ext ofType:(NSString*)type
|
- (void) createTmpFileWithExtension:(NSString*)ext ofType:(NSString*)type
|
||||||
|
@ -502,7 +500,7 @@
|
||||||
- (NSTask *) taskWithLaunchPath:(NSString *)launch arguments:(NSArray *)args;
|
- (NSTask *) taskWithLaunchPath:(NSString *)launch arguments:(NSArray *)args;
|
||||||
{
|
{
|
||||||
NSTask * task = [[NSTask alloc] init];
|
NSTask * task = [[NSTask alloc] init];
|
||||||
NSString * path = [self workPath];
|
NSString * path = [[self workURL] path];
|
||||||
NSPipe * pipe = [NSPipe pipe];
|
NSPipe * pipe = [NSPipe pipe];
|
||||||
|
|
||||||
[task setCurrentDirectoryPath: path];
|
[task setCurrentDirectoryPath: path];
|
||||||
|
@ -528,11 +526,8 @@
|
||||||
MusicSequence music;
|
MusicSequence music;
|
||||||
NewMusicSequence(&music);
|
NewMusicSequence(&music);
|
||||||
|
|
||||||
FSRef fsRef;
|
MusicSequenceFileLoad(music, (CFURLRef)[self fileURLWithExtension:@"mid"],
|
||||||
CFURLGetFSRef((CFURLRef)[self fileURLWithExtension:@"mid"], &fsRef);
|
0, kMusicSequenceLoadSMF_ChannelsToTracks);
|
||||||
|
|
||||||
MusicSequenceLoadSMFWithFlags(music, &fsRef,
|
|
||||||
kMusicSequenceLoadSMF_ChannelsToTracks);
|
|
||||||
|
|
||||||
size_t countIn = 0;
|
size_t countIn = 0;
|
||||||
if (playElements & kVLPlayCountIn)
|
if (playElements & kVLPlayCountIn)
|
||||||
|
@ -598,7 +593,7 @@
|
||||||
|
|
||||||
- (IBAction) playMusic:(id)sender
|
- (IBAction) playMusic:(id)sender
|
||||||
{
|
{
|
||||||
switch (int tag = [sender tag]) {
|
switch ([sender tag]) {
|
||||||
case 1: // Fwd
|
case 1: // Fwd
|
||||||
VLSoundOut::Instance()->Fwd();
|
VLSoundOut::Instance()->Fwd();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
//
|
//
|
||||||
// (MN) Matthias Neeracher
|
// (MN) Matthias Neeracher
|
||||||
//
|
//
|
||||||
// Copyright © 2007 Matthias Neeracher
|
// Copyright © 2007-2011 Matthias Neeracher
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "VLKeyValueUndo.h"
|
#import "VLKeyValueUndo.h"
|
||||||
|
#import "VLDocument.h"
|
||||||
|
|
||||||
@implementation VLKeyValueUndo
|
@implementation VLKeyValueUndo
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
VLDocument *doc = [self document];
|
VLDocument *doc = [self document];
|
||||||
NSURL * pdfURL = [doc fileURLWithExtension:@"pdf"];
|
NSURL * pdfURL = [doc fileURLWithExtension:@"pdf"];
|
||||||
if (!pdfURL) {
|
if (!pdfURL) {
|
||||||
NSString * path = [doc workPath];
|
NSURL * workURL = [doc workURL];
|
||||||
NSFileWrapper * wrapper =
|
NSFileWrapper * wrapper =
|
||||||
[[[NSFileWrapper alloc] initWithPath:path] autorelease];
|
[[[NSFileWrapper alloc] initWithURL:workURL options:0 error:nil] autorelease];
|
||||||
//
|
//
|
||||||
// Find newest pdf file
|
// Find newest pdf file
|
||||||
//
|
//
|
||||||
|
@ -57,9 +57,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pdfPath)
|
if (pdfPath)
|
||||||
pdfURL =
|
pdfURL = [workURL URLByAppendingPathComponent:pdfPath];
|
||||||
[NSURL fileURLWithPath:
|
|
||||||
[path stringByAppendingPathComponent:pdfPath]];
|
|
||||||
}
|
}
|
||||||
if (pdfURL) {
|
if (pdfURL) {
|
||||||
PDFDocument * pdfDoc =
|
PDFDocument * pdfDoc =
|
||||||
|
|
|
@ -106,7 +106,7 @@ void VLSoundOut::PlayFile(CFDataRef file)
|
||||||
MusicSequence music;
|
MusicSequence music;
|
||||||
|
|
||||||
NewMusicSequence(&music);
|
NewMusicSequence(&music);
|
||||||
MusicSequenceLoadSMFDataWithFlags(music, file,
|
MusicSequenceFileLoadData(music, file, 0,
|
||||||
kMusicSequenceLoadSMF_ChannelsToTracks);
|
kMusicSequenceLoadSMF_ChannelsToTracks);
|
||||||
PlaySequence(music);
|
PlaySequence(music);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ VLAUSoundOut::~VLAUSoundOut()
|
||||||
void VLAUSoundOut::InitSoundOutput(bool fileOutput)
|
void VLAUSoundOut::InitSoundOutput(bool fileOutput)
|
||||||
{
|
{
|
||||||
AUNode synthNode, limiterNode, outNode;
|
AUNode synthNode, limiterNode, outNode;
|
||||||
ComponentDescription cd;
|
AudioComponentDescription cd;
|
||||||
|
|
||||||
cd.componentManufacturer = kAudioUnitManufacturer_Apple;
|
cd.componentManufacturer = kAudioUnitManufacturer_Apple;
|
||||||
cd.componentFlags = 0;
|
cd.componentFlags = 0;
|
||||||
|
@ -147,12 +147,12 @@ void VLAUSoundOut::InitSoundOutput(bool fileOutput)
|
||||||
cd.componentType = kAudioUnitType_MusicDevice;
|
cd.componentType = kAudioUnitType_MusicDevice;
|
||||||
cd.componentSubType = kAudioUnitSubType_DLSSynth;
|
cd.componentSubType = kAudioUnitSubType_DLSSynth;
|
||||||
|
|
||||||
AUGraphNewNode(fGraph, &cd, 0, NULL, &synthNode);
|
AUGraphAddNode(fGraph, &cd, &synthNode);
|
||||||
|
|
||||||
cd.componentType = kAudioUnitType_Effect;
|
cd.componentType = kAudioUnitType_Effect;
|
||||||
cd.componentSubType = kAudioUnitSubType_PeakLimiter;
|
cd.componentSubType = kAudioUnitSubType_PeakLimiter;
|
||||||
|
|
||||||
AUGraphNewNode (fGraph, &cd, 0, NULL, &limiterNode);
|
AUGraphAddNode (fGraph, &cd, &limiterNode);
|
||||||
|
|
||||||
cd.componentType = kAudioUnitType_Output;
|
cd.componentType = kAudioUnitType_Output;
|
||||||
if (fileOutput)
|
if (fileOutput)
|
||||||
|
@ -160,7 +160,7 @@ void VLAUSoundOut::InitSoundOutput(bool fileOutput)
|
||||||
else
|
else
|
||||||
cd.componentSubType = kAudioUnitSubType_DefaultOutput;
|
cd.componentSubType = kAudioUnitSubType_DefaultOutput;
|
||||||
|
|
||||||
AUGraphNewNode(fGraph, &cd, 0, NULL, &outNode);
|
AUGraphAddNode(fGraph, &cd, &outNode);
|
||||||
|
|
||||||
R(AUGraphOpen(fGraph));
|
R(AUGraphOpen(fGraph));
|
||||||
AUGraphConnectNodeInput(fGraph, synthNode, 0, limiterNode, 0);
|
AUGraphConnectNodeInput(fGraph, synthNode, 0, limiterNode, 0);
|
||||||
|
@ -169,7 +169,7 @@ void VLAUSoundOut::InitSoundOutput(bool fileOutput)
|
||||||
if (fileOutput) {
|
if (fileOutput) {
|
||||||
UInt32 value = 1;
|
UInt32 value = 1;
|
||||||
AudioUnit synth;
|
AudioUnit synth;
|
||||||
R(AUGraphGetNodeInfo(fGraph, synthNode, 0, 0, 0, &synth));
|
R(AUGraphNodeInfo(fGraph, synthNode, NULL, &synth));
|
||||||
R(AudioUnitSetProperty(synth,
|
R(AudioUnitSetProperty(synth,
|
||||||
kAudioUnitProperty_OfflineRender,
|
kAudioUnitProperty_OfflineRender,
|
||||||
kAudioUnitScope_Global, 0,
|
kAudioUnitScope_Global, 0,
|
||||||
|
@ -349,7 +349,7 @@ VLAUFileSoundOut::~VLAUFileSoundOut()
|
||||||
|
|
||||||
void VLAUFileSoundOut::SetupOutput(AUNode outputNode)
|
void VLAUFileSoundOut::SetupOutput(AUNode outputNode)
|
||||||
{
|
{
|
||||||
R(AUGraphGetNodeInfo(fGraph, outputNode, 0, 0, 0, &fOutput));
|
R(AUGraphNodeInfo(fGraph, outputNode, NULL, &fOutput));
|
||||||
Float64 sampleRate = 22050.0;
|
Float64 sampleRate = 22050.0;
|
||||||
R(AudioUnitSetProperty(fOutput,
|
R(AudioUnitSetProperty(fOutput,
|
||||||
kAudioUnitProperty_SampleRate,
|
kAudioUnitProperty_SampleRate,
|
||||||
|
@ -405,17 +405,11 @@ void VLAUFileSoundOut::PlaySequence(MusicSequence music)
|
||||||
R(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL,
|
R(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL,
|
||||||
&size, &outputFormat));
|
&size, &outputFormat));
|
||||||
}
|
}
|
||||||
|
CFRelease(name);
|
||||||
CFURLRef dir =
|
|
||||||
CFURLCreateCopyDeletingLastPathComponent(NULL, fFile);
|
|
||||||
FSRef parentDir;
|
|
||||||
CFURLGetFSRef(dir, &parentDir);
|
|
||||||
CFRelease(dir);
|
|
||||||
|
|
||||||
ExtAudioFileRef outfile;
|
ExtAudioFileRef outfile;
|
||||||
R(ExtAudioFileCreateNew(&parentDir, name,
|
R(ExtAudioFileCreateWithURL(fFile, fileType, &outputFormat, NULL,
|
||||||
fileType, &outputFormat, NULL, &outfile));
|
kAudioFileFlags_EraseFile, &outfile));
|
||||||
CFRelease(name);
|
|
||||||
|
|
||||||
CAStreamBasicDescription clientFormat;
|
CAStreamBasicDescription clientFormat;
|
||||||
size = sizeof(clientFormat);
|
size = sizeof(clientFormat);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user