use of cli.System.Threading.WaitCallback in project playn by threerings.
the class IOSAudio method createAVAP.
Sound createAVAP(NSUrl url) {
final IOSSoundAVAP sound = new IOSSoundAVAP();
ThreadPool.QueueUserWorkItem(new WaitCallback(new WaitCallback.Method() {
public void Invoke(Object arg) {
NSUrl url = (NSUrl) arg;
NSError[] error = new NSError[1];
AVAudioPlayer player = AVAudioPlayer.FromUrl(url, error);
if (error[0] == null) {
dispatchLoaded(sound, player);
} else {
platform.log().warn("Error loading sound [" + url + ", " + error[0] + "]");
dispatchLoadError(sound, new Exception(error[0].ToString()));
}
}
}), url);
return sound;
}
use of cli.System.Threading.WaitCallback in project playn by threerings.
the class IOSAudio method createOAL.
Sound createOAL(String assetPath) {
final IOSSoundOAL sound = new IOSSoundOAL(this);
ThreadPool.QueueUserWorkItem(new WaitCallback(new WaitCallback.Method() {
public void Invoke(Object arg) {
String path = (String) arg;
int bufferId = 0;
try {
bufferId = AL.GenBuffer();
CAFLoader.load(path, bufferId);
dispatchLoaded(sound, bufferId);
} catch (Throwable t) {
if (bufferId != 0)
AL.DeleteBuffer(bufferId);
dispatchLoadError(sound, t);
}
}
}), assetPath);
return sound;
}
Aggregations