// Update a sound in the displayed buttons, sound list, and sound file // soundClip - An object storing information about the added or updated sound public void updateSound(SoundInfo soundClip) { // Add the sound to the project SoundInfo newSound = soundManager.addSound(soundClip); if (newSound != null) { // Add a new button to the GUI addSound(newSound); } if (soundManager.getProjectModified()) { if (newSound == null) { // An existing sound was updated // Update the button label and tooltip for (int s = 0; s < soundList.size(); s++) { BoardButton button = soundList.get(s); if (button.getKeyCode() == soundClip.getKeyCode()) { button.updateButtonText(); break; } } } // Update the GUI frame.setProjectModified(); refreshSoundBoard(); } }
// Removes a sound from the interface and sound list // keyCode - The keyboard key code associated with the sound public void deleteSound(int keyCode) { soundManager.deleteSound(keyCode); // Search the sound buttons for the button to remove for (int s = 0; s < soundList.size(); s++) { BoardButton button = soundList.get(s); if (button.getKeyCode() == keyCode) { // Remove the button from the interface remove(button.getButton()); soundList.remove(s); // Update the GUI frame.setProjectModified(); refreshSoundBoard(); break; } } }