Package ipsk.audio

Interface AudioController2

  • All Known Subinterfaces:
    AudioController3, AudioController4
    All Known Implementing Classes:
    J2AudioController2, J2AudioController3, J2AudioController4

    public interface AudioController2
    Manages audio recording and playback. This interface allows easy recording of playback and recording auf audio. After the number of lines (using

    A typical scenario for a session:

    1. Set audio file format for the session.
    2. Optionally set the devices to use.
    3. Open for recording.
    4. Start recording.
    5. Stop recording.
    6. Wait for CaptureRecordedEvent.
    7. Close capture.
    8. Open playback.
    9. Optionally set start/stop position.
    10. Start playback.
    11. Optionally pause playback.
    12. Start playback again.
    13. Stop playback or the playback finishes at the end of file(s)
    14. Wait for PlaybackStopEvent and close playback.
    Author:
    Klaus Jänsch, klausj@phonetik.uni-muenchen.de
    • Method Detail

      • setPlaybackDeviceByName

        void setPlaybackDeviceByName​(java.lang.String deviceName)
                              throws AudioControllerException
        Use the source mixer (playback) with the given name.
        Parameters:
        deviceName - the name of the source mixer
        Throws:
        AudioControllerException
      • setCaptureDeviceByName

        void setCaptureDeviceByName​(java.lang.String deviceName)
                             throws AudioControllerException
        Use the target mixer (recording) with the given name.
        Parameters:
        deviceName - the name of the target mixer
        Throws:
        AudioControllerException
      • supportsDeviceProviders

        boolean supportsDeviceProviders()
      • setRecordingAudioFileFormat

        void setRecordingAudioFileFormat​(javax.sound.sampled.AudioFileFormat audiofileFormat)
        Set audio file format for recording.
        Parameters:
        audiofileFormat - audio file format
      • getAudioFileFormat

        javax.sound.sampled.AudioFileFormat getAudioFileFormat()
        Get audio format.
        Returns:
        audio format
      • getPlaybackAudioFormat

        javax.sound.sampled.AudioFormat getPlaybackAudioFormat()
        Get audio format for playback. The controller sets the audio format according to the set playback files. So it can differ from the chosen foprmat.
        Returns:
        audio format
      • getPlaybackFile

        java.io.File getPlaybackFile()
        Gets playback files.

        the size of the array is equal the number of lines opened.

        Returns:
        the file array of playbackfiles set
      • setOverwrite

        void setOverwrite​(boolean overwrite)
        Sets overwrite flag. If the overwrite flag is set, existing recording files are overwritten without any exception or warning.
        Parameters:
        overwrite - overwrite flag
      • isOverwrite

        boolean isOverwrite()
        Gets overwrite flag. If the overwrite flag is set, existing recording files are overwritten without any exception or warning.
        Returns:
        overwrite flag
      • setPrimaryRecordTarget

        void setPrimaryRecordTarget​(PrimaryRecordTarget primaryRecordTarget)
        Set primary record target.
        Parameters:
        primaryRecordTarget -
      • getPrimaryRecordTarget

        PrimaryRecordTarget getPrimaryRecordTarget()
        Get the primary recording target.
      • setRecordingFile

        void setRecordingFile​(java.io.File recordingFile)
        Sets recording file.
        Parameters:
        recordingFile -
      • getRecordingFile

        java.io.File getRecordingFile()
        Gets recording files.

        the size of the array is equal the number of lines opened.

        Returns:
        recordingFiles
      • getCaptureLevelInfos

        LevelInfo[] getCaptureLevelInfos()
        Gets levels of all channels. maximum level is 1.0 representing 0dB
        minimum level is 0
        array has channels * numLines entries
        Returns:
        current audio levels
      • getPlaybackLevelInfos

        LevelInfo[] getPlaybackLevelInfos()
      • isPlaybackRandomPositioningSupported

        boolean isPlaybackRandomPositioningSupported()
        Get random positioning capability of the playback engine.
        Returns:
        random positioning capability
      • getPlaybackFrameLength

        long getPlaybackFrameLength()
        Gets length of largest playback file in frames, -1 if not available
        Returns:
        length of largest playback file in frames
      • setPlaybackFramePosition

        long setPlaybackFramePosition​(long newPosition)
                               throws AudioControllerException
        Sets the new frame position of playback.
        Parameters:
        newPosition - the requested position
        Returns:
        the actually set position or POS_UNKNOWN (-1) if not supported
        Throws:
        AudioControllerException
      • getPlaybackFramePosition

        long getPlaybackFramePosition()
        Get playback position.
        Returns:
        current playback position in audio frames or POS_UNKNOWN (-1) if not supported
      • setPlaybackStartFramePosition

        void setPlaybackStartFramePosition​(long startPosition)
        Sets the start position. Used to play only a segment of an audio file.
        Parameters:
        startPosition - position in audio frames from where to start
      • getPlaybackStartFramePosition

        long getPlaybackStartFramePosition()
        Gets the start position.
        Returns:
        start position
      • setPlaybackStopFramePosition

        void setPlaybackStopFramePosition​(long stopPosition)
        Sets the stop position. Used to play only a segment of an audio file. To play the whole audio file set the position to AUDIO_END (-1).
        Parameters:
        stopPosition - position in audio frames to stop
      • getPlaybackStopFramePosition

        long getPlaybackStopFramePosition()
        Gets the stop position.
        Returns:
        stop position
      • getCaptureFramePosition

        long getCaptureFramePosition()
        Get recording position.
        Returns:
        current recording position in audio frames or -1 if not supported
      • isCaptureOpen

        boolean isCaptureOpen()
        Check if capture engine is open.
        Returns:
        true if open
      • getPropertyNames

        java.lang.String[] getPropertyNames()
        Get an implementation specific property names.
        Returns:
        property names
      • getPropertyDescription

        java.lang.String getPropertyDescription​(java.lang.String propertyName)
        Get a description of the property.
        Parameters:
        propertyName -
        Returns:
        description
      • setProperty

        void setProperty​(java.lang.String propertyName,
                         java.lang.String value)
        Set a property for a specific implementation.
        Parameters:
        propertyName -
        value -
      • getProperty

        java.lang.String getProperty​(java.lang.String propertyName)
        Get an implementation specific property.
        Parameters:
        propertyName -
        Returns:
        value of the property or null if there is no such property
      • getPreferredCaptureLineBufferSizeMilliSeconds

        float getPreferredCaptureLineBufferSizeMilliSeconds()
        Get preferred capture line buffer size.
        Returns:
        line buffer size in milliseconds
      • setPreferredCaptureLineBufferSizeMilliSeconds

        void setPreferredCaptureLineBufferSizeMilliSeconds​(float preferredCaptureLineBufferSizeMilliSeconds)
        Set preferred capture line buffer size.
        Parameters:
        preferredCaptureLineBufferSizeMilliSeconds - line buffer size in milliseconds
      • getPreferredPlaybackLineBufferSizeMilliSeconds

        float getPreferredPlaybackLineBufferSizeMilliSeconds()
        Get preferred playback line buffer size.
        Returns:
        line buffer size in milliseconds
      • setPreferredPlaybackLineBufferSizeMilliSeconds

        void setPreferredPlaybackLineBufferSizeMilliSeconds​(float preferredPlaybackLineBufferSizeMilliSeconds)
        Set preferred playback line buffer size.
        Parameters:
        preferredPlaybackLineBufferSizeMilliSeconds - line buffer size in milliseconds
      • setMaxRecordingFrameLength

        void setMaxRecordingFrameLength​(java.lang.Long maxFrameLength)
        Set max recording length.
        Parameters:
        maxFrameLength - max recording length in frames, null for infinite recording
      • getMaxRecordingFrameLength

        java.lang.Long getMaxRecordingFrameLength()
        Get max recording length. Default is infinite recording (null).
        Returns:
        max recording length in frames, null for infinite recording
      • isFileTransitionRecordingSupported

        boolean isFileTransitionRecordingSupported()
        Get file transition capability. File transition recording is a feature, which allows to change the recording file during capture. The capture stream is not interrupted. The recording files can be concatened later to get one seamless recording file.
        Returns:
        true if file transitioning is supported by this controller
      • isSessionInfoHandlingSupported

        boolean isSessionInfoHandlingSupported()
        Get support for recording session info file handling.
        Returns:
        true if recording session info file handling is supported
      • getRecordingSessionInfoFile

        java.io.File getRecordingSessionInfoFile()
        Get the current used session info file.
        Returns:
        session info file, null if not used (default)
      • setRecordingSessionInfoFile

        void setRecordingSessionInfoFile​(java.io.File recordingSessionInfoFile)
        Set the current used session info file.
        Parameters:
        recordingSessionInfoFile - session info file, null if not used (default)