| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
#ifndef DS3DLIB_INTERNAL_H |
| 63 |
#define DS3DLIB_INTERNAL_H |
| 64 |
|
| 65 |
#include <windows.h> |
| 66 |
#include <mmsystem.h> |
| 67 |
|
| 68 |
#include "win/directx/dsound.h" |
| 69 |
#include "ssl_lib.h" |
| 70 |
|
| 71 |
class win_llsSystem; |
| 72 |
|
| 73 |
struct DSLOOPSTREAM { |
| 74 |
uint8_t method; |
| 75 |
uint8_t playing; |
| 76 |
uint8_t please_close; |
| 77 |
|
| 78 |
union |
| 79 |
{ |
| 80 |
uint8_t close_on_next; |
| 81 |
int8_t loop_step; |
| 82 |
}; |
| 83 |
|
| 84 |
union |
| 85 |
{ |
| 86 |
DWORD bytes_left; |
| 87 |
float loop_timer; |
| 88 |
}; |
| 89 |
|
| 90 |
char *current_position; |
| 91 |
HANDLE hEvent; |
| 92 |
DWORD half_buffer_point; |
| 93 |
DWORD last_half; |
| 94 |
int num_written; |
| 95 |
uint8_t time_slice; |
| 96 |
bool kill_me; |
| 97 |
bool f_sample_16bit; |
| 98 |
char silence_byte; |
| 99 |
}; |
| 100 |
|
| 101 |
struct DSSTREAM { |
| 102 |
|
| 103 |
LPDIRECTSOUNDBUFFER m_lp_primary_buffer; |
| 104 |
LPDIRECTSOUNDBUFFER m_lp_looping_buffer; |
| 105 |
bool m_f_secondary_looping; |
| 106 |
|
| 107 |
int BufferSize; |
| 108 |
|
| 109 |
int MaxWriteSamples; |
| 110 |
int MaxWriteBytes; |
| 111 |
|
| 112 |
uintptr_t thread_handle; |
| 113 |
|
| 114 |
volatile bool thread_request_kill; |
| 115 |
volatile bool thread_alive; |
| 116 |
|
| 117 |
|
| 118 |
int NextWritePos; |
| 119 |
int LastPlayPos; |
| 120 |
|
| 121 |
}; |
| 122 |
|
| 123 |
struct tPSBInfo { |
| 124 |
float volume; |
| 125 |
union { |
| 126 |
float pan; |
| 127 |
pos_state *cur_pos; |
| 128 |
}; |
| 129 |
float reverb; |
| 130 |
uint16_t freq; |
| 131 |
uint16_t priority; |
| 132 |
bool looping; |
| 133 |
}; |
| 134 |
|
| 135 |
|
| 136 |
class sound_buffer_info { |
| 137 |
public: |
| 138 |
sound_buffer_info() { |
| 139 |
m_status = SSF_UNUSED; |
| 140 |
m_sound_buffer = NULL; |
| 141 |
m_sound_buffer_3d = NULL; |
| 142 |
s = NULL; |
| 143 |
} |
| 144 |
|
| 145 |
play_information *play_info; |
| 146 |
|
| 147 |
int m_sound_index; |
| 148 |
int m_unique_id; |
| 149 |
|
| 150 |
|
| 151 |
volatile DSLOOPSTREAM *s; |
| 152 |
union { |
| 153 |
LPDIRECTSOUNDBUFFER m_sound_buffer; |
| 154 |
void *m_snd_obj; |
| 155 |
}; |
| 156 |
LPDIRECTSOUND3DBUFFER m_sound_buffer_3d; |
| 157 |
LPKSPROPERTYSET m_lpksps; |
| 158 |
|
| 159 |
int16_t m_mixer_type; |
| 160 |
int16_t m_buffer_type; |
| 161 |
|
| 162 |
char *sample_data; |
| 163 |
int sample_length; |
| 164 |
|
| 165 |
bool stereo; |
| 166 |
int8_t bps; |
| 167 |
uint8_t m_status; |
| 168 |
uint8_t pad; |
| 169 |
|
| 170 |
float m_volume; |
| 171 |
}; |
| 172 |
|
| 173 |
|
| 174 |
void sb_stop_buffer(sound_buffer_info *sb); |
| 175 |
|
| 176 |
|
| 177 |
void sb_free_buffer(sound_buffer_info *sb); |
| 178 |
|
| 179 |
|
| 180 |
bool sb_load_buffer(sound_buffer_info *sb, void *sample_data, int length); |
| 181 |
|
| 182 |
|
| 183 |
int sb_get_current_position(sound_buffer_info *sb, uint32_t *writep); |
| 184 |
|
| 185 |
|
| 186 |
bool sb_lock_buffer(sound_buffer_info *sb, uint32_t dwWriteCursor, uint32_t dwWriteBytes, void **lplpvAudioPtr1, |
| 187 |
uint32_t *lpdwAudioBytes1, void **lplpvAudioPtr2, uint32_t *lpdwAudioBytes2); |
| 188 |
|
| 189 |
|
| 190 |
bool sb_unlock_buffer(sound_buffer_info *sb, void *ptr1, uint32_t len1, void *ptr2, uint32_t len2); |
| 191 |
|
| 192 |
|
| 193 |
bool sb_loop_thread_init(win_llsSystem *lls); |
| 194 |
|
| 195 |
|
| 196 |
void sb_loop_thread_kill(); |
| 197 |
|
| 198 |
|
| 199 |
bool sb_loop_element_init(sound_buffer_info *sb, char *sample_ptr, int sound_length, int buffer_size); |
| 200 |
|
| 201 |
|
| 202 |
bool sb_stream_element_init(sound_buffer_info *sb, char *sample_ptr, int sound_length, int buffer_size); |
| 203 |
|
| 204 |
|
| 205 |
void sb_loop_element_kill(sound_buffer_info *sb); |
| 206 |
void sb_loop_element_wait_until_dead(sound_buffer_info *sb); |
| 207 |
|
| 208 |
|
| 209 |
void sb_stream_element_kill(sound_buffer_info *sb); |
| 210 |
void sb_stream_buffered_update(sound_buffer_info *sb); |
| 211 |
|
| 212 |
|
| 213 |
char *sb_get_loop_info(const sound_buffer_info *sb, int *loop_byte_start, int *loop_byte_end, bool *is_16_bit); |
| 214 |
char *sb_get_loop_step_info(const sound_buffer_info *sb, int step, bool is16bit, int *length); |
| 215 |
void sb_buffered_loop_step(win_llsSystem *lls, sound_buffer_info *sb, int force_next_step = -2); |
| 216 |
|
| 217 |
#include "ds3dlib.h" |
| 218 |
#include "ddsndgeometry.h" |
| 219 |
|
| 220 |
#endif |