ScummVM API documentation
px_sfx_description.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (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. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_PX_SFX_DESCRIPTION_H
28 #define ICB_PX_SFX_DESCRIPTION_H
29 
30 namespace ICB {
31 
32 // versions...
33 // 100 initial
34 // 101 rearanged
35 // 105 added also to sfxdesc files to be checked by converter
36 //
37 #define SFX_VERSION 105
38 
39 #define NO_LOOPING 0x00
40 #define WAV_LOOPING_FLAG 0x01
41 #define SFX_LOOPING_FLAG 0x02
42 
43 // this class contains an envelope of the form y=ax^3+bx^2+cx+d
44 class CEnvelope {
45 public:
46  int32 a;
47  int32 b;
48  int32 c;
49  int32 d;
50  int8 div; // dividing value on the time scale
51  CEnvelope() { Reset(); }
52  void Reset() {
53  a = b = c = d = 0;
54  div = 1;
55  }
56 };
57 
58 // this class contains a single sfx ready to be saved out. This will go in it's own file eventually...
59 class CSfx {
60 public:
61  CSfx() { Reset(); }
62 
63  CEnvelope m_volume; // volume where v<=0 => none >=128 => max
64  CEnvelope m_pitch; // pitch addition to base pitch (in PSX pitch units where 0x1000=44100hz, etc)
65 
66  int32 m_duration; // duration in 128th of second
67  int32 m_rand_pitch; // random value to add to pitch at start (in PSX pitch units where 0x1000=44100hz, etc)
68 
69  int32 m_min_distance; // in cm
70  int32 m_max_distance; // in cm
71 
72  int8 m_sampleNameOffset; // offset into structure of sampleName...
73  int8 m_descOffset; // generally this will be 0 when outputing for the engine since the engine will not need descriptions
74 
75  int8 m_looping; // BIT 0 is hardware flag, bit 1 is software flag.
76 
77  int8 m_rand_mode; // mode=0 is normal, choose a random value at startup, mode>0 is some divider of the envelope
78 
79  void Reset() {
80  m_volume.Reset();
81  m_pitch.Reset();
82  m_duration = 0;
83  m_looping = 0;
84  m_rand_pitch = 0;
85  m_rand_mode = 0;
86  m_sampleNameOffset = 0;
87  m_descOffset = 0;
88  m_min_distance = 0;
89  m_max_distance = 0;
90  }
91 
92  const char *GetSampleName() { return (const char *) this + m_sampleNameOffset; }
93 };
94 
95 } // End of namespace ICB
96 
97 #endif
Definition: actor.h:32
Definition: px_sfx_description.h:59
Definition: px_sfx_description.h:44