remove cr/lfs from chmmr timestamps
fixes stuttering in melnorm speech #143, static using number speech #135, subtitles not aligning #134 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@719 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -659,22 +659,30 @@ void SoundDecoder_Seek (TFB_SoundDecoder *decoder, uint32 seekTime)
|
|||||||
else
|
else
|
||||||
decoder->pos = (pcm_pos + decoder->start_sample) * 4;
|
decoder->pos = (pcm_pos + decoder->start_sample) * 4;
|
||||||
|
|
||||||
//fprintf (stderr, "SoundDecoder_Seek(): seek %s\n", decoder->filename);
|
//fprintf (stderr, "SoundDecoder_Seek(): %s (start: %d pos: %d end: %d)\n",
|
||||||
|
// decoder->filename, decoder->start_sample, pcm_pos, decoder->end_sample);
|
||||||
decoder->error = SOUNDDECODER_OK;
|
decoder->error = SOUNDDECODER_OK;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SOUNDDECODER_BUF:
|
case SOUNDDECODER_BUF:
|
||||||
{
|
{
|
||||||
decoder->pos = seekTime * decoder->frequency *
|
uint32 pcm_pos = seekTime * decoder->frequency / 1000;
|
||||||
(decoder->format == decoder_formats.mono16 ? 2 : 4) / 1000;
|
decoder->pos = pcm_pos *
|
||||||
|
(decoder->format == decoder_formats.mono16 ? 2 : 4);
|
||||||
|
//fprintf (stderr, "SoundDecoder_Seek(): %s(buf) (start: %d pos: %d end: %d)\n",
|
||||||
|
// decoder->filename, decoder->start_sample, pcm_pos, decoder->end_sample);
|
||||||
decoder->error = SOUNDDECODER_OK;
|
decoder->error = SOUNDDECODER_OK;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SOUNDDECODER_NULL:
|
case SOUNDDECODER_NULL:
|
||||||
decoder->pos = seekTime * decoder->frequency * 2 / 1000;
|
{
|
||||||
|
uint32 pcm_pos = seekTime * decoder->frequency / 1000;
|
||||||
|
decoder->pos = pcm_pos * 2;
|
||||||
|
//fprintf (stderr, "SoundDecoder_Seek(): %s(null) (start: %d pos: %d end: %d)\n",
|
||||||
|
// decoder->filename, decoder->start_sample, pcm_pos, decoder->end_sample);
|
||||||
decoder->error = SOUNDDECODER_OK;
|
decoder->error = SOUNDDECODER_OK;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
fprintf (stderr, "SoundDecoder_Seek(): unknown type %d\n", decoder->type);
|
fprintf (stderr, "SoundDecoder_Seek(): unknown type %d\n", decoder->type);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ DoTrackTag (TFB_SoundTag *tag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
GetTimeStamps(UNICODE *TimeStamps, sint32 *time_stamps)
|
GetTimeStamps(UNICODE *TimeStamps, sint32 *time_stamps)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
@@ -207,6 +207,7 @@ GetTimeStamps(UNICODE *TimeStamps, sint32 *time_stamps)
|
|||||||
if (*TimeStamps)
|
if (*TimeStamps)
|
||||||
TimeStamps++;
|
TimeStamps++;
|
||||||
}
|
}
|
||||||
|
return (num);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEXT_SPEED 70
|
#define TEXT_SPEED 70
|
||||||
@@ -413,11 +414,13 @@ SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, void (*
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
tct++;
|
tct++;
|
||||||
if (TimeStamp)
|
|
||||||
GetTimeStamps (TimeStamp, time_stamps);
|
|
||||||
|
|
||||||
fprintf (stderr, "SpliceTrack(): loading %s\n", TrackName);
|
fprintf (stderr, "SpliceTrack(): loading %s\n", TrackName);
|
||||||
|
|
||||||
|
if (TimeStamp)
|
||||||
|
if ((GetTimeStamps (TimeStamp, time_stamps) + 1) != num_pages)
|
||||||
|
fprintf (stderr, "SpliceTrack(): number of timestamps doesn't match number of pages!\n");
|
||||||
|
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
for (page_counter = 0; page_counter < num_pages; page_counter++)
|
for (page_counter = 0; page_counter < num_pages; page_counter++)
|
||||||
{
|
{
|
||||||
@@ -446,7 +449,7 @@ SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, void (*
|
|||||||
}
|
}
|
||||||
startTime += abs (time_stamps[page_counter]);
|
startTime += abs (time_stamps[page_counter]);
|
||||||
|
|
||||||
// fprintf (stderr, "page (%d of %d): %d\n",page_counter, num_pages, startTime);
|
// 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",
|
//fprintf (stderr, " decoder: %s, rate %d format %x\n",
|
||||||
@@ -500,7 +503,11 @@ recompute_track_pos (TFB_SoundSample *sample, TFB_SoundChain *first_chain, sint3
|
|||||||
return;
|
return;
|
||||||
while (cur_chain->next &&
|
while (cur_chain->next &&
|
||||||
(sint32)(cur_chain->next->start_time * (float)ONE_SECOND) < offset)
|
(sint32)(cur_chain->next->start_time * (float)ONE_SECOND) < offset)
|
||||||
|
{
|
||||||
|
if (cur_chain->tag.type)
|
||||||
|
DoTrackTag (&cur_chain->tag);
|
||||||
cur_chain = cur_chain->next;
|
cur_chain = cur_chain->next;
|
||||||
|
}
|
||||||
if (cur_chain->tag.type)
|
if (cur_chain->tag.type)
|
||||||
DoTrackTag (&cur_chain->tag);
|
DoTrackTag (&cur_chain->tag);
|
||||||
if ((sint32)((cur_chain->start_time + cur_chain->decoder->length) * (float)ONE_SECOND) < offset)
|
if ((sint32)((cur_chain->start_time + cur_chain->decoder->length) * (float)ONE_SECOND) < offset)
|
||||||
|
|||||||
Reference in New Issue
Block a user