Pulsar  3d3a057
player_load.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Player sound loading
4  */
5 #pragma once
6 
7 #include <pulsar/player/player.h>
8 #include <pulsar/bfwav/bfwav.h>
9 #include <pulsar/bfstm/bfstm.h>
10 
11 /// Player sound load layout
12 typedef enum {
13  PLSR_PlayerSoundLoadLayout_Channel = 0, ///< One offset per channel where is stored one contiguous chunk of data
14  PLSR_PlayerSoundLoadLayout_Blocks, ///< One offset where is stored fixed-size blocks in channel order until the end is reached
16 
17 /// Player sound load channel layout specific information
18 typedef struct {
19  u32 offsets[PLSR_PLAYER_MAX_CHANNELS]; ///< Offset for each channel where data begins
21 
22 /// Player sound load blocks layout specific information
23 typedef struct {
24  u32 firstBlockOffset; ///< Offset where the data of first block of the first channel begins
25  u32 blockSize;
26  u32 lastBlockPadding;
28 
29 /// Player sound load layout information
30 typedef struct {
32 
33  union {
36  };
38 
39 typedef struct {
40  AudioRendererAdpcmContext context;
41  AudioRendererAdpcmParameters parameters;
43 
44 /// Player sound load information
45 typedef struct {
46  const PLSR_Archive* ar; ///< Archive file to read from
48 
49  PcmFormat pcmFormat;
50  bool looping;
51  unsigned int sampleRate;
52  unsigned int sampleCount;
53  unsigned int loopStartSample; ///< Loop starting sample (if looping is true)
54  unsigned int channelCount;
55  size_t dataSize; ///< total data size of one channel (if 0 this will be computed according to format and sample count)
56 
57  PLSR_PlayerSoundAdpcmChannelInfo adpcm[PLSR_PLAYER_MAX_CHANNELS]; ///< Populated if pcmFormat is PcmFormat_Adpcm
59 
60 /// Load a sound from a normalized sound load information
PLSR_PlayerSoundLoadLayout
Player sound load layout.
Definition: player_load.h:12
Player sound load information.
Definition: player_load.h:45
One offset where is stored fixed-size blocks in channel order until the end is reached.
Definition: player_load.h:14
One offset per channel where is stored one contiguous chunk of data.
Definition: player_load.h:13
Stream file init.
Player init.
Definition: player_load.h:39
Player sound load channel layout specific information.
Definition: player_load.h:18
const PLSR_Archive * ar
Archive file to read from.
Definition: player_load.h:46
Wave file init.
unsigned int loopStartSample
Loop starting sample (if looping is true)
Definition: player_load.h:53
Player sound load blocks layout specific information.
Definition: player_load.h:23
size_t dataSize
total data size of one channel (if 0 this will be computed according to format and sample count) ...
Definition: player_load.h:55
Archive file.
Definition: archive.h:75
PLSR_RC plsrPlayerLoad(const PLSR_PlayerSoundLoadInfo *loadInfo, PLSR_PlayerSoundId *out)
Load a sound from a normalized sound load information.
u32 PLSR_RC
Result code returned by Pulsar functions.
Definition: types.h:73
u32 firstBlockOffset
Offset where the data of first block of the first channel begins.
Definition: player_load.h:24
Player sound.
Definition: player.h:39
Player sound load layout information.
Definition: player_load.h:30