mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
NSSound implementation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14216 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
72f3efecea
commit
b874ffa8f7
15 changed files with 2571 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
|||
2002-07-30 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* configure.ac: Check for autofile header/libs.
|
||||
* Source/NSBundleAdditions.m (pathForSoundResource:): New.
|
||||
* Source/NSSound.m: New file
|
||||
* Headers/gnustep/gui/NSSound.h: Idem.
|
||||
* Tools/gsnd: New server tool. (Implementation from
|
||||
Enrico Sersale).
|
||||
|
||||
2002-07-18 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* NSBundleAdditions.m: (-[awakeWithContext:]) Corrected
|
||||
|
|
118
Headers/gnustep/gui/NSSound.h
Normal file
118
Headers/gnustep/gui/NSSound.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
NSSound.h
|
||||
|
||||
Load, manipulate and play sounds
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Enrico Sersale <enrico@imago.ro>
|
||||
Date: Jul 2002
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSSound
|
||||
#define _GNUstep_H_NSSound
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
|
||||
@class NSArray;
|
||||
@class NSData;
|
||||
@class NSMutableData;
|
||||
@class NSPasteboard;
|
||||
@class NSString;
|
||||
@class NSURL;
|
||||
|
||||
@interface NSSound : NSObject <NSCoding, NSCopying>
|
||||
{
|
||||
id gsnd;
|
||||
|
||||
NSString *name;
|
||||
NSString *uniqueIdentifier;
|
||||
BOOL onlyReference;
|
||||
id delegate;
|
||||
|
||||
long dataLocation;
|
||||
long dataSize;
|
||||
int dataFormat;
|
||||
float samplingRate;
|
||||
float frameSize;
|
||||
long frameCount;
|
||||
int channelCount;
|
||||
NSMutableData *data;
|
||||
}
|
||||
|
||||
//
|
||||
// Creating an NSSound
|
||||
//
|
||||
- (id)initWithContentsOfFile:(NSString *)path byReference:(BOOL)byRef;
|
||||
- (id)initWithContentsOfURL:(NSURL *)url byReference:(BOOL)byRef;
|
||||
- (id)initWithData:(NSData *)data;
|
||||
- (id)initWithPasteboard:(NSPasteboard *)pasteboard;
|
||||
|
||||
//
|
||||
// Playing
|
||||
//
|
||||
- (BOOL)pause;
|
||||
- (BOOL)play;
|
||||
- (BOOL)resume;
|
||||
- (BOOL)stop;
|
||||
- (BOOL)isPlaying;
|
||||
|
||||
//
|
||||
// Working with pasteboards
|
||||
//
|
||||
+ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard;
|
||||
+ (NSArray *)soundUnfilteredPasteboardTypes;
|
||||
- (void)writeToPasteboard:(NSPasteboard *)pasteboard;
|
||||
|
||||
//
|
||||
// Working with delegates
|
||||
//
|
||||
- (id)delegate;
|
||||
- (void)setDelegate:(id)aDelegate;
|
||||
|
||||
//
|
||||
// Naming Sounds
|
||||
//
|
||||
+ (id)soundNamed:(NSString *)name;
|
||||
+ (NSArray *)soundUnfilteredFileTypes;
|
||||
- (NSString *)name;
|
||||
- (BOOL)setName:(NSString *)aName;
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
// Methods Implemented by the Delegate
|
||||
//
|
||||
@interface NSObject (NSSoundDelegate)
|
||||
|
||||
- (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSBundle (NSSoundAdditions)
|
||||
|
||||
- (NSString *)pathForSoundResource:(NSString *)name;
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSSound
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
/* Headers/gnustep/gui/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <audiofile.h> header file. */
|
||||
#undef HAVE_AUDIOFILE_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ NSSecureTextField.m \
|
|||
NSSelection.m \
|
||||
NSSlider.m \
|
||||
NSSliderCell.m \
|
||||
NSSound.m \
|
||||
NSSpellChecker.m \
|
||||
NSSpellServer.m \
|
||||
NSSplitView.m \
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <AppKit/NSMenu.h>
|
||||
#include <AppKit/NSControl.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSSound.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSNibConnector.h>
|
||||
|
@ -417,6 +418,31 @@ Class gmodel_class(void)
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)pathForSoundResource:(NSString *)name
|
||||
{
|
||||
NSString *ext = [name pathExtension];
|
||||
NSString *path = nil;
|
||||
|
||||
if ((ext == nil) || [ext isEqualToString:@""])
|
||||
{
|
||||
NSArray *types = [NSSound soundUnfilteredFileTypes];
|
||||
unsigned c = [types count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; path == nil && i < c; i++)
|
||||
{
|
||||
ext = [types objectAtIndex: i];
|
||||
path = [self pathForResource: name ofType: ext];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = [name stringByDeletingPathExtension];
|
||||
path = [self pathForResource: name ofType: ext];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
- (BOOL) loadNibFile: (NSString*)fileName
|
||||
externalNameTable: (NSDictionary*)context
|
||||
withZone: (NSZone*)zone
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSColor.h>
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/NSSound.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
|
||||
@implementation NSButtonCell
|
||||
|
|
803
Source/NSSound.m
Normal file
803
Source/NSSound.m
Normal file
|
@ -0,0 +1,803 @@
|
|||
/** <title>NSSound</title>
|
||||
|
||||
<abstract>Load, manipulate and play sounds</abstract>
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Author: Enrico Sersale <enrico@imago.ro>
|
||||
Date: Jul 2002
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gnustep/gui/config.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/NSPasteboard.h>
|
||||
#include <AppKit/NSSound.h>
|
||||
|
||||
#ifdef HAVE_AUDIOFILE_H
|
||||
#include <audiofile.h>
|
||||
#endif
|
||||
|
||||
#define BUFFER_SIZE_IN_FRAMES 4096
|
||||
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
/* Class variables and functions for class methods */
|
||||
static NSMutableDictionary *nameDict = nil;
|
||||
static NSDictionary *nsmapping = nil;
|
||||
|
||||
#define GSNDNAME @"GNUstepGSSoundServer"
|
||||
|
||||
@protocol GSSoundSvr
|
||||
|
||||
- (BOOL)playSound:(id)aSound;
|
||||
|
||||
- (BOOL)stopSoundWithIdentifier:(NSString *)identifier;
|
||||
|
||||
- (BOOL)pauseSoundWithIdentifier:(NSString *)identifier;
|
||||
|
||||
- (BOOL)resumeSoundWithIdentifier:(NSString *)identifier;
|
||||
|
||||
- (BOOL)isPlayingSoundWithIdentifier:(NSString *)identifier;
|
||||
|
||||
@end
|
||||
|
||||
static id<GSSoundSvr> the_server = nil;
|
||||
|
||||
@interface NSSound (PrivateMethods)
|
||||
|
||||
+ (id<GSSoundSvr>)gsnd;
|
||||
|
||||
+ (void)localServer:(id<GSSoundSvr>)s;
|
||||
|
||||
+ (id)lostServer:(NSNotification*)notification;
|
||||
|
||||
- (BOOL)getDataFromFileAtPath:(NSString *)path;
|
||||
|
||||
- (void)setIdentifier:(NSString *)identifier;
|
||||
|
||||
- (NSString *)identifier;
|
||||
|
||||
- (float)samplingRate;
|
||||
|
||||
- (float)frameSize;
|
||||
|
||||
- (long)frameCount;
|
||||
|
||||
- (NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSSound (PrivateMethods)
|
||||
|
||||
#ifdef HAVE_AUDIOFILE_H
|
||||
+ (id<GSSoundSvr>)gsnd
|
||||
{
|
||||
if (the_server == nil)
|
||||
{
|
||||
NSString *host;
|
||||
NSString *description;
|
||||
|
||||
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
||||
if (host == nil)
|
||||
{
|
||||
host = @"";
|
||||
}
|
||||
else
|
||||
{
|
||||
NSHost *h = [NSHost hostWithName: host];
|
||||
if (h == nil)
|
||||
{
|
||||
NSLog(@"Unknown NSHost (%@) ignored", host);
|
||||
host = @"";
|
||||
}
|
||||
else if ([h isEqual: [NSHost currentHost]] == YES)
|
||||
{
|
||||
host = @"";
|
||||
}
|
||||
else
|
||||
{
|
||||
host = [h name];
|
||||
}
|
||||
}
|
||||
|
||||
if ([host length] == 0)
|
||||
{
|
||||
description = @"local host";
|
||||
}
|
||||
else
|
||||
{
|
||||
description = host;
|
||||
}
|
||||
|
||||
the_server = (id<GSSoundSvr>)[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: GSNDNAME host: host];
|
||||
|
||||
if (the_server == nil && [host length] > 0)
|
||||
{
|
||||
NSString *service = [GSNDNAME stringByAppendingFormat: @"-%@", host];
|
||||
|
||||
the_server = (id<GSSoundSvr>)[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: service host: @"*"];
|
||||
}
|
||||
|
||||
if (RETAIN ((id)the_server) != nil)
|
||||
{
|
||||
NSConnection* conn = [(id)the_server connectionForProxy];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(lostServer:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: conn];
|
||||
}
|
||||
else
|
||||
{
|
||||
static BOOL recursion = NO;
|
||||
static NSString *cmd = nil;
|
||||
static NSArray *args = nil;
|
||||
|
||||
if (cmd == nil && recursion == NO)
|
||||
{
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
cmd = RETAIN([[NSSearchPathForDirectoriesInDomains(
|
||||
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
|
||||
stringByAppendingPathComponent: @"gsnd"]);
|
||||
#else
|
||||
cmd = RETAIN([[@GNUSTEP_INSTALL_PREFIX
|
||||
stringByAppendingPathComponent: @"Tools"]
|
||||
stringByAppendingPathComponent: @"gsnd"]);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (recursion == YES || cmd == nil)
|
||||
{
|
||||
NSLog(@"Unable to contact sound server - "
|
||||
@"please ensure that gsnd is running for %@.", description);
|
||||
return nil;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"\nI couldn't contact the sound server for %@ -\n"
|
||||
@"so I'm attempting to to start one - which will take a few seconds.\n"
|
||||
@"Trying to launch gsnd from %@ or a machine/operating-system subdirectory.\n"
|
||||
@"It is recommended that you start the sound server (gsnd) when\n"
|
||||
@"your windowing system is started up.\n", description,
|
||||
[cmd stringByDeletingLastPathComponent]);
|
||||
|
||||
if ([host length] > 0)
|
||||
{
|
||||
args = [[NSArray alloc] initWithObjects: @"-NSHost", host, nil];
|
||||
}
|
||||
|
||||
[NSTask launchedTaskWithLaunchPath: cmd arguments: args];
|
||||
|
||||
[NSTimer scheduledTimerWithTimeInterval: 5.0
|
||||
invocation: nil repeats: NO];
|
||||
|
||||
[[NSRunLoop currentRunLoop] runUntilDate:
|
||||
[NSDate dateWithTimeIntervalSinceNow: 5.0]];
|
||||
|
||||
recursion = YES;
|
||||
[self gsnd];
|
||||
recursion = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return the_server;
|
||||
}
|
||||
|
||||
+ (void)localServer:(id<GSSoundSvr>)s
|
||||
{
|
||||
the_server = s;
|
||||
}
|
||||
|
||||
+ (id)lostServer:(NSNotification*)notification
|
||||
{
|
||||
id obj = the_server;
|
||||
|
||||
the_server = nil;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: [notification object]];
|
||||
RELEASE (obj);
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)getDataFromFileAtPath:(NSString *)path
|
||||
{
|
||||
AFfilehandle file;
|
||||
AFframecount framesRead;
|
||||
void *buffer;
|
||||
|
||||
#define CHECK_AF_ERR(x) \
|
||||
if ((x) == -1) { \
|
||||
afCloseFile(file); \
|
||||
return NO; \
|
||||
}
|
||||
|
||||
if ((file = afOpenFile([path cString], "r", NULL)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
dataFormat = AF_SAMPFMT_TWOSCOMP;
|
||||
CHECK_AF_ERR (afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, dataFormat, 16));
|
||||
channelCount = DEFAULT_CHANNELS;
|
||||
CHECK_AF_ERR (afSetVirtualChannels(file, AF_DEFAULT_TRACK, channelCount));
|
||||
CHECK_AF_ERR (samplingRate = afGetRate(file, AF_DEFAULT_TRACK));
|
||||
CHECK_AF_ERR (frameCount = afGetFrameCount(file, AF_DEFAULT_TRACK));
|
||||
CHECK_AF_ERR (frameSize = afGetVirtualFrameSize(file, AF_DEFAULT_TRACK, 1));
|
||||
CHECK_AF_ERR (dataLocation = afGetDataOffset(file, AF_DEFAULT_TRACK));
|
||||
|
||||
buffer = NSZoneMalloc(NSDefaultMallocZone(), BUFFER_SIZE_IN_FRAMES * frameSize);
|
||||
data = [[NSMutableData alloc] initWithCapacity: 1];
|
||||
|
||||
CHECK_AF_ERR (framesRead = afReadFrames(file, AF_DEFAULT_TRACK, buffer, BUFFER_SIZE_IN_FRAMES));
|
||||
|
||||
while (framesRead > 0)
|
||||
{
|
||||
[data appendBytes: (const void *)buffer
|
||||
length: framesRead * frameSize];
|
||||
CHECK_AF_ERR (framesRead = afReadFrames(file, AF_DEFAULT_TRACK, buffer, BUFFER_SIZE_IN_FRAMES));
|
||||
}
|
||||
|
||||
dataSize = [data length];
|
||||
NSZoneFree(NSDefaultMallocZone(), buffer);
|
||||
afCloseFile(file);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#else
|
||||
/* No sound software */
|
||||
|
||||
+ (id<GSSoundSvr>)gsnd
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (void)localServer:(id<GSSoundSvr>)s
|
||||
{
|
||||
}
|
||||
|
||||
+ (id)lostServer:(NSNotification*)notification
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)getDataFromFileAtPath:(NSString *)path
|
||||
{
|
||||
NSLog(@"NSSound: No sound software installed, cannot get sound");
|
||||
return NO;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)setIdentifier:(NSString *)identifier
|
||||
{
|
||||
ASSIGN (uniqueIdentifier, identifier);
|
||||
}
|
||||
|
||||
- (NSString *)identifier
|
||||
{
|
||||
return uniqueIdentifier;
|
||||
}
|
||||
|
||||
- (float)samplingRate
|
||||
{
|
||||
return samplingRate;
|
||||
}
|
||||
|
||||
- (float)frameSize
|
||||
{
|
||||
return frameSize;
|
||||
}
|
||||
|
||||
- (long)frameCount
|
||||
{
|
||||
return frameCount;
|
||||
}
|
||||
|
||||
- (NSData *)data
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSSound
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self == [NSSound class])
|
||||
{
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
NSString *path = [NSBundle pathForGNUstepResource: @"nsmapping"
|
||||
ofType: @"strings"
|
||||
inDirectory: @"Sounds"];
|
||||
#else
|
||||
NSBundle *system = [NSBundle bundleWithPath: @GNUSTEP_INSTALL_LIBDIR];
|
||||
NSString *path = [system pathForResource: @"nsmapping"
|
||||
ofType: @"strings"
|
||||
inDirectory: @"Sounds"];
|
||||
#endif
|
||||
|
||||
[self setVersion: 1];
|
||||
|
||||
nameDict = [[NSMutableDictionary alloc] initWithCapacity: 10];
|
||||
|
||||
if (path)
|
||||
{
|
||||
nsmapping = RETAIN([[NSString stringWithContentsOfFile: path]
|
||||
propertyListFromStringsFileFormat]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
TEST_RELEASE (data);
|
||||
if (name && self == [nameDict objectForKey: name])
|
||||
{
|
||||
[nameDict removeObjectForKey: name];
|
||||
}
|
||||
TEST_RELEASE (name);
|
||||
TEST_RELEASE (uniqueIdentifier);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
//
|
||||
// Creating an NSSound
|
||||
//
|
||||
- (id)initWithContentsOfFile:(NSString *)path byReference:(BOOL)byRef
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
onlyReference = byRef;
|
||||
ASSIGN (name, [path lastPathComponent]);
|
||||
uniqueIdentifier = nil;
|
||||
if ([self getDataFromFileAtPath: path] == NO)
|
||||
{
|
||||
NSLog(@"Could not get sound data from %@", path);
|
||||
DESTROY (self);
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithContentsOfURL:(NSURL *)url byReference:(BOOL)byRef
|
||||
{
|
||||
onlyReference = byRef;
|
||||
return [self initWithData: [NSData dataWithContentsOfURL: url]];
|
||||
}
|
||||
|
||||
- (id)initWithData:(NSData *)data
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)initWithPasteboard:(NSPasteboard *)pasteboard
|
||||
{
|
||||
if ([NSSound canInitWithPasteboard: pasteboard] == YES)
|
||||
{
|
||||
NSData *d = [pasteboard dataForType: @"NSGeneralPboardType"];
|
||||
return [self initWithData: d];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Playing
|
||||
//
|
||||
- (BOOL)pause
|
||||
{
|
||||
if (uniqueIdentifier)
|
||||
{
|
||||
return [[NSSound gsnd] pauseSoundWithIdentifier: uniqueIdentifier];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)play
|
||||
{
|
||||
return [[NSSound gsnd] playSound: self];
|
||||
}
|
||||
|
||||
- (BOOL)resume
|
||||
{
|
||||
if (uniqueIdentifier)
|
||||
{
|
||||
return [[NSSound gsnd] resumeSoundWithIdentifier: uniqueIdentifier];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)stop
|
||||
{
|
||||
if (uniqueIdentifier)
|
||||
{
|
||||
return [[NSSound gsnd] stopSoundWithIdentifier: uniqueIdentifier];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)isPlaying
|
||||
{
|
||||
if (uniqueIdentifier)
|
||||
{
|
||||
return [[NSSound gsnd] isPlayingSoundWithIdentifier: uniqueIdentifier];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
//
|
||||
// Working with pasteboards
|
||||
//
|
||||
+ (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard
|
||||
{
|
||||
NSArray *pbTypes = [pasteboard types];
|
||||
NSArray *myTypes = [NSSound soundUnfilteredPasteboardTypes];
|
||||
|
||||
return ([pbTypes firstObjectCommonWithArray: myTypes] != nil);
|
||||
}
|
||||
|
||||
+ (NSArray *)soundUnfilteredPasteboardTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects: @"NSGeneralPboardType", nil];
|
||||
}
|
||||
|
||||
- (void)writeToPasteboard:(NSPasteboard *)pasteboard
|
||||
{
|
||||
NSData *d = [NSArchiver archivedDataWithRootObject: self];
|
||||
|
||||
if (d != nil) {
|
||||
[pasteboard declareTypes: [NSSound soundUnfilteredPasteboardTypes]
|
||||
owner: nil];
|
||||
[pasteboard setData: d forType: @"NSGeneralPboardType"];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Working with delegates
|
||||
//
|
||||
- (id)delegate
|
||||
{
|
||||
return delegate;
|
||||
}
|
||||
|
||||
- (void)setDelegate:(id)aDelegate
|
||||
{
|
||||
delegate = aDelegate;
|
||||
}
|
||||
|
||||
//
|
||||
// Naming Sounds
|
||||
//
|
||||
+ (id)soundNamed:(NSString *)aName
|
||||
{
|
||||
NSString *realName = [nsmapping objectForKey: aName];
|
||||
NSSound *sound;
|
||||
|
||||
if (realName)
|
||||
{
|
||||
aName = realName;
|
||||
}
|
||||
|
||||
sound = (NSSound *)[nameDict objectForKey: aName];
|
||||
|
||||
if (sound == nil)
|
||||
{
|
||||
NSString *extension;
|
||||
NSString *path = nil;
|
||||
NSBundle *main_bundle;
|
||||
NSArray *array;
|
||||
NSString *the_name = aName;
|
||||
|
||||
// FIXME: This should use [NSBundle pathForSoundResource], but this will
|
||||
// only allow soundUnfilteredFileTypes.
|
||||
/* If there is no sound with that name, search in the main bundle */
|
||||
|
||||
main_bundle = [NSBundle mainBundle];
|
||||
extension = [aName pathExtension];
|
||||
|
||||
if (extension != nil && [extension length] == 0)
|
||||
{
|
||||
extension = nil;
|
||||
}
|
||||
|
||||
/* Check if extension is one of the sound types */
|
||||
array = [NSSound soundUnfilteredFileTypes];
|
||||
|
||||
if ([array indexOfObject: extension] != NSNotFound)
|
||||
{
|
||||
/* Extension is one of the sound types
|
||||
So remove from the name */
|
||||
the_name = [aName stringByDeletingPathExtension];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise extension is not an sound type
|
||||
So leave it alone */
|
||||
the_name = aName;
|
||||
extension = nil;
|
||||
}
|
||||
|
||||
/* First search locally */
|
||||
if (extension)
|
||||
{
|
||||
path = [main_bundle pathForResource: the_name ofType: extension];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
id o, e;
|
||||
|
||||
e = [array objectEnumerator];
|
||||
while ((o = [e nextObject]))
|
||||
{
|
||||
path = [main_bundle pathForResource: the_name ofType: o];
|
||||
if (path != nil && [path length] != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If not found then search in system */
|
||||
if (!path)
|
||||
{
|
||||
if (extension)
|
||||
{
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
path = [NSBundle pathForGNUstepResource: the_name
|
||||
ofType: extension
|
||||
inDirectory: @"Sounds"];
|
||||
#else
|
||||
NSBundle *system = [NSBundle bundleWithPath: @GNUSTEP_INSTALL_LIBDIR];
|
||||
|
||||
path = [system pathForResource: the_name
|
||||
ofType: extension
|
||||
inDirectory: @"Sounds"];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
id o, e;
|
||||
|
||||
e = [array objectEnumerator];
|
||||
while ((o = [e nextObject])) {
|
||||
path = [NSBundle pathForGNUstepResource: the_name
|
||||
ofType: o
|
||||
inDirectory: @"Sounds"];
|
||||
if (path != nil && [path length] != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
NSBundle *system = [NSBundle bundleWithPath: @GNUSTEP_INSTALL_LIBDIR];
|
||||
id o, e;
|
||||
|
||||
e = [array objectEnumerator];
|
||||
while ((o = [e nextObject]))
|
||||
{
|
||||
path = [system pathForResource: the_name
|
||||
ofType: o
|
||||
inDirectory: @"Sounds"];
|
||||
if (path != nil && [path length] != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if ([path length] != 0)
|
||||
{
|
||||
sound = [[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path byReference: NO];
|
||||
|
||||
if (sound != nil)
|
||||
{
|
||||
[sound setName: aName];
|
||||
RELEASE(sound);
|
||||
sound->onlyReference = YES;
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
+ (NSArray *)soundUnfilteredFileTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects: @"aiff", @"waw", @"snd", @"au", nil];
|
||||
}
|
||||
|
||||
- (NSString *)name
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
- (BOOL)setName:(NSString *)aName
|
||||
{
|
||||
BOOL retained = NO;
|
||||
|
||||
if (!aName || [nameDict objectForKey: aName])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (name && self == [nameDict objectForKey: name])
|
||||
{
|
||||
/* We retain self in case removing from the dictionary releases
|
||||
us */
|
||||
RETAIN (self);
|
||||
retained = YES;
|
||||
[nameDict removeObjectForKey: name];
|
||||
}
|
||||
|
||||
ASSIGN(name, aName);
|
||||
|
||||
[nameDict setObject: self forKey: name];
|
||||
if (retained)
|
||||
{
|
||||
RELEASE (self);
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding
|
||||
//
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(BOOL) at: &onlyReference];
|
||||
[coder encodeObject: name];
|
||||
|
||||
if (onlyReference == YES)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (uniqueIdentifier != nil)
|
||||
{
|
||||
[coder encodeObject: uniqueIdentifier];
|
||||
}
|
||||
|
||||
[coder encodeConditionalObject: delegate];
|
||||
[coder encodeValueOfObjCType: @encode(long) at: &dataLocation];
|
||||
[coder encodeValueOfObjCType: @encode(long) at: &dataSize];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &dataFormat];
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &samplingRate];
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &frameSize];
|
||||
[coder encodeValueOfObjCType: @encode(long) at: &frameCount];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &channelCount];
|
||||
|
||||
[coder encodeObject: data];
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder*)decoder
|
||||
{
|
||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &onlyReference];
|
||||
|
||||
if (onlyReference == YES)
|
||||
{
|
||||
NSString *theName = [decoder decodeObject];
|
||||
|
||||
RELEASE (self);
|
||||
self = RETAIN ([NSSound soundNamed: theName]);
|
||||
[self setName: theName];
|
||||
|
||||
} else
|
||||
{
|
||||
NSData *d;
|
||||
|
||||
name = [decoder decodeObject];
|
||||
TEST_RETAIN (name);
|
||||
|
||||
uniqueIdentifier = [decoder decodeObject];
|
||||
if (uniqueIdentifier != nil) {
|
||||
RETAIN (uniqueIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
uniqueIdentifier = nil;
|
||||
}
|
||||
|
||||
delegate = [decoder decodeObject];
|
||||
if (delegate != nil)
|
||||
{
|
||||
[self setDelegate: delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
delegate = nil;
|
||||
}
|
||||
|
||||
[decoder decodeValueOfObjCType: @encode(long) at: &dataLocation];
|
||||
[decoder decodeValueOfObjCType: @encode(long) at: &dataSize];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &dataFormat];
|
||||
[decoder decodeValueOfObjCType: @encode(float) at: &samplingRate];
|
||||
[decoder decodeValueOfObjCType: @encode(float) at: &frameSize];
|
||||
[decoder decodeValueOfObjCType: @encode(long) at: &frameCount];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &channelCount];
|
||||
|
||||
d = [decoder decodeObject];
|
||||
if (d != nil) {
|
||||
data = [d mutableCopy];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)awakeAfterUsingCoder:(NSCoder *)coder
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCopying
|
||||
//
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
NSSound *newSound = (NSSound *)NSCopyObject(self, 0, zone);
|
||||
|
||||
newSound->dataLocation = dataLocation;
|
||||
newSound->dataSize = dataSize;
|
||||
newSound->dataFormat = dataFormat;
|
||||
newSound->samplingRate = samplingRate;
|
||||
newSound->frameSize = frameSize;
|
||||
newSound->frameCount = frameCount;
|
||||
newSound->channelCount = channelCount;
|
||||
newSound->data = [data mutableCopy];
|
||||
newSound->name = [name copy];
|
||||
if (uniqueIdentifier != nil)
|
||||
{
|
||||
newSound->uniqueIdentifier = [uniqueIdentifier copy];
|
||||
}
|
||||
else
|
||||
{
|
||||
newSound->uniqueIdentifier = nil;
|
||||
}
|
||||
newSound->onlyReference = onlyReference;
|
||||
newSound->delegate = delegate;
|
||||
|
||||
return newSound;
|
||||
}
|
||||
|
||||
@end
|
|
@ -3,8 +3,6 @@
|
|||
#
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Scott Christley <scottc@net-community.com>
|
||||
#
|
||||
# This file is part of the GNUstep GUI Library.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
|
@ -17,9 +15,6 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# If you are interested in a warranty or support for this source code,
|
||||
# contact Scott Christley at scottc@net-community.com
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
|
@ -34,7 +29,8 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
include ../config.make
|
||||
|
||||
include ../Version
|
||||
# The applications to be compiled
|
||||
|
||||
SUBPROJECTS = $(BUILD_GSND)
|
||||
TOOL_NAME = make_services set_show_service gopen
|
||||
SERVICE_NAME = example GSspell
|
||||
|
||||
|
@ -57,6 +53,7 @@ GNUSTEP_MAKE_SERVICES=./$(GNUSTEP_OBJ_DIR)/make_services
|
|||
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
include $(GNUSTEP_MAKEFILES)/service.make
|
||||
include $(GNUSTEP_MAKEFILES)/aggregate.make
|
||||
|
||||
-include GNUmakefile.local.service
|
||||
include GNUmakefile.postamble
|
||||
|
|
49
Tools/gsnd/GNUmakefile
Normal file
49
Tools/gsnd/GNUmakefile
Normal file
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# Tools level makefile for gsnd
|
||||
#
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of the GNUstep GUI Library.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
# The applications to be compiled
|
||||
TOOL_NAME = gsnd
|
||||
|
||||
# The source files to be compiled
|
||||
gsnd_OBJC_FILES = gsnd.m
|
||||
|
||||
ifeq (mingw32, $(GNUSTEP_TARGET_OS))
|
||||
gsnd_C_FILES = portaudio/pa_common/pa_lib.c \
|
||||
portaudio/pa_win_ds/dsound_wrapper.c \
|
||||
portaudio/pa_win_ds/pa_dsound.c
|
||||
else
|
||||
gsnd_C_FILES = portaudio/pa_common/pa_lib.c \
|
||||
portaudio/pa_unix_oss/pa_unix_oss.c \
|
||||
portaudio/pa_common/pa_trace.c
|
||||
endif
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
-include GNUmakefile.local
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/tool.make
|
||||
|
||||
-include GNUmakefile.postamble
|
58
Tools/gsnd/GNUmakefile.postamble
Normal file
58
Tools/gsnd/GNUmakefile.postamble
Normal file
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Makefile.postamble
|
||||
#
|
||||
# Project specific makefile rules
|
||||
#
|
||||
# Uncomment the targets you want.
|
||||
# The double colons (::) are important, do not make them single colons
|
||||
# otherwise the normal makefile rules will not be performed.
|
||||
#
|
||||
|
||||
# Things to do before compiling
|
||||
|
||||
ifeq (mingw32, $(GNUSTEP_TARGET_OS))
|
||||
PA_OBJ_DIR = $(GNUSTEP_OBJ_DIR)/portaudio/pa_win_ds
|
||||
else
|
||||
PA_OBJ_DIR = $(GNUSTEP_OBJ_DIR)/portaudio/pa_unix_oss
|
||||
endif
|
||||
|
||||
before-all::
|
||||
test -d $(GNUSTEP_OBJ_DIR)/portaudio/pa_common || \
|
||||
mkdir -p $(GNUSTEP_OBJ_DIR)/portaudio/pa_common ; \
|
||||
test -d $(PA_OBJ_DIR) || \
|
||||
mkdir -p $(PA_OBJ_DIR) ;
|
||||
|
||||
# Things to do after compiling
|
||||
# after-all::
|
||||
|
||||
# Things to do before installing
|
||||
#before-install::
|
||||
|
||||
# Things to do after installing
|
||||
# after-install::
|
||||
|
||||
# Things to do before uninstalling
|
||||
# before-uninstall::
|
||||
|
||||
# Things to do after uninstalling
|
||||
# after-uninstall::
|
||||
|
||||
# Things to do before cleaning
|
||||
# before-clean::
|
||||
|
||||
# Things to do after cleaning
|
||||
# after-clean::
|
||||
|
||||
# Things to do before distcleaning
|
||||
# before-distclean::
|
||||
|
||||
# Things to do after distcleaning
|
||||
after-distclean::
|
||||
rm -f $(GNUSTEP_OBJ_DIR)/portaudio/pa_common
|
||||
rm -f $(PA_OBJ_DIR)
|
||||
|
||||
# Things to do before checking
|
||||
# before-check::
|
||||
|
||||
# Things to do after checking
|
||||
# after-check::
|
40
Tools/gsnd/GNUmakefile.preamble
Normal file
40
Tools/gsnd/GNUmakefile.preamble
Normal file
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# Makefile.preamble
|
||||
#
|
||||
# Project specific makefile variables, and additional
|
||||
#
|
||||
# Do not put any Makefile rules in this file, instead they should
|
||||
# be put into Makefile.postamble.
|
||||
#
|
||||
|
||||
#
|
||||
# Flags dealing with compiling and linking
|
||||
#
|
||||
|
||||
# Additional flags to pass to the preprocessor
|
||||
#ADDITIONAL_CPPFLAGS +=
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
#ADDITIONAL_OBJCFLAGS +=
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
#ADDITIONAL_CFLAGS +=
|
||||
|
||||
# Additional include directories the compiler should search
|
||||
ADDITIONAL_INCLUDE_DIRS += -Iportaudio/pa_common
|
||||
|
||||
# Additional LDFLAGS to pass to the linker
|
||||
#ADDITIONAL_LDFLAGS +=
|
||||
|
||||
# Additional library directories the linker should search
|
||||
# ADDITIONAL_LIB_DIRS += -L../Source/$(GNUSTEP_OBJ_DIR)
|
||||
|
||||
# Additional libraries when linking applications
|
||||
#ADDITIONAL_GUI_LIBS +=
|
||||
|
||||
#
|
||||
# Flags dealing with installing and uninstalling
|
||||
#
|
||||
|
||||
# Additional directories to be created during installation
|
||||
ADDITIONAL_INSTALL_DIRS +=
|
1265
Tools/gsnd/gsnd.m
Normal file
1265
Tools/gsnd/gsnd.m
Normal file
File diff suppressed because it is too large
Load diff
|
@ -6,3 +6,4 @@ ADDITIONAL_INCLUDE_DIRS += @ADDITIONAL_INCLUDE_DIRS@
|
|||
ADDITIONAL_LIB_DIRS += @ADDITIONAL_LIB_DIRS@
|
||||
ADDITIONAL_DEPENDS = @ADDITIONAL_DEPENDS@
|
||||
|
||||
BUILD_GSND=@BUILD_GSND@
|
||||
|
|
181
configure
vendored
181
configure
vendored
|
@ -3175,6 +3175,186 @@ ADDITIONAL_INCLUDE_DIRS="$GRAPHIC_CFLAGS"
|
|||
ADDITIONAL_LIB_DIRS="$GRAPHIC_LFLAGS"
|
||||
ADDITIONAL_DEPENDS="$GRAPHIC_LIBS"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# NSSound
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
for ac_header in audiofile.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
else
|
||||
# Is the header compilable?
|
||||
echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6
|
||||
|
||||
# Is the header present?
|
||||
echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
ac_status=$?
|
||||
egrep -v '^ *\+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null; then
|
||||
if test -s conftest.err; then
|
||||
ac_cpp_err=$ac_c_preproc_warn_flag
|
||||
else
|
||||
ac_cpp_err=
|
||||
fi
|
||||
else
|
||||
ac_cpp_err=yes
|
||||
fi
|
||||
if test -z "$ac_cpp_err"; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc in
|
||||
yes:no )
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
|
||||
no:yes )
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
|
||||
esac
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
eval "$as_ac_Header=$ac_header_preproc"
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
|
||||
fi
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
audio_ok=no
|
||||
BUILD_GSND=
|
||||
echo "$as_me:$LINENO: checking for main in -laudiofile" >&5
|
||||
echo $ECHO_N "checking for main in -laudiofile... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_audiofile_main+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-laudiofile $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
|
||||
#ifdef F77_DUMMY_MAIN
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int F77_DUMMY_MAIN() { return 1; }
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
main ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_audiofile_main=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_lib_audiofile_main=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_audiofile_main" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_audiofile_main" >&6
|
||||
if test $ac_cv_lib_audiofile_main = yes; then
|
||||
audio_ok=yes
|
||||
else
|
||||
audio_ok=no
|
||||
fi
|
||||
|
||||
if test $audio_ok = yes; then
|
||||
ADDITIONAL_DEPENDS="$ADDITIONAL_DEPENDS -laudiofile"
|
||||
BUILD_GSND=gsnd
|
||||
fi
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Record the version
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -3777,6 +3957,7 @@ s,@ac_ct_CC@,$ac_ct_CC,;t t
|
|||
s,@EXEEXT@,$EXEEXT,;t t
|
||||
s,@OBJEXT@,$OBJEXT,;t t
|
||||
s,@CPP@,$CPP,;t t
|
||||
s,@BUILD_GSND@,$BUILD_GSND,;t t
|
||||
s,@GNUSTEP_GUI_VERSION@,$GNUSTEP_GUI_VERSION,;t t
|
||||
s,@GNUSTEP_GUI_MAJOR_VERSION@,$GNUSTEP_GUI_MAJOR_VERSION,;t t
|
||||
s,@GNUSTEP_GUI_MINOR_VERSION@,$GNUSTEP_GUI_MINOR_VERSION,;t t
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -209,6 +209,19 @@ ADDITIONAL_INCLUDE_DIRS="$GRAPHIC_CFLAGS"
|
|||
ADDITIONAL_LIB_DIRS="$GRAPHIC_LFLAGS"
|
||||
ADDITIONAL_DEPENDS="$GRAPHIC_LIBS"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# NSSound
|
||||
#--------------------------------------------------------------------
|
||||
AC_CHECK_HEADERS(audiofile.h)
|
||||
audio_ok=no
|
||||
BUILD_GSND=
|
||||
AC_CHECK_LIB(audiofile, main, audio_ok=yes, audio_ok=no)
|
||||
if test $audio_ok = yes; then
|
||||
ADDITIONAL_DEPENDS="$ADDITIONAL_DEPENDS -laudiofile"
|
||||
BUILD_GSND=gsnd
|
||||
fi
|
||||
AC_SUBST(BUILD_GSND)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Record the version
|
||||
#--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue