protected boolean enqueue ( SoundKey key , boolean okToStartNew ) { boolean add ; boolean queued ; synchronized ( _queue ) { if ( key . cmd == PLAY && _queue . size ( ) > MAX_QUEUE_SIZE ) { queued = add = false ; } else { _queue . appendLoud ( key ) ; queued = true ; add = okToStartNew && ( _freeSpoolers == 0 ) && ( _spoolerCount < MAX_SPOOLERS ) ; if ( add ) { _spoolerCount ++ ; } } } // and if we need a new thread, add it if ( add ) { Thread spooler = new Thread ( "narya SoundManager line spooler" ) { @ Override public void run ( ) { spoolerRun ( ) ; } } ; spooler . setDaemon ( true ) ; spooler . start ( ) ; } return queued ; }
Enqueue a new SoundKey .