Package vavi.sound.mfi

Examples of vavi.sound.mfi.MfiEvent


    /** */
    private static final TempoMessage tempoMessage = new TempoMessage(0x00, 0xff, 0xc2, 50);

    /** @return TempoMessage is always the same instance */
    public static MfiEvent getTempoEvent() {
        return new MfiEvent(tempoMessage, 0l);
    }
View Full Code Here


     * @param masterVolume in %
     */
    public static MfiEvent getMasterVolumeEvent(int masterVolume) {
        int realMasterVolume = (int) (masterVolume * maxMasterVolume / 100f);
        MfiMessage message = new MasterVolumeMessage(0x00, 0xff, 0xb0, realMasterVolume);
        return new MfiEvent(message, 0l);
    }
View Full Code Here

     * @param adpcmVolume in %
     */
    public static MfiEvent getVolumeEvent(int adpcmVolume) {
        int realAdpcmVolume = (int) (adpcmVolume * maxAdpcmVolume / 100f);
        MfiMessage message = new AudioChannelVolumeMessage(0x00, 0x7f, 0x80, realAdpcmVolume);
        return new MfiEvent(message, 0l);
    }
View Full Code Here

     *
     * @param pan
     */
    public static MfiEvent getPanEvent(int pan) {
        MfiMessage message = new AudioChannelPanpotMessage(0x00, 0x7f, 0x81, pan);
        return new MfiEvent(message, 0l);
    }
View Full Code Here

    }

    /** */
    public static MfiEvent getPlayEvent() {
        MfiMessage message = new AudioPlayMessage(0x00, 0x7f, 0x00, new byte[] { 0, 63 });
        return new MfiEvent(message, 0l);
    }
View Full Code Here

     *
     * @param start true: start, false: end
     */
    public static MfiEvent getCuePointEvent(boolean start) {
        MfiMessage message = new CuePointMessage(0x00, start ? 0x00 : 0x01);
        return new MfiEvent(message, 0l);
    }
View Full Code Here

    /** */
    private static final TempoMessage tempoMessage = new TempoMessage(0x00, 0xff, 0xcb, 100);

    /** @return TempoMessage is always the same instance */
    public static MfiEvent getTempoEvent() {
        return new MfiEvent(tempoMessage, 0l);
    }
View Full Code Here

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

        int delta = getDelta(time);
Debug.println("delta: " + delta);
        for (int i = 0; i < delta / Nop2Message.maxDelta; i++) {
            events.add(new MfiEvent(new Nop2Message(0xff, 0xff), 0l));
        }
        int moduloOfDelta = delta % Nop2Message.maxDelta;
        events.add(new MfiEvent(new Nop2Message(moduloOfDelta % 0x100, moduloOfDelta / 0x100), 0l));

        return events;
    }
View Full Code Here

    /** 0x80 */
    private static List<MfiEvent> getAudioEventsType1(byte[] data, int sampleRate, int bits, int channels) {
        List<MfiEvent> events = new ArrayList<MfiEvent>();
        // exst
        events.add(new MfiEvent(new ExstMessage(1), 0l));

        // ainf
        events.add(new MfiEvent(new AinfMessage(false, 1), 0l));

        // audio data
        AudioEngine audioEngine = Factory.getAudioEngine(0x80); // TODO 0x80 is not defined in spec
        byte[] adpcm = audioEngine.encode(bits, channels, data);
        AdpmMessage adpmMessage = new AdpmMessage(sampleRate / 1000, bits, false, channels);
        AudioDataMessage audioData = new AudioDataMessage(0x80, 0x00, adpmMessage); // TODO 0x80 is not defined in spec
        audioData.setData(adpcm);
        events.add(new MfiEvent(audioData, 0l));

        return events;
    }
View Full Code Here

    /** 0x81 */
    private static List<MfiEvent> getAudioEventsType2(byte[] data, int sampleRate, int bits, int channels) {
        List<MfiEvent> events = new ArrayList<MfiEvent>();

        // exst
        events.add(new MfiEvent(new ExstMessage(1), 0l));

        // ainf
        events.add(new MfiEvent(new AinfMessage(false, 1, new AinfMessage.AudioInfo(0x81, new byte[] { 0x10, 0x08, 0x10, 0x10, 0x08, 0x10 })), 0l));

        // audio data
        AudioEngine audioEngine = Factory.getAudioEngine(0x81);
        byte[] adpcm = audioEngine.encode(bits, channels, data);
        AdpmMessage adpmMessage = new AdpmMessage(sampleRate / 1000, bits, false, channels);
        AudioDataMessage audioData = new AudioDataMessage(AudioDataMessage.FORMAT_ADPCM_TYPE2, 0x00, adpmMessage);
        audioData.setData(adpcm);
        events.add(new MfiEvent(audioData, 0l));

        return events;
    }
View Full Code Here

TOP

Related Classes of vavi.sound.mfi.MfiEvent

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.