2006-10-09 18:02:59 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _OKULAR_SOUND_H_
|
|
|
|
#define _OKULAR_SOUND_H_
|
|
|
|
|
2007-01-03 14:30:48 +00:00
|
|
|
#include <okular/core/okular_export.h>
|
2006-10-09 18:02:59 +00:00
|
|
|
|
|
|
|
#include <QtCore/QByteArray>
|
|
|
|
#include <QtCore/QString>
|
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
|
|
|
|
/**
|
2006-11-27 08:04:41 +00:00
|
|
|
* @short Contains information about a sound object.
|
2006-10-09 18:02:59 +00:00
|
|
|
*
|
2006-11-27 08:04:41 +00:00
|
|
|
* This class encapsulates the information about a sound object
|
|
|
|
* which is used for links on enter/leave page event.
|
2006-10-09 18:02:59 +00:00
|
|
|
*/
|
|
|
|
class OKULAR_EXPORT Sound
|
|
|
|
{
|
|
|
|
public:
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Describes where the sound is stored.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
enum SoundType {
|
2006-11-27 08:04:41 +00:00
|
|
|
External, ///< Is stored at external resource (e.g. url)
|
|
|
|
Embedded ///< Is stored embedded in the document
|
2006-10-09 18:02:59 +00:00
|
|
|
};
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Describes the encoding of the sound data.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
enum SoundEncoding {
|
2006-11-27 08:04:41 +00:00
|
|
|
Raw, ///< Is not encoded
|
|
|
|
Signed, ///< Is encoded with twos-complement values
|
2007-01-20 14:51:43 +00:00
|
|
|
muLaw, ///< Is µ-law encoded
|
2006-11-27 08:04:41 +00:00
|
|
|
ALaw ///< Is A-law encoded
|
2006-10-09 18:02:59 +00:00
|
|
|
};
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Creates a new sound object with the given embedded
|
|
|
|
* sound @p data.
|
|
|
|
*/
|
2007-01-04 15:22:28 +00:00
|
|
|
explicit Sound( const QByteArray& data );
|
2006-10-09 18:02:59 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Creates a new sound object with the given external @p filename.
|
|
|
|
*/
|
2007-01-04 15:22:28 +00:00
|
|
|
explicit Sound( const QString& filename );
|
2006-11-27 08:04:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroys the sound object.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
~Sound();
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the type of the sound object.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
SoundType soundType() const;
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the external storage url of the sound data.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
QString url() const;
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the embedded sound data.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
QByteArray data() const;
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Sets the sampling @p rate.
|
|
|
|
*/
|
|
|
|
void setSamplingRate( double rate );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the sampling rate.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
double samplingRate() const;
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Sets the number of @p channels.
|
|
|
|
*/
|
|
|
|
void setChannels( int channels );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of channels.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
int channels() const;
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
2007-05-27 09:59:52 +00:00
|
|
|
* Sets the bits per sample @p rate.
|
2006-11-27 08:04:41 +00:00
|
|
|
*/
|
|
|
|
void setBitsPerSample( int rate );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the bits per sample rate.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
int bitsPerSample() const;
|
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Sets the type of sound @p encoding.
|
|
|
|
*/
|
|
|
|
void setSoundEncoding( SoundEncoding encoding );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the sound encoding.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
SoundEncoding soundEncoding() const;
|
|
|
|
|
|
|
|
private:
|
2006-11-27 08:04:41 +00:00
|
|
|
class Private;
|
|
|
|
Private* const d;
|
|
|
|
|
|
|
|
Q_DISABLE_COPY( Sound )
|
2006-10-09 18:02:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|