Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSSound.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSSound; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSData; | |
19 import dwt.internal.cocoa.NSDate : NSTimeInterval; | |
20 import dwt.internal.cocoa.NSObject; | |
21 import dwt.internal.cocoa.NSPasteboard; | |
22 import dwt.internal.cocoa.NSString; | |
23 import dwt.internal.cocoa.NSURL; | |
24 import dwt.internal.cocoa.OS; | |
25 import objc = dwt.internal.objc.runtime; | |
26 | |
27 public class NSSound : NSObject | |
28 { | |
29 | |
30 public this () | |
31 { | |
32 super(); | |
33 } | |
34 | |
35 public this (objc.id id) | |
36 { | |
37 super(id); | |
38 } | |
39 | |
40 public static bool canInitWithPasteboard (NSPasteboard pasteboard) | |
41 { | |
42 return OS.objc_msgSend(OS.class_NSSound, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id : null) !is null; | |
43 } | |
44 | |
45 public NSArray channelMapping () | |
46 { | |
47 objc.id result = OS.objc_msgSend(this.id, OS.sel_channelMapping); | |
48 return result !is null ? new NSArray(result) : null; | |
49 } | |
50 | |
51 public NSTimeInterval currentTime () | |
52 { | |
53 return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id, OS.sel_currentTime); | |
54 } | |
55 | |
56 public id delegatee () | |
57 { | |
58 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); | |
59 return result !is null ? new id(result) : null; | |
60 } | |
61 | |
62 public NSTimeInterval duration () | |
63 { | |
64 return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id, OS.sel_duration); | |
65 } | |
66 | |
67 public id initWithContentsOfFile (NSString path, bool byRef) | |
68 { | |
69 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_1byReference_1, path !is null ? path.id : null, byRef); | |
70 return result !is null ? new id(result) : null; | |
71 } | |
72 | |
73 public id initWithContentsOfURL (NSURL url, bool byRef) | |
74 { | |
75 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfURL_1byReference_1, url !is null ? url.id : null, byRef); | |
76 return result !is null ? new id(result) : null; | |
77 } | |
78 | |
79 public id initWithData (NSData data) | |
80 { | |
81 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_1, data !is null ? data.id : null); | |
82 return result !is null ? new id(result) : null; | |
83 } | |
84 | |
85 public id initWithPasteboard (NSPasteboard pasteboard) | |
86 { | |
87 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithPasteboard_1, pasteboard !is null ? pasteboard.id : null); | |
88 return result !is null ? new id(result) : null; | |
89 } | |
90 | |
91 public bool isPlaying () | |
92 { | |
93 return OS.objc_msgSend(this.id, OS.sel_isPlaying) !is null; | |
94 } | |
95 | |
96 public bool loops () | |
97 { | |
98 return OS.objc_msgSend(this.id, OS.sel_loops) !is null; | |
99 } | |
100 | |
101 public NSString name () | |
102 { | |
103 objc.id result = OS.objc_msgSend(this.id, OS.sel_name); | |
104 return result !is null ? new NSString(result) : null; | |
105 } | |
106 | |
107 public bool pause () | |
108 { | |
109 return OS.objc_msgSend(this.id, OS.sel_pause) !is null; | |
110 } | |
111 | |
112 public bool play () | |
113 { | |
114 return OS.objc_msgSend(this.id, OS.sel_play) !is null; | |
115 } | |
116 | |
117 public NSString playbackDeviceIdentifier () | |
118 { | |
119 objc.id result = OS.objc_msgSend(this.id, OS.sel_playbackDeviceIdentifier); | |
120 return result !is null ? new NSString(result) : null; | |
121 } | |
122 | |
123 public bool resume () | |
124 { | |
125 return OS.objc_msgSend(this.id, OS.sel_resume) !is null; | |
126 } | |
127 | |
128 public void setChannelMapping (NSArray channelMapping) | |
129 { | |
130 OS.objc_msgSend(this.id, OS.sel_setChannelMapping_1, channelMapping !is null ? channelMapping.id : null); | |
131 } | |
132 | |
133 public void setCurrentTime (NSTimeInterval seconds) | |
134 { | |
135 OS.objc_msgSend(this.id, OS.sel_setCurrentTime_1, seconds); | |
136 } | |
137 | |
138 public void setDelegate (id aDelegate) | |
139 { | |
140 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, aDelegate !is null ? aDelegate.id : null); | |
141 } | |
142 | |
143 public void setLoops (bool val) | |
144 { | |
145 OS.objc_msgSend(this.id, OS.sel_setLoops_1, val); | |
146 } | |
147 | |
148 public bool setName (NSString string) | |
149 { | |
150 return OS.objc_msgSend(this.id, OS.sel_setName_1, string !is null ? string.id : null) !is null; | |
151 } | |
152 | |
153 public void setPlaybackDeviceIdentifier (NSString deviceUID) | |
154 { | |
155 OS.objc_msgSend(this.id, OS.sel_setPlaybackDeviceIdentifier_1, deviceUID !is null ? deviceUID.id : null); | |
156 } | |
157 | |
158 public void setVolume (float volume) | |
159 { | |
160 OS.objc_msgSend(this.id, OS.sel_setVolume_1, volume); | |
161 } | |
162 | |
163 public static id soundNamed (NSString name) | |
164 { | |
165 objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundNamed_1, name !is null ? name.id : null); | |
166 return result !is null ? new id(result) : null; | |
167 } | |
168 | |
169 public static NSArray soundUnfilteredFileTypes () | |
170 { | |
171 objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredFileTypes); | |
172 return result !is null ? new NSArray(result) : null; | |
173 } | |
174 | |
175 public static NSArray soundUnfilteredPasteboardTypes () | |
176 { | |
177 objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredPasteboardTypes); | |
178 return result !is null ? new NSArray(result) : null; | |
179 } | |
180 | |
181 public static NSArray soundUnfilteredTypes () | |
182 { | |
183 objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredTypes); | |
184 return result !is null ? new NSArray(result) : null; | |
185 } | |
186 | |
187 public bool stop () | |
188 { | |
189 return OS.objc_msgSend(this.id, OS.sel_stop) !is null; | |
190 } | |
191 | |
192 public float volume () | |
193 { | |
194 return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_volume); | |
195 } | |
196 | |
197 public void writeToPasteboard (NSPasteboard pasteboard) | |
198 { | |
199 OS.objc_msgSend(this.id, OS.sel_writeToPasteboard_1, pasteboard !is null ? pasteboard.id : null); | |
200 } | |
201 | |
202 } |