@Override public void run () { while (true) { recorder.read(samples, 0, samples.length); device.writeSamples(samples, 0, samples.length); } } });
@Override public void run () { onCompletionListener.onCompletion(AndroidMusic.this); } });
@Override public void create () { Gdx.audio.newSound(Gdx.files.internal("data/tic.ogg")).play(); }
public void clicked (InputEvent event, float x, float y) { sound.stop(soundId); } });
@Override public void create () { // copy an internal mp3 to the external storage FileHandle src = Gdx.files.internal("data/8.12.mp3"); FileHandle dst = Gdx.files.external("8.12.mp3"); src.copyTo(dst); // create a music instance and start playback Music music = Gdx.audio.newMusic(dst); music.play(); }
@Override public void changed (ChangeEvent event, Actor actor) { if(music != null) music.setLooping(btLoop.isChecked()); } });
@Override public void dispose () { ui.dispose(); skin.dispose(); sound.dispose(); } }
@Override public void dispose () { batch.dispose(); buttons.getTexture().dispose(); music.dispose(); } }
@Override public void run () { final float frequency = 440; float increment = (float)(2 * Math.PI) * frequency / 44100; // angular increment for each sample float angle = 0; float samples[] = new float[1024]; while (!stop) { for (int i = 0; i < samples.length; i += 2) { samples[i] = 0.5f * (float)Math.sin(angle); samples[i + 1] = 2 * samples[i]; angle += increment; } device.writeSamples(samples, 0, samples.length); } device.dispose(); } });
public void changed (ChangeEvent event, Actor actor) { sound.setVolume(soundId, volume.getValue()); volumeValue.setText("" + volume.getValue()); } });
@Override public void changed (ChangeEvent event, Actor actor) { if (!sliderUpdating && slider.isDragging()) music.setPosition((slider.getValue() / 100f) * songDuration); } });
public void changed (ChangeEvent event, Actor actor) { sound.setPitch(soundId, pitch.getValue()); pitchValue.setText("" + pitch.getValue()); } });
public void changed (ChangeEvent event, Actor actor) { sound.setPan(soundId, pan.getValue(), volume.getValue()); panValue.setText("" + pan.getValue()); } });
@Override public void run () { onCompletionListener.onCompletion(AndroidMusic.this); } });
@Override public void onfinish () { if (isLooping) play(); else if (onCompletionListener != null) onCompletionListener.onCompletion(this); } }
@Override public void onfinish () { if (isLooping) play(); else if (onCompletionListener != null) onCompletionListener.onCompletion(this); } }
public void update () { if (audio.noDevice) return; if (sourceID == -1) return; boolean end = false; int buffers = alGetSourcei(sourceID, AL_BUFFERS_PROCESSED); while (buffers-- > 0) { int bufferID = alSourceUnqueueBuffers(sourceID); if (bufferID == AL_INVALID_VALUE) break; if (renderedSecondsQueue.size > 0) renderedSeconds = renderedSecondsQueue.pop(); if (end) continue; if (fill(bufferID)) alSourceQueueBuffers(sourceID, bufferID); else end = true; } if (end && alGetSourcei(sourceID, AL_BUFFERS_QUEUED) == 0) { stop(); if (onCompletionListener != null) onCompletionListener.onCompletion(this); } // A buffer underflow will cause the source to stop. if (isPlaying && alGetSourcei(sourceID, AL_SOURCE_STATE) != AL_PLAYING) alSourcePlay(sourceID); }
public void update () { if (audio.noDevice) return; if (sourceID == -1) return; boolean end = false; int buffers = alGetSourcei(sourceID, AL_BUFFERS_PROCESSED); while (buffers-- > 0) { int bufferID = alSourceUnqueueBuffers(sourceID); if (bufferID == AL_INVALID_VALUE) break; if (renderedSecondsQueue.size > 0) renderedSeconds = renderedSecondsQueue.pop(); if (end) continue; if (fill(bufferID)) alSourceQueueBuffers(sourceID, bufferID); else end = true; } if (end && alGetSourcei(sourceID, AL_BUFFERS_QUEUED) == 0) { stop(); if (onCompletionListener != null) onCompletionListener.onCompletion(this); } // A buffer underflow will cause the source to stop. if (isPlaying && alGetSourcei(sourceID, AL_SOURCE_STATE) != AL_PLAYING) alSourcePlay(sourceID); }