Class RMIRemoteAudio

  • All Implemented Interfaces:
    java.io.Serializable, java.rmi.Remote, RMIAudio

    public class RMIRemoteAudio
    extends java.rmi.server.UnicastRemoteObject
    implements RMIAudio
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.rmi.server.RemoteObject

        ref
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected RMIRemoteAudio()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getVolume()
      Get the current master volume level
      void loadSettings()
      Load the current system settings associated with this class.
      void playNote​(int[] inst, int freq, int len)
      Play a note with attack, decay, sustain and release shape.
      int playSample​(byte[] data, int offset, int len, int freq, int vol)
      Queue a series of PCM samples to play at the specified volume and sample rate.
      int playSample​(java.io.File file)
      Play a wav file
      int playSample​(java.io.File file, int vol)
      Play a wav file
      void playTone​(int freq, int duration)  
      void playTone​(int aFrequency, int aDuration, int aVolume)
      Plays a tone, given its frequency and duration.
      void setVolume​(int vol)
      Set the master volume level
      void systemSound​(int aCode)
      Play a system sound.
      • Methods inherited from class java.rmi.server.UnicastRemoteObject

        clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
      • Methods inherited from class java.rmi.server.RemoteServer

        getClientHost, getLog, setLog
      • Methods inherited from class java.rmi.server.RemoteObject

        equals, getRef, hashCode, toString, toStub
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RMIRemoteAudio

        protected RMIRemoteAudio()
                          throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
    • Method Detail

      • systemSound

        public void systemSound​(int aCode)
                         throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Play a system sound.
        aCodeResulting Sound
        0short beep
        1double beep
        2descending arpeggio
        3ascending arpeggio
        4long, low buzz
        Specified by:
        systemSound in interface RMIAudio
        Throws:
        java.rmi.RemoteException
      • playTone

        public void playTone​(int aFrequency,
                             int aDuration,
                             int aVolume)
                      throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Plays a tone, given its frequency and duration.
        Specified by:
        playTone in interface RMIAudio
        Parameters:
        aFrequency - The frequency of the tone in Hertz (Hz).
        aDuration - The duration of the tone, in milliseconds.
        aVolume - The volume of the playback 100 corresponds to 100%
        Throws:
        java.rmi.RemoteException
      • playTone

        public void playTone​(int freq,
                             int duration)
                      throws java.rmi.RemoteException
        Specified by:
        playTone in interface RMIAudio
        Throws:
        java.rmi.RemoteException
      • playSample

        public int playSample​(java.io.File file,
                              int vol)
                       throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Play a wav file
        Specified by:
        playSample in interface RMIAudio
        Parameters:
        file - the 8-bit PWM (WAV) sample file
        vol - the volume percentage 0 - 100
        Returns:
        The number of milliseconds the sample will play for or < 0 if there is an error.
        Throws:
        java.rmi.RemoteException
      • playSample

        public int playSample​(java.io.File file)
                       throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Play a wav file
        Specified by:
        playSample in interface RMIAudio
        Parameters:
        file - the 8-bit PWM (WAV) sample file
        Returns:
        The number of milliseconds the sample will play for or < 0 if there is an error.
        Throws:
        java.rmi.RemoteException
      • playSample

        public int playSample​(byte[] data,
                              int offset,
                              int len,
                              int freq,
                              int vol)
                       throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Queue a series of PCM samples to play at the specified volume and sample rate.
        Specified by:
        playSample in interface RMIAudio
        Parameters:
        data - Buffer containing the samples
        offset - Offset of the first sample in the buffer
        len - Number of samples to queue
        freq - Sample rate
        vol - playback volume
        Returns:
        Number of samples actually queued
        Throws:
        java.rmi.RemoteException
      • playNote

        public void playNote​(int[] inst,
                             int freq,
                             int len)
                      throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Play a note with attack, decay, sustain and release shape. This function allows the playing of a more musical sounding note. It uses a set of supplied "instrument" parameters to define the shape of the notes envelope.
        Specified by:
        playNote in interface RMIAudio
        Parameters:
        inst - Instrument definition
        freq - The note to play (in Hz)
        len - The duration of the note (in ms)
        Throws:
        java.rmi.RemoteException
      • setVolume

        public void setVolume​(int vol)
                       throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Set the master volume level
        Specified by:
        setVolume in interface RMIAudio
        Parameters:
        vol - 0-100
        Throws:
        java.rmi.RemoteException
      • getVolume

        public int getVolume()
                      throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Get the current master volume level
        Specified by:
        getVolume in interface RMIAudio
        Returns:
        the current master volume 0-100
        Throws:
        java.rmi.RemoteException
      • loadSettings

        public void loadSettings()
                          throws java.rmi.RemoteException
        Description copied from interface: RMIAudio
        Load the current system settings associated with this class. Called automatically to initialize the class. May be called if it is required to reload any settings.
        Specified by:
        loadSettings in interface RMIAudio
        Throws:
        java.rmi.RemoteException