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_
|
|
|
|
|
2014-10-27 21:35:06 +00:00
|
|
|
#include "okularcore_export.h"
|
2006-10-09 18:02:59 +00:00
|
|
|
|
2018-08-31 09:23:45 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QString>
|
2006-10-09 18:02:59 +00:00
|
|
|
|
|
|
|
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
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT Sound
|
2006-10-09 18:02:59 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
};
|
2020-07-10 22:15:05 +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
|
|
|
};
|
2020-07-10 22:15:05 +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);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Creates a new sound object with the given external @p url.
|
2006-11-27 08:04:41 +00:00
|
|
|
*/
|
2019-12-20 15:40:59 +00:00
|
|
|
explicit Sound(const QString &url);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Destroys the sound object.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
~Sound();
|
2020-07-10 22:15:05 +00:00
|
|
|
|
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;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
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;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the embedded sound data.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
QByteArray data() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Sets the sampling @p rate.
|
|
|
|
*/
|
|
|
|
void setSamplingRate(double rate);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the sampling rate.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
double samplingRate() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Sets the number of @p channels.
|
|
|
|
*/
|
|
|
|
void setChannels(int channels);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of channels.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
int channels() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
2019-12-20 15:40:59 +00:00
|
|
|
* Sets the bits per sample @p bitsPerSample.
|
2006-11-27 08:04:41 +00:00
|
|
|
*/
|
2019-12-20 15:40:59 +00:00
|
|
|
void setBitsPerSample(int bitsPerSample);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the bits per sample rate.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
int bitsPerSample() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Sets the type of sound @p encoding.
|
|
|
|
*/
|
|
|
|
void setSoundEncoding(SoundEncoding encoding);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
/**
|
|
|
|
* Returns the sound encoding.
|
|
|
|
*/
|
2006-10-09 18:02:59 +00:00
|
|
|
SoundEncoding soundEncoding() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-10-09 18:02:59 +00:00
|
|
|
private:
|
2006-11-27 08:04:41 +00:00
|
|
|
class Private;
|
|
|
|
Private *const d;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-27 08:04:41 +00:00
|
|
|
Q_DISABLE_COPY(Sound)
|
2006-10-09 18:02:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|