private Sound createSound(String path, boolean isMusic) { // look for .caf (uncompressed), .aifc (compressed, but fast), then .mp3 for (String encpath : new String[] { path + ".caf", path + ".aifc", path + ".mp3" }) { File fullPath = resolvePath(encpath); if (!fullPath.exists()) continue; return plat.audio().createSound(fullPath, isMusic); } plat.log().warn("Missing sound: " + path); return new Sound.Error(new FileNotFoundException(path)); }
protected Sound getSound(String path, boolean music) { Exception err = null; for (String suff : SUFFIXES) { final String soundPath = path + suff; try { return plat.audio().createSound(requireResource(soundPath), music); } catch (Exception e) { err = e; // note the error, and loop through and try the next format } } plat.log().warn("Sound load error " + path + ": " + err); return new Sound.Error(err); }
protected Sound getSound(String path, boolean music) { Exception err = null; for (String suff : SUFFIXES) { final String soundPath = path + suff; try { return plat.audio().createSound(requireResource(soundPath), music); } catch (Exception e) { err = e; // note the error, and loop through and try the next format } } plat.log().warn("Sound load error " + path + ": " + err); return new Sound.Error(err); }
protected Sound getSound(String path, boolean music) { Exception err = null; for (String suff : SUFFIXES) { final String soundPath = path + suff; try { return platform.audio().createSound(requireResource(soundPath), music); } catch (Exception e) { err = e; // note the error, and loop through and try the next format } } platform.log().warn("Sound load error " + path + ": " + err); return new Sound.Error(err); }
protected Sound getSound(String path, boolean music) { Exception err = null; for (String suff : SUFFIXES) { final String soundPath = path + suff; try { return platform.audio().createSound(requireResource(soundPath), music); } catch (Exception e) { err = e; // note the error, and loop through and try the next format } } platform.log().warn("Sound load error " + path + ": " + err); return new Sound.Error(err); }
private Sound createSound(String path, boolean isMusic) { // look for .caf (uncompressed), .aifc (compressed, but fast), then .mp3 for (String encpath : new String[] { path + ".caf", path + ".aifc", path + ".mp3" }) { File fullPath = resolvePath(encpath); if (!fullPath.exists()) continue; return platform.audio().createSound(fullPath, isMusic); } platform.log().warn("Missing sound: " + path); return new Sound.Error(new FileNotFoundException(path)); } }