All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugvm.apple.audiotoolbox.ExtAudioFile Maven / Gradle / Ivy

There is a newer version: 1.2.9
Show newest version
/*
 * Copyright (C) 2013-2015 RoboVM AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bugvm.apple.audiotoolbox;

/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.audiounit.*;
import com.bugvm.apple.coreaudio.*;
import com.bugvm.apple.coremidi.*;
/**/

/**/
/**/
/**/@Library("AudioToolbox")/**/
/**/public/**/ class /**/ExtAudioFile/**/ 
    extends /**/NativeObject/**/ 
    /**//**/ {

    /**/public static class ExtAudioFilePtr extends Ptr {}/**/
    /**/static { Bro.bind(ExtAudioFile.class); }/**/
    /**//**/
    /**/
    protected ExtAudioFile() {}
    /**/
    /**//**/
    /**//**/
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public static ExtAudioFile openURL(NSURL url) throws OSStatusException {
        ExtAudioFile.ExtAudioFilePtr ptr = new ExtAudioFile.ExtAudioFilePtr();
        OSStatus status = openURL0(url, ptr);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public static ExtAudioFile wrapAudioFile(AudioFile audioFile, boolean forWriting) throws OSStatusException {
        ExtAudioFile.ExtAudioFilePtr ptr = new ExtAudioFile.ExtAudioFilePtr();
        OSStatus status = wrapAudioFile0(audioFile, forWriting, ptr);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public static ExtAudioFile create(NSURL url, AudioFileType fileType, AudioStreamBasicDescription streamDesc, AudioChannelLayout channelLayout, AudioFileFlags flags) throws OSStatusException {
        ExtAudioFile.ExtAudioFilePtr ptr = new ExtAudioFile.ExtAudioFilePtr();
        OSStatus status = create0(url, fileType, streamDesc, channelLayout, flags, ptr);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public void dispose() throws OSStatusException {
        OSStatus status = dispose0();
        OSStatusException.throwIfNecessary(status);
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public int read(int numberFrames, AudioBufferList data) throws OSStatusException {
        IntPtr ptr = new IntPtr(numberFrames);
        OSStatus status = read0(ptr, data);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public void write(int numberFrames, AudioBufferList data) throws OSStatusException {
        OSStatus status = write0(numberFrames, data);
        OSStatusException.throwIfNecessary(status);
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public void writeAsync(int numberFrames, AudioBufferList data) throws OSStatusException {
        OSStatus status = writeAsync0(numberFrames, data);
        OSStatusException.throwIfNecessary(status);
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public void seek(long frameOffset) throws OSStatusException {
        OSStatus status = seek0(frameOffset);
        OSStatusException.throwIfNecessary(status);
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public long tell() throws OSStatusException {
        LongPtr ptr = new LongPtr();
        OSStatus status = tell0(ptr);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public int getPropertySize(ExtAudioFileProperty id) throws OSStatusException {
        IntPtr ptr = new IntPtr();
        OSStatus status = getPropertyInfo0(id, ptr, null);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public boolean isPropertyWritable(ExtAudioFileProperty id) throws OSStatusException {
        BooleanPtr ptr = new BooleanPtr();
        OSStatus status = getPropertyInfo0(id, null, ptr);
        OSStatusException.throwIfNecessary(status);
        return ptr.get();
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public > T getProperty(ExtAudioFileProperty id, Class type) throws OSStatusException {
        T data = Struct.allocate(type);
        IntPtr dataSize = new IntPtr(Struct.sizeOf(data));
        OSStatus status = getProperty0(id, dataSize, data.as(VoidPtr.class));
        OSStatusException.throwIfNecessary(status);
        return data;
    }
    /**
     * @throws OSStatusException 
     * @since Available in iOS 2.1 and later.
     */
    public > void setProperty(ExtAudioFileProperty id, T data) throws OSStatusException {
        OSStatus status = setProperty0(id, data == null ? 0 : Struct.sizeOf(data), data == null ? null : data.as(VoidPtr.class));
        OSStatusException.throwIfNecessary(status);
    }
    public int getPropertyAsInt(ExtAudioFileProperty id) throws OSStatusException {
        IntPtr ptr = getProperty(id, IntPtr.class);
        return ptr.get();
    }
    public long getPropertyAsLong(ExtAudioFileProperty id) throws OSStatusException {
        LongPtr ptr = getProperty(id, LongPtr.class);
        return ptr.get();
    }
    public float getPropertyAsFloat(ExtAudioFileProperty id) throws OSStatusException {
        FloatPtr ptr = getProperty(id, FloatPtr.class);
        return ptr.get();
    }
    public double getPropertyAsDouble(ExtAudioFileProperty id) throws OSStatusException {
        DoublePtr ptr = getProperty(id, DoublePtr.class);
        return ptr.get();
    }
    public void setProperty(ExtAudioFileProperty id, int value) throws OSStatusException {
        setProperty(id, new IntPtr(value));
    }
    public void setProperty(ExtAudioFileProperty id, long value) throws OSStatusException {
        setProperty(id, new LongPtr(value));
    }
    public void setProperty(ExtAudioFileProperty id, float value) throws OSStatusException {
        setProperty(id, new FloatPtr(value));
    }
    public void setProperty(ExtAudioFileProperty id, double value) throws OSStatusException {
        setProperty(id, new DoublePtr(value));
    }
    /**/
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileOpenURL", optional=true)
    protected static native OSStatus openURL0(NSURL inURL, ExtAudioFile.ExtAudioFilePtr outExtAudioFile);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileWrapAudioFileID", optional=true)
    protected static native OSStatus wrapAudioFile0(AudioFile inFileID, boolean inForWriting, ExtAudioFile.ExtAudioFilePtr outExtAudioFile);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileCreateWithURL", optional=true)
    protected static native OSStatus create0(NSURL inURL, AudioFileType inFileType, AudioStreamBasicDescription inStreamDesc, AudioChannelLayout inChannelLayout, AudioFileFlags inFlags, ExtAudioFile.ExtAudioFilePtr outExtAudioFile);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileDispose", optional=true)
    protected native OSStatus dispose0();
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileRead", optional=true)
    protected native OSStatus read0(IntPtr ioNumberFrames, AudioBufferList ioData);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileWrite", optional=true)
    protected native OSStatus write0(int inNumberFrames, AudioBufferList ioData);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileWriteAsync", optional=true)
    protected native OSStatus writeAsync0(int inNumberFrames, AudioBufferList ioData);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileSeek", optional=true)
    protected native OSStatus seek0(long inFrameOffset);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileTell", optional=true)
    protected native OSStatus tell0(LongPtr outFrameOffset);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileGetPropertyInfo", optional=true)
    protected native OSStatus getPropertyInfo0(ExtAudioFileProperty inPropertyID, IntPtr outSize, BooleanPtr outWritable);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileGetProperty", optional=true)
    protected native OSStatus getProperty0(ExtAudioFileProperty inPropertyID, IntPtr ioPropertyDataSize, VoidPtr outPropertyData);
    /**
     * @since Available in iOS 2.1 and later.
     */
    @Bridge(symbol="ExtAudioFileSetProperty", optional=true)
    protected native OSStatus setProperty0(ExtAudioFileProperty inPropertyID, int inPropertyDataSize, VoidPtr inPropertyData);
    /**/
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy