SDL_Mixer音频解读注示
sdlgui吧
全部回复
仅看楼主
level 10
twtfcu3 楼主
2014年06月16日 12点06分 1
level 10
twtfcu3 楼主
typedef struct Mix_Chunk {
int allocated;
Uint8 *abuf;
Uint32 alen;
Uint8 volume; /* Per-sample volume, 0-128 */
} Mix_Chunk;
音频块的数据结构
int allocated表示音乐的加载模式
Uint8 *abuf我个人理解为音频文件加载到内存的数据块,应该可以直接操作的。
Uint32 alen音频的字节长度
Uint8 volume音频的音量0-128
2014年06月16日 12点06分 2
level 10
twtfcu3 楼主
typedef struct _Mix_Music Mix_Music
音乐对象指针,而且只能是指针。。。。。。
2014年06月16日 12点06分 3
level 10
twtfcu3 楼主
typedef enum {
MUS_NONE,
MUS_CMD,
MUS_WAV,
MUS_MOD,
MUS_MID,
MUS_OGG,
MUS_MP3, /* using SMPEG */
MUS_MP3_MAD,
MUS_FLAC
} Mix_MusicType;
从Mix_GetMusicType函数 中返回以上这些值
如果音乐是从外部命令打开的,则返回MUS_CMD
2014年06月16日 12点06分 4
smpeg什么意思?[疑问]
2014年06月22日 12点06分
回复 闪光点22的xh :视频
2014年06月22日 12点06分
回复 twtfcu3 :...那Mix_LoadMUS能不能加载mp3的文件?
2014年06月22日 12点06分
level 10
twtfcu3 楼主
typedef enum {
MIX_NO_FADING,
MIX_FADING_OUT,
MIX_FADING_IN
} Mix_Fading;
直接翻译,应该是音乐过渡时的音效渐变
通过Mix_FadingMusic 和 Mix_FadingChannel 两个函数返回以上这些值。
2014年06月16日 12点06分 5
level 10
twtfcu3 楼主
typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len,
void *udata);
Mix_EffectFunc_t 这是定义了一个特效处理回调函数类型
这一类的函数参数为(int,void*,int,void*),没有返回值(个人认为不是一个好方式)
chan 这种效应是影响now.MIX_CHANNEL_POST通道数通过进行后处理效果在最终混音 (机械翻译)
stream当前采样的处理缓冲器
len流的字节长度
udata注册这个效果处理器函数时所传递给Mix_RegisterEffect用户数据的指针 (机械翻译)
2014年06月16日 12点06分 6
level 10
twtfcu3 楼主
typedef void (*Mix_EffectDone_t)(int chan, void *udata);
个人理解为特效完成后的回调函数,但没深入分析理解
2014年06月16日 13点06分 7
level 10
twtfcu3 楼主
SDL_MIXER_MAJOR_VERSION
1
SDL_mixer library major number at compilation time
SDL_MIXER更新的主版本号
SDL_MIXER_MINOR_VERSION
2
SDL_mixer library minor number at compilation time
SDL_MIXER微调更新版本号
SDL_MIXER_PATCHLEVEL
9
SDL_mixer library patch level at compilation time
SDL_MIXER补丁版本号
MIX_CHANNELS
8
The default mixer has this many simultaneous mixing channels after the first call to Mix_OpenAudio.
第一次调用Mix_OpenAudio后默认创建的混音通道个数
MIX_DEFAULT_FREQUENCY
22050
Good default sample rate in Hz (samples per second) for PC sound cards.
PC声卡的默认HZ采样率
MIX_DEFAULT_FORMAT
AUDIO_S16SYS
The suggested default is signed 16bit samples in host byte order.
建议的默认签署16位样品中主机字节顺序。 (机械翻译)
MIX_DEFAULT_CHANNELS
2
Stereo sound is a good default.
最好默认为立体音
MIX_MAX_VOLUME
128
Maximum value for any volume setting.
This is currently the same as SDL_MIX_MAXVOLUME.
任何音量的最大值,目前与SDL_MIX_MAXVOLUME值一样
MIX_CHANNEL_POST
-2
This is the channel number used for post processing effects.
: 这是用于后处理效果的信道数 (机械翻译)
MIX_EFFECTSMAXSPEED
"MIX_EFFECTSMAXSPEED"
A convience definition for the string name of the environment variable to define when you desire the internal effects to sacrifice quality and/or RAM for speed. The environment variable must be set (else nonexisting) before Mix_OpenAudio is called for the setting to take effect.
2014年06月16日 13点06分 8
level 10
twtfcu3 楼主
7. Glossary(术语表)
Byte Order(字节顺序)
Also known as Big-Endian. Which means the most significant byte comes first in storage. Sparc and Motorola 68k based chips are MSB ordered.
由此可知大端(我一直叫做高位的),第一位存储最显著的字节,
(SDL defines this as SDL_BYTEORDER==SDL_BIG_ENDIAN)
Little-Endian(LSB ) is stored in the opposite order, with the least significant byte first in memory. Intel and AMD are two LSB machines.
小端(LSB 我一直叫做低位) 存储在相反的顺序,Intel and AMD是两个LSB机
(SDL defines this as SDL_BYTEORDER==SDL_LIL_ENDIAN)
2014年06月16日 13点06分 9
level 12
楼主 吧主 播放mp3或其他音乐文件在哪学习啊 我在网上搜了一下午了 也没找到 能不能指条明路,[太开心]
2014年06月23日 09点06分 10
找MP3的解码库,再了解它的API就可以了
2014年06月23日 10点06分
回复 twtfcu3 :我找找
2014年06月23日 14点06分
1