Package vavi.sound.mobile

Examples of vavi.sound.mobile.AudioEngine$Util


    }

    /* */
    public void sequence() throws InvalidSmafDataException {
Debug.println("WAVE DATA: " + number);
        AudioEngine engine = Factory.getAudioEngine(format);
        engine.setData(number, -1, samplingRate, samplingBits, channels, data, false);
    }
View Full Code Here


    }

    /* */
    public void sequence() throws InvalidSmafDataException {
Debug.println("WAVE PLAY: " + number);
        AudioEngine engine = Factory.getAudioEngine();
        engine.start(number);
    }
View Full Code Here

    /** */
    public void sequence() throws InvalidMfiDataException {
        int id = getIndex();

        AudioEngine engine = Factory.getAudioEngine();
        engine.start(id);
    }
View Full Code Here

    public static List<MfiEvent> getAdpcmEvents(byte[] pcm, float time, int sampleRate, int bits, int channels, int adpcmVolume) throws InvalidMfiDataException {
        int delta = getDelta(time);
Debug.println("delta: " + delta + ", time: " + time);
        int velocity = (int) (adpcmVolume * maxVelocity / 100f);

        AudioEngine audioEngine = NecSequencer.getAudioEngine();

        int numberOfChunks = pcm.length / (PCM_MAX_BLOCK * channels);
        int moduloOfChunks = pcm.length % (PCM_MAX_BLOCK * channels);

        List<MfiEvent> events = new ArrayList<MfiEvent>();

        // 1. data
        int streamNumber = 0;
        for (int i = 0; i < numberOfChunks; i++) {
            byte[] temp = new byte[PCM_MAX_BLOCK * channels];
            System.arraycopy(pcm, (PCM_MAX_BLOCK * channels) * i, temp, 0, PCM_MAX_BLOCK * channels);
            byte[] chunk = audioEngine.encode(4, channels, temp);
            if (channels == 1) {
Debug.println("wave chunk(" + i + "): " + chunk.length);
       
                // adpcm data
                events.add(getVoiceEvent(streamNumber++, channels, sampleRate, chunk));

            } else {
                byte[] chunkM = new byte[chunk.length / 2];

                System.arraycopy(chunk, 0, chunkM, 0, chunkM.length);
Debug.println("wave l chunk(" + i + "): " + chunkM.length);

                // adpcm data L
                events.add(getVoiceEvent(streamNumber++, 1, sampleRate, chunkM)); // TODO channel is 1

                System.arraycopy(chunk, chunkM.length, chunkM, 0, chunkM.length);
Debug.println("wave r chunk(" + i + "): " + chunkM.length);

                // adpcm data R
                events.add(getVoiceEvent(streamNumber++, 1, sampleRate, chunkM)); // TODO channel is 1
            }
        }
        if (moduloOfChunks != 0) {
            byte[] temp = new byte[moduloOfChunks];
            System.arraycopy(pcm, (PCM_MAX_BLOCK * channels) * numberOfChunks, temp, 0, moduloOfChunks);
            byte[] chunk = audioEngine.encode(4, channels, temp);
            if (channels == 1) {
Debug.println("wave chunk(" + numberOfChunks + "): " + chunk.length);
           
                // adpcm data
                events.add(getVoiceEvent(streamNumber++, channels, sampleRate, chunk));
View Full Code Here

    public static List<MfiEvent> getAdpcmEventsEx(byte[] pcm, float time, int sampleRate, int bits, int channels, int adpcmVolume) throws InvalidMfiDataException {
        int delta = getDelta(time);
Debug.println("delta: " + delta + ", time: " + time);
        int velocity = (int) (adpcmVolume * maxVelocity / 100f);

        AudioEngine audioEngine = NecSequencer.getAudioEngine();

        byte[] adpcm = audioEngine.encode(4, channels, pcm);
Debug.println("adpcm length: " + adpcm.length);
//System.err.println("pcm:\n" + StringUtil.getDump(pcm, 64) + "adpcm L:\n" + StringUtil.getDump(adpcm, 64) +"adpcm R:\n" + StringUtil.getDump(adpcm, adpcm.length / 2, 64));

        int numberOfChunks = adpcm.length / MAX_BLOCK;
        int moduloOfChunks = adpcm.length % MAX_BLOCK;
View Full Code Here

    }

    /** unused ??? */
    public byte[] getMessage() throws InvalidMfiDataException {

        AudioEngine audioEngine = NecSequencer.getAudioEngine();
        adpcm = audioEngine.encode(4, 1, pcm); // TODO bits, channel
Debug.println("adpcm length: " + adpcm.length);

        // [10~]
        byte[] tmp = new byte[adpcm.length + 5];

View Full Code Here

        AdpmMessage adpm = (AdpmMessage) subChunks.get(AdpmMessage.TYPE);
        int samplingRate = adpm.getSamplingRate() * 1000;
        int samplingBits = adpm.getSamplingBits();
        int channels = adpm.getChannels();

        AudioEngine engine = Factory.getAudioEngine(format);
        engine.setData(id, -1, samplingRate, samplingBits, channels, data, false);
    }
View Full Code Here

TOP

Related Classes of vavi.sound.mobile.AudioEngine$Util

Copyright © 2018 www.massapicom. 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.