fix overlooked dtmf changed
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6992 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0624a541d8
commit
079975d3c3
|
@ -55,7 +55,7 @@ struct soundtouch_helper {
|
||||||
int literal;
|
int literal;
|
||||||
};
|
};
|
||||||
|
|
||||||
static switch_status_t on_dtmf(switch_core_session_t *session, const char *dtmf)
|
static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_media_bug_t *bug;
|
switch_media_bug_t *bug;
|
||||||
|
@ -65,89 +65,82 @@ static switch_status_t on_dtmf(switch_core_session_t *session, const char *dtmf)
|
||||||
struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
|
struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
|
||||||
|
|
||||||
if (sth) {
|
if (sth) {
|
||||||
const char *p;
|
|
||||||
|
|
||||||
if (sth->literal) {
|
if (sth->literal) {
|
||||||
sth->literal = 0;
|
sth->literal = 0;
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = dtmf; p && *p; p++) {
|
|
||||||
if (sth->literal) {
|
switch(dtmf->digit) {
|
||||||
sth->literal = 0;
|
case '*':
|
||||||
return SWITCH_STATUS_SUCCESS;
|
sth->literal++;
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
sth->semi += .5;
|
||||||
|
sth->st->setPitchSemiTones(sth->semi);
|
||||||
|
sth->st->flush();
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
sth->semi = 0;
|
||||||
|
sth->st->setPitchSemiTones(sth->semi);
|
||||||
|
sth->st->flush();
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
sth->semi -= .5;
|
||||||
|
sth->st->setPitchSemiTones(sth->semi);
|
||||||
|
sth->st->flush();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '6':
|
||||||
|
sth->pitch += .2;
|
||||||
|
sth->st->setPitch(sth->pitch);
|
||||||
|
sth->st->flush();
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
|
sth->pitch = 1;
|
||||||
|
sth->st->setPitch(sth->pitch);
|
||||||
|
sth->st->flush();
|
||||||
|
break;
|
||||||
|
case '4':
|
||||||
|
sth->pitch -= .2;
|
||||||
|
if (sth->pitch <= 0) {
|
||||||
|
sth->pitch = .2;
|
||||||
}
|
}
|
||||||
|
sth->st->setPitch(sth->pitch);
|
||||||
|
sth->st->flush();
|
||||||
|
break;
|
||||||
|
|
||||||
switch(*p) {
|
case '9':
|
||||||
case '*':
|
sth->octaves += .2;
|
||||||
sth->literal++;
|
sth->st->setPitchOctaves(sth->octaves);
|
||||||
break;
|
sth->st->flush();
|
||||||
case '3':
|
break;
|
||||||
sth->semi += .5;
|
case '8':
|
||||||
sth->st->setPitchSemiTones(sth->semi);
|
sth->octaves = 0;
|
||||||
sth->st->flush();
|
sth->st->setPitchOctaves(sth->octaves);
|
||||||
break;
|
sth->st->flush();
|
||||||
case '2':
|
break;
|
||||||
sth->semi = 0;
|
case '7':
|
||||||
sth->st->setPitchSemiTones(sth->semi);
|
sth->octaves -= .2;
|
||||||
sth->st->flush();
|
sth->st->setPitchOctaves(sth->octaves);
|
||||||
break;
|
sth->st->flush();
|
||||||
case '1':
|
break;
|
||||||
sth->semi -= .5;
|
|
||||||
sth->st->setPitchSemiTones(sth->semi);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '6':
|
|
||||||
sth->pitch += .2;
|
|
||||||
sth->st->setPitch(sth->pitch);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
case '5':
|
|
||||||
sth->pitch = 1;
|
|
||||||
sth->st->setPitch(sth->pitch);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
case '4':
|
|
||||||
sth->pitch -= .2;
|
|
||||||
if (sth->pitch <= 0) {
|
|
||||||
sth->pitch = .2;
|
|
||||||
}
|
|
||||||
sth->st->setPitch(sth->pitch);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '9':
|
|
||||||
sth->octaves += .2;
|
|
||||||
sth->st->setPitchOctaves(sth->octaves);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
case '8':
|
|
||||||
sth->octaves = 0;
|
|
||||||
sth->st->setPitchOctaves(sth->octaves);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
case '7':
|
|
||||||
sth->octaves -= .2;
|
|
||||||
sth->st->setPitchOctaves(sth->octaves);
|
|
||||||
sth->st->flush();
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case '0':
|
case '0':
|
||||||
sth->octaves = 0;
|
sth->octaves = 0;
|
||||||
sth->st->setPitchOctaves(sth->octaves);
|
sth->st->setPitchOctaves(sth->octaves);
|
||||||
sth->pitch = 1;
|
sth->pitch = 1;
|
||||||
sth->st->setPitch(sth->pitch);
|
sth->st->setPitch(sth->pitch);
|
||||||
sth->semi = 0;
|
sth->semi = 0;
|
||||||
sth->st->setPitchSemiTones(sth->semi);
|
sth->st->setPitchSemiTones(sth->semi);
|
||||||
sth->st->flush();
|
sth->st->flush();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue