Package javax.sound.sampled

Examples of javax.sound.sampled.SourceDataLine.start()


            line.open();
        } catch (LineUnavailableException ex) {
            LOG.log(Level.SEVERE, null, ex);
            return;
        }
        line.start();
        OggPlayer player = new OggPlayer(line);

        InputStream in;
        try {
            in = new FileInputStream("Agogo.ogg");
View Full Code Here


        if (line != null) {
            // open it
            line.open();

            // start
            line.start();
            int nBytesRead = 0, nBytesWritten = 0;
            while (nBytesRead != -1) {
                nBytesRead = dataIn.read(data, 0, data.length);
                if (nBytesRead != -1) {
                    nBytesWritten = line.write(data, 0, nBytesRead);
View Full Code Here

    int sampleSize = 2;
    AudioFormat audioFormat = new AudioFormat(sampleRate, 8 * sampleSize, outChans, true, true);
    DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
    SourceDataLine sourceDataLine = (SourceDataLine) AudioSystem.getLine(info);
    sourceDataLine.open(audioFormat);
    sourceDataLine.start();

    // Buffer setup for exchanging samples between libpd and JavaSound.
    // Question: Is this the best possible solution?  It seems to involve too
    // much copying.
    int frames = PdBase.blockSize() * ticks;
 
View Full Code Here

                pan.setValue(1.0f);
            else if (curPosition == Position.LEFT)
                pan.setValue(-1.0f);
        }
        auline.start();
        int nBytesRead = 0;
        byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
        try {
            while (nBytesRead != -1) {
View Full Code Here

                    try {
                        AudioFormat af = new AudioFormat(SAMPLE_RATE, 8, 1, true, true);
                        DataLine.Info info = new DataLine.Info(SourceDataLine.class, af);
                        SourceDataLine source = (SourceDataLine) AudioSystem.getLine(info);
                        source.open(af);
                        source.start();
                        byte[] buf = new byte[(int) (SAMPLE_RATE * seconds)];
                        for (int i = 0; i < buf.length; i++) {
                            buf[i] = (byte) (Math.sin(RAD * frequency / SAMPLE_RATE * i) * 64.0 / Math.sqrt(i));
                        }
                        source.write(buf, 0, buf.length);
View Full Code Here

                pan.setValue(1.0f);
            else if (curPosition == Position.LEFT)
                pan.setValue(-1.0f);
        }

        auline.start();
        int nBytesRead = 0;
        byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];

        try {
            while (nBytesRead != -1) {
View Full Code Here

        }

        total++;

        log("    start...");
        line.start();

        AsyncLineStopper lineStopper = new AsyncLineStopper(line, STOPPER_DELAY);
        int offset = scenario.getBufferOffset(line);
        int len = scenario.getBufferLength(line);
        // ensure len represents integral number of frames
View Full Code Here

            } else if (curPosition == Position.LEFT) {
                pan.setValue(-1.0f);
            }
        }

        auline.start();
        int nBytesRead = 0;
        byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];

        try {
            while (nBytesRead != -1) {
View Full Code Here

            System.out.println("Scale: " + scale);

            SourceDataLine line = AudioSystem.getSourceDataLine(af);
            line.open(af);
            line.start();

            Double[] scaleFrequencies = scale.toArray(new Double[scale.size()]);

            // first play the whole scale
            WaveMelodyGenerator.playScale(line, scaleFrequencies);
View Full Code Here

                                        audioFormat.getFrameRate() * (float) (speed * calibration),
                                        audioFormat.isBigEndian());
                                DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
                                audioOutputLine = (SourceDataLine) AudioSystem.getLine(info);
                                audioOutputLine.open(audioFormat);
                                audioOutputLine.start();
                            }
                            stateChange = State.PLAYING;
                            break;
                        case PAUSE:
                            stateChange = State.PAUSED;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.