簡體   English   中英

Java-LWJGL-OpenAL-了解一些代碼

[英]Java - LWJGL - OpenAL - Understanding some code

地獄編碼員,我目前正在與LWJGL合作研究OpenAL,我不明白這些代碼行的作用(這些注釋代表我認為他們在做什么,您能告訴我正確的事情嗎?一件事。我用谷歌搜索。

WaveData data = WaveData.create(new BufferedInputStream(new FileInputStream("res/sound.wav")));//generate data from the file (binary data?)
    int buffer = alGenBuffers();//generate an empty buffer
    alBufferData(buffer,data.format,data.data,data.samplerate);//assign previously generated data to buffer
    data.dispose();//what does this line do? (I can not understand what dispose means. Throw away or give the data?)    
    int source = alGenSources();//generate source(What does source mean here?)
    alSourcei(source , AL_BUFFER, buffer);//set a property the the source. arg # 1 is the property type , arg # 0 is the source to set the property at and arg # 3 is the value to pass as a property.

請幫助我成為一個更好的程序員。 問候〜Teo

如您所見: https : //github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/util/WaveData.java data.dispose()清除不丟棄數據但會丟棄數據的ByteBuffer重置讀/寫位置(請參閱http://docs.oracle.com/javase/7/docs/api/java/nio/Buffer.html#clear%28%29

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM