DI-Guy SDK Documentation  13.7
diguySoundInstance.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 /*********************************************************************
7  **
8  *t diguySoundInstance
9  **
10  */
11 
12 #pragma once
13 
14 #ifdef SWIG
15 %module diguySoundInstance
16 #else
17 #define CPLUSPLUS_ONLY
18 #endif
19 
20 #ifdef CPLUSPLUS_ONLY
21 class bdiSoundInstance;
22 class bdiScenarioCharacter;
23 #endif
24 
25 #include <declspec_diguy.h>
26 
27 /****************************************************************************/
28 class BDI_DECLSPEC_diguy diguySoundInstance
29 {
30 public:
31 
32  /*l
33  **
34  *b Returns:
35  **
36  ** name of the sound used by the sound instance.
37  **
38  *b Callable From:
39  **
40  *- - C++
41  *- - Script
42  */
43  const char* get_name();
44 
45  /*l
46  *b Returns:
47  **
48  ** type name of the object; this value will never be NULL
49  **
50  *b Callable From:
51  **
52  *- - C++
53  *- - Script
54  */
55  const char* get_type_name();
56 
57  /*l
58  *b Description:
59  **
60  ** This function causes the sound to play immediately, starting from
61  ** the specified time offset. The sound will continue until it has
62  ** completed, or it is stopped.
63  **
64  *b Returns:
65  **
66  ** 0 on success, -1 on failure
67  **
68  *b Callable From:
69  **
70  *- - C++
71  *- - Script
72  */
73  int play(double offset = 0.0);
74 
75  /*l
76  *b Returns:
77  **
78  ** 1 if the sound is playing; 0 if not
79  **
80  *b Callable From:
81  **
82  *- - C++
83  *- - Script
84  */
85  int get_is_playing();
86 
87  /*l
88  *b Returns:
89  **
90  ** 1 if the sound is stopping; 0 if not
91  **
92  *b Callable From:
93  **
94  *- - C++
95  *- - Script
96  */
97  int get_is_stopping();
98 
99  /*l
100  *b Description:
101  **
102  ** This function causes this sound to stop. It does not destroy the
103  ** sound instance. The sound instance can be played again if desired.
104  **
105  *b Arguments
106  **
107  *a rampdown_time - how long to take fading out the sound
108  **
109  ** *b Returns:
110  **
111  ** 0 on success, -1 on failure
112  **
113  *b Callable From:
114  **
115  *- - C++
116  *- - Script
117  */
118  int stop(float rampdown_time = 0.0f);
119 
120  /*l
121  *b Description:
122  **
123  ** This function causes the sound instance to be automatically
124  ** deleted when the sound has completed. No further calls
125  ** through the diguySoundInstance object can or should
126  ** be made, so this function should only be called once all
127  ** durations, reps, etc. have been set.
128  **
129  *b Returns:
130  **
131  ** 0 on success, -1 on failure
132  **
133  *b Callable From:
134  **
135  *- - C++
136  *- - Script
137  */
138  int set_automatic_destroy_flag();
139 
140  /*l
141  *b Description:
142  **
143  ** This function sets whether the sound is "ambient" (it will
144  ** be equally audible from everywhere within the world), or
145  ** "3d" (it will move with the character.
146  **
147  *b Arguments
148  **
149  *a is_3d_sound_flag - pass 1 to make the sound 3d; pass 0 to make
150  *a the sound ambient
151  **
152  *b Callable From:
153  **
154  *- - C++
155  *- - Script
156  */
157  void set_is_3d_sound_flag(int is_3d_sound_flag);
158 
159  /*l
160  *b Returns:
161  **
162  ** 1 if the sound is 3d; 0 if not
163  **
164  *b Callable From:
165  **
166  *- - C++
167  *- - Script
168  */
169  int get_is_3d_sound_flag();
171 
176 #ifdef CPLUSPLUS_ONLY
177 
178  bdiSoundInstance* get_scripted_object() { return m_scripted_object; }
179 
180 private:
181 
182  void clear_scripted_object() { m_scripted_object = nullptr; }
183 
184  /*l
185  ** A private constructor.
186  */
187  diguySoundInstance( bdiSoundInstance* scripted_object, bdiScenarioCharacter* character );
189  /*l
190  ** A private destructor.
191  */
192  virtual ~diguySoundInstance();
193 
194  /*l
195  ** A pointer to internal data.
196  */
197  bdiSoundInstance* m_scripted_object;
198  bdiScenarioCharacter* m_character;
199 
200  friend class bdiScenarioCharacter;
201  friend class bdiSoundInstance;
202  friend class bdiSoundFactory;
203  friend class bdiSoundFactoryOpenAL;
204 
205 #endif
206 
207 };
Definition: diguySoundInstance.h:27