public int play() {
        int clipIdx = -1;

        // Check if there are currently any free clips to play
        if (clipAssembly[nextPlaybackIdx].isRunning() == false) {
            clipIdx = nextPlaybackIdx;
            clipAssembly[clipIdx].setFramePosition(0);

            // If needed alter the playback volume
            if (alterNextClipVolume) {
                if (clipAssembly[clipIdx].isControlSupported(
                        FloatControl.Type.MASTER_GAIN) == false) {
                    throw new IllegalStateException("SoundAssetAssembly.play: " +
                            "The stored clip does not support volume changes.");
                }
                
                FloatControl gainControl 
                        = (FloatControl) clipAssembly[clipIdx].getControl( 
                            FloatControl.Type.MASTER_GAIN );
                float volumeRange = gainControl.getMaximum() - gainControl.getMinimum();
                float newGain = volumeRange * nextClipVolume + gainControl.getMinimum();

                gainControl.setValue(newGain);
            }

            // If needed alter the playback pan
            if (alterNextClipPan) {
                if (clipAssembly[clipIdx].isControlSupported(FloatControl.Type.PAN)) {
                    FloatControl panControl 
                            = (FloatControl) clipAssembly[clipIdx].getControl( 
                                FloatControl.Type.PAN );
                    panControl.setValue(nextClipPan);
                } else if (clipAssembly[clipIdx].isControlSupported(
                        FloatControl.Type.BALANCE)) {
                    FloatControl balControl 
                            = (FloatControl) clipAssembly[clipIdx].getControl( 
                                FloatControl.Type.BALANCE );
                    balControl.setValue(nextClipPan);
                } else {
                    throw new IllegalStateException("" + "SoundAssetAssembly.play: " +
                            "Cannot change pan or balance on loaded clip.");
                }
            }

            clipAssembly[clipIdx].start();

            // Move onto the next clip in the playback sequence
            nextPlaybackIdx = (nextPlaybackIdx + 1) % clipAssembly.length;
        } else {
            // If the next clip is already playing, then it is stopped and
            // the play request reissued.
            clipAssembly[nextPlaybackIdx].stop();
            clipIdx = play();
        }


        // Irrespective of weither a clip was selected for playback, reset the 
        // next clip and next pan changes to false.
        alterNextClipVolume = false;
        alterNextClipPan = false;

        return clipIdx;
    }