• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • arts
 

arts

  • arts
  • kde
kdatarequest_impl.cpp
1 /*
2
3 Copyright (C) 2002 Nikolas Zimmermann <wildfox@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19
20 */
21
22#include <kdebug.h>
23#include "flowsystem.h"
24#include "convert.h"
25#include "kdatarequest_impl.moc"
26
27using namespace Arts;
28
29KDataRequest_impl::KDataRequest_impl()
30{
31 m_lastBlockSize = 0;
32 m_outBlock = 0;
33}
34
35KDataRequest_impl::~KDataRequest_impl()
36{
37 delete []m_outBlock;
38}
39
40void KDataRequest_impl::streamInit()
41{
42}
43
44void KDataRequest_impl::streamEnd()
45{
46}
47
48void KDataRequest_impl::calculateBlock(unsigned long samples)
49{
50 long blockSize = samples * 4;
51
52 if(m_lastBlockSize != blockSize)
53 {
54 delete []m_outBlock;
55 emit newBlockSize(blockSize);
56
57 m_outBlock = new unsigned char[blockSize]; // 2 channels, 16 bit
58
59 emit newBlockPointer((long) m_outBlock);
60
61 m_lastBlockSize = blockSize;
62 }
63
64 convert_stereo_2float_i16le(samples, left, right, m_outBlock);
65 emit newData();
66}
67
68/*
69 * this is the most tricky part here - since we will run in a context
70 * where no audio hardware will play the "give me more data role",
71 * we'll have to request things ourselves (requireFlow() tells the
72 * flowsystem that more signal flow should happen, so that
73 * calculateBlock will get called
74 */
75void KDataRequest_impl::goOn()
76{
77 _node()->requireFlow();
78}
79
80REGISTER_IMPLEMENTATION(KDataRequest_impl);

arts

Skip menu "arts"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

arts

Skip menu "arts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for arts by doxygen 1.9.4
This website is maintained by Timothy Pearson.