native get_state_val(part_id, State_Param:p, ...);
/* Multisense */
-native play_sample (sample_name[], Float:speed);
-native play_tone (tone_name[], Float:duration);
+native play_sample (sample_name[], Float:speed, ...);
+native play_tone (tone_name[], Float:duration, ...);
/***********************************************************/
/* Edje physics calls. */
action: FOCUS_OBJECT;\n
action: PARAM_COPY "src_part" "src_param" "dst_part" "dst_param";\n
action: PARAM_SET "part" "param" "value";\n
- action: PLAY_SAMPLE "sample name" speed (speed of sample - 1.0 is original speed - faster is higher pitch);\n
+ action: PLAY_SAMPLE "sample name" speed (speed of sample - 1.0 is original speed - faster is higher pitch) [channel optional EFFECT/FX | BACKGROUND/BG | MUSIC/MUS | FOREGROUND/FG | INTERFACE/UI | INPUT | ALERT;\n
action: PLAY_TONE "tone name" duration in seconds ( Range 0.1 to 10.0 );\n
action: PHYSICS_IMPULSE 10 -23.4 0;\n
action: PHYSICS_TORQUE_IMPULSE 0 2.1 0.95;\n
}
}
ep->speed = parse_float_range(2, 0.0, 100.0);
+ if (get_arg_count() >= 4)
+ ep->channel = parse_enum(3,
+ "EFFECT", 0, "FX", 0,
+ "BACKGROUND", 1, "BG", 1,
+ "MUSIC", 2, "MUS", 2,
+ "FOREGROUND", 3, "FG", 3,
+ "INTERFACE", 4, "UI", 4,
+ "INPUT", 5,
+ "ALERT", 6,
+ NULL);
}
else if (ep->action == EDJE_ACTION_TYPE_SOUND_TONE)
{
case EDJE_ACTION_TYPE_PHYSICS_ROT_SET:
check_arg_count(5);
break;
+ case EDJE_ACTION_TYPE_SOUND_SAMPLE:
+ break;
default:
check_arg_count(3);
}
/**
* @}
*/
+
+/**
+ * @defgroup Edje_Audio Edje Audio
+ *
+ * @brief Functions to manipulate audio abilities in edje.
+ *
+ * Perspective is a graphical tool that makes objets represented in 2D
+ * look like they have a 3D appearance.
+ *
+ * Edje allows us to use perspective on any edje object. This group of
+ * functions deal with the use of perspective, by creating and configuring
+ * a perspective object that must set to a edje object or a canvas,
+ * affecting all the objects inside that have no particular perspective
+ * set already.
+ *
+ * @ingroup Edje_Audio
+ *
+ * @{
+ */
+
+/**
+ * Identifiers of Edje message types, which can be sent back and forth
+ * code and a given Edje object's theme file/group.
+ *
+ * @see edje_audio_channel_mute_set()
+ * @see edje_audio_channel_mute_get()
+ *
+ * @since 1.9
+ */
+typedef enum _Edje_Channel
+{
+ EDJE_CHANNEL_EFFECT = 0, /**< Standard audio effects */
+ EDJE_CHANNEL_BACKGROUND = 1, /**< Background audio sounds */
+ EDJE_CHANNEL_MUSIC = 2, /**< Music audio */
+ EDJE_CHANNEL_FOREGROUND = 3, /**< Foreground audio sounds */
+ EDJE_CHANNEL_INTERFACE = 4, /**< Sounds related to the interface */
+ EDJE_CHANNEL_INPUT = 5, /**< Sounds related to regular input */
+ EDJE_CHANNEL_ALERT = 6, /**< Sounds for major alerts */
+ EDJE_CHANNEL_ALL = 7 /**< All audio channels (convenience) */
+} Edje_Channel;
+
+/**
+ * Set the mute state of audio for the process as a whole
+ *
+ * @param channel The channel to set the mute state of
+ * @param mute The mute state
+ *
+ * This sets the mute (no output) state of audio for the given channel.
+ *
+ * @see edje_audio_channel_mute_get()
+ *
+ * @since 1.9
+ */
+EAPI void edje_audio_channel_mute_set(Edje_Channel channel, Eina_Bool mute);
+
+/**
+ * Get the mute state of the given channel
+ *
+ * @param channel The channel to get the mute state of
+ * @return The mute state of the channel
+ *
+ * @see edje_audio_channel_mute_set()
+ *
+ * @since 1.9
+ */
+EAPI Eina_Bool edje_audio_channel_mute_get(Edje_Channel channel);
+
+/**
+ * @}
+ */
+
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "physics.y", physics.y, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "physics.z", physics.z, EET_T_DOUBLE);
#endif
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "channel", channel, EET_T_UCHAR);
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Image_Id);
_edje_edd_edje_part_image_id =
* set_state(part_id, state[], Float:state_val)
* get_state(part_id, dst[], maxlen, &Float:val)
* set_tween_state(part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val)
- * play_sample(sample_name, speed)
- * play_tone(tone_name, duration)
+ * play_sample(sample_name, speed, ...)
+ * play_tone(tone_name, duration, ...)
* run_program(program_id)
* Direction:get_drag_dir(part_id)
* get_drag(part_id, &Float:dx, &Float:&dy)
Edje *ed;
char *sample_name = NULL;
float speed = 1.0;
+ int channel = 0;
- CHKPARAM(2);
+ if (params[0] < (int) (sizeof(Embryo_Cell) * 2))
+ return 0;
ed = embryo_program_data_get(ep);
GETSTR(sample_name, params[1]);
if ((!sample_name)) return 0;
speed = EMBRYO_CELL_TO_FLOAT(params[2]);
- _edje_multisense_internal_sound_sample_play(ed, sample_name, (double)speed);
+ if (params[0] == (int) (sizeof(Embryo_Cell) * 3))
+ GETINT(channel, params[3]);
+ _edje_multisense_internal_sound_sample_play(ed, sample_name,
+ (double)speed, channel);
return 0;
}
Edje *ed;
char *tone_name = NULL;
float duration = 0.1;
+ int channel = 0;
- CHKPARAM(2);
+ if (params[0] < (int) (sizeof(Embryo_Cell) * 2))
+ return 0;
ed = embryo_program_data_get(ep);
GETSTR(tone_name, params[1]);
if ((!tone_name)) return 0;
duration = EMBRYO_CELL_TO_FLOAT(params[2]);
- _edje_multisense_internal_sound_tone_play(ed, tone_name, (double) duration);
+ if (params[0] == (int) (sizeof(Embryo_Cell) * 3))
+ GETINT(channel, params[3]);
+ _edje_multisense_internal_sound_tone_play(ed, tone_name,
+ (double)duration, channel);
return 0;
}
return vf->offset;
}
-static void _free(void *data)
+static void
+_free(void *data)
{
struct _edje_multisense_eet_data *eet_data = data;
free(data);
outs--;
}
+
+static Eina_Bool _channel_mute_states[8] = { 0 };
+
+static Eina_Bool
+_channel_mute(Edje *ed EINA_UNUSED, int channel)
+{
+ // ed lets use set mute per object... but for now no api's for this
+ // if all are muted ... then all!
+ if (_channel_mute_states[7]) return EINA_TRUE;
+ if ((channel < 0) || (channel > 7)) return EINA_FALSE;
+ return _channel_mute_states[channel];
+ return EINA_FALSE;
+}
+
+#endif
+
+EAPI void
+edje_audio_channel_mute_set(Edje_Channel channel, Eina_Bool mute)
+{
+#ifdef ENABLE_MULTISENSE
+ if ((channel < 0) || (channel > 7)) return;
+ _channel_mute_states[channel] = mute;
+#else
+ (void) channel;
+ (void) mute;
#endif
+}
+
+EAPI Eina_Bool
+edje_audio_channel_mute_get(Edje_Channel channel)
+{
+#ifdef ENABLE_MULTISENSE
+ if ((channel < 0) || (channel > 7)) return EINA_FALSE;
+ return _channel_mute_states[channel];
+#else
+ (void) channel;
+ return EINA_FALSE;
+#endif
+}
Eina_Bool
-_edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed)
+_edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed, int channel)
{
- #ifdef ENABLE_MULTISENSE
+#ifdef ENABLE_MULTISENSE
Eo *in;
Edje_Sound_Sample *sample;
char snd_id_str[255];
int i;
Eina_Bool ret;
+ if (_channel_mute(ed, channel)) return EINA_FALSE;
+
if (outfail) return EINA_FALSE;
if (!sample_name)
(void) ed;
(void) sample_name;
(void) speed;
+ (void) channel;
return EINA_FALSE;
#endif
}
Eina_Bool
-_edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration)
+_edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration, int channel)
{
#ifdef ENABLE_MULTISENSE
unsigned int i;
return EINA_FALSE;
}
+ if (_channel_mute(ed, channel)) return EINA_FALSE;
+
if (outfail) return EINA_FALSE;
if ((!ed) || (!ed->file) || (!ed->file->sound_dir))
(void) ed;
(void) duration;
(void) tone_name;
+ (void) channel;
return EINA_FALSE;
#endif
double z;
} physics;
#endif
-
+ unsigned char channel;
Eina_Bool exec : 1;
};
void _edje_multisense_init(void);
void _edje_multisense_shutdown(void);
-Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed);
-Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration);
+Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed, int channel);
+Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration, int channel);
void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state);
case EDJE_ACTION_TYPE_SOUND_SAMPLE:
if (_edje_block_break(ed))
goto break_prog;
- _edje_multisense_internal_sound_sample_play(ed, pr->sample_name, pr->speed);
+ _edje_multisense_internal_sound_sample_play(ed, pr->sample_name, pr->speed, pr->channel);
break;
case EDJE_ACTION_TYPE_SOUND_TONE:
if (_edje_block_break(ed))
goto break_prog;
- _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration);
+ _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration, pr->channel);
break;
case EDJE_ACTION_TYPE_PARAM_COPY:
{