void bmx_gme_enable_accuracy(MaxMusicEmu * emu, int enabled) { gme_enable_accuracy(emu->emu, enabled); }
static gboolean gme_setup (GstGmeDec * gme) { gme_info_t *info; gme_err_t gme_err = NULL; GstTagList *taglist; guint64 total_duration; guint64 fade_time; GstBuffer *buffer; GstSegment seg; GstMapInfo map; if (!gst_adapter_available (gme->adapter) || !gme_negotiate (gme)) { return FALSE; } buffer = gst_adapter_take_buffer (gme->adapter, gst_adapter_available (gme->adapter)); gst_buffer_map (buffer, &map, GST_MAP_READ); gme_err = gme_open_data (map.data, map.size, &gme->player, 32000); gst_buffer_unmap (buffer, &map); gst_buffer_unref (buffer); if (gme_err || !gme->player) { if (gme->player) { gme_delete (gme->player); gme->player = NULL; } GST_ELEMENT_ERROR (gme, STREAM, DEMUX, (NULL), ("%s", gme_err)); return FALSE; } gme_err = gme_track_info (gme->player, &info, 0); taglist = gst_tag_list_new_empty (); if (info->song && *info->song) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, info->song, NULL); if (info->author && *info->author) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_ARTIST, info->author, NULL); /* Prefer the name of the official soundtrack over the name of the game (since this is * how track numbers are derived) */ if (info->game && *info->game) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_ALBUM, info->game, NULL); if (info->comment && *info->comment) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_COMMENT, info->comment, NULL); if (info->dumper && *info->dumper) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_CONTACT, info->dumper, NULL); if (info->copyright && *info->copyright) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_COPYRIGHT, info->copyright, NULL); if (info->system && *info->system) gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_ENCODER, info->system, NULL); gme->total_duration = total_duration = gst_util_uint64_scale_int (info->play_length + (info->loop_length > 0 ? 8000 : 0), GST_MSECOND, 1); fade_time = info->loop_length > 0 ? info->play_length : 0; gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_DURATION, total_duration, NULL); gst_pad_push_event (gme->srcpad, gst_event_new_tag (taglist)); g_free (info); #ifdef HAVE_LIBGME_ACCURACY /* TODO: Is it worth it to make this optional? */ gme_enable_accuracy (gme->player, 1); #endif gme_start_track (gme->player, 0); if (fade_time) gme_set_fade (gme->player, fade_time); gst_segment_init (&seg, GST_FORMAT_TIME); gst_pad_push_event (gme->srcpad, gst_event_new_segment (&seg)); gst_pad_start_task (gme->srcpad, (GstTaskFunction) gst_gme_play, gme->srcpad, NULL); gme->initialized = TRUE; gme->seeking = FALSE; gme->seekpoint = 0; return gme->initialized; }
void Music_Player::enable_accuracy( bool b ) { suspend(); gme_enable_accuracy( emu_, b ); resume(); }