File indexing completed on 2024-04-28 04:32:45
0001 /* 0002 SPDX-FileCopyrightText: 2006 Pino Toscano <pino@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _OKULAR_SOUND_H_ 0008 #define _OKULAR_SOUND_H_ 0009 0010 #include "okularcore_export.h" 0011 0012 #include <QByteArray> 0013 #include <QString> 0014 0015 namespace Okular 0016 { 0017 /** 0018 * @short Contains information about a sound object. 0019 * 0020 * This class encapsulates the information about a sound object 0021 * which is used for links on enter/leave page event. 0022 */ 0023 class OKULARCORE_EXPORT Sound 0024 { 0025 public: 0026 /** 0027 * Describes where the sound is stored. 0028 */ 0029 enum SoundType { 0030 External, ///< Is stored at external resource (e.g. url) 0031 Embedded ///< Is stored embedded in the document 0032 }; 0033 0034 /** 0035 * Describes the encoding of the sound data. 0036 */ 0037 enum SoundEncoding { 0038 Raw, ///< Is not encoded 0039 Signed, ///< Is encoded with twos-complement values 0040 muLaw, ///< Is ยต-law encoded 0041 ALaw ///< Is A-law encoded 0042 }; 0043 0044 /** 0045 * Creates a new sound object with the given embedded 0046 * sound @p data. 0047 */ 0048 explicit Sound(const QByteArray &data); 0049 0050 /** 0051 * Creates a new sound object with the given external @p url. 0052 */ 0053 explicit Sound(const QString &url); 0054 0055 /** 0056 * Destroys the sound object. 0057 */ 0058 ~Sound(); 0059 0060 /** 0061 * Returns the type of the sound object. 0062 */ 0063 SoundType soundType() const; 0064 0065 /** 0066 * Returns the external storage url of the sound data. 0067 */ 0068 QString url() const; 0069 0070 /** 0071 * Returns the embedded sound data. 0072 */ 0073 QByteArray data() const; 0074 0075 /** 0076 * Sets the sampling @p rate. 0077 */ 0078 void setSamplingRate(double rate); 0079 0080 /** 0081 * Returns the sampling rate. 0082 */ 0083 double samplingRate() const; 0084 0085 /** 0086 * Sets the number of @p channels. 0087 */ 0088 void setChannels(int channels); 0089 0090 /** 0091 * Returns the number of channels. 0092 */ 0093 int channels() const; 0094 0095 /** 0096 * Sets the bits per sample @p bitsPerSample. 0097 */ 0098 void setBitsPerSample(int bitsPerSample); 0099 0100 /** 0101 * Returns the bits per sample rate. 0102 */ 0103 int bitsPerSample() const; 0104 0105 /** 0106 * Sets the type of sound @p encoding. 0107 */ 0108 void setSoundEncoding(SoundEncoding encoding); 0109 0110 /** 0111 * Returns the sound encoding. 0112 */ 0113 SoundEncoding soundEncoding() const; 0114 0115 private: 0116 class Private; 0117 Private *const d; 0118 0119 Q_DISABLE_COPY(Sound) 0120 }; 0121 0122 } 0123 0124 #endif