net.sf.jack4j.examples
Class WavRecorder

java.lang.Object
  extended by net.sf.jack4j.JackClient
      extended by net.sf.jack4j.AbstractJackClient
          extended by net.sf.jack4j.examples.WavRecorder

public class WavRecorder
extends AbstractJackClient

Simple WAV recorder.

See comments in the code that describe the usage of Jack4j library.

To run the examples, you need to have the native Jack4j library in your system load path (LD_LIBRARY_PATH under Linux).

This example client expects single command line parameter - client name.

Author:
repa

Constructor Summary
WavRecorder(java.lang.String clientName)
          Constructor.
 
Method Summary
static void main(java.lang.String[] args)
           
 int process(int bufferSize)
          This is callback method, invoked by Jack client thread every now and then.
 void run()
          Activation and main event loop.
 
Methods inherited from class net.sf.jack4j.AbstractJackClient
bufferSizeCallback, clientRegistrationCallback, freewheelCallback, graphOrderCallback, portConnectCallback, portRegistrationCallback, sampleRateCallback, threadInitCallback, xRunCallback
 
Methods inherited from class net.sf.jack4j.JackClient
activate, addAudioPort, addMidiPort, addPort, close, connect, cpuLoad, deactivate, disconnect, finalize, framesSinceCycleStart, framesToTime, frameTime, getAllPortConnections, getBufferSize, getCallbackStruct, getClientHandle, getClientName, getClientThread, getPorts, getPorts, getSampleRate, getStatistics, getTotalPortLatency, internalClientByName, isActive, isMine, isOpen, isProcessMethodSynchronized, isRealtime, isShutdown, lastFrameTime, loadInternalClient, localPort, localPortNames, portById, portByName, recomputeTotalLatencies, recomputeTotalPortLatency, removePort, requestPortMonitorByName, setAllDefaultCallbacks, setBufferSize, setBufferSizeCallback, setClientRegistrationCallback, setDefaultBufferSizeCallback, setDefaultClientRegistrationCallback, setDefaultFreewheelCallback, setDefaultGraphOrderCallback, setDefaultPortConnectCallback, setDefaultPortRegistrationCallback, setDefaultProcessCallback, setDefaultSampleRateCallback, setDefaultShutdownCallback, setDefaultThreadInitCallback, setDefaultXRunCallback, setFreewheel, setFreewheelCallback, setGraphOrderCallback, setPortConnectCallback, setPortRegistrationCallback, setProcessCallback, setProcessMethodSynchronized, setSampleRateCallback, setShutdownCallback, setThreadInitCallback, setXRunCallback, threadWait, time, timeToFrames
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WavRecorder

public WavRecorder(java.lang.String clientName)
            throws java.lang.Exception
Constructor.

Registers under given client name, sets the callbacks and adds ports.

Throws:
java.lang.Exception
Method Detail

process

public int process(int bufferSize)
            throws java.lang.Exception
This is callback method, invoked by Jack client thread every now and then.

This method actually works with the sound. As this client has input ports registered, each buffer attached to input port will contain bufferSize samples before this method is called.

Ports were created earlier, during client initialization.

Overrides:
process in class AbstractJackClient
Throws:
java.lang.Exception
See Also:
JackClient.process(int)

run

public void run()
         throws java.lang.Exception
Activation and main event loop.

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2008 Ondrej Par. All Rights Reserved.