Class SongFactory
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
All songs created by this factory are automatically registered. Registered songs are unregistered when song is closed.
-
Method Summary
Modifier and TypeMethodDescriptioncreateEmptySong
(String name) Create a 8-bar empty song.createEmptySong
(String name, int clsSize) Create an empty song of specified length.Get a Song object from a file.createSong
(String name, ChordLeadSheet cls) Create a Song from the specified chordleadsheet.createSong
(String name, ChordLeadSheet cls, SongStructure sgs) Create a Song from the specified chordleadsheet.findSong
(ChordLeadSheet cls) Find in the created song the first one which uses the specified ChordLeadSheet.findSong
(SongStructure sgs) Find in the created song the first one which uses the specified SongStructure.Return a deep copy of the specified song.getCopyUnlinked
(Song song, boolean register) Return a copy of the song where the SongStructure does NOT listen to the ChordLeadsheet changes.static SongFactory
getNewSongName
(String baseName) Provide a new song name which is not used by any currently opened song.All songs created by this object are automatically registered.boolean
isSongNameUsed
(String name) void
void
registerSong
(Song sg) Register a song if it was not created by the SongManager.void
unregisterSong
(Song song) Remove a song from the list returned by getRegisteredSong().
-
Method Details
-
getInstance
-
getRegisteredSongs
All songs created by this object are automatically registered.- Returns:
- A list of the songs registered by this object.
-
registerSong
Register a song if it was not created by the SongManager.- Parameters:
sg
-
-
getNewSongName
Provide a new song name which is not used by any currently opened song.- Parameters:
baseName
- Can't be blank- Returns:
-
createFromFile
Get a Song object from a file.Song's getFile() will return f.
Song's getName() will return f.getName().- Parameters:
f
-- Returns:
- Throws:
SongCreationException
-
unregisterSong
Remove a song from the list returned by getRegisteredSong().- Parameters:
song
-
-
findSong
Find in the created song the first one which uses the specified SongStructure.- Parameters:
sgs
-- Returns:
-
findSong
Find in the created song the first one which uses the specified ChordLeadSheet.- Parameters:
cls
-- Returns:
-
createSong
Create a Song from the specified chordleadsheet.- Parameters:
name
-cls
-- Returns:
- Throws:
UnsupportedEditException
- Can happen if too many timesignature changes resulting in not enough Midi channels for the various rhythms.
-
createSong
public Song createSong(String name, ChordLeadSheet cls, SongStructure sgs) throws UnsupportedEditException Create a Song from the specified chordleadsheet.- Parameters:
name
-cls
-sgs
- Must be kept consistent with cls changes (sgs.getParentChordLeadSheet() must be non null)- Returns:
- Throws:
UnsupportedEditException
- Can happen if too many timesignature changes resulting in not enough Midi channels for the various rhythms.
-
createEmptySong
Create a 8-bar empty song.- Parameters:
name
-- Returns:
-
createEmptySong
Create an empty song of specified length.Initial section is "A" with a C starting chord symbol.
- Parameters:
name
- The name of the songclsSize
- The number of bars of the song.- Returns:
-
isSongNameUsed
-
getCopy
Return a deep copy of the specified song.Copy the following variables: chordleadsheet, songStructure, name, tempo, comments, tags, user phrases, clientProperties.
ChordLeadSheetItem's clientProperties are copied.
Listeners or file are NOT copied. Returned song is not closed, even if the original song was.- Parameters:
song
-register
- If true register the created song- Returns:
-
getCopyUnlinked
Return a copy of the song where the SongStructure does NOT listen to the ChordLeadsheet changes.WARNING: Because SongStructure and ChordLeadsheet are not linked, changing them might result in inconsistent states. This should be used only in special cases.
Copy the following variables: chordleadsheet, songStructure, name, tempo, comments, tags, user phrases. Listeners or file are NOT copied.
- Parameters:
song
-register
- If true register the created song.- Returns:
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-