小编Nat*_* G.的帖子

为OpenAL加载.WAV文件

我正在尝试加载.WAV文件以与OpenAL一起播放。我正在跟踪我在互联网上找到的示例,但它的行为很奇怪。这是代码:

struct RIFF_Header {
    char chunkID[4];
    long chunkSize;//size not including chunkSize or chunkID
    char format[4];
};

/*
 * Struct to hold fmt subchunk data for WAVE files.
 */
struct WAVE_Format {
    char subChunkID[4];
    long subChunkSize;
    short audioFormat;
    short numChannels;
    long sampleRate;
    long byteRate;
    short blockAlign;
    short bitsPerSample;
};

/*
* Struct to hold the data of the wave file
*/
struct WAVE_Data {
    char subChunkID[4]; //should contain the word data
    long subChunk2Size; //Stores the size of the data block
}; …
Run Code Online (Sandbox Code Playgroud)

c++ audio openal wav

5
推荐指数
1
解决办法
2310
查看次数

标签 统计

audio ×1

c++ ×1

openal ×1

wav ×1