cami.jmootcher
Class AudioSample

java.lang.Object
  extended by cami.jmootcher.AudioSample
All Implemented Interfaces:
JMootcherConstants

public class AudioSample
extends java.lang.Object
implements JMootcherConstants

representing a freesound-sample

Version:
0.7
Author:
Camillo Bruni

Field Summary
 
Fields inherited from interface cami.jmootcher.JMootcherConstants
AIFF, AUDIOSAMPLE_DATE_FORMAT, BUFFER_SIZE, CACHE_ROOT_DIR, ENCODING, FILE_URL, FLAC, HOME_URL, LOGIN_REDIRECT_URL, LOGIN_URL, LOGOUT_URL, MP3, OGG, PREVIEW_CACHE_DIRNAME, SAMPLE_CACHE_DIRNAME, VALID_LOGIN_TEXT, VALID_XML_LINE_PREFIX, VALID_XML_SECONDLINE, WAV, XML_CACHE_DIRNAME, XML_SEARCH_URL, XML_SIMILAR_URL, XML_URL
 
Constructor Summary
AudioSample(JMootcher mootcher, int ID)
           
AudioSample(JMootcher mootcher, java.lang.String ID)
           
 
Method Summary
 int getBitDepth()
          returns the bitDepth of the sample, usually 16
 int getBitRate()
          returns the resolution (bitRate) of the sample
 long getBytesLoaded()
          returns the number of bytes loaded
 int getChannels()
          returns the number of channels, usually 1 or 2 (mono, stere)
 java.util.Date getDate()
          returns the creation-date of this sample
 java.lang.String getDescription()
          returns the freesound description of this file
 AudioSample[] getDissimilarFiles()
          returns an array containig disimilar soundfiles, for further information see
 float getDuration()
          returns the duration in seconds of the sample
 java.lang.String getExtension()
          returns a String-representation of the fileextension, the getFileType-method returns a integer-repr of the fileextension, see the JMootcherConstants for more details
 int getFileSize()
          returns the final filesize of the sample in bytes
 int getFileType()
          Returns an internal representation of the soundTypes
 java.net.URL getFileURL()
          returns the url of the full-quality, original audiosample, this url is mostly useless, since you can only access the file with a valid login/registration
 int getID()
          Returns the freesound id of this sample
 java.io.InputStream getInputStream()
          returns an InputStream pointing to the given file, or null if the File doesnt exist, the InputStream points on the file specified by the getFileURL.
 java.lang.String[] getKeyWords()
          returns the freesound keywords for this sample
 float getLatitude()
          Returns the altitude of a geotagged Sample, null if not geotagged
 float getLongitude()
          return the logitude of geotagged sample, or null
 JMootcher getMootcher()
          returns the assigned jMootcher controller, which handles all HTTP-requests
 java.lang.String getOriginalFileName()
          returns the sample's original filename
 java.io.File getPreview()
          returns the File of the cached audiosample-preview, which is created automatically in the constructor Use this method instead of getPreviewURL or getPreviewInputStream to access the audioFile
 java.net.URL getPreviewImageURL()
          returns the URL of a preview image, frequency is colorcoded, the image-format is png
 java.lang.String getPreviewImageURLString()
           
 java.io.InputStream getPreviewInputStream()
          returns an InputStream pointing to the preview mp3, if the File doesnt exists a null is returned
 java.net.URL getPreviewURL()
          returns the URL to the prewiev soundFile, which is accessiblel without an account, for the full sample a freesound account is required.
 java.lang.String getPreviewURLString()
          The url to the previewfile of this sample. this is a low quality mp3-file, which can be accessed without any registration
 java.io.File getSample()
          returns the File of the cached audiosample, which is created automatically in the constructor.
 int getSampleRate()
          returns the sample rate in [Hz]
 AudioSample[] getSimilarFiles()
          returns an array containig similar soundfiles, for further information see freesound
 int getUserID()
          returns the freesound-user-id of the creater of this sample
 boolean isGeoTagged()
          returns if the sample has been geotagge ( an altidude and logitude assigned)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioSample

public AudioSample(JMootcher mootcher,
                   java.lang.String ID)
            throws java.lang.Exception
Throws:
java.lang.Exception

AudioSample

public AudioSample(JMootcher mootcher,
                   int ID)
            throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getID

public int getID()
Returns the freesound id of this sample


getFileType

public int getFileType()
Returns an internal representation of the soundTypes

Returns:
fileType_
See Also:
JMootcherConstants

getLatitude

public float getLatitude()
Returns the altitude of a geotagged Sample, null if not geotagged

Returns:
See Also:
getLongitude, isGeoTagged

getLongitude

public float getLongitude()
return the logitude of geotagged sample, or null

Returns:
See Also:
getAltitude, isGeoTagged

isGeoTagged

public boolean isGeoTagged()
returns if the sample has been geotagge ( an altidude and logitude assigned)

Returns:
See Also:
getAltitude, getLongitude

getBitDepth

public int getBitDepth()
returns the bitDepth of the sample, usually 16

Returns:

getBitRate

public int getBitRate()
returns the resolution (bitRate) of the sample

Returns:

getChannels

public int getChannels()
returns the number of channels, usually 1 or 2 (mono, stere)

Returns:

getDescription

public java.lang.String getDescription()
returns the freesound description of this file

Returns:

getDuration

public float getDuration()
returns the duration in seconds of the sample

Returns:

getExtension

public java.lang.String getExtension()
returns a String-representation of the fileextension, the getFileType-method returns a integer-repr of the fileextension, see the JMootcherConstants for more details

Returns:
See Also:
getFileType

getFileSize

public int getFileSize()
returns the final filesize of the sample in bytes

Returns:

getBytesLoaded

public long getBytesLoaded()
returns the number of bytes loaded

See Also:

getKeyWords

public java.lang.String[] getKeyWords()
returns the freesound keywords for this sample

Returns:

getDate

public java.util.Date getDate()
returns the creation-date of this sample

Returns:

getMootcher

public JMootcher getMootcher()
returns the assigned jMootcher controller, which handles all HTTP-requests

Returns:

getOriginalFileName

public java.lang.String getOriginalFileName()
returns the sample's original filename

Returns:

getSampleRate

public int getSampleRate()
returns the sample rate in [Hz]

Returns:
sampleRate

getUserID

public int getUserID()
returns the freesound-user-id of the creater of this sample

Returns:

getSimilarFiles

public AudioSample[] getSimilarFiles()
returns an array containig similar soundfiles, for further information see freesound

Returns:
See Also:
getDissimilarFiles

getDissimilarFiles

public AudioSample[] getDissimilarFiles()
returns an array containig disimilar soundfiles, for further information see

Returns:
See Also:
getSimilarFiles

getPreviewURL

public java.net.URL getPreviewURL()
returns the URL to the prewiev soundFile, which is accessiblel without an account, for the full sample a freesound account is required.

Returns:

getPreviewURLString

public java.lang.String getPreviewURLString()
The url to the previewfile of this sample. this is a low quality mp3-file, which can be accessed without any registration

Returns:

getFileURL

public java.net.URL getFileURL()
returns the url of the full-quality, original audiosample, this url is mostly useless, since you can only access the file with a valid login/registration

Returns:

getPreviewImageURL

public java.net.URL getPreviewImageURL()
returns the URL of a preview image, frequency is colorcoded, the image-format is png

Returns:

getPreviewImageURLString

public java.lang.String getPreviewImageURLString()

getInputStream

public java.io.InputStream getInputStream()
returns an InputStream pointing to the given file, or null if the File doesnt exist, the InputStream points on the file specified by the getFileURL. An another time, this isn't very usefull, since valid login-cookies are necessary

Returns:
See Also:
getSample, getPreview

getPreviewInputStream

public java.io.InputStream getPreviewInputStream()
returns an InputStream pointing to the preview mp3, if the File doesnt exists a null is returned

Returns:

getSample

public java.io.File getSample()
returns the File of the cached audiosample, which is created automatically in the constructor. Use this method instead of getFileURL or getInputStream to access the audioFile. Make sure that the file is buffered, otherwise there will be an error when playing.

Returns:
See Also:
getPreview

getPreview

public java.io.File getPreview()
returns the File of the cached audiosample-preview, which is created automatically in the constructor Use this method instead of getPreviewURL or getPreviewInputStream to access the audioFile

Returns:
See Also:
getSample