[Freeswitch-svn] [commit] r6992 - freeswitch/trunk/src/mod/applications/mod_soundtouch

Freeswitch SVN anthm at freeswitch.org
Thu Dec 27 13:23:16 EST 2007


Author: anthm
Date: Thu Dec 27 13:23:15 2007
New Revision: 6992

Modified:
   freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp

Log:
fix overlooked dtmf changed

Modified: freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	(original)
+++ freeswitch/trunk/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	Thu Dec 27 13:23:15 2007
@@ -55,7 +55,7 @@
     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;
@@ -65,88 +65,81 @@
         struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
         
         if (sth) {
-            const char *p;
-
             if (sth->literal) {
                 sth->literal = 0;
                 return SWITCH_STATUS_SUCCESS;
             }
 
-            for (p = dtmf; p && *p; p++) {
-                if (sth->literal) {
-                    sth->literal = 0;
-                    return SWITCH_STATUS_SUCCESS;
-                }
+            
+            switch(dtmf->digit) {
+            case '*':
+                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;
 
-                switch(*p) {
-                case '*':
-                    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;
-
-                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':
-                    sth->octaves = 0;
-                    sth->st->setPitchOctaves(sth->octaves);
-                    sth->pitch = 1;
-                    sth->st->setPitch(sth->pitch);
-                    sth->semi = 0;
-                    sth->st->setPitchSemiTones(sth->semi);
-                    sth->st->flush();
-                    
+            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':
+                sth->octaves = 0;
+                sth->st->setPitchOctaves(sth->octaves);
+                sth->pitch = 1;
+                sth->st->setPitch(sth->pitch);
+                sth->semi = 0;
+                sth->st->setPitchSemiTones(sth->semi);
+                sth->st->flush();
+                    
             }
+
         }
+        
 
         return SWITCH_STATUS_FALSE;
     }



More information about the Freeswitch-svn mailing list