RemoteVstPlugin: fixed too short arrays for preset names
[lmms.git] / include / AudioDummy.h
blob324b08c858e5c10a124988e96e8c5d68f7854459
1 /*
2 * AudioDummy.h - dummy audio-device
4 * Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
25 #ifndef _AUDIO_DUMMY_H
26 #define _AUDIO_DUMMY_H
28 #include "AudioBackend.h"
29 #include "Cpu.h"
30 #include "MicroTimer.h"
33 class AudioDummy : public AudioBackend, public QThread
35 public:
36 AudioDummy( bool & _success_ful, AudioOutputContext * context ) :
37 AudioBackend( DEFAULT_CHANNELS, context )
39 _success_ful = true;
42 virtual ~AudioDummy()
44 stopProcessing();
47 inline static QString name()
49 return QT_TRANSLATE_NOOP( "setupWidget", "Dummy (no sound output)" );
53 class setupWidget : public AudioBackend::setupWidget
55 public:
56 setupWidget( QWidget * _parent ) :
57 AudioBackend::setupWidget( AudioDummy::name(), _parent )
61 virtual ~setupWidget()
65 virtual void saveSettings()
69 virtual void show()
71 parentWidget()->hide();
72 QWidget::show();
75 } ;
78 private:
79 virtual void startProcessing()
81 start();
84 virtual void stopProcessing()
86 if( isRunning() )
88 wait( 1000 );
89 terminate();
93 virtual void run()
95 MicroTimer timer;
96 sampleFrameA * buf = CPU::allocFrames( mixer()->framesPerPeriod() );
97 while( true )
99 timer.reset();
100 int frames = getNextBuffer( buf );
101 if( frames == 0 )
103 break;
106 const Sint32 microseconds = static_cast<Sint32>(
107 mixer()->framesPerPeriod() * 1000000.0f /
108 mixer()->processingSampleRate() - timer.elapsed() );
109 if( microseconds > 0 )
111 usleep( microseconds );
114 CPU::freeFrames( buf );
120 #endif