summaryrefslogtreecommitdiffstats
path: root/ksayit/Freeverb_plugin/freeverbsetupimpl.cpp
blob: f861a57114bfba6d6a683fde60be1ed4ab35f4f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/***************************************************************************
                          freeverbsetupimpl.cpp  -  description
                             -------------------
    begin                : Son Nov 2 2003
    copyright            : (C) 2003 by Robert Vogl
    email                : voglrobe@saphir
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <iostream>
using namespace std;
 
// QT includes
#include <tqslider.h>
#include <tqlcdnumber.h>

// KDE includes
#include <kdebug.h>

// App specific includes
#include "freeverbsetupimpl.h"

FreeverbSetupImpl::FreeverbSetupImpl(TQWidget *tqparent, const char *name, bool modal, KConfig *config )
 : Freeverb_Setup(tqparent,name,modal), m_config(config) {

  // initialize Widgets
  Init();

}
FreeverbSetupImpl::~FreeverbSetupImpl(){
}


void FreeverbSetupImpl::sliderRoomChanged(int value)
{
  LCD_room->display( 99-value );
}


void FreeverbSetupImpl::sliderDampChanged(int value)
{
  LCD_damp->display( 99-value );
}


void FreeverbSetupImpl::sliderWetChanged(int value)
{
  LCD_wet->display( 99-value );
}


void FreeverbSetupImpl::sliderDryChanged(int value)
{
  LCD_dry->display( 99-value );
}


void FreeverbSetupImpl::sliderWidthChanged(int value)
{
  LCD_width->display( 99-value );
}


void FreeverbSetupImpl::saveWasClicked()
{
  kdDebug(100200) << "FreeverbSetupImpl::saveWasClicked()" << endl;
  // Save freeverb configuration
  m_config->setGroup("Synth_FREEVERB");
  m_config->writeEntry( "room",   LCD_room->intValue() );  
  m_config->writeEntry( "damp",   LCD_damp->intValue() );
  m_config->writeEntry( "wet",    LCD_wet->intValue() );
  m_config->writeEntry( "dry",    LCD_dry->intValue() );
  m_config->writeEntry( "width",  LCD_width->intValue() );
  m_config->sync();
}

void FreeverbSetupImpl::Init()
{
  // Read freeverb configuration
  m_config->setGroup("Synth_FREEVERB");
   LCD_room->display( m_config->readNumEntry("room", 50) );
   slider_room->setValue( 99-LCD_room->intValue() );

   LCD_damp->display( m_config->readNumEntry("damp", 50) );
   slider_damp->setValue( 99-LCD_damp->intValue() );
   
   LCD_wet->display( m_config->readNumEntry("wet", 50) );
   slider_wet->setValue( 99-LCD_wet->intValue() );
   
   LCD_dry->display( m_config->readNumEntry("dry", 50) );
   slider_dry->setValue( 99-LCD_dry->intValue() );
   
   LCD_width->display( m_config->readNumEntry("width", 50) );
   slider_width->setValue( 99-LCD_width->intValue() );
}


void FreeverbSetupImpl::slotOKwasClicked()
{
  // save configuration
  saveWasClicked();
  // simply close the dialog
  this->accept();
}



#include "freeverbsetupimpl.moc"