• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • core
sound.cpp
Go to the documentation of this file.
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  ***************************************************************************/
9 
10 #include "sound.h"
11 
12 #include <QtCore/QVariant>
13 
14 using namespace Okular;
15 
16 class Sound::Private
17 {
18  public:
19  Private( const QByteArray &data )
20  : m_data( QVariant( data ) ),
21  m_type( Sound::Embedded )
22  {
23  init();
24  }
25 
26  Private( const QString &url )
27  : m_data( QVariant( url ) ),
28  m_type( Sound::External )
29  {
30  init();
31  }
32 
33  void init()
34  {
35  m_samplingRate = 44100.0;
36  m_channels = 1;
37  m_bitsPerSample = 8;
38  m_soundEncoding = Sound::Raw;
39  }
40 
41  QVariant m_data;
42  Sound::SoundType m_type;
43  double m_samplingRate;
44  int m_channels;
45  int m_bitsPerSample;
46  SoundEncoding m_soundEncoding;
47 };
48 
49 Sound::Sound( const QByteArray& data )
50  : d( new Private( data ) )
51 {
52 }
53 
54 Sound::Sound( const QString& url )
55  : d( new Private( url ) )
56 {
57 }
58 
59 Sound::~Sound()
60 {
61  delete d;
62 }
63 
64 Sound::SoundType Sound::soundType() const
65 {
66  return d->m_type;
67 }
68 
69 QString Sound::url() const
70 {
71  return d->m_type == Sound::External ? d->m_data.toString() : QString();
72 }
73 
74 QByteArray Sound::data() const
75 {
76  return d->m_type == Sound::Embedded ? d->m_data.toByteArray() : QByteArray();
77 }
78 
79 double Sound::samplingRate() const
80 {
81  return d->m_samplingRate;
82 }
83 
84 void Sound::setSamplingRate( double samplingRate )
85 {
86  d->m_samplingRate = samplingRate;
87 }
88 
89 int Sound::channels() const
90 {
91  return d->m_channels;
92 }
93 
94 void Sound::setChannels( int channels )
95 {
96  d->m_channels = channels;
97 }
98 
99 int Sound::bitsPerSample() const
100 {
101  return d->m_bitsPerSample;
102 }
103 
104 void Sound::setBitsPerSample( int bitsPerSample )
105 {
106  d->m_bitsPerSample = bitsPerSample;
107 }
108 
109 Sound::SoundEncoding Sound::soundEncoding() const
110 {
111  return d->m_soundEncoding;
112 }
113 
114 void Sound::setSoundEncoding( Sound::SoundEncoding soundEncoding )
115 {
116  d->m_soundEncoding = soundEncoding;
117 }
sound.h
Okular::Sound::samplingRate
double samplingRate() const
Returns the sampling rate.
Definition: sound.cpp:79
Okular::Sound::Raw
Is not encoded.
Definition: sound.h:41
Okular::Sound::channels
int channels() const
Returns the number of channels.
Definition: sound.cpp:89
Okular::Sound::soundEncoding
SoundEncoding soundEncoding() const
Returns the sound encoding.
Definition: sound.cpp:109
Okular::Sound::setSamplingRate
void setSamplingRate(double rate)
Sets the sampling rate.
Definition: sound.cpp:84
Okular::Sound::url
QString url() const
Returns the external storage url of the sound data.
Definition: sound.cpp:69
Okular::Sound::Embedded
Is stored embedded in the document.
Definition: sound.h:34
Okular::Sound::~Sound
~Sound()
Destroys the sound object.
Definition: sound.cpp:59
Okular::Sound
Contains information about a sound object.
Definition: sound.h:26
Okular::Sound::setChannels
void setChannels(int channels)
Sets the number of channels.
Definition: sound.cpp:94
Okular::Sound::setSoundEncoding
void setSoundEncoding(SoundEncoding encoding)
Sets the type of sound encoding.
Definition: sound.cpp:114
Okular::Sound::bitsPerSample
int bitsPerSample() const
Returns the bits per sample rate.
Definition: sound.cpp:99
Okular::Sound::SoundEncoding
SoundEncoding
Describes the encoding of the sound data.
Definition: sound.h:40
Okular::Sound::External
Is stored at external resource (e.g. url)
Definition: sound.h:33
Okular::Sound::soundType
SoundType soundType() const
Returns the type of the sound object.
Definition: sound.cpp:64
Okular::Sound::SoundType
SoundType
Describes where the sound is stored.
Definition: sound.h:32
Okular::Sound::setBitsPerSample
void setBitsPerSample(int rate)
Sets the bits per sample rate.
Definition: sound.cpp:104
Okular::Sound::data
QByteArray data() const
Returns the embedded sound data.
Definition: sound.cpp:74
Okular::Sound::Sound
Sound(const QByteArray &data)
Creates a new sound object with the given embedded sound data.
Definition: sound.cpp:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal