static void bt_edit_application_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { BtEditApplication *self = BT_EDIT_APPLICATION (object); return_if_disposed (); switch (property_id) { case EDIT_APPLICATION_SONG: #ifdef USE_DEBUG if (G_OBJECT_REF_COUNT (self->priv->song) != 1) { GST_DEBUG ("old song: %" G_OBJECT_REF_COUNT_FMT, G_OBJECT_LOG_REF_COUNT (self->priv->song)); } #endif g_object_try_unref (self->priv->song); self->priv->song = BT_SONG (g_value_dup_object (value)); GST_DEBUG ("new song: %" G_OBJECT_REF_COUNT_FMT, G_OBJECT_LOG_REF_COUNT (self->priv->song)); break; case EDIT_APPLICATION_UNSAVED: self->priv->unsaved = g_value_get_boolean (value); GST_INFO ("set the unsaved flag to %d for the song", self->priv->unsaved); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void bt_cmd_pattern_set_property (GObject * const object, const guint property_id, const GValue * const value, GParamSpec * const pspec) { BtCmdPattern *const self = BT_CMD_PATTERN (object); return_if_disposed (); switch (property_id) { case CMD_PATTERN_SONG: self->priv->song = BT_SONG (g_value_get_object (value)); g_object_try_weak_ref (self->priv->song); //GST_DEBUG("set the song for pattern: %p",self->priv->song); break; case CMD_PATTERN_NAME: g_free (self->priv->name); self->priv->name = g_value_dup_string (value); GST_DEBUG ("set the display name for the pattern: '%s'", self->priv->name); break; case CMD_PATTERN_MACHINE: self->priv->machine = BT_MACHINE (g_value_get_object (value)); g_object_try_weak_ref (self->priv->machine); break; case CMD_PATTERN_COMMAND: self->priv->cmd = g_value_get_enum (value); GST_DEBUG ("set the cmd for the pattern: %d", self->priv->cmd); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void bt_wavetable_set_property (GObject * const object, const guint property_id, const GValue * const value, GParamSpec * const pspec) { const BtWavetable *const self = BT_WAVETABLE (object); return_if_disposed (); switch (property_id) { case WAVETABLE_SONG: self->priv->song = BT_SONG (g_value_get_object (value)); g_object_try_weak_ref (self->priv->song); //GST_DEBUG("set the song for wavetable: %p",self->priv->song); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void bt_wavelevel_set_property (GObject * const object, const guint property_id, const GValue * const value, GParamSpec * const pspec) { const BtWavelevel *const self = BT_WAVELEVEL (object); return_if_disposed (); switch (property_id) { case WAVELEVEL_SONG: self->priv->song = BT_SONG (g_value_get_object (value)); g_object_try_weak_ref (self->priv->song); //GST_DEBUG("set the song for wavelevel: %p",self->priv->song); break; case WAVELEVEL_WAVE: self->priv->wave = BT_WAVE (g_value_get_object (value)); g_object_try_weak_ref (self->priv->wave); GST_DEBUG ("set the wave for wavelevel: %p", self->priv->wave); break; case WAVELEVEL_ROOT_NOTE: self->priv->root_note = g_value_get_enum (value); GST_DEBUG ("set the root-note for wavelevel: %d", self->priv->root_note); break; case WAVELEVEL_LENGTH: self->priv->length = g_value_get_ulong (value); GST_DEBUG ("set the length for wavelevel: %lu", self->priv->length); break; case WAVELEVEL_LOOP_START: self->priv->loop_start = g_value_get_ulong (value); GST_INFO ("loop: 0 / %lu .. %lu / %lu", self->priv->loop_start, self->priv->loop_end, self->priv->length); // make sure its less then loop_end/length if (self->priv->loop_end > 0) { if (self->priv->loop_start >= self->priv->loop_end) { GST_DEBUG ("clip loop-start by loop-end: %lu", self->priv->loop_end); self->priv->loop_start = self->priv->loop_end - 1; } } if (self->priv->length > 0) { if (self->priv->loop_start >= self->priv->length) { GST_DEBUG ("clip loop-start by length: %lu", self->priv->length); self->priv->loop_start = self->priv->length - 1; } } GST_DEBUG ("set the loop-start for wavelevel: %lu", self->priv->loop_start); break; case WAVELEVEL_LOOP_END: self->priv->loop_end = g_value_get_ulong (value); GST_INFO ("loop: 0 / %lu .. %lu / %lu", self->priv->loop_start, self->priv->loop_end, self->priv->length); // make sure its more then loop-start if (self->priv->loop_start > 0) { if (self->priv->loop_end < self->priv->loop_start) { GST_DEBUG ("clip loop-end by loop-start: %lu", self->priv->loop_start); self->priv->loop_end = self->priv->loop_start + 1; } } // make sure its less then or equal to length if (self->priv->length > 0) { if (self->priv->loop_end > self->priv->length) { GST_DEBUG ("clip loop-end by length: %lu", self->priv->length); self->priv->loop_end = self->priv->length; } } GST_DEBUG ("set the loop-start for wavelevel: %lu", self->priv->loop_start); break; case WAVELEVEL_RATE: self->priv->rate = g_value_get_ulong (value); GST_DEBUG ("set the rate for wavelevel: %lu", self->priv->rate); break; case WAVELEVEL_DATA: g_free (self->priv->sample); self->priv->sample = g_value_get_pointer (value); GST_DEBUG ("set the data-pointer for wavelevel: %p", self->priv->sample); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void bt_song_info_set_property (GObject * const object, const guint property_id, const GValue * const value, GParamSpec * const pspec) { const BtSongInfo *const self = BT_SONG_INFO (object); return_if_disposed (); switch (property_id) { case SONG_INFO_SONG: self->priv->song = BT_SONG (g_value_get_object (value)); g_object_try_weak_ref (self->priv->song); GST_DEBUG ("set the song for song-info: %p", self->priv->song); break; case SONG_INFO_FILE_NAME: g_free (self->priv->file_name); self->priv->file_name = g_value_dup_string (value); GST_DEBUG ("set the file-name for song_info: %s", self->priv->file_name); break; case SONG_INFO_INFO:{ const gchar *str = g_value_get_string (value); if ((self->priv->info != str) && (!self->priv->info || !str || strcmp (self->priv->info, str))) { g_free (self->priv->info); if (str) { self->priv->info = g_value_dup_string (value); gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_DESCRIPTION, self->priv->info, NULL); } else { self->priv->info = NULL; gst_tag_list_remove_tag (self->priv->taglist, GST_TAG_DESCRIPTION); } GST_DEBUG ("set the info for song_info: %s", self->priv->info); } break; } case SONG_INFO_NAME:{ const gchar *str = g_value_get_string (value); if ((self->priv->name != str) && (!self->priv->name || !str || strcmp (self->priv->name, str))) { g_free (self->priv->name); if (str) { self->priv->name = g_value_dup_string (value); gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, self->priv->name, NULL); } else { self->priv->name = NULL; gst_tag_list_remove_tag (self->priv->taglist, GST_TAG_TITLE); } GST_DEBUG ("set the name for song_info: %s", self->priv->name); } break; } case SONG_INFO_GENRE:{ const gchar *str = g_value_get_string (value); if ((self->priv->genre != str) && (!self->priv->genre || !str || strcmp (self->priv->genre, str))) { g_free (self->priv->genre); if (str) { self->priv->genre = g_value_dup_string (value); gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE, self->priv->genre, NULL); } else { self->priv->genre = NULL; gst_tag_list_remove_tag (self->priv->taglist, GST_TAG_GENRE); } GST_DEBUG ("set the genre for song_info: %s", self->priv->genre); } break; } case SONG_INFO_AUTHOR:{ const gchar *str = g_value_get_string (value); if ((self->priv->author != str) && (!self->priv->author || !str || strcmp (self->priv->author, str))) { g_free (self->priv->author); if (str) { self->priv->author = g_value_dup_string (value); gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_ARTIST, self->priv->author, NULL); } else { self->priv->author = NULL; gst_tag_list_remove_tag (self->priv->taglist, GST_TAG_ARTIST); } GST_DEBUG ("set the author for song_info: %s", self->priv->author); } break; } case SONG_INFO_BPM:{ gulong val = g_value_get_ulong (value); if (self->priv->beats_per_minute != val) { self->priv->beats_per_minute = val; gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_BEATS_PER_MINUTE, (gdouble) self->priv->beats_per_minute, NULL); bt_song_info_tempo_changed (self); GST_DEBUG ("set the bpm for song_info: %lu", self->priv->beats_per_minute); } break; } case SONG_INFO_TPB:{ gulong val = g_value_get_ulong (value); if (self->priv->ticks_per_beat != val) { self->priv->ticks_per_beat = val; bt_song_info_tempo_changed (self); GST_DEBUG ("set the tpb for song_info: %lu", self->priv->ticks_per_beat); } } break; case SONG_INFO_BARS:{ gulong val = g_value_get_ulong (value); if (self->priv->bars != val) { self->priv->bars = val; bt_song_info_tempo_changed (self); GST_DEBUG ("set the bars for song_info: %lu", self->priv->bars); } break; } case SONG_INFO_CREATE_DTS:{ const gchar *const dts = g_value_get_string (value); if (dts) { if (strlen (dts) == DTS_LEN) { strcpy (self->priv->create_dts, dts); } } else { time_t now = time (NULL); /* this is ISO 8601 Date and Time Format * %F Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99) * %T The time in 24-hour notation (%H:%M:%S). (SU) */ strftime (self->priv->create_dts, DTS_LEN + 1, "%FT%TZ", gmtime (&now)); } break; } case SONG_INFO_CHANGE_DTS:{ const gchar *const dts = g_value_get_string (value); if (dts) { if (strlen (dts) == DTS_LEN) { struct tm tm = { 0, }; strcpy (self->priv->change_dts, dts); // parse date and update tag strptime (dts, "%FT%TZ", &tm); g_date_set_time_t (self->priv->tag_date, mktime (&tm)); gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_DATE, self->priv->tag_date, NULL); } } else { time_t now = time (NULL); strftime (self->priv->change_dts, DTS_LEN + 1, "%FT%TZ", gmtime (&now)); g_date_set_time_t (self->priv->tag_date, now); gst_tag_list_add (self->priv->taglist, GST_TAG_MERGE_REPLACE, GST_TAG_DATE, self->priv->tag_date, NULL); } break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }