2016-10-29 02:02:21 +03:00
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
// File: WAVFileReader.h
|
|
|
|
//
|
|
|
|
// Functions for loading WAV audio files
|
|
|
|
//
|
2021-02-27 10:01:15 +03:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
2018-02-24 09:08:23 +03:00
|
|
|
// Licensed under the MIT License.
|
2016-10-29 02:02:21 +03:00
|
|
|
//
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkId=248929
|
2018-02-24 09:08:23 +03:00
|
|
|
// http://go.microsoft.com/fwlink/?LinkID=615561
|
2016-10-29 02:02:21 +03:00
|
|
|
//-------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <objbase.h>
|
2020-03-03 23:20:04 +03:00
|
|
|
|
|
|
|
#include <cstdint>
|
2016-10-29 02:02:21 +03:00
|
|
|
#include <memory>
|
|
|
|
#include <mmreg.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DirectX
|
|
|
|
{
|
2018-05-02 05:13:50 +03:00
|
|
|
HRESULT LoadWAVAudioInMemory(
|
|
|
|
_In_reads_bytes_(wavDataSize) const uint8_t* wavData,
|
|
|
|
_In_ size_t wavDataSize,
|
|
|
|
_Outptr_ const WAVEFORMATEX** wfx,
|
|
|
|
_Outptr_ const uint8_t** startAudio,
|
2019-12-11 05:33:53 +03:00
|
|
|
_Out_ uint32_t* audioBytes) noexcept;
|
2018-05-02 05:13:50 +03:00
|
|
|
|
|
|
|
HRESULT LoadWAVAudioFromFile(
|
|
|
|
_In_z_ const wchar_t* szFileName,
|
|
|
|
_Inout_ std::unique_ptr<uint8_t[]>& wavData,
|
|
|
|
_Outptr_ const WAVEFORMATEX** wfx,
|
|
|
|
_Outptr_ const uint8_t** startAudio,
|
2019-12-11 05:33:53 +03:00
|
|
|
_Out_ uint32_t* audioBytes) noexcept;
|
2016-10-29 02:02:21 +03:00
|
|
|
|
|
|
|
struct WAVData
|
|
|
|
{
|
|
|
|
const WAVEFORMATEX* wfx;
|
|
|
|
const uint8_t* startAudio;
|
|
|
|
uint32_t audioBytes;
|
|
|
|
uint32_t loopStart;
|
|
|
|
uint32_t loopLength;
|
|
|
|
const uint32_t* seek; // Note: XMA Seek data is Big-Endian
|
|
|
|
uint32_t seekCount;
|
|
|
|
};
|
|
|
|
|
2018-05-02 05:13:50 +03:00
|
|
|
HRESULT LoadWAVAudioInMemoryEx(
|
|
|
|
_In_reads_bytes_(wavDataSize) const uint8_t* wavData,
|
|
|
|
_In_ size_t wavDataSize,
|
2019-12-11 05:33:53 +03:00
|
|
|
_Out_ WAVData& result) noexcept;
|
2016-10-29 02:02:21 +03:00
|
|
|
|
2018-05-02 05:13:50 +03:00
|
|
|
HRESULT LoadWAVAudioFromFileEx(
|
|
|
|
_In_z_ const wchar_t* szFileName,
|
|
|
|
_Inout_ std::unique_ptr<uint8_t[]>& wavData,
|
2019-12-11 05:33:53 +03:00
|
|
|
_Out_ WAVData& result) noexcept;
|
2018-06-07 04:37:54 +03:00
|
|
|
}
|