RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.51
diff -u -r1.51 sound.cpp
|
|
|
|
| 24 | 24 | #include "scumm.h" |
| 25 | 25 | #include "sound/mididrv.h" |
| 26 | 26 | #include "sound/imuse.h" |
| | 27 | #include "sys/stat.h" |
| 27 | 28 | |
| 28 | 29 | #ifdef _WIN32_WCE |
| 29 | 30 | extern void *bsearch(const void *, const void *, size_t, |
| … |
… |
|
| 106 | 107 | ptr = getResourceAddress(rtSound, sound); |
| 107 | 108 | if (ptr != NULL && READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) { |
| 108 | 109 | ptr += 8; |
| | 110 | #ifdef COMPRESSED_SOUND_FILE |
| | 111 | playMP3CDTrack(ptr[16], ptr[17] == 0xff ? -1 : ptr[17], |
| | 112 | (ptr[18] * 60 + ptr[19]) * 75 + ptr[20], 0); |
| | 113 | #else |
| 109 | 114 | _system->play_cdrom(ptr[16], ptr[17] == 0xff ? -1 : ptr[17], |
| 110 | 115 | (ptr[18] * 60 + ptr[19]) * 75 + ptr[20], 0); |
| | 116 | #endif |
| 111 | 117 | current_cd_sound = sound; |
| 112 | 118 | return; |
| 113 | 119 | } |
| … |
… |
|
| 691 | 697 | float frame_size; |
| 692 | 698 | mad_timer_t duration; |
| 693 | 699 | |
| 694 | | if (!start && !delay) { |
| | 700 | if (!num_loops && !start) { |
| 695 | 701 | _mixer->stop(_mp3_handle); |
| 696 | 702 | return; |
| 697 | 703 | } |
| … |
… |
|
| 705 | 711 | offset = (long)((float)start / (float)75 * 1000 / |
| 706 | 712 | (float)((float)1152 / (float)_mad_header[index].samplerate * |
| 707 | 713 | 1000) * (float)(frame_size + 0.5)); |
| 708 | 714 | // Calc delay |
| 709 | | mad_timer_set(&duration, 0, delay, 75); |
| | 715 | if (!delay) { |
| | 716 | struct stat file_stat; |
| | 717 | fstat(fileno(_mp3_tracks[index]),&file_stat); |
| | 718 | mad_timer_set(&duration, 0,file_stat.st_size, (_mad_header[index].bitrate/8)); |
| | 719 | } else { |
| | 720 | mad_timer_set(&duration, 0, delay, 75); |
| | 721 | } |
| 710 | 722 | // Go |
| 711 | 723 | fseek(_mp3_tracks[index], offset, SEEK_SET); |
| 712 | 724 | |