ecore_audio_playback: Support changing of speed
authorDaniel Willmann <d.willmann@samsung.com>
Mon, 18 Mar 2013 16:08:34 +0000 (16:08 +0000)
committerDaniel Willmann <d.willmann@samsung.com>
Tue, 2 Apr 2013 15:26:47 +0000 (16:26 +0100)
Implement ecore_audio_input_speed_set() in playback example
Fix volume limit off-by-one check while I'm at it

Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
src/examples/ecore/ecore_audio_playback.c

index 6b0f0f4..86ff8c2 100644 (file)
@@ -87,18 +87,42 @@ handle_cmd(char *cmd, size_t bread)
      }
    else if (!strncmp(cmd, "+", bread))
      {
-        if (volume <= 1.5)
+        if (volume < 1.5)
           volume += 0.01;
         ecore_audio_output_volume_set(out, volume);
         printf("Volume: %3.0f%%\n", volume * 100);
      }
    else if (!strncmp(cmd, "-", bread))
      {
-        if (volume >= 0)
+        if (volume > 0)
           volume -= 0.01;
         ecore_audio_output_volume_set(out, volume);
         printf("Volume: %3.0f%%\n", volume * 100);
      }
+   else if (!strncmp(cmd, "*", bread))
+     {
+        double speed;
+        EINA_LIST_FOREACH(out_inputs, input, in)
+          {
+             speed = ecore_audio_input_speed_get(in);
+             if (speed < 2.0)
+               speed += 0.01;
+             ecore_audio_input_speed_set(in, speed);
+             printf("Speed: %3.0f%% (%s)\n", speed * 100, ecore_audio_input_name_get(in));
+          }
+     }
+   else if (!strncmp(cmd, "/", bread))
+     {
+        double speed;
+        EINA_LIST_FOREACH(out_inputs, input, in)
+          {
+             speed = ecore_audio_input_speed_get(in);
+             if (speed > 0.5)
+               speed -= 0.01;
+             ecore_audio_input_speed_set(in, speed);
+             printf("Speed: %3.0f%% (%s)\n", speed * 100, ecore_audio_input_name_get(in));
+          }
+     }
    else if (!strncmp(cmd, " ", bread))
      {
         EINA_LIST_FOREACH(out_inputs, input, in)