11 #define NEED_STRHDL             // for STRHTL struct in audiostr.h 
   27 #define MAX_STREAM_BUFFERS 4 
   34 #define BIGBUF_SIZE                                     176400 
   42 #define COMPRESSED_BUFFER_SIZE  176400 
   46 #define AS_HIGHEST_MAX  999999999       // max uncompressed filesize supported is 999 meg 
   56 static int dbg_print_ogg_error(
const char *
filename, 
int rc)
 
   60         memset( &err_msg, 0, 
sizeof(err_msg) );
 
   62         Assert( filename != NULL );
 
   66                         strncpy(err_msg, 
"A false status was returned", 99);
 
   70                         strncpy(err_msg, 
"End-of-file reached", 99);
 
   74                         strncpy(err_msg, 
"Data interruption (hole)", 99);
 
   78                         strncpy(err_msg, 
"Media read error", 99);
 
   82                         strncpy(err_msg, 
"Internal logic fault", 99);
 
   86                         strncpy(err_msg, 
"Attempted to use a feature that's not supported", 99);
 
   90                         strncpy(err_msg, 
"Invalid argument value", 99);
 
   94                         strncpy(err_msg, 
"File contains non-Vorbis data, or is not a Vorbis file", 99);
 
   98                         strncpy(err_msg, 
"Invalid bitstream header", 99);
 
  102                         strncpy(err_msg, 
"Vorbis version mismatch", 99);
 
  106                         strncpy(err_msg, 
"Submitted data is not audio", 99);
 
  110                         strncpy(err_msg, 
"An invalid packet was submitted", 99);
 
  114                         strncpy(err_msg, 
"Invalid stream section supplied, or corrupt link", 99);
 
  118                         strncpy(err_msg, 
"Bitstream is not seekable", 99);
 
  122                         strncpy(err_msg, 
"Unknown error occurred", 99);
 
  129                 mprintf((
"OGG ERROR: \"%s\" in %s\n", err_msg, filename));
 
  136 static int audiostr_read_uint(
HMMIO rw, 
uint *
i)
 
  140         if (rc != 
sizeof(
uint))
 
  148 static int audiostr_read_word(
HMMIO rw, 
WORD *i)
 
  152         if (rc != 
sizeof(
WORD))
 
  160 static int audiostr_read_dword(
HMMIO rw, 
DWORD *i)
 
  164         if (rc != 
sizeof(
DWORD))
 
  200         bool Open (
char *pszFilename, 
bool keep_ext = 
true);
 
  239         bool Create (
char *pszFilename);
 
  241         void Play (
float volume, 
int looping);
 
  245         void Stop (
int paused = 0);
 
  386         m_snd_info.cfp = NULL;
 
  387         m_snd_info.true_offset = 0;
 
  389         m_pwfmt_original = NULL;
 
  391         m_nUncompressedAvgDataRate = 0;
 
  394         m_total_uncompressed_bytes_read = 0;
 
  396         m_al_format = AL_FORMAT_MONO8;
 
  401         m_abort_next_read = 
false;
 
  408         if (m_pwfmt_original) {
 
  410                 m_pwfmt_original = NULL;
 
  413         if ( m_hStream_open ) {
 
  419         if (m_snd_info.cfp) {
 
  421                         ov_clear(&m_snd_info.vorbis_file);
 
  424                 m_snd_info.cfp = NULL;
 
  425                 m_snd_info.true_offset = 0;
 
  431 extern const char *
stristr(
const char *str, 
const char *substr);
 
  440         int FileSize, FileOffset;
 
  444         m_total_uncompressed_bytes_read = 0;
 
  479         if (m_snd_info.cfp == NULL)
 
  482         m_snd_info.true_offset = FileOffset;
 
  483         m_snd_info.size = FileSize;
 
  487                 mmioSeek( m_snd_info.cfp, FileOffset, SEEK_SET );
 
  491                 if ( ov_open_callbacks(&m_snd_info, &m_snd_info.vorbis_file, NULL, 0, 
mmio_callbacks) == 0 ) {
 
  493                         ov_info(&m_snd_info.vorbis_file, -1);
 
  496                         if ( ov_streams(&m_snd_info.vorbis_file) != 1 ) {
 
  497                                 mprintf((
"AUDIOSTR => OGG reading error:  We don't handle bitstream changes!\n"));
 
  503                         m_wfmt.nChannels = (
WORD) m_snd_info.vorbis_file.vi->channels;
 
  504                         m_wfmt.nSamplesPerSec = m_snd_info.vorbis_file.vi->rate;
 
  512                                         m_wfmt.wBitsPerSample = 16;
 
  516                                         m_wfmt.wBitsPerSample = 8;
 
  522                         m_wfmt.nBlockAlign = (
ushort)(( m_wfmt.nChannels * m_wfmt.wBitsPerSample ) / 8);
 
  523                         m_wfmt.nAvgBytesPerSec = m_wfmt.nSamplesPerSec * m_wfmt.nBlockAlign;
 
  525                         m_nBlockAlign = m_wfmt.nBlockAlign;
 
  526                         m_nUncompressedAvgDataRate = m_wfmt.nAvgBytesPerSec;
 
  530                         m_nDataSize = m_data_bytes_left = ((
int)ov_pcm_total(&m_snd_info.vorbis_file, -1) * m_wfmt.nBlockAlign);
 
  532                         mprintf((
"AUDIOSTR => OGG reading error: Not a valid Vorbis file!\n"));
 
  541                 mmioSeek( m_snd_info.cfp, 12+FileOffset, SEEK_SET );
 
  547                         if ( !audiostr_read_uint(m_snd_info.cfp, &tag) )
 
  550                         if ( !audiostr_read_uint(m_snd_info.cfp, &size) )
 
  553                         next_chunk = 
mmioSeek(m_snd_info.cfp, 0, SEEK_CUR );
 
  560                                         audiostr_read_word(m_snd_info.cfp, &pcmwf.
wf.
wFormatTag);
 
  561                                         audiostr_read_word(m_snd_info.cfp, &pcmwf.
wf.
nChannels);
 
  568                                                 audiostr_read_word(m_snd_info.cfp, &cbExtra);
 
  572                                                 Assert(m_pwfmt_original != NULL);
 
  574                                                 memcpy (m_pwfmt_original, &pcmwf, 
sizeof(pcmwf));
 
  575                                                 m_pwfmt_original->cbSize = cbExtra;
 
  591                                         m_data_bytes_left = 
size;
 
  592                                         m_data_offset = 
mmioSeek( m_snd_info.cfp, 0, SEEK_CUR );
 
  602                         mmioSeek( m_snd_info.cfp, next_chunk, SEEK_SET );
 
  606                 if ( !done || (m_pwfmt_original == NULL) )
 
  612                 switch (m_pwfmt_original->wFormatTag) {
 
  615                                 m_wfmt.wBitsPerSample = m_pwfmt_original->wBitsPerSample;
 
  621                                 m_bits_per_sample_uncompressed = m_wfmt.wBitsPerSample;
 
  633                                                 m_wfmt.wBitsPerSample = 16;
 
  637                                                 m_wfmt.wBitsPerSample = 8;
 
  645                                 nprintf((
"SOUND", 
"SOUND => Not supporting %d format for playing wave files\n", m_pwfmt_original->wFormatTag));
 
  653                 m_wfmt.nChannels = m_pwfmt_original->nChannels;
 
  654                 m_wfmt.nSamplesPerSec = m_pwfmt_original->nSamplesPerSec;
 
  656                 m_wfmt.nBlockAlign = (
ushort)(( m_wfmt.nChannels * m_wfmt.wBitsPerSample ) / 8);
 
  657                 m_wfmt.nAvgBytesPerSec = m_wfmt.nBlockAlign * m_wfmt.nSamplesPerSec;
 
  660                 m_nBlockAlign = m_pwfmt_original->nBlockAlign;
 
  661                 m_nUncompressedAvgDataRate = m_wfmt.nAvgBytesPerSec;
 
  663                 Assert( (m_wfmt.nChannels == 1) || (m_wfmt.nChannels == 2) );
 
  672         if (m_al_format != AL_INVALID_VALUE) {  
 
  681         nprintf((
"SOUND",
"SOUND ==> Could not open wave file %s for streaming\n", filename));
 
  685         if (m_snd_info.cfp != NULL) {
 
  688                 m_snd_info.cfp = NULL;
 
  689                 m_snd_info.true_offset = 0;
 
  693         if (m_pwfmt_original) {
 
  695                 m_pwfmt_original = NULL;
 
  702                 nprintf((
"SOUND", 
"AUDIOSTR => Successfully opened: %s\n", filename));
 
  717         m_total_uncompressed_bytes_read = 0;
 
  721                 rval = (
int)ov_raw_seek(&m_snd_info.vorbis_file, m_data_offset);
 
  723                 rval = 
mmioSeek( m_snd_info.cfp, m_data_offset, SEEK_SET );
 
  730         m_data_bytes_left = m_nDataSize;
 
  731         m_abort_next_read = 
false;
 
  746         void    *dest_buf=NULL, *uncompressed_wave_data;
 
  747         int                             rc, uncompressed_bytes_written, section, last_section = -1, byte_order = 0;
 
  748         uint    src_bytes_used, convert_len, num_bytes_desired=0, num_bytes_read;
 
  752 #if BYTE_ORDER == BIG_ENDIAN 
  762         switch ( m_wave_format ) {
 
  764                         num_bytes_desired = cbSize;
 
  769                         if ( !m_hStream_open ) {
 
  770                                 if ( !
ACM_stream_open(m_pwfmt_original, &m_wfxDest, (
void**)&m_hStream, m_bits_per_sample_uncompressed)  ) {
 
  777                         num_bytes_desired = cbSize;
 
  785                         if ( num_bytes_desired <= 0 ) {
 
  786                                 num_bytes_desired = 0;
 
  797                         num_bytes_desired = cbSize;
 
  802                         num_bytes_desired = cbSize;
 
  804                         if (m_wfmt.wBitsPerSample == 32) {
 
  818                         nprintf((
"SOUND", 
"SOUND => Not supporting %d format for playing wave files\n", m_wave_format));
 
  829         if ( m_data_bytes_left <= 0 ) {
 
  831                 uncompressed_bytes_written = 0;
 
  835         if ( (m_data_bytes_left > 0) && (num_bytes_desired > 0) ) {
 
  838                 if ( num_bytes_desired <= (
uint)m_data_bytes_left ) {
 
  839                         num_bytes_read = num_bytes_desired;
 
  842                         num_bytes_read = m_data_bytes_left;
 
  847                         int sign = (m_wfmt.wBitsPerSample == 8) ? 0 : 1;
 
  848                         int sample_size = 
sizeof(
float) * m_wfmt.nChannels;
 
  850                         while ( !m_abort_next_read && ((
uint)actual_read < num_bytes_read)) {
 
  853                                 if (m_wfmt.wBitsPerSample == 32) {
 
  854                                         rc = ov_read_float(&m_snd_info.vorbis_file, &pcm, (num_bytes_read - actual_read) / sample_size, §ion);
 
  856                                         rc = ov_read(&m_snd_info.vorbis_file, (
char *)dest_buf + actual_read, num_bytes_read - actual_read, byte_order, m_wfmt.wBitsPerSample / 8, sign, §ion);
 
  860                                 if ((last_section != -1) && (last_section != section)) {
 
  861                                         mprintf((
"AUDIOSTR => OGG reading error:  We don't handle bitstream changes!\n"));
 
  866                                         if (m_wfmt.wBitsPerSample == 32) {
 
  867                                                 float *out_p = (
float*)((
ubyte*)dest_buf + actual_read);
 
  869                                                 for (
int i = 0; i < rc; i++) {
 
  870                                                         for (
int j = 0; j < m_wfmt.nChannels; j++) {
 
  871                                                                 *out_p++ = pcm[j][
i];
 
  875                                                 actual_read += (rc * m_wfmt.nBlockAlign);
 
  880                                         last_section = section;
 
  881                                 } 
else if ( rc == 0 ) {
 
  883                                 } 
else if ( rc < 0 ) {
 
  884                                         if ( dbg_print_ogg_error(m_wFilename, rc) ) {
 
  896                         while ( !m_abort_next_read && ((
uint)actual_read < num_bytes_read) ) {
 
  897                                 rc = 
mmioRead(m_snd_info.cfp, (
char *)dest_buf, num_bytes_read);
 
  903 #if BYTE_ORDER == BIG_ENDIAN 
  907                                 for (
int i = 0; i < rc; i += 
sizeof(
float)) {
 
  908                                         swap_tmp = (
float *)((
ubyte*)dest_buf + 
i);
 
  913                                 if (m_wfmt.wBitsPerSample == 32) {
 
  915                                 } 
else if (m_wfmt.wBitsPerSample == 16) {
 
  916                                         float *in_p = (
float*)dest_buf;
 
  917                                         short *out_p = (
short*)((
ubyte*)uncompressed_wave_data + actual_read);
 
  921                                         for (
int i = 0; i < 
end; i++) {
 
  922                                                 int i_val = (
int)(in_p[i] * 32767.0
f + 0.5
f);
 
  923                                                 CLAMP(i_val, -32768, 32767);
 
  925                                                 *out_p++ = (short)i_val;
 
  928                                         actual_read += (rc >> 1);
 
  930                                         Assert( m_wfmt.wBitsPerSample == 8 );
 
  932                                         float *in_p = (
float*)dest_buf;
 
  935                                         int end = num_bytes_read / 
sizeof(
float);
 
  937                                         for (
int i = 0; i < 
end; i++) {
 
  938                                                 int i_val = (
int)(in_p[i] * 127.0
f + 0.5
f) + 128;
 
  939                                                 CLAMP(i_val, 0, 255);
 
  941                                                 *out_p++ = (
ubyte)i_val;
 
  944                                         actual_read += (rc >> 2);
 
  950                         actual_read = 
mmioRead( m_snd_info.cfp, (
char *)dest_buf, num_bytes_read );
 
  953                 if ( (actual_read <= 0) || (m_abort_next_read) ) {
 
  955                         uncompressed_bytes_written = 0;
 
  959                 if ( num_bytes_desired >= (
uint)m_data_bytes_left ) {
 
  960                         m_abort_next_read = 1;                  
 
  963                 num_bytes_read = actual_read;
 
  968                 if ( num_bytes_read > 0 ) {
 
  973                         } 
else if ( convert_len == 0 ) {
 
  974                                 if (num_bytes_read < m_nBlockAlign) {
 
  975                                         mprintf((
"AUDIOSTR => Warning: Short read detected in ACM decode of '%s'!!\n", m_wFilename));
 
  982                 Assert(src_bytes_used <= num_bytes_read);
 
  983                 if ( src_bytes_used < num_bytes_read ) {
 
  985                         mmioSeek( m_snd_info.cfp, src_bytes_used - num_bytes_read, SEEK_CUR );
 
  989                 m_data_bytes_left -= src_bytes_used;
 
  990                 m_nBytesPlayed += src_bytes_used;
 
  991                 uncompressed_bytes_written = convert_len;
 
  999                 m_data_bytes_left -= num_bytes_read;
 
 1000                 m_nBytesPlayed += num_bytes_read;
 
 1001                 uncompressed_bytes_written = num_bytes_read;
 
 1003 #if BYTE_ORDER == BIG_ENDIAN 
 1006                         if (m_wfmt.wBitsPerSample == 16) {
 
 1009                                 for (
uint i=0; i<uncompressed_bytes_written; i=i+2) {
 
 1022         uncompressed_bytes_written = 0;
 
 1025         m_total_uncompressed_bytes_read += uncompressed_bytes_written;
 
 1027         return (uncompressed_bytes_written);
 
 1054         m_fade_timer_id = 0;
 
 1056         m_bPastLimit = 
false;
 
 1058         m_bDestroy_when_faded = 
false;
 
 1060         m_lCutoffVolume = 0.0f;
 
 1061         m_bIsPaused = 
false;
 
 1062         m_bReadingDone = 
false;
 
 1065         m_fPlaying = m_fCued = 
false;
 
 1071         memset(m_buffer_ids, 0, 
sizeof(m_buffer_ids));
 
 1086                 if ( !strlen(pszFilename) )
 
 1095                         m_pwavefile->Init();
 
 1097                         m_pwavefile->m_bits_per_sample_uncompressed = m_bits_per_sample_uncompressed;
 
 1100                                 m_cbBufSize = m_pwavefile->m_wfmt.nAvgBytesPerSec >> 2;
 
 1102                                 m_cbBufSize -= (m_cbBufSize % m_pwavefile->m_wfmt.nBlockAlign);
 
 1103                                 m_cbBufSize += (m_cbBufSize % 12) << 1;
 
 1109                                 OpenAL_ErrorCheck( alGenSources(1, &m_source_id), { fRtn = 
false; 
goto ErrorExit; } );
 
 1134                                 nprintf((
"SOUND", 
"SOUND => Failed to open wave file: %s\n\r", pszFilename));
 
 1140                         nprintf((
"Sound", 
"SOUND => Failed to create WaveFile object %s\n\r", pszFilename));
 
 1150         if ( (fRtn == 
false) && (m_pwavefile) ) {
 
 1151                 mprintf((
"AUDIOSTR => ErrorExit for ::Create() on wave file: %s\n", pszFilename));
 
 1156                 m_pwavefile->Close();
 
 1168         ALint buffers_processed = 0;
 
 1175         OpenAL_ErrorPrint( alGetSourcei(m_source_id, AL_BUFFERS_PROCESSED, &buffers_processed) );
 
 1177         while (buffers_processed) {
 
 1178                 ALuint buffer_id = 0;
 
 1180                 buffers_processed--;
 
 1191                 m_pwavefile->Close();
 
 1210         ubyte *uncompressed_wave_data;
 
 1212         *num_bytes_written = 0;
 
 1214         if ( size == 0 || m_bReadingDone ) {
 
 1218         if ( (m_buffer_ids[0] == 0) || !m_pwavefile ) {
 
 1232         int num_bytes_read = 0;
 
 1236                         num_bytes_read = m_pwavefile->Read(uncompressed_wave_data, m_cbBufSize, service);
 
 1238                         if (num_bytes_read < 0) {
 
 1240                         } 
else if (num_bytes_read > 0) {
 
 1241                                 OpenAL_ErrorCheck( alBufferData(m_buffer_ids[ib], m_pwavefile->GetALFormat(), uncompressed_wave_data, num_bytes_read, m_pwavefile->m_wfmt.nSamplesPerSec), { fRtn = 
false; 
goto ErrorExit; } );
 
 1242                                 OpenAL_ErrorCheck( alSourceQueueBuffers(m_source_id, 1, &m_buffer_ids[ib]), { fRtn = 
false; 
goto ErrorExit; } );
 
 1244                                 *num_bytes_written += num_bytes_read;
 
 1248                 ALint buffers_processed = 0;
 
 1249                 OpenAL_ErrorPrint( alGetSourcei(m_source_id, AL_BUFFERS_PROCESSED, &buffers_processed) );
 
 1251                 while (buffers_processed) {
 
 1252                         ALuint buffer_id = 0;
 
 1255                         num_bytes_read = m_pwavefile->Read(uncompressed_wave_data, m_cbBufSize, service);
 
 1257                         if (num_bytes_read < 0) {
 
 1259                         } 
else if (num_bytes_read > 0) {
 
 1260                                 OpenAL_ErrorPrint( alBufferData(buffer_id, m_pwavefile->GetALFormat(), uncompressed_wave_data, num_bytes_read, m_pwavefile->m_wfmt.nSamplesPerSec) );
 
 1263                                 *num_bytes_written += num_bytes_read;
 
 1266                         buffers_processed--;
 
 1285         uint dwMaxSize = m_cbBufSize;
 
 1288         OpenAL_ErrorCheck( alGetSourcei(m_source_id, AL_BUFFERS_PROCESSED, &n), 
return 0 );
 
 1290         OpenAL_ErrorCheck( alGetSourcei(m_source_id, AL_BUFFERS_QUEUED, &q), 
return 0 );
 
 1299 #define VOLUME_ATTENUATION_BEFORE_CUTOFF                        0.03f 
 1300 #define VOLUME_ATTENUATION                                                      0.65f 
 1318         if ( m_bFade == 
true ) {
 
 1319                 if ( m_lCutoffVolume == 0.0
f ) {
 
 1331                 if ( vol < m_lCutoffVolume ) {
 
 1333                         m_lCutoffVolume = 0.0f;
 
 1335                         if ( m_bDestroy_when_faded == 
true ) {
 
 1353         uint dwFreeSpace = GetMaxWriteSize ();
 
 1360                 uint num_bytes_written;
 
 1362                 if (WriteWaveData (dwFreeSpace, &num_bytes_written) == 
true) {
 
 1365                         if ( m_pwavefile->m_total_uncompressed_bytes_read >= m_pwavefile->m_max_uncompressed_bytes_to_read ) {
 
 1372                                 m_fade_timer_id = 0;
 
 1378                                 m_bPastLimit = 
true;
 
 1381                         if ( PlaybackDone() ) {
 
 1382                                 if ( m_bDestroy_when_faded == 
true ) {
 
 1391                                 if ( m_bLooping && !m_bFade) {
 
 1392                                         Play(m_lVolume, m_bLooping);
 
 1413         uint num_bytes_written;
 
 1417                 m_fade_timer_id = 0;
 
 1419                 m_bPastLimit = 
false;
 
 1421                 m_lCutoffVolume = 0.0f;
 
 1423                 m_bDestroy_when_faded = 
false;
 
 1429                 m_pwavefile->Cue ();
 
 1432                 ALint buffers_processed = 0;
 
 1433                 OpenAL_ErrorPrint( alGetSourcei(m_source_id, AL_BUFFERS_PROCESSED, &buffers_processed) );
 
 1435                 while (buffers_processed) {
 
 1436                         ALuint buffer_id = 0;
 
 1438                         buffers_processed--;
 
 1442                 WriteWaveData (m_cbBufSize, &num_bytes_written, 0);
 
 1451         if (m_buffer_ids[0] != 0) {
 
 1454                         if ( m_bIsPaused == 
false)
 
 1473                 m_timer.constructor();
 
 1475                 m_timer.Create (m_nBufService, m_nBufService, 
ptr_u (
this), TimerCallback);
 
 1479                 m_bIsPaused = 
false;
 
 1494         if ( m_pwavefile == NULL )
 
 1497         m_pwavefile->m_max_uncompressed_bytes_to_read = ((sample_cutoff * m_pwavefile->m_wfmt.wBitsPerSample) / 8);
 
 1502         if ( m_pwavefile == NULL )
 
 1505         return ((m_pwavefile->m_total_uncompressed_bytes_read * 8) / m_pwavefile->m_wfmt.wBitsPerSample);
 
 1514         if (!m_fPlaying || PlaybackDone())
 
 1521                 m_bDestroy_when_faded = 
true;
 
 1529         m_bDestroy_when_faded = 
false;
 
 1544                 m_bIsPaused = (paused != 0);
 
 1547                 m_timer.destructor();
 
 1559                 m_timer.destructor();
 
 1562                 m_bIsPaused = 
false;
 
 1566         ALint buffers_processed = 0;
 
 1567         OpenAL_ErrorPrint( alGetSourcei(m_source_id, AL_BUFFERS_PROCESSED, &buffers_processed) );
 
 1569         while (buffers_processed) {
 
 1570                 ALuint buffer_id = 0;
 
 1572                 buffers_processed--;
 
 1576         m_bReadingDone = 
false;
 
 1582         CAP(vol, 0.0
f, 1.0
f);
 
 1601         if (m_bReadingDone && (state != AL_PLAYING))
 
 1615         if ( Audiostream_inited == 1 )
 
 1651         SDL_InitSubSystem(SDL_INIT_TIMER);
 
 1656         Audiostream_inited = 1;
 
 1663         if ( Audiostream_inited == 0 )
 
 1669                 if ( Audio_streams[i].status == 
ASF_USED ) {
 
 1698         Audiostream_inited = 0;
 
 1722                 if (Audio_streams[i].status == 
ASF_FREE) {
 
 1729         if (i == MAX_AUDIO_STREAMS) {
 
 1730                 nprintf((
"Sound", 
"SOUND => No more audio streams available!\n"));
 
 1747                         char *
p = strrchr(fname, 
'.');
 
 1748                         if ( p && (strlen(p) > 2) )
 
 1762         rc = Audio_streams[
i].
Create(fname);
 
 1774         if (!Audiostream_inited)
 
 1782         if ( Audio_streams[i].status == 
ASF_USED ) {
 
 1796                 if ( Audio_streams[i].status == 
ASF_FREE )
 
 1805         if (!Audiostream_inited)
 
 1814         if (volume == -1.0
f) {
 
 1818         Assert(volume >= 0.0
f && volume <= 1.0
f );
 
 1819         CAP(volume, 0.0
f, 1.0
f);
 
 1823         Audio_streams[
i].
Play(volume, looping);
 
 1834         if ( Audio_streams[i].status != 
ASF_USED )
 
 1842         if (!Audiostream_inited)
 
 1854                 Audio_streams[
i].
Stop(paused);
 
 1862                 if ( Audio_streams[i].status == 
ASF_FREE )
 
 1877         Assert( volume >= 0.0
f && volume <= 1.0
f);
 
 1879         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1892         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1906         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1919         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1932         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1950         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1956         if (via_sexp_or_script)
 
 1967         if ( Audio_streams[i].status == 
ASF_FREE )
 
 1971                 audiostream_play(i, Audio_streams[i].Get_Volume(), Audio_streams[i].Is_looping());
 
 1974         if (via_sexp_or_script)
 
 1983                 if ( Audio_streams[i].status == 
ASF_FREE )
 
 1995                 if ( Audio_streams[i].status == 
ASF_FREE )
 
 1999                 if ( Audio_streams[i].paused_via_sexp_or_script && !via_sexp_or_script )
 
#define VOLUME_ATTENUATION_BEFORE_CUTOFF
 
uint m_max_uncompressed_bytes_to_read
 
void audiostream_set_volume_all(float volume, int type)
 
#define OpenAL_ErrorCheck(x, y)
 
#define WAVE_FORMAT_ADPCM
 
#define MAX_STREAM_BUFFERS
 
const char * audio_ext_list[]
 
#define DELETE_CRITICAL_SECTION(csc)
 
void audiostream_close_all(int fade)
 
void Play(float volume, int looping)
 
ALuint m_buffer_ids[MAX_STREAM_BUFFERS]
 
float Get_Default_Volume()
 
#define VOLUME_ATTENUATION
 
bool Create(uint nPeriod, uint nRes, ptr_u dwUser, TIMERCALLBACK pfnCallback)
 
bool Create(char *pszFilename)
 
SDL_mutex * CRITICAL_SECTION
 
#define OpenAL_ErrorPrint(x)
 
#define AL_AUXILIARY_SEND_FILTER
 
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out=0, char *pack_filename=NULL, int *size=NULL, int *offset=NULL, bool localize=false)
 
ALuint *typedef ALuint *typedef ALenum
 
int ACM_query_source_size(void *stream, int dest_len)
 
uint m_bits_per_sample_uncompressed
 
void Set_Sample_Cutoff(uint sample_cutoff)
 
MMRESULT mmioClose(HMMIO hmmio, uint wFlags)
 
uint GetNumBytesRemaining(void)
 
uint GetUncompressedAvgDataRate(void)
 
#define CLAMP(x, min, max)
 
ubyte * Wavedata_load_buffer
 
int audiostream_is_inited()
 
int audiostream_is_playing(int i)
 
ubyte * Compressed_buffer
 
uint audiostream_get_samples_committed(int i)
 
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
 
bool Open(char *pszFilename, bool keep_ext=true)
 
CRITICAL_SECTION write_lock
 
int cf_find_file_location(const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize=false)
 
ALuint *typedef ALuint *typedef ALint
 
CRITICAL_SECTION Global_service_lock
 
void audiostream_stop(int i, int rewind, int paused)
 
void audiostream_unpause_all(bool via_sexp_or_script)
 
void audiostream_pause_all(bool via_sexp_or_script)
 
bool m_bDestroy_when_faded
 
bool WriteWaveData(uint cbSize, uint *num_bytes_written, int service=1)
 
#define COMPRESSED_BUFFER_SIZE
 
long mmioSeek(HMMIO hmmio, long lOffset, int iOrigin)
 
uint Get_Samples_Committed(void)
 
#define ENTER_CRITICAL_SECTION(csc)
 
void audiostream_set_volume(int i, float volume)
 
int ACM_stream_close(void *stream)
 
uint m_nUncompressedAvgDataRate
 
void audiostream_unpause(int i, bool via_sexp_or_script)
 
char m_wFilename[MAX_FILENAME_LEN]
 
int Read(ubyte *pbDest, uint cbSize, int service=1)
 
void Fade_and_Destroy(void)
 
int ACM_stream_open(WAVEFORMATEX *pwfxSrc, WAVEFORMATEX *pwfxDest, void **stream, int dest_bps)
 
uint GetMaxWriteSize(void)
 
ubyte * Compressed_service_buffer
 
void audiostream_close_file(int i, int fade)
 
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
 
GLdouble GLdouble GLdouble GLdouble q
 
bool(* TIMERCALLBACK)(ptr_u)
 
#define LEAVE_CRITICAL_SECTION(csc)
 
void CAP(T &v, T mn, T mx)
 
static bool TimerCallback(ptr_u dwUser)
 
ALenum openal_get_format(ALint bits, ALint n_channels)
 
ushort m_bits_per_sample_uncompressed
 
int audiostream_is_paused(int i)
 
bool paused_via_sexp_or_script
 
#define INITIALIZE_CRITICAL_SECTION(csc)
 
#define MAX_AUDIO_STREAMS
 
static void CALLBACK TimeProc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
 
TIMERCALLBACK m_pfnCallback
 
uint GetNumBytesPlayed(void)
 
const ushort DefBufferServiceInterval
 
uint m_total_uncompressed_bytes_read
 
void Set_Volume(float vol)
 
void audiostream_play(int i, float volume, int looping)
 
long mmioRead(HMMIO hmmio, HPSTR pch, long cch)
 
ov_callbacks mmio_callbacks
 
void audiostream_set_sample_cutoff(int i, uint cutoff)
 
int audiostream_open(const char *filename, int type)
 
ubyte * Wavedata_service_buffer
 
void Stop_and_Rewind(void)
 
WAVEFORMATEX * m_pwfmt_original
 
void audiostream_pause(int i, bool via_sexp_or_script)
 
int ACM_convert(void *stream, ubyte *src, int src_len, ubyte *dest, int max_dest_bytes, unsigned int *dest_len, unsigned int *src_bytes_used)
 
int timer_get_milliseconds()
 
const char * stristr(const char *str, const char *substr)
 
void Set_Default_Volume(float vol)
 
int audiostream_done_reading(int i)
 
AudioStream Audio_streams[MAX_AUDIO_STREAMS]
 
#define WAVE_FORMAT_IEEE_FLOAT
 
#define OGG_FORMAT_VORBIS
 
HMMIO mmioOpen(LPSTR szFilename, LPMMIOINFO lpmmioinfo, DWORD dwOpenFlags)