Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSSound.d @ 13:f565d3a95c0a
Ported dwt.internal
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 22 Aug 2008 16:46:34 +0200 |
parents | 8b48be5454ce |
children |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSSound; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSData; import dwt.internal.cocoa.NSDate : NSTimeInterval; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSPasteboard; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.NSURL; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSSound : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public static bool canInitWithPasteboard (NSPasteboard pasteboard) { return OS.objc_msgSend(OS.class_NSSound, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id_ : null) !is null; } public NSArray channelMapping () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_channelMapping); return result !is null ? new NSArray(result) : null; } public NSTimeInterval currentTime () { return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id_, OS.sel_currentTime); } public id delegatee () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate); return result !is null ? new id(result) : null; } public NSTimeInterval duration () { return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id_, OS.sel_duration); } public id initWithContentsOfFile (NSString path, bool byRef) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1byReference_1, path !is null ? path.id_ : null, byRef); return result !is null ? new id(result) : null; } public id initWithContentsOfURL (NSURL url, bool byRef) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1byReference_1, url !is null ? url.id_ : null, byRef); return result !is null ? new id(result) : null; } public id initWithData (NSData data) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithData_1, data !is null ? data.id_ : null); return result !is null ? new id(result) : null; } public id initWithPasteboard (NSPasteboard pasteboard) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithPasteboard_1, pasteboard !is null ? pasteboard.id_ : null); return result !is null ? new id(result) : null; } public bool isPlaying () { return OS.objc_msgSend(this.id_, OS.sel_isPlaying) !is null; } public bool loops () { return OS.objc_msgSend(this.id_, OS.sel_loops) !is null; } public NSString name () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); return result !is null ? new NSString(result) : null; } public bool pause () { return OS.objc_msgSend(this.id_, OS.sel_pause) !is null; } public bool play () { return OS.objc_msgSend(this.id_, OS.sel_play) !is null; } public NSString playbackDeviceIdentifier () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_playbackDeviceIdentifier); return result !is null ? new NSString(result) : null; } public bool resume () { return OS.objc_msgSend(this.id_, OS.sel_resume) !is null; } public void setChannelMapping (NSArray channelMapping) { OS.objc_msgSend(this.id_, OS.sel_setChannelMapping_1, channelMapping !is null ? channelMapping.id_ : null); } public void setCurrentTime (NSTimeInterval seconds) { OS.objc_msgSend(this.id_, OS.sel_setCurrentTime_1, seconds); } public void setDelegate (id aDelegate) { OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, aDelegate !is null ? aDelegate.id_ : null); } public void setLoops (bool val) { OS.objc_msgSend(this.id_, OS.sel_setLoops_1, val); } public bool setName (NSString string) { return OS.objc_msgSend(this.id_, OS.sel_setName_1, string !is null ? string.id_ : null) !is null; } public void setPlaybackDeviceIdentifier (NSString deviceUID) { OS.objc_msgSend(this.id_, OS.sel_setPlaybackDeviceIdentifier_1, deviceUID !is null ? deviceUID.id_ : null); } public void setVolume (float volume) { OS.objc_msgSend(this.id_, OS.sel_setVolume_1, volume); } public static id soundNamed (NSString name) { objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundNamed_1, name !is null ? name.id_ : null); return result !is null ? new id(result) : null; } public static NSArray soundUnfilteredFileTypes () { objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredFileTypes); return result !is null ? new NSArray(result) : null; } public static NSArray soundUnfilteredPasteboardTypes () { objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredPasteboardTypes); return result !is null ? new NSArray(result) : null; } public static NSArray soundUnfilteredTypes () { objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredTypes); return result !is null ? new NSArray(result) : null; } public bool stop () { return OS.objc_msgSend(this.id_, OS.sel_stop) !is null; } public float volume () { return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_volume); } public void writeToPasteboard (NSPasteboard pasteboard) { OS.objc_msgSend(this.id_, OS.sel_writeToPasteboard_1, pasteboard !is null ? pasteboard.id_ : null); } }