⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsthread.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                if (debugFlag)                    debugPrint("JSThread                    " +                      "start Midi backgroundSound with gain " + leftGain);            }            else { // soundType is POINT_SOUND or CONE_SOUND                // start up main left and right channels for spatial rendered sound                returnValue = JSMidi.startSamples(sample,                       ((JSPositionalSample)sample).getSecondIndex(),                       loopCount, leftGain, rightGain, leftDelay, rightDelay);                *******                // TODO: positional MIDI sounds not supported.                //     The above startSamples really just start on sample                //     Don't bother with reverb channel for now.                 //                // start up reverb channel w/out delay even if reverb not on now                //                float reverbGain = 0.0f;                if (!muted && auralParams.reverbFlag) {                    reverbGain = sample.getGain() *                           attribs.reflectionCoefficient;                }                int reverbRtrnVal = JSMidi.startSample(                       ((JSPositionalSample)sample).getReverbIndex(), loopCount,                               reverbGain);                *******                if (debugFlag)                    debugPrint("JSThread                    " +                      "start Midi positionalSound with gain "+ leftGain +                      ", " + rightGain);            }        }        else {            if (debugFlag)                debugPrint(                    "JSThread: Internal Error startSample dataType " +                    dataType + " invalid");            return false;        }        // TODO: have to look at return values and conditionally return 'success'**********/        return true;    }    boolean stopSample(JSSample sample) {/***********// QUESTION: should this have a return values - error - or not??        int   dataType = sample.getDataType();        int   soundType = sample.getSoundType();        int returnValue = 0;        if (dataType == JSAuralParameters.STREAMING_AUDIO_DATA) {            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSStream.stopSamples(sample,                         ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSStream.stopSample(                         ((JSPositionalSample)sample).getReverbIndex());            }            else                returnValue = JSStream.stopSample(sample);        }        else if (dataType == JSAuralParameters.BUFFERED_AUDIO_DATA) {            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSClip.stopSamples(sample,                         ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSClip.stopSample(                         ((JSPositionalSample)sample).getReverbIndex());            }            else                returnValue = JSClip.stopSample(sample);        }        else if (dataType == JSAuralParameters.STREAMING_MIDI_DATA ||                 dataType == JSAuralParameters.BUFFERED_MIDI_DATA) {          *****            // TODO: positional sounds NOT supported yet            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSMidi.stopSamples(sample,                         ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSMidi.stopSample(                         ((JSPositionalSample)sample).getReverbIndex());            }            else          *****                returnValue = JSMidi.stopSample(sample);        }        else {            if (debugFlag)                debugPrint( "JSThread: Internal Error stopSample dataType " +                  dataType + " invalid");            return -1;        }************/        return true;    }      void pauseSample(JSSample sample) {/**********        int   dataType = sample.getDataType();        int   soundType = sample.getSoundType();        int returnValue = 0;        if (dataType == JSAuralParameters.STREAMING_AUDIO_DATA) {            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSStream.pauseSamples(sample,                         ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSStream.pauseSample(                         ((JSPositionalSample)sample).getReverbIndex());            }            else                returnValue = JSStream.pauseSample(sample);        }        else if (dataType == JSAuralParameters.BUFFERED_AUDIO_DATA) {            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSClip.pauseSamples(sample,                         ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSClip.pauseSample(                         ((JSPositionalSample)sample).getReverbIndex());            }            else                returnValue = JSClip.pauseSample(sample);        }        else if (dataType == JSAuralParameters.STREAMING_MIDI_DATA ||                 dataType == JSAuralParameters.BUFFERED_MIDI_DATA) {            *******            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSMidi.pauseSamples(sample,                         ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSMidi.pauseSample(                         ((JSPositionalSample)sample).getReverbIndex());            }            else            *****                returnValue = JSMidi.pauseSample(sample);        }        else {            if (debugFlag)                debugPrint(                  "JSThread: Internal Error pauseSample dataType " +                  dataType + " invalid");        }        if (returnValue < 0) {            if (debugFlag)                debugPrint( "JSThread: Internal Error pauseSample " +                    "for sample " + sample + " failed");        }// QUESTION: return value or not???        return;*************/    }    void unpauseSample(JSSample sample) {/**************        int   dataType = sample.getDataType();        int   soundType = sample.getSoundType();        int returnValue = 0;        if (dataType == JSAuralParameters.STREAMING_AUDIO_DATA) {            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSStream.unpauseSamples(sample,                      ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSStream.unpauseSample(                      ((JSPositionalSample)sample).getReverbIndex());            }               else                returnValue = JSStream.unpauseSample(sample);        }        else if (dataType == JSAuralParameters.BUFFERED_AUDIO_DATA) {            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSClip.unpauseSamples(sample,                      ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSClip.unpauseSample(                      ((JSPositionalSample)sample).getReverbIndex());            }               else                returnValue = JSClip.unpauseSample(sample);        }        else if (dataType == JSAuralParameters.STREAMING_MIDI_DATA ||                 dataType == JSAuralParameters.BUFFERED_MIDI_DATA) {            *********            // TODO: positional Midi sounds            if ( (soundType == AudioDevice3D.CONE_SOUND) ||                 (soundType == AudioDevice3D.POINT_SOUND) ) {                returnValue = JSMidi.unpauseSamples(sample,                      ((JSPositionalSample)sample).getSecondIndex());                returnValue = JSMidi.unpauseSample(                      ((JSPositionalSample)sample).getReverbIndex());            }            else            *********                returnValue = JSMidi.unpauseSample(sample);        }        else {            if (debugFlag)                debugPrint(                      "JSThread: Internal Error unpauseSample dataType " +                      dataType + " invalid");        }        if (returnValue < 0) {            if (debugFlag)                debugPrint( "JSThread: Internal Error unpauseSample " +                   "for sample " + sample + " failed");         }// QUESTION: return value or not???        return;*************/    }// TODO:     void muteSample(JSSample sample) {        // is this already muted? if so don't do anytning        // This determines if mute is done as a zero gain or        // as a stop, advance restart...    }// TODO:     void unmuteSample(JSSample sample) {        if (debugFlag)            debugPrint( "JSThread.unmuteSample not implemented");    }    int startStreams() {// QUESTION: return value or not???        return 0;    }    int startStream() {// QUESTION: return value or not???        return 0;    }    int startClips() {// QUESTION: return value or not???        return 0;    }    int startClip() {// QUESTION: return value or not???        return 0;    }    /**     * This initializes this thread.  Once this method returns, the thread is     * ready to do work.     */    public void initialize() {        super.initialize();        // this.setPriority(Thread.MAX_PRIORITY);        // TODO: init values of fields???        if (debugFlag)            debugPrint("JSThread.initialize()");        // TODO: doesn't do anything yet    }    /**     * Code to close the device     * @return flag: true is closed sucessfully, false if error     */      boolean close() {        // TODO: for now do nothing        return false;    }    public void shutdown() {    }    // default resource clean up method    public void cleanup() {        super.cleanup();        if (debugFlag)            debugPrint("JSThread.cleanup()");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -