openpiano.settings
Class Settings

java.lang.Object
  extended by openpiano.settings.Settings

public class Settings
extends Object

A class managing the user settings

Version:
1.0, 07/30/08
Author:
Sascha Westermann

Constructor Summary
Settings(Controller controller)
          Creates a settings object and reads settings from a file
 
Method Summary
 int addMidiSettings(MidiSettings midiSettings)
          Adds a new configuration for a MIDI file
 String getActualMidiOutputDevice()
          Returns the name of the actual MIDI output device
 float getAngle()
          Returns the angle of the piano
 File getFileDir()
          Returns the directory of the MIDI files
 int getFirstKey()
          Returns the first key of the shown piano
 int getLastKey()
          Returns the last key of the shown piano
 MidiInput getMidiInput()
          Returns the MIDI receiver
 String getMidiInputDevice()
          Returns the name of the MIDI input device according to the configuration
 int getMidiKeyboardIndex()
          Returns the index of the MIDI input device
 MidiOutput getMidiOutput()
          Returns the MIDI transmitter
 String getMidiOutputDevice()
          Returns the name of the MIDI output device according to the configuration
 int getMidiOutputIndex()
          Returns the index of the MIDI output device
 MidiDevice.Info[] getMidiPorts(Boolean input)
          Returns the available MIDI ports
 LinkedList<MidiSettings> getMidiSettings()
          Returns the configurations for the MIDI files
 MidiSettings getMidiSettings(int index)
          Returns the configuration for a MIDI file
 int getWindowHeight()
          Returns the height of the application window
 int getWindowPosX()
          Returns the x-position of the application window
 int getWindowPosY()
          Returns the y-position of the application window
 int getWindowWidth()
          Returns the width of the application window
 float getZoomFactor()
          Returns the zoom factor of the piano
 void handleMidiInputChange(MidiDevice.Info midiDevice)
          Handles the change of MIDI input devices
 void handleMidiInputChange(MidiDevice.Info midiDevice, Boolean saveSettings)
          Handles the change of MIDI input devices
 void handleMidiInputChange(MidiDevice.Info midiDevice, Boolean saveSettings, Boolean returnFromOptions)
          Handles the change of MIDI input devices
 void handleMidiOutputChange(MidiDevice.Info midiDevice)
          Handles the change of MIDI output devices
 void handleMidiOutputChange(MidiDevice.Info midiDevice, Boolean saveSettings)
          Handles the change of MIDI output devices
 Boolean isAudioOn(int track)
          Returns the status of the audio function of a specified track of the current loaded configuration
 Boolean isAwaitNotesOn()
          Returns the status of the await notes function of the current loaded configuration
 Boolean isMarkKeysOn()
          Returns the status of the mark keys function of the current loaded configuration
 Boolean isVisualOn(int track)
          Returns the status of the visual function of a specified track of the current loaded configuration
 int lookupForFile(String md5Hash)
          Looks the configuration up for a previously saved hash
 void saveSettings()
          Saves the settings to the configuration file
 void setActualMidiInputDevice(String midiInputDevice)
          Sets the actual MIDI input device
 void setActualMidiOutputDevice(String midiOutputDevice)
          Sets the actual MIDI output device
 void setAngle(float angle)
          Sets the angle of the piano
 void setFileDir(File fileDir)
          Sets the directory of the MIDI files
 void setFirstKey(int firstKey)
          Sets the first key of the shown piano
 void setLastKey(int lastKey)
          Sets the last key of the shown piano
 void setMidiOutputDevice(String midiOutputDevice)
          Sets the MIDI output device
 void setWindowHeight(int windowHeight)
          Sets the height of the application window
 void setWindowPosX(int windowPosX)
          Sets the x-position of the application window
 void setWindowPosY(int windowPosY)
          Sets the y-position of the application window
 void setWindowWidth(int windowWidth)
          Sets the width of the application window
 void setZoomFactor(float zoomFactor)
          Sets the zoom factor of the piano
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Settings

public Settings(Controller controller)
Creates a settings object and reads settings from a file

Parameters:
controller - the main controller of the application
Method Detail

lookupForFile

public int lookupForFile(String md5Hash)
Looks the configuration up for a previously saved hash

Parameters:
md5Hash - the MD5 hash to look for
Returns:
the index of the known hash value, else -1

isMarkKeysOn

public Boolean isMarkKeysOn()
Returns the status of the mark keys function of the current loaded configuration

Returns:
true if mark keys function is enabled

isAwaitNotesOn

public Boolean isAwaitNotesOn()
Returns the status of the await notes function of the current loaded configuration

Returns:
true if await notes function is enabled

isAudioOn

public Boolean isAudioOn(int track)
Returns the status of the audio function of a specified track of the current loaded configuration

Parameters:
track - the relevant track
Returns:
true if audio function is enabled on the track

isVisualOn

public Boolean isVisualOn(int track)
Returns the status of the visual function of a specified track of the current loaded configuration

Parameters:
track - the relevant track
Returns:
true if visual function is enabled on the track

getFirstKey

public int getFirstKey()
Returns the first key of the shown piano

Returns:
the first key of the shown piano

getLastKey

public int getLastKey()
Returns the last key of the shown piano

Returns:
the last key of the shown piano

setFirstKey

public void setFirstKey(int firstKey)
Sets the first key of the shown piano

Parameters:
firstKey - the first key of the shown piano

setLastKey

public void setLastKey(int lastKey)
Sets the last key of the shown piano

Parameters:
lastKey - the last key of the shown piano

getMidiKeyboardIndex

public int getMidiKeyboardIndex()
Returns the index of the MIDI input device

Returns:
the index of the MIDI input device

getMidiOutputIndex

public int getMidiOutputIndex()
Returns the index of the MIDI output device

Returns:
the index of the MIDI output device

getFileDir

public File getFileDir()
Returns the directory of the MIDI files

Returns:
the directory of the MIDI files

setFileDir

public void setFileDir(File fileDir)
Sets the directory of the MIDI files

Parameters:
fileDir - the directory of the MIDI files

getMidiPorts

public MidiDevice.Info[] getMidiPorts(Boolean input)
Returns the available MIDI ports

Parameters:
input - true if MIDI input ports should be returned, false for MIDI output ports
Returns:
the available MIDI ports

addMidiSettings

public int addMidiSettings(MidiSettings midiSettings)
Adds a new configuration for a MIDI file

Parameters:
midiSettings - the settings of a MIDI file to add
Returns:
the index of the configuration

saveSettings

public void saveSettings()
Saves the settings to the configuration file


getActualMidiOutputDevice

public String getActualMidiOutputDevice()
Returns the name of the actual MIDI output device

Returns:
the name of the actual MIDI output device

getMidiInputDevice

public String getMidiInputDevice()
Returns the name of the MIDI input device according to the configuration

Returns:
the name of the MIDI input device according to the configuration

getMidiOutputDevice

public String getMidiOutputDevice()
Returns the name of the MIDI output device according to the configuration

Returns:
the name of the MIDI output device according to the configuration

setActualMidiInputDevice

public void setActualMidiInputDevice(String midiInputDevice)
Sets the actual MIDI input device

Parameters:
midiInputDevice - the actual MIDI input device

setActualMidiOutputDevice

public void setActualMidiOutputDevice(String midiOutputDevice)
Sets the actual MIDI output device

Parameters:
midiOutputDevice - the actual MIDI output device

setMidiOutputDevice

public void setMidiOutputDevice(String midiOutputDevice)
Sets the MIDI output device

Parameters:
midiOutputDevice - the MIDI output device

getMidiSettings

public MidiSettings getMidiSettings(int index)
Returns the configuration for a MIDI file

Parameters:
index - the index of the configuration to return
Returns:
the configuration for a MIDI file

getMidiSettings

public LinkedList<MidiSettings> getMidiSettings()
Returns the configurations for the MIDI files

Returns:
the configuration for the MIDI files

getMidiOutput

public MidiOutput getMidiOutput()
Returns the MIDI transmitter

Returns:
the MIDI transmitter

handleMidiOutputChange

public void handleMidiOutputChange(MidiDevice.Info midiDevice,
                                   Boolean saveSettings)
Handles the change of MIDI output devices

Parameters:
midiDevice - the new MIDI output device
saveSettings - true if new device should be saved

handleMidiOutputChange

public void handleMidiOutputChange(MidiDevice.Info midiDevice)
Handles the change of MIDI output devices

Parameters:
midiDevice - the new MIDI output device

getMidiInput

public MidiInput getMidiInput()
Returns the MIDI receiver

Returns:
the MIDI receiver

handleMidiInputChange

public void handleMidiInputChange(MidiDevice.Info midiDevice)
Handles the change of MIDI input devices

Parameters:
midiDevice - the new MIDI input device

handleMidiInputChange

public void handleMidiInputChange(MidiDevice.Info midiDevice,
                                  Boolean saveSettings)
Handles the change of MIDI input devices

Parameters:
midiDevice - the new MIDI input device
saveSettings - true if new device should be saved

handleMidiInputChange

public void handleMidiInputChange(MidiDevice.Info midiDevice,
                                  Boolean saveSettings,
                                  Boolean returnFromOptions)
Handles the change of MIDI input devices

Parameters:
midiDevice - the new MIDI input device
saveSettings - true if new device should be saved
returnFromOptions - true if called from keyboard size settings

setWindowHeight

public void setWindowHeight(int windowHeight)
Sets the height of the application window

Parameters:
windowHeight - the height of the application window

setWindowWidth

public void setWindowWidth(int windowWidth)
Sets the width of the application window

Parameters:
windowWidth - the widths of the application window

getWindowHeight

public int getWindowHeight()
Returns the height of the application window

Returns:
the height of the application window

getWindowWidth

public int getWindowWidth()
Returns the width of the application window

Returns:
the width of the application window

setWindowPosX

public void setWindowPosX(int windowPosX)
Sets the x-position of the application window

Parameters:
windowPosX - the x-position of the application window

setWindowPosY

public void setWindowPosY(int windowPosY)
Sets the y-position of the application window

Parameters:
windowPosY - the y-position of the application window

getWindowPosX

public int getWindowPosX()
Returns the x-position of the application window

Returns:
the x-position of the application window

getWindowPosY

public int getWindowPosY()
Returns the y-position of the application window

Returns:
the y-position of the application window

setAngle

public void setAngle(float angle)
Sets the angle of the piano

Parameters:
angle - the angle of the piano

getAngle

public float getAngle()
Returns the angle of the piano

Returns:
the angle of the piano

setZoomFactor

public void setZoomFactor(float zoomFactor)
Sets the zoom factor of the piano

Parameters:
zoomFactor - the zoom factor of the piano

getZoomFactor

public float getZoomFactor()
Returns the zoom factor of the piano

Returns:
the zoom factor of the piano