UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
s_music.h
Go to the documentation of this file.
1 
6 /*
7 All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 Original file from Quake 2 v3.21: quake2-2.31/client/sound.h
10 Copyright (C) 1997-2001 Id Software, Inc.
11 
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 
21 See the GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 
27 */
28 
29 #pragma once
30 
31 #include "../../shared/ufotypes.h" /* for bool & byte */
32 
33 /* 2 channels and a width of 2 bytes (short) */
34 #define SAMPLE_SIZE 4
35 #define MAX_RAW_SAMPLES 4096 * SAMPLE_SIZE
36 
37 typedef struct musicStream_s {
38  bool playing;
40  int mixerPos;
41  int samplePos;
43 
44 void M_AddToSampleBuffer(musicStream_t* userdata, int rate, int samples, const byte* data);
45 void M_StopMusicStream(musicStream_t* userdata);
46 void M_ParseMusic(const char* name, const char** text);
47 void M_Frame(void);
48 void M_Init(void);
49 void M_Shutdown(void);
50 void M_Stop(void);
void M_Stop(void)
Definition: s_music.cpp:114
int mixerPos
Definition: s_music.h:40
void M_StopMusicStream(musicStream_t *userdata)
Definition: s_music.cpp:465
bool playing
Definition: s_music.h:38
int samplePos
Definition: s_music.h:41
void M_Init(void)
Definition: s_music.cpp:359
void M_AddToSampleBuffer(musicStream_t *userdata, int rate, int samples, const byte *data)
Add stereo samples with a 16 byte width to the stream buffer.
Definition: s_music.cpp:431
struct musicStream_s musicStream_t
#define MAX_RAW_SAMPLES
Definition: s_music.h:35
byte sampleBuf[MAX_RAW_SAMPLES]
Definition: s_music.h:39
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
GLsizei const GLvoid * data
Definition: r_gl.h:152
uint8_t byte
Definition: ufotypes.h:34
void M_Frame(void)
Definition: s_music.cpp:317
void M_ParseMusic(const char *name, const char **text)
Parses music definitions for different situations.
Definition: s_music.cpp:73
void M_Shutdown(void)
Definition: s_music.cpp:372