public void setSoundPitch (long soundId, float pitch) { if (!soundIdToSource.containsKey(soundId)) return; int sourceId = soundIdToSource.get(soundId); AL10.alSourcef(sourceId, AL10.AL_PITCH, pitch); }
/** Add the instance to the managed instances. * You should avoid using this method. This method is intended for internal purposes only. */ public static void addInstance(final btCollisionObject obj) { instances.put(getCPtr(obj), obj); }
/** Remove the instance to the managed instances. * Be careful using this method. This method is intended for internal purposes only. */ public static void removeInstance(final btCollisionObject obj) { instances.remove(getCPtr(obj)); }
private static Material getMaterial (ModelMesh modelMesh, Texture texture, String textureName) { Material m = null; long materialHash = Hash.RSHash(modelMesh.toString() + textureName); if (cachedMaterials == null) { cachedMaterials = new LongMap<Material>(); } if (cachedMaterials.containsKey(materialHash)) { return cachedMaterials.get(materialHash); } else { TextureAttribute ta = new TextureAttribute(texture, 0, "u_texture"); m = new Material("default", ta); cachedMaterials.put(materialHash, m); } return m; }
int obtainSource (boolean isMusic) { if (noDevice) return 0; for (int i = 0, n = idleSources.size; i < n; i++) { int sourceId = idleSources.get(i); int state = alGetSourcei(sourceId, AL_SOURCE_STATE); if (state != AL_PLAYING && state != AL_PAUSED) { if (isMusic) { idleSources.removeIndex(i); } else { if (sourceToSoundId.containsKey(sourceId)) { long soundId = sourceToSoundId.get(sourceId); sourceToSoundId.remove(sourceId); soundIdToSource.remove(soundId); } long soundId = nextSoundId++; sourceToSoundId.put(sourceId, soundId); soundIdToSource.put(soundId, sourceId); } alSourceStop(sourceId); alSourcei(sourceId, AL_BUFFER, 0); AL10.alSourcef(sourceId, AL10.AL_GAIN, 1); AL10.alSourcef(sourceId, AL10.AL_PITCH, 1); AL10.alSource3f(sourceId, AL10.AL_POSITION, 0, 0, 1f); return sourceId; } } return -1; }
public static ScreenTransition getTransition (TransitionType transitionType) { ScreenTransition transition = transitions.get(transitionType.hash); if (transition == null) { transition = createTransition(transitionType); transitions.put(transitionType.hash, transition); } else { transition.reset(); } return transition; }
public static class Library extends Pointer implements Disposable { LongMap<ByteBuffer> fontData = new LongMap<ByteBuffer>();
private boolean reportFixture (long addr) { if (queryCallback != null) return queryCallback.reportFixture(fixtures.get(addr)); else return false; }
public void dispose () { if (noDevice) return; for (int i = 0, n = allSources.size; i < n; i++) { int sourceID = allSources.get(i); int state = alGetSourcei(sourceID, AL_SOURCE_STATE); if (state != AL_STOPPED) alSourceStop(sourceID); alDeleteSources(sourceID); } sourceToSoundId.clear(); soundIdToSource.clear(); AL.destroy(); while (AL.isCreated()) { try { Thread.sleep(10); } catch (InterruptedException e) { } } }
/** @param bodies an Array in which to place all bodies currently in the simulation */ public void getBodies (Array<Body> bodies) { bodies.clear(); bodies.ensureCapacity(this.bodies.size); for (Iterator<Body> iter = this.bodies.values(); iter.hasNext();) { bodies.add(iter.next()); } }
cachedStillModels = new LongMap<StillModel>(); if (cachedStillModels.containsKey(modelHash)) { return cachedStillModels.get(modelHash); } else { try { cachedStillModels.put(modelHash, m); } catch (IOException ioex) { Gdx.app.log("ModelFactory", ioex.getMessage());
int obtainSource (boolean isMusic) { if (noDevice) return 0; for (int i = 0, n = idleSources.size; i < n; i++) { int sourceId = idleSources.get(i); int state = alGetSourcei(sourceId, AL_SOURCE_STATE); if (state != AL_PLAYING && state != AL_PAUSED) { if (isMusic) { idleSources.removeIndex(i); } else { if (sourceToSoundId.containsKey(sourceId)) { long soundId = sourceToSoundId.get(sourceId); sourceToSoundId.remove(sourceId); soundIdToSource.remove(soundId); } long soundId = nextSoundId++; sourceToSoundId.put(sourceId, soundId); soundIdToSource.put(soundId, sourceId); } alSourceStop(sourceId); alSourcei(sourceId, AL_BUFFER, 0); AL10.alSourcef(sourceId, AL10.AL_GAIN, 1); AL10.alSourcef(sourceId, AL10.AL_PITCH, 1); AL10.alSource3f(sourceId, AL10.AL_POSITION, 0, 0, 1f); return sourceId; } } return -1; }
public static class Library extends Pointer implements Disposable { LongMap<ByteBuffer> fontData = new LongMap<ByteBuffer>();
/** @return The existing instance for the specified pointer, or a newly created instance if the instance didn't exist */ public static btCollisionObject getInstance(final long swigCPtr, boolean owner) { if (swigCPtr == 0) return null; btCollisionObject result = instances.get(swigCPtr); if (result == null) result = new btCollisionObject(swigCPtr, owner); return result; }