Better fix for #309, now handles the case of missing only some voice

oggs but not all


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1009 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2003-07-02 21:48:02 +00:00
parent 878e7691ce
commit cc2345a29d
+13 -7
View File
@@ -490,19 +490,25 @@ SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, void (*
// fprintf (stderr, "page (%d of %d): %d ts: %d\n",page_counter, num_pages, startTime, time_stamps[page_counter]); // fprintf (stderr, "page (%d of %d): %d ts: %d\n",page_counter, num_pages, startTime, time_stamps[page_counter]);
if (last_chain->decoder) if (last_chain->decoder)
{ {
//fprintf (stderr, " decoder: %s, rate %d format %x\n", static float old_volume = 0.0f;
// last_chain->decoder->decoder_info, if (last_chain->decoder->type == SOUNDDECODER_NULL)
// last_chain->decoder->frequency, {
// last_chain->decoder->format); if (speechVolumeScale != 0.0f)
if (last_chain->decoder->type == SOUNDDECODER_NULL &&
speechVolumeScale != 0.0f)
{ {
/* No voice ogg available so zeroing speech volume to /* No voice ogg available so zeroing speech volume to
ensure proper operation of oscilloscope and music fading */ ensure proper operation of oscilloscope and music fading */
old_volume = speechVolumeScale;
speechVolumeScale = 0.0f; speechVolumeScale = 0.0f;
fprintf (stderr, "SpliceTrack(): no voice ogg available so setting speech volume to zero\n"); fprintf (stderr, "SpliceTrack(): no voice ogg available so setting speech volume to zero\n");
} }
}
else if (old_volume != 0.0f && speechVolumeScale != old_volume)
{
/* This time voice ogg is there */
fprintf (stderr, "SpliceTrack(): restoring speech volume\n");
speechVolumeScale = old_volume;
old_volume = 0.0f;
}
sound_sample->length += last_chain->decoder->length; sound_sample->length += last_chain->decoder->length;
if (! no_page_break) if (! no_page_break)