mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-21 08:43:40 +01:00
cleanup: move channel mappings to .h
This commit is contained in:
parent
a6b8dcefc0
commit
e839f0635f
@ -1,4 +1,5 @@
|
||||
#include "coding.h"
|
||||
#include "../util/channel_mappings.h"
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "hca_keys.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../coding/hca_decoder_clhca.h"
|
||||
#include "../util/channel_mappings.h"
|
||||
|
||||
#ifdef VGM_DEBUG_OUTPUT
|
||||
//#define HCA_BRUTEFORCE
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <string.h>
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../util/channel_mappings.h"
|
||||
#include "ogg_vorbis_streamfile.h"
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "../coding/coding.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
#include "../util/channel_mappings.h"
|
||||
#include "riff_ogg_streamfile.h"
|
||||
|
||||
/* RIFF - Resource Interchange File Format, standard container used in many games */
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "../coding/coding.h"
|
||||
#include "../util/chunks.h"
|
||||
#include "../util/endianness.h"
|
||||
#include "../util/channel_mappings.h"
|
||||
|
||||
|
||||
/* Wwise uses a custom RIFF/RIFX header, non-standard enough that it's parsed it here.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "vgmstream.h"
|
||||
#include "mixing.h"
|
||||
#include "plugins.h"
|
||||
#include "util/channel_mappings.h"
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
@ -1187,7 +1188,7 @@ typedef enum {
|
||||
void mixing_macro_downmix(VGMSTREAM* vgmstream, int max /*, mapping_t output_mapping*/) {
|
||||
mixing_data *data = vgmstream->mixing_data;
|
||||
int ch, output_channels, mp_in, mp_out, ch_in, ch_out;
|
||||
mapping_t input_mapping, output_mapping;
|
||||
channel_mapping_t input_mapping, output_mapping;
|
||||
const double vol_max = 1.0;
|
||||
const double vol_sqrt = 1 / sqrt(2);
|
||||
const double vol_half = 1 / 2;
|
||||
|
49
src/util/channel_mappings.h
Normal file
49
src/util/channel_mappings.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef _CHANNEL_MAPPING_H
|
||||
#define _CHANNEL_MAPPING_H
|
||||
|
||||
/* standard WAVEFORMATEXTENSIBLE speaker positions */
|
||||
typedef enum {
|
||||
speaker_FL = (1 << 0), /* front left */
|
||||
speaker_FR = (1 << 1), /* front right */
|
||||
speaker_FC = (1 << 2), /* front center */
|
||||
speaker_LFE = (1 << 3), /* low frequency effects */
|
||||
speaker_BL = (1 << 4), /* back left */
|
||||
speaker_BR = (1 << 5), /* back right */
|
||||
speaker_FLC = (1 << 6), /* front left center */
|
||||
speaker_FRC = (1 << 7), /* front right center */
|
||||
speaker_BC = (1 << 8), /* back center */
|
||||
speaker_SL = (1 << 9), /* side left */
|
||||
speaker_SR = (1 << 10), /* side right */
|
||||
|
||||
speaker_TC = (1 << 11), /* top center*/
|
||||
speaker_TFL = (1 << 12), /* top front left */
|
||||
speaker_TFC = (1 << 13), /* top front center */
|
||||
speaker_TFR = (1 << 14), /* top front right */
|
||||
speaker_TBL = (1 << 15), /* top back left */
|
||||
speaker_TBC = (1 << 16), /* top back center */
|
||||
speaker_TBR = (1 << 17), /* top back left */
|
||||
|
||||
} speaker_t;
|
||||
|
||||
/* typical mappings that metas may use to set channel_layout (but plugin must actually use it)
|
||||
* (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR)
|
||||
* not too sure about names but no clear standards */
|
||||
typedef enum {
|
||||
mapping_MONO = speaker_FC,
|
||||
mapping_STEREO = speaker_FL | speaker_FR,
|
||||
mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE,
|
||||
mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */
|
||||
mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR,
|
||||
mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC,
|
||||
mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR,
|
||||
mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR,
|
||||
mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR,
|
||||
mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR,
|
||||
mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR,
|
||||
mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR,
|
||||
mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC,
|
||||
mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC,
|
||||
mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR,
|
||||
} channel_mapping_t;
|
||||
|
||||
#endif
|
@ -762,50 +762,6 @@ typedef enum {
|
||||
|
||||
} meta_t;
|
||||
|
||||
/* standard WAVEFORMATEXTENSIBLE speaker positions */
|
||||
typedef enum {
|
||||
speaker_FL = (1 << 0), /* front left */
|
||||
speaker_FR = (1 << 1), /* front right */
|
||||
speaker_FC = (1 << 2), /* front center */
|
||||
speaker_LFE = (1 << 3), /* low frequency effects */
|
||||
speaker_BL = (1 << 4), /* back left */
|
||||
speaker_BR = (1 << 5), /* back right */
|
||||
speaker_FLC = (1 << 6), /* front left center */
|
||||
speaker_FRC = (1 << 7), /* front right center */
|
||||
speaker_BC = (1 << 8), /* back center */
|
||||
speaker_SL = (1 << 9), /* side left */
|
||||
speaker_SR = (1 << 10), /* side right */
|
||||
|
||||
speaker_TC = (1 << 11), /* top center*/
|
||||
speaker_TFL = (1 << 12), /* top front left */
|
||||
speaker_TFC = (1 << 13), /* top front center */
|
||||
speaker_TFR = (1 << 14), /* top front right */
|
||||
speaker_TBL = (1 << 15), /* top back left */
|
||||
speaker_TBC = (1 << 16), /* top back center */
|
||||
speaker_TBR = (1 << 17), /* top back left */
|
||||
|
||||
} speaker_t;
|
||||
|
||||
/* typical mappings that metas may use to set channel_layout (but plugin must actually use it)
|
||||
* (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR)
|
||||
* not too sure about names but no clear standards */
|
||||
typedef enum {
|
||||
mapping_MONO = speaker_FC,
|
||||
mapping_STEREO = speaker_FL | speaker_FR,
|
||||
mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE,
|
||||
mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */
|
||||
mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR,
|
||||
mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC,
|
||||
mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR,
|
||||
mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR,
|
||||
mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR,
|
||||
mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR,
|
||||
mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR,
|
||||
mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR,
|
||||
mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC,
|
||||
mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC,
|
||||
mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR,
|
||||
} mapping_t;
|
||||
|
||||
typedef struct {
|
||||
int config_set; /* some of the mods below are set */
|
||||
@ -952,7 +908,7 @@ typedef struct {
|
||||
size_t stream_size; /* info to properly calculate bitrate in case of subsongs */
|
||||
char stream_name[STREAM_NAME_SIZE]; /* name of the current stream (info), if the file stores it and it's filled */
|
||||
|
||||
/* mapping config (info for plugins) */
|
||||
/* mapping config (info for plugins) see channel_mappings.h */
|
||||
uint32_t channel_layout; /* order: FL FR FC LFE BL BR FLC FRC BC SL SR etc (WAVEFORMATEX flags where FL=lowest bit set) */
|
||||
|
||||
/* other config */
|
||||
|
Loading…
x
Reference in New Issue
Block a user