/[svn]/jsampler/trunk/src/org/jsampler/task/Global.java
ViewVC logotype

Annotation of /jsampler/trunk/src/org/jsampler/task/Global.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1144 - (hide annotations) (download)
Mon Apr 2 21:39:15 2007 UTC (17 years ago) by iliev
File size: 2457 byte(s)
- upgrading to version 0.4a

1 iliev 1144 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4     * Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>
5     *
6     * This file is part of JSampler.
7     *
8     * JSampler is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License version 2
10     * as published by the Free Software Foundation.
11     *
12     * JSampler is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with JSampler; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20     * MA 02111-1307 USA
21     */
22    
23     package org.jsampler.task;
24    
25     import java.util.logging.Level;
26    
27     import org.jsampler.CC;
28     import org.jsampler.HF;
29    
30     import static org.jsampler.JSI18n.i18n;
31    
32    
33     /**
34     * Provides tasks for managing the global settings of the sampler.
35     * @author Grigor Iliev
36     */
37     public class Global {
38    
39     /** Forbits the instantiation of this class. */
40     private Global() { }
41    
42     /**
43     * This task gets the global volume of the sampler.
44     */
45     public static class GetVolume extends EnhancedTask<Float> {
46     /** Creates a new instance of <code>Get</code>. */
47     public
48     GetVolume() {
49     setTitle("Global.GetVolume_task");
50     setDescription(i18n.getMessage("Global.GetVolume.desc"));
51     }
52    
53     /** The entry point of the task. */
54     public void
55     run() {
56     try { setResult(CC.getClient().getVolume()); }
57     catch(Exception x) {
58     setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));
59     CC.getLogger().log(Level.FINE, getErrorMessage(), x);
60     }
61     }
62     }
63    
64    
65     /**
66     * This task sets the global volume of the sampler.
67     */
68     public static class SetVolume extends EnhancedTask {
69     private float volume;
70    
71     /**
72     * Creates new instance of <code>SetVolume</code>.
73     * @param volume The new volume value.
74     */
75     public
76     SetVolume(float volume) {
77     setTitle("Global.SetVolume_task");
78     setDescription(i18n.getMessage("Global.SetVolume.desc"));
79     this.volume = volume;
80     }
81    
82     /** The entry point of the task. */
83     public void
84     run() {
85     try {
86     CC.getClient().setVolume(volume);
87     } catch(Exception x) {
88     setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));
89     CC.getLogger().log(Level.FINE, getErrorMessage(), x);
90     }
91     }
92     }
93     }

  ViewVC Help
Powered by ViewVC