mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-27 16:53:55 +00:00
Retracted some winmm changes
This commit is contained in:
@@ -614,128 +614,6 @@ WAVEFORMATEXTENSIBLE :: struct {
|
||||
SubFormat: GUID,
|
||||
}
|
||||
|
||||
MPEGLAYER3_WFX_EXTRA_BYTES :: 12
|
||||
// MPEG Layer3 WAVEFORMATEX structure
|
||||
MPEGLAYER3WAVEFORMAT :: struct {
|
||||
using wfx: WAVEFORMATEX,
|
||||
wID: WORD,
|
||||
fdwFlags: DWORD,
|
||||
nBlockSize: WORD,
|
||||
nFramesPerBlock: WORD,
|
||||
nCodecDelay: WORD,
|
||||
}
|
||||
LPMPEGLAYER3WAVEFORMAT :: ^MPEGLAYER3WAVEFORMAT
|
||||
|
||||
MPEGLAYER3_ID_UNKNOWN :: 0
|
||||
MPEGLAYER3_ID_MPEG :: 1
|
||||
MPEGLAYER3_ID_CONSTANTFRAMESIZE :: 2
|
||||
|
||||
MPEGLAYER3_FLAG_PADDING_ISO :: 0x00000000
|
||||
MPEGLAYER3_FLAG_PADDING_ON :: 0x00000001
|
||||
MPEGLAYER3_FLAG_PADDING_OFF :: 0x00000002
|
||||
|
||||
/*
|
||||
"MPEG-2" in the comments below refers to ISO/IEC 13818-7 (MPEG-2 AAC spec).
|
||||
"MPEG-4" in the comments below refers to ISO/IEC 14496-3 (MPEG-4 Audio spec).
|
||||
|
||||
The following defines the format block to be used for MPEG-2 AAC or MPEG-4 HE-AAC v1/v2 streams.
|
||||
When setting media type attributes in Media Foundation (MF) objects, this will appear in conjunction with major type MFMediaType_Audio and sub type MFAudioFormat_AAC (=MEDIASUBTYPE_MPEG_HEAAC).
|
||||
The format block structure HEAACWAVEFORMAT is defined below. It starts with the structure HEAACWAVEINFO (which is an extension of WAVEFORMATEX), followed by AudioSpecificConfig() as defined by ISO/IEC 14496-3 (MPEG-4 audio).
|
||||
Since the length of AudioSpecificConfig() may vary from one stream to another, this is a variable size format block.
|
||||
|
||||
The WAVEFORMATEX fields describe the properties of the core AAC stream, without SBR/PS extensions (if exists). This is the description of the WAVEFORMATEX fields:
|
||||
|
||||
wfx.wFormatTag - Set this to WAVE_FORMAT_MPEG_HEAAC (0x1610).
|
||||
|
||||
wfx.nChannels - Total number of channels in core AAC stream (including LFE if exists).
|
||||
This might be different than the decoded number of channels if the MPEG-4 Parametric Stereo (PS) tool exists. If unknown, set to zero.
|
||||
|
||||
wfx.nSamplesPerSec - Sampling rate of core AAC stream. This will be one of the 12 supported sampling rate between 8000 and 96000 Hz, as defined in MPEG-2.
|
||||
This might be different than the decoded sampling rate if the MPEG-4 Spectral Band Replication (SBR) tool exists.
|
||||
If not know in advance, the sampling rate can be extracted from:
|
||||
- the 4-bit sampling_frequency_index field in adts_fixed_header(), or
|
||||
- program_config_element() in adif_header for MPEG-2 streams, or
|
||||
- the 4-bit samplingFrequencyIndex field in AudioSpecificConfig() for MPEG-4 streams.
|
||||
|
||||
wfx.nAvgBytesPerSec - The average bytes per second calculated based on the average bit rate of the compressed stream.
|
||||
This value may be used by parsers to seek into a particular time offset in the stream. It may also be used by applications to determine roughly how much buffer length to allocate.
|
||||
If this is not known in advance, this value can be estimated by parsing some (or all) of the compressed HE-AAC frames and calculating bit rate based on average compressed frame size.
|
||||
If unknown, set to zero.
|
||||
|
||||
wfx.nBlockAlign - Set this to 1.
|
||||
|
||||
wfx.wBitsPerSample - Desired bit depth of the decoded PCM. If unknown, set to zero.
|
||||
|
||||
wfx.cbSize - Set this to 12 (=sizeof(HEAACWAVEINFO)-sizeof(WAVEFORMATEX)) plus the size of AudioSpecificConfig() in bytes.
|
||||
|
||||
===================================
|
||||
|
||||
How do we parse this format block? assume pbBuff is the address of the first byte in the format block. We do the following:
|
||||
|
||||
pwfInfo := cast(^HEAACWAVEINFO)pbBuff
|
||||
|
||||
if pwfInfo.wStructType == 0 {
|
||||
pwf := cast(^HEAACWAVEFORMAT)pbBuff
|
||||
|
||||
// All HEAACWAVEFORMAT fields can now be accessed through pwf
|
||||
// To parse AudioSpecificConfig(), write a function such as
|
||||
// ParseAudioSpecificConfig :: proc(pbASC: ^BYTE, dwASCLen: DWORD),
|
||||
// and call:
|
||||
|
||||
dwASCLen: DWORD = pwf.wfInfo.wfx.cbSize - size_of(HEAACWAVEINFO) + size_of(WAVEFORMATEX)
|
||||
|
||||
ParseAudioSpecificConfig(pwf.pbAudioSpecificConfig, dwASCLen)
|
||||
} else {
|
||||
// Reserved
|
||||
}
|
||||
*/
|
||||
|
||||
// This structure has a size of 30 bytes
|
||||
HEAACWAVEINFO :: struct {
|
||||
// Defines core AAC properties. See description above. WAVEFORMATEX is of size 18 bytes.
|
||||
using wfx: WAVEFORMATEX,
|
||||
|
||||
// Defines the payload type
|
||||
// 0-RAW. The stream contains raw_data_block() elements only.
|
||||
// 1-ADTS. The stream contains an adts_sequence(), as defined by MPEG-2.
|
||||
// 2-ADIF. The stream contains an adif_sequence(), as defined by MPEG-2.
|
||||
// 3-LOAS. The stream contains an MPEG-4 audio transport stream with a synchronization layer LOAS and a multiplex layer LATM.
|
||||
// All other codes are reserved.
|
||||
wPayloadType: WORD,
|
||||
|
||||
// This is the 8-bit field audioProfileLevelIndication available in the MPEG-4 object descriptor.
|
||||
// It is an indication (as defined in MPEG-4 audio) of the audio profile and level required to process the content associated with this stream.
|
||||
// For example values 0x28-0x2B correspond to AAC Profile, values 0x2C-0x2F correspond to HE-AAC profile and 0x30-0x33 for HE-AAC v2 profile.
|
||||
// If unknown, set to zero or 0xFE ("no audio profile specified").
|
||||
wAudioProfileLevelIndication: WORD,
|
||||
|
||||
// Defines the data that follows this structure. Currently only one data type is supported:
|
||||
// 0- AudioSpecificConfig() (as defined by MPEG-4 Audio, ISO/IEC 14496-3) will follow this structure.
|
||||
// wfx.cbSize will indicate the total length including AudioSpecificConfig().
|
||||
// Use HEAACWAVEFORMAT to gain easy access to the address of the first byte of AudioSpecificConfig() for parsing.
|
||||
// Typical values for the size of AudioSpecificConfig (ASC) are:
|
||||
// - 2 bytes for AAC or HE-AAC v1/v2 with implicit signaling of SBR,
|
||||
// - 5 bytes for HE-AAC v1 with explicit signaling of SBR,
|
||||
// - 7 bytes for HE-AAC v2 with explicit signaling of SBR and PS.
|
||||
// The size may be longer than 7 bytes if the 4-bit channelConfiguration field in ASC is zero, which means program_config_element() is present in ASC.
|
||||
// All other codes are reserved.
|
||||
wStructType: WORD,
|
||||
|
||||
// Set these to zero
|
||||
wReserved1: WORD,
|
||||
dwReserved2: DWORD,
|
||||
}
|
||||
LPHEAACWAVEINFO :: ^HEAACWAVEINFO
|
||||
|
||||
// This structure describes the format block for wStructType=0
|
||||
// This structure has a size of 31 bytes
|
||||
HEAACWAVEFORMAT :: struct {
|
||||
using wfInfo: HEAACWAVEINFO,
|
||||
pbAudioSpecificConfig: [1]BYTE, // First byte of AudioSpecificConfig()
|
||||
}
|
||||
LPHEAACWAVEFORMAT :: ^HEAACWAVEFORMAT
|
||||
|
||||
|
||||
WAVEHDR :: struct {
|
||||
lpData: LPSTR, /* pointer to locked data buffer */
|
||||
dwBufferLength: DWORD, /* length of data buffer */
|
||||
@@ -824,90 +702,3 @@ CALLBACK_TASK :: 0x00020000 /* dwCallback is a HTASK */
|
||||
CALLBACK_FUNCTION :: 0x00030000 /* dwCallback is a FARPROC */
|
||||
CALLBACK_THREAD :: CALLBACK_TASK /* thread ID replaces 16 bit task */
|
||||
CALLBACK_EVENT :: 0x00050000 /* dwCallback is an EVENT Handle */
|
||||
|
||||
|
||||
// Description: Type definitions used by the audio session manager RPC/COM interfaces
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Description: AudioClient share mode
|
||||
// SHARED - The device will be opened in shared mode and use the WAS format.
|
||||
// EXCLUSIVE - The device will be opened in exclusive mode and use the application specified format.
|
||||
AUDCLNT_SHAREMODE :: enum i32 {
|
||||
SHARED,
|
||||
EXCLUSIVE,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Description: Audio stream categories
|
||||
// ForegroundOnlyMedia - (deprecated for Win10) Music, Streaming audio
|
||||
// BackgroundCapableMedia - (deprecated for Win10) Video with audio
|
||||
// Communications - VOIP, chat, phone call
|
||||
// Alerts - Alarm, Ring tones
|
||||
// SoundEffects - Sound effects, clicks, dings
|
||||
// GameEffects - Game sound effects
|
||||
// GameMedia - Background audio for games
|
||||
// GameChat - In game player chat
|
||||
// Speech - Speech recognition
|
||||
// Media - Music, Streaming audio
|
||||
// Movie - Video with audio
|
||||
// FarFieldSpeech - Capture of far field speech
|
||||
// UniformSpeech - Uniform, device agnostic speech processing
|
||||
// VoiceTyping - Dictation, typing by voice
|
||||
// Other - All other streams (default)
|
||||
AUDIO_STREAM_CATEGORY :: enum i32 {
|
||||
//ForegroundOnlyMedia = 1,
|
||||
//BackgroundCapableMedia = 2,
|
||||
Communications = 3,
|
||||
Alerts = 4,
|
||||
SoundEffects = 5,
|
||||
GameEffects = 6,
|
||||
GameMedia = 7,
|
||||
GameChat = 8,
|
||||
Speech = 9,
|
||||
Movie = 10,
|
||||
Media = 11,
|
||||
FarFieldSpeech = 12,
|
||||
UniformSpeech = 13,
|
||||
VoiceTyping = 14,
|
||||
Other = 0,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Description: AudioClient stream flags
|
||||
// Can be a combination of AUDCLNT_STREAMFLAGS and AUDCLNT_SYSFXFLAGS:
|
||||
// AUDCLNT_STREAMFLAGS (this group of flags uses the high word, w/exception of high-bit which is reserved, 0x7FFF0000):
|
||||
// AUDCLNT_STREAMFLAGS_CROSSPROCESS - Audio policy control for this stream will be shared with with other process sessions that use the same audio session GUID.
|
||||
// AUDCLNT_STREAMFLAGS_LOOPBACK - Initializes a renderer endpoint for a loopback audio application. In this mode, a capture stream will be opened on the specified renderer endpoint. Shared mode and a renderer endpoint is required.
|
||||
// Otherwise the IAudioClient.Initialize call will fail. If the initialize is successful, a capture stream will be available from the IAudioClient object.
|
||||
// AUDCLNT_STREAMFLAGS_EVENTCALLBACK - An exclusive mode client will supply an event handle that will be signaled when an IRP completes (or a waveRT buffer completes) telling it to fill the next buffer
|
||||
// AUDCLNT_STREAMFLAGS_NOPERSIST - Session state will not be persisted
|
||||
// AUDCLNT_STREAMFLAGS_RATEADJUST - The sample rate of the stream is adjusted to a rate specified by an application.
|
||||
// AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY - When used with AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM, a sample rate converter with better quality than the default conversion but with a higher performance cost is used.
|
||||
// This should be used if the audio is ultimately intended to be heard by humans as opposed to other scenarios such as pumping silence or populating a meter.
|
||||
// AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM - A channel matrixer and a sample rate converter are inserted as necessary to convert between the uncompressed format supplied to IAudioClient.Initialize and the audio engine mix format.
|
||||
// AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED - Session expires when there are no streams and no owning session controls.
|
||||
// AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE - Don't show volume control in the Volume Mixer.
|
||||
// AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED - Don't show volume control in the Volume Mixer after the session expires.
|
||||
// AUDCLNT_SYSFXFLAGS (these flags use low word 0x0000FFFF):
|
||||
// none defined currently
|
||||
AUDCLNT_STREAMFLAGS_CROSSPROCESS :: 0x00010000
|
||||
AUDCLNT_STREAMFLAGS_LOOPBACK :: 0x00020000
|
||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK :: 0x00040000
|
||||
AUDCLNT_STREAMFLAGS_NOPERSIST :: 0x00080000
|
||||
AUDCLNT_STREAMFLAGS_RATEADJUST :: 0x00100000
|
||||
AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY :: 0x08000000
|
||||
AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM :: 0x80000000
|
||||
AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED :: 0x10000000
|
||||
AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE :: 0x20000000
|
||||
AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED :: 0x40000000
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Description: AudioSession State.
|
||||
// AudioSessionStateInactive - The session has no active audio streams.
|
||||
// AudioSessionStateActive - The session has active audio streams.
|
||||
// AudioSessionStateExpired - The session is dormant.
|
||||
AudioSessionState :: enum i32 {
|
||||
Inactive = 0,
|
||||
Active = 1,
|
||||
Expired = 2,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user