compile
[kdegraphics.git] / okular / core / sound.h
blob23ba8d86f8a9de5b7f8cedf3665d9aac5d7ee75e
1 /***************************************************************************
2 * Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef _OKULAR_SOUND_H_
11 #define _OKULAR_SOUND_H_
13 #include <okular/core/okular_export.h>
15 #include <QtCore/QByteArray>
16 #include <QtCore/QString>
18 namespace Okular {
20 /**
21 * @short Contains information about a sound object.
23 * This class encapsulates the information about a sound object
24 * which is used for links on enter/leave page event.
26 class OKULAR_EXPORT Sound
28 public:
29 /**
30 * Describes where the sound is stored.
32 enum SoundType {
33 External, ///< Is stored at external resource (e.g. url)
34 Embedded ///< Is stored embedded in the document
37 /**
38 * Describes the encoding of the sound data.
40 enum SoundEncoding {
41 Raw, ///< Is not encoded
42 Signed, ///< Is encoded with twos-complement values
43 muLaw, ///< Is ยต-law encoded
44 ALaw ///< Is A-law encoded
47 /**
48 * Creates a new sound object with the given embedded
49 * sound @p data.
51 explicit Sound( const QByteArray& data );
53 /**
54 * Creates a new sound object with the given external @p filename.
56 explicit Sound( const QString& filename );
58 /**
59 * Destroys the sound object.
61 ~Sound();
63 /**
64 * Returns the type of the sound object.
66 SoundType soundType() const;
68 /**
69 * Returns the external storage url of the sound data.
71 QString url() const;
73 /**
74 * Returns the embedded sound data.
76 QByteArray data() const;
78 /**
79 * Sets the sampling @p rate.
81 void setSamplingRate( double rate );
83 /**
84 * Returns the sampling rate.
86 double samplingRate() const;
88 /**
89 * Sets the number of @p channels.
91 void setChannels( int channels );
93 /**
94 * Returns the number of channels.
96 int channels() const;
98 /**
99 * Sets the bits per sample @p rate.
101 void setBitsPerSample( int rate );
104 * Returns the bits per sample rate.
106 int bitsPerSample() const;
109 * Sets the type of sound @p encoding.
111 void setSoundEncoding( SoundEncoding encoding );
114 * Returns the sound encoding.
116 SoundEncoding soundEncoding() const;
118 private:
119 class Private;
120 Private* const d;
122 Q_DISABLE_COPY( Sound )
127 #endif