Changeset 2305
- Timestamp:
- Sep 22, 2008 9:29:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/tonegen.c
r2294 r2305 350 350 unsigned options; 351 351 unsigned playback_options; 352 pj_bool_t has_fading; /* Enable fade-in and fade-out */ 352 353 unsigned fade_in_len; /* fade in for this # of samples */ 353 354 unsigned fade_out_len; /* fade out for this # of samples*/ … … 438 439 tonegen->digit_map = &digit_map; 439 440 441 tonegen->has_fading = PJ_TRUE; 440 442 tonegen->fade_in_len = PJMEDIA_TONEGEN_FADE_IN_TIME * clock_rate / 1000; 441 443 tonegen->fade_out_len = PJMEDIA_TONEGEN_FADE_OUT_TIME * clock_rate / 1000; … … 644 646 required -= cnt; 645 647 646 if (tonegen-> dig_samples == cnt) {648 if (tonegen->has_fading && tonegen->dig_samples == cnt) { 647 649 /* Fade in */ 648 650 short *samp = (dst - cnt); … … 661 663 } 662 664 } 663 } else if (tonegen-> dig_samples ==on_samp) {665 } else if (tonegen->has_fading && tonegen->dig_samples==on_samp) { 664 666 /* Fade out */ 665 667 if (cnt > tonegen->fade_out_len) … … 766 768 tones, count * sizeof(pjmedia_tone_desc)); 767 769 768 /* Normalize volume */ 770 /* Normalize volume, and check if we need to disable fading. 771 * Disable fading if tone off time is zero. Application probably 772 * wants to play this tone continuously (e.g. dial tone). 773 */ 774 tonegen->has_fading = PJ_TRUE; 769 775 for (i=0; i<count; ++i) { 770 776 pjmedia_tone_desc *t = &tonegen->digits[i+tonegen->count]; … … 773 779 else if (t->volume < 0) 774 780 t->volume = (short) -t->volume; 781 if (t->off_msec == 0) 782 tonegen->has_fading = PJ_FALSE; 775 783 } 776 784
Note: See TracChangeset
for help on using the changeset viewer.