• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AUDDBG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AUDDBG函数的典型用法代码示例。如果您正苦于以下问题:C++ AUDDBG函数的具体用法?C++ AUDDBG怎么用?C++ AUDDBG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AUDDBG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mlp_hook_playback_begin

static void mlp_hook_playback_begin(gpointer hook_data, gpointer user_data)
{
	gint playlist = mlp_playlist_get_playing();
	gint pos = mlp_playlist_get_position(playlist);

	if (mlp_playlist_entry_get_length (playlist, pos, FALSE) < 30)
	{
		AUDDBG(" *** not submitting due to entry->length < 30");
		return;
	}

	gchar * filename = mlp_playlist_entry_get_filename (playlist, pos);
	if (ishttp (filename))
	{
		AUDDBG(" *** not submitting due to HTTP source");
		str_unref (filename);
		return;
	}
	str_unref (filename);

	sc_idle(m_scrobbler);

	if (submit_tuple)
		tuple_unref (submit_tuple);
	submit_tuple = mlp_playlist_entry_get_tuple (playlist, pos, FALSE);
	if (! submit_tuple)
		return;

	sc_addentry(m_scrobbler, submit_tuple, tuple_get_int(submit_tuple, FIELD_LENGTH, NULL) / 1000);

	if (!track_timeout)
		track_timeout = g_timeout_add_seconds(1, sc_timeout, NULL);
}
开发者ID:Falcon-peregrinus,项目名称:mlplayer,代码行数:33,代码来源:plugin.c


示例2: pulse_drain

static void pulse_drain(void) {
    pa_operation *o = NULL;
    int success = 0;

    CHECK_CONNECTED();

    pa_threaded_mainloop_lock(mainloop);
    CHECK_DEAD_GOTO(fail, 0);

    if (!(o = pa_stream_drain(stream, stream_success_cb, &success))) {
        AUDDBG("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context)));
        goto fail;
    }

    while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
        CHECK_DEAD_GOTO(fail, 1);
        pa_threaded_mainloop_wait(mainloop);
    }

    if (!success)
        AUDDBG("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context)));

fail:
    if (o)
        pa_operation_unref(o);

    pa_threaded_mainloop_unlock(mainloop);
}
开发者ID:Pitxyoki,项目名称:audacious-plugins,代码行数:28,代码来源:pulse_audio.c


示例3: metadata_callback

void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
    callback_info *info = (callback_info*) client_data;
    gsize size;

    if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)
    {
        info->stream.samples = metadata->data.stream_info.total_samples;
        AUDDBG("total_samples=%lld\n", (long long) metadata->data.stream_info.total_samples);

        info->stream.bits_per_sample = metadata->data.stream_info.bits_per_sample;
        AUDDBG("bits_per_sample=%d\n", metadata->data.stream_info.bits_per_sample);

        info->stream.channels = metadata->data.stream_info.channels;
        AUDDBG("channels=%d\n", metadata->data.stream_info.channels);

        info->stream.samplerate = metadata->data.stream_info.sample_rate;
        AUDDBG("sample_rate=%d\n", metadata->data.stream_info.sample_rate);

        size = vfs_fsize(info->fd);

        if (size == -1 || info->stream.samples == 0)
            info->bitrate = 0;
        else
            info->bitrate = 8 * size * (gint64) info->stream.samplerate / info->stream.samples;

        AUDDBG("bitrate=%d\n", info->bitrate);

        info->metadata_changed = TRUE;
    }
}
开发者ID:ivan-dives,项目名称:audacious-plugins,代码行数:31,代码来源:seekable_stream_callbacks.c


示例4: get_format_by_extension

static AVInputFormat * get_format_by_extension (const gchar * name)
{
    const gchar * ext0, * sub;
    uri_parse (name, NULL, & ext0, & sub, NULL);

    if (ext0 == sub)
        return NULL;

    gchar * ext = g_ascii_strdown (ext0 + 1, sub - ext0 - 1);

    AUDDBG ("Get format by extension: %s\n", name);
    pthread_mutex_lock (& data_mutex);

    if (! extension_dict)
        extension_dict = create_extension_dict ();

    AVInputFormat * f = g_hash_table_lookup (extension_dict, ext);
    pthread_mutex_unlock (& data_mutex);

    if (f)
        AUDDBG ("Format %s.\n", f->name);
    else
        AUDDBG ("Format unknown.\n");

    g_free (ext);
    return f;
}
开发者ID:rapidrabbit,项目名称:audacious-plugins,代码行数:27,代码来源:ffaudio-core.c


示例5: start_single

static void start_single (int type)
{
    PluginHandle * p;

    if ((p = find_enabled (type)) != NULL)
    {
        AUDDBG ("Starting selected %s plugin %s.\n", table[type].name,
         plugin_get_name (p));

        if (table[type].u.s.set_current (p))
            return;

        AUDDBG ("%s failed to start.\n", plugin_get_name (p));
        plugin_set_enabled (p, FALSE);
    }

    AUDDBG ("Probing for %s plugin.\n", table[type].name);

    if ((p = table[type].u.s.probe ()) == NULL)
    {
        fprintf (stderr, "FATAL: No %s plugin found.\n", table[type].name);
        exit (EXIT_FAILURE);
    }

    AUDDBG ("Starting %s.\n", plugin_get_name (p));
    plugin_set_enabled (p, TRUE);

    if (! table[type].u.s.set_current (p))
    {
        fprintf (stderr, "FATAL: %s failed to start.\n", plugin_get_name (p));
        plugin_set_enabled (p, FALSE);
        exit (EXIT_FAILURE);
    }
}
开发者ID:NiklausAizen,项目名称:audacious,代码行数:34,代码来源:plugin-init.c


示例6: set_format

static bool_t set_format(int format, int rate, int channels)
{
    int param;

    AUDDBG("Audio format: %s, sample rate: %dHz, number of channels: %d.\n", oss_format_to_text(format), rate, channels);

    /* Enable/disable format conversions made by the OSS software */
    param = aud_get_bool("oss4", "cookedmode");
    CHECK(ioctl, oss_data->fd, SNDCTL_DSP_COOKEDMODE, &param);

    AUDDBG("%s format conversions made by the OSS software.\n", param ? "Enabled" : "Disabled");

    param = format;
    CHECK_NOISY(ioctl, oss_data->fd, SNDCTL_DSP_SETFMT, &param);
    CHECK_VAL(param == format, ERROR_NOISY, "Selected audio format is not supported by the device.\n");

    param = rate;
    CHECK_NOISY(ioctl, oss_data->fd, SNDCTL_DSP_SPEED, &param);
    CHECK_VAL(param >= rate * 9 / 10 && param <= rate * 11 / 10, ERROR_NOISY,
     "Selected sample rate is not supported by the device.\n");

    param = channels;
    CHECK_NOISY(ioctl, oss_data->fd, SNDCTL_DSP_CHANNELS, &param);
    CHECK_VAL(param == channels, ERROR_NOISY, "Selected number of channels is not supported by the device.\n");

    oss_data->format = format;
    oss_data->rate = rate;
    oss_data->channels = channels;
    oss_data->bits_per_sample = oss_format_to_bits(oss_data->format);

    return TRUE;

FAILED:
    return FALSE;
}
开发者ID:CBke,项目名称:audacious-plugins,代码行数:35,代码来源:oss.c


示例7: scrobbler_communication_init

//called from scrobbler_init() @ scrobbler.c
bool_t scrobbler_communication_init() {
    CURLcode curl_requests_result = curl_global_init(CURL_GLOBAL_DEFAULT);
    if (curl_requests_result != CURLE_OK) {
        AUDDBG("Could not initialize libCURL: %s.\n", curl_easy_strerror(curl_requests_result));
        return FALSE;
    }

    curlHandle = curl_easy_init();
    if (curlHandle == NULL) {
        AUDDBG("Could not initialize libCURL.\n");
        return FALSE;
    }

    curl_requests_result = curl_easy_setopt(curlHandle, CURLOPT_URL, SCROBBLER_URL);
    if (curl_requests_result != CURLE_OK) {
        AUDDBG("Could not define scrobbler destination URL: %s.\n", curl_easy_strerror(curl_requests_result));
        return FALSE;
    }

    curl_requests_result = curl_easy_setopt(curlHandle, CURLOPT_WRITEFUNCTION, result_callback);
    if (curl_requests_result != CURLE_OK) {
        AUDDBG("Could not register scrobbler callback function: %s.\n", curl_easy_strerror(curl_requests_result));
        return FALSE;
    }

    return TRUE;
}
开发者ID:kereell,项目名称:audacious-plugins,代码行数:28,代码来源:scrobbler_communication.c


示例8: general_load

static void general_load (PluginHandle * plugin)
{
    GList * node = g_list_find_custom (loaded_general_plugins, plugin,
     (GCompareFunc) general_find_cb);
    if (node != NULL)
        return;

    AUDDBG ("Loading %s.\n", plugin_get_name (plugin));
    GeneralPlugin * gp = plugin_get_header (plugin);
    g_return_if_fail (gp != NULL);

    LoadedGeneral * general = g_slice_new (LoadedGeneral);
    general->plugin = plugin;
    general->gp = gp;
    general->widget = NULL;

    if (gp->get_widget != NULL)
        general->widget = gp->get_widget ();

    if (general->widget != NULL)
    {
        AUDDBG ("Adding %s to interface.\n", plugin_get_name (plugin));
        g_signal_connect (general->widget, "destroy", (GCallback)
         gtk_widget_destroyed, & general->widget);
        interface_add_plugin_widget (plugin, general->widget);
    }

    loaded_general_plugins = g_list_prepend (loaded_general_plugins, general);
}
开发者ID:Geotto,项目名称:audacious,代码行数:29,代码来源:general.c


示例9: wv_probe_for_tuple

static Tuple *
wv_probe_for_tuple(const char * filename, VFSFile * fd)
{
    WavpackContext *ctx;
    Tuple *tu;
    char error[1024];

    ctx = WavpackOpenFileInputEx(&wv_readers, fd, NULL, error, OPEN_TAGS, 0);

    if (ctx == NULL)
        return NULL;

    AUDDBG("starting probe of %p\n", (void *) fd);

    vfs_rewind(fd);
    tu = tuple_new_from_filename(filename);

    vfs_rewind(fd);
    tag_tuple_read(tu, fd);

    tuple_set_int(tu, FIELD_LENGTH, NULL,
        ((uint64_t) WavpackGetNumSamples(ctx) * 1000) / (uint64_t) WavpackGetSampleRate(ctx));
    tuple_set_str(tu, FIELD_CODEC, NULL, "WavPack");

    char * quality = wv_get_quality (ctx);
    tuple_set_str (tu, FIELD_QUALITY, NULL, quality);
    str_unref (quality);

    WavpackCloseFile(ctx);

    AUDDBG("returning tuple %p for file %p\n", (void *) tu, (void *) fd);
    return tu;
}
开发者ID:CBke,项目名称:audacious-plugins,代码行数:33,代码来源:wavpack.c


示例10: start

void start(void) {
	sc_going = 1;

	gchar * username = mlp_get_string ("audioscrobbler", "username");
	gchar * password = mlp_get_string ("audioscrobbler", "password");
	gchar * sc_url = mlp_get_string ("audioscrobbler", "sc_url");

	if ((!username || !password) || (!*username || !*password))
	{
		AUDDBG("username/password not found - not starting last.fm support");
		sc_going = 0;
	}
	else
		sc_init(username, password, sc_url);

	g_free (username);
	g_free (password);
	g_free (sc_url);

	m_scrobbler = g_mutex_new();

	hook_associate("playback begin", mlp_hook_playback_begin, NULL);
	hook_associate("playback stop", mlp_hook_playback_end, NULL);

	AUDDBG("plugin started");
	sc_idle(m_scrobbler);
}
开发者ID:Falcon-peregrinus,项目名称:mlplayer,代码行数:27,代码来源:plugin.c


示例11: pulse_flush

static void pulse_flush(int time) {
    pa_operation *o = NULL;
    int success = 0;

    CHECK_CONNECTED();

    pa_threaded_mainloop_lock(mainloop);
    CHECK_DEAD_GOTO(fail, 1);

    written = time * (int64_t) bytes_per_second / 1000;
    flush_time = time;

    if (!(o = pa_stream_flush(stream, stream_success_cb, &success))) {
        AUDDBG("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
        goto fail;
    }

    while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
        CHECK_DEAD_GOTO(fail, 1);
        pa_threaded_mainloop_wait(mainloop);
    }

    if (!success)
        AUDDBG("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));

fail:
    if (o)
        pa_operation_unref(o);

    pa_threaded_mainloop_unlock(mainloop);
}
开发者ID:Pitxyoki,项目名称:audacious-plugins,代码行数:31,代码来源:pulse_audio.c


示例12: delete_lines_from_scrobble_log

static void delete_lines_from_scrobble_log (GSList **lines_to_remove_ptr, gchar *queuepath) {
    GSList *lines_to_remove = *lines_to_remove_ptr;
    gchar *contents = NULL;
    gchar **lines = NULL;
    gchar **finallines = g_malloc_n(1, sizeof(gchar *));
    int n_finallines;

    if (lines_to_remove == NULL) {
        return;
    }
    lines_to_remove = g_slist_reverse(lines_to_remove);


    pthread_mutex_lock(&log_access_mutex);

    gboolean success = g_file_get_contents(queuepath, &contents, NULL, NULL);
    if (!success) {
        AUDDBG("Could not read scrobbler.log contents.\n");
    } else {
        lines = g_strsplit(contents, "\n", 0);

        n_finallines = 0;
        for (int i = 0 ; lines[i] != NULL && strlen(lines[i]) > 0; i++) {
            if (lines_to_remove != NULL && *((int *) (lines_to_remove->data)) == i) {
                //this line is to remove
                lines_to_remove = g_slist_next(lines_to_remove);
            } else {
                //keep this line
                n_finallines++;
                finallines = g_realloc_n(finallines, n_finallines, sizeof(gchar *));
                finallines[n_finallines-1] = g_strdup(lines[i]);
            }
        }

        finallines = g_realloc_n(finallines, n_finallines+2, sizeof(gchar *));
        finallines[n_finallines] = g_strdup("");
        finallines[n_finallines+1] = NULL;
        g_free(contents);
        contents = g_strjoinv("\n", finallines);
        success = g_file_set_contents(queuepath, contents, -1, NULL);
        if (!success) {
            AUDDBG("Could not write to scrobbler.log!\n");
        }

    }

    pthread_mutex_unlock(&log_access_mutex);


    g_strfreev(finallines);
    g_strfreev(lines);
    g_free(contents);
}
开发者ID:kereell,项目名称:audacious-plugins,代码行数:53,代码来源:scrobbler_communication.c


示例13: scrobbler_test_connection

//returns:
// FALSE if there was a network problem.
// TRUE otherwise (scrobbling_enabled must be checked)
//sets scrobbling_enabled to TRUE if the session is OK
//sets session_key to NULL if it is invalid
static bool_t scrobbler_test_connection() {

    if (session_key == NULL || strlen(session_key) == 0) {
        scrobbling_enabled = FALSE;
        return TRUE;
    }


    gchar *testmsg = create_message_to_lastfm("user.getRecommendedArtists",
                                              3,
                                              "limit", "1",
                                              "api_key", SCROBBLER_API_KEY,
                                              "sk", session_key
                                             );
    bool_t success = send_message_to_lastfm(testmsg);
    g_free(testmsg);
    if (success == FALSE) {
        AUDDBG("Network problems. Will not scrobble any tracks.\n");
        scrobbling_enabled = FALSE;
        if (permission_check_requested) {
            perm_result = PERMISSION_NONET;
        }
        return FALSE;
    }

    gchar *error_code = NULL;
    gchar *error_detail = NULL;
    if (read_authentication_test_result(&error_code, &error_detail) == FALSE) {
        AUDDBG("Error code: %s. Detail: %s.\n", error_code, error_detail);
        if (error_code != NULL && (
                g_strcmp0(error_code, "4") == 0 || //error code 4: Authentication Failed - You do not have permissions to access the service
                g_strcmp0(error_code, "9") == 0    //error code 9: Invalid session key - Please re-authenticate
            )) {
            g_free(error_code);
            g_free(error_detail);
            g_free(session_key);
            session_key = NULL;
            aud_set_string("scrobbler", "session_key", "");
            scrobbling_enabled = FALSE;
            return TRUE;
        } else {
            //network problem.
            scrobbling_enabled = FALSE;
            AUDDBG("Connection NOT OK. Scrobbling disabled\n");
            return FALSE;
        }
    } else {
        //THIS IS THE ONLY PLACE WHERE SCROBBLING IS SET TO ENABLED IN RUN-TIME
        scrobbling_enabled = TRUE;
        AUDDBG("Connection OK. Scrobbling enabled.\n");
        return TRUE;
    }
}
开发者ID:kereell,项目名称:audacious-plugins,代码行数:58,代码来源:scrobbler_communication.c


示例14: start_multi_cb

static bool_t start_multi_cb (PluginHandle * p, void * type)
{
    AUDDBG ("Starting %s.\n", plugin_get_name (p));

    if (! table[GPOINTER_TO_INT (type)].u.m.start (p))
    {
        AUDDBG ("%s failed to start; disabling.\n", plugin_get_name (p));
        plugin_set_enabled (p, FALSE);
    }

    return TRUE;
}
开发者ID:NiklausAizen,项目名称:audacious,代码行数:12,代码来源:plugin-init.c


示例15: send_message_to_lastfm

static bool_t send_message_to_lastfm(gchar *data) {
    AUDDBG("This message will be sent to last.fm:\n%s\n%%%%End of message%%%%\n", data);//Enter?\n", data);
    curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDS, data);
    CURLcode curl_requests_result = curl_easy_perform(curlHandle);

    if (curl_requests_result != CURLE_OK) {
        AUDDBG("Could not communicate with last.fm: %s.\n", curl_easy_strerror(curl_requests_result));
        return FALSE;
    }

    return TRUE;
}
开发者ID:kereell,项目名称:audacious-plugins,代码行数:12,代码来源:scrobbler_communication.c


示例16: g_build_filename

gchar *archive_decompress(const gchar *filename)
{
    gchar *tmpdir, *cmd, *escaped_filename;
    ArchiveType type;
#ifndef HAVE_MKDTEMP
#ifdef S_IRGRP
    mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
#else
    mode_t mode755 = S_IRWXU;
#endif
#endif

    if ((type = archive_get_type(filename)) <= ARCHIVE_DIR)
        return NULL;

#ifdef HAVE_MKDTEMP
    tmpdir = g_build_filename(g_get_tmp_dir(), "audacious.XXXXXXXX", NULL);
    if (!mkdtemp(tmpdir))
    {
        g_free(tmpdir);
        AUDDBG("Unable to load skin: Failed to create temporary "
               "directory: %s\n", g_strerror(errno));
        return NULL;
    }
#else
    tmpdir = g_strdup_printf("%s/audacious.%ld", g_get_tmp_dir(), (long)rand());
    make_directory(tmpdir, mode755);
#endif

    escaped_filename = escape_shell_chars(filename);
    cmd = archive_extract_funcs[type] (escaped_filename, tmpdir);
    g_free(escaped_filename);

    if (!cmd)
    {
        AUDDBG("extraction function is NULL!\n");
        g_free(tmpdir);
        return NULL;
    }

    AUDDBG("Attempt to execute \"%s\"\n", cmd);

    if (system(cmd) != 0)
    {
        AUDDBG("could not execute cmd %s\n", cmd);
        g_free(cmd);
        return NULL;
    }
    g_free(cmd);

    return tmpdir;
}
开发者ID:Pitxyoki,项目名称:audacious-plugins,代码行数:52,代码来源:util.c


示例17: flac_get_image

bool_t flac_get_image(const char *filename, VFSFile *fd, void **data, int64_t *length)
{
    AUDDBG("Probe for song image.\n");

    FLAC__Metadata_Iterator *iter;
    FLAC__Metadata_Chain *chain;
    FLAC__StreamMetadata *metadata = NULL;
    FLAC__Metadata_ChainStatus status;
    bool_t has_image = FALSE;

    chain = FLAC__metadata_chain_new();

    if (!FLAC__metadata_chain_read_with_callbacks(chain, fd, io_callbacks))
        goto ERR;

    iter = FLAC__metadata_iterator_new();

    FLAC__metadata_iterator_init(iter, chain);

    while (FLAC__metadata_iterator_next(iter))
        if (FLAC__metadata_iterator_get_block_type(iter) == FLAC__METADATA_TYPE_PICTURE)
            break;

    if (FLAC__metadata_iterator_get_block_type(iter) == FLAC__METADATA_TYPE_PICTURE)
    {
        metadata = FLAC__metadata_iterator_get_block(iter);

        if (metadata->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER)
        {
            AUDDBG("FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER found.");

            * data = malloc (metadata->data.picture.data_length);
            * length = metadata->data.picture.data_length;
            memcpy (* data, metadata->data.picture.data, * length);
            has_image = TRUE;
        }
    }

    FLAC__metadata_iterator_delete(iter);
    FLAC__metadata_chain_delete(chain);

    return has_image;

ERR:
    status = FLAC__metadata_chain_status(chain);
    FLAC__metadata_chain_delete(chain);

    FLACNG_ERROR("An error occured: %s\n", FLAC__Metadata_ChainStatusString[status]);
    return FALSE;
}
开发者ID:CBke,项目名称:audacious-plugins,代码行数:50,代码来源:metadata.c


示例18: mp3_close

static void mp3_close(void)
{
    if (output_file) {
        int imp3, encout;

        /* write remaining mp3 data */
        encout = lame_encode_flush_nogap(gfp, encbuffer, LAME_MAXMP3BUFFER);
        write_output(encbuffer, encout);

        /* set gfp->num_samples for valid TLEN tag */
        lame_set_num_samples(gfp, numsamples);

        /* append v1 tag */
        imp3 = lame_get_id3v1_tag(gfp, encbuffer, sizeof(encbuffer));
        if (imp3 > 0)
            write_output(encbuffer, imp3);

        /* update v2 tag */
        imp3 = lame_get_id3v2_tag(gfp, encbuffer, sizeof(encbuffer));
        if (imp3 > 0) {
            if (vfs_fseek(output_file, 0, SEEK_SET) != 0) {
                AUDDBG("can't rewind\n");
            }
            else {
                write_output(encbuffer, imp3);
            }
        }

        /* update lame tag */
        if (id3v2_size) {
            if (vfs_fseek(output_file, id3v2_size, SEEK_SET) != 0) {
                AUDDBG("fatal error: can't update LAME-tag frame!\n");
            }
            else {
                imp3 = lame_get_lametag_frame(gfp, encbuffer, sizeof(encbuffer));
                write_output(encbuffer, imp3);
            }
        }
    }

    g_free (write_buffer);

    lame_close(gfp);
    AUDDBG("lame_close() done\n");

    free_lameid3(&lameid3);
    numsamples = 0;
}
开发者ID:ivan-dives,项目名称:audacious-plugins,代码行数:48,代码来源:mp3.c


示例19: sdlout_open_audio

int sdlout_open_audio (int format, int rate, int chan)
{
    if (format != FMT_S16_NE)
    {
        sdlout_error ("Only signed 16-bit, native endian audio is supported.\n");
        return 0;
    }

    AUDDBG ("Opening audio for %d channels, %d Hz.\n", chan, rate);

    sdlout_chan = chan;
    sdlout_rate = rate;

    buffer_size = 2 * chan * (aud_get_int (NULL, "output_buffer_size") * rate / 1000);
    buffer = g_malloc (buffer_size);
    buffer_data_start = 0;
    buffer_data_len = 0;

    frames_written = 0;
    prebuffer_flag = 1;
    paused_flag = 0;

    SDL_AudioSpec spec = {
     .freq = rate,
     .format = AUDIO_S16,
     .channels = chan,
     .samples = 4096,
     .callback = callback,
     .userdata = NULL};

    if (SDL_OpenAudio (& spec, NULL) < 0)
    {
        sdlout_error ("Failed to open audio stream: %s.\n", SDL_GetError ());
        g_free (buffer);
        buffer = NULL;
        return 0;
    }

    return 1;
}

void sdlout_close_audio (void)
{
    AUDDBG ("Closing audio.\n");
    SDL_CloseAudio ();
    g_free (buffer);
    buffer = NULL;
}
开发者ID:brassy,项目名称:audacious-plugins,代码行数:48,代码来源:sdlout.c


示例20: read_cb

static size_t read_cb(void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle)
{
    size_t read;

    if (handle == NULL)
    {
        FLACNG_ERROR("Trying to read data from an uninitialized file!\n");
        return -1;
    }

    read = vfs_fread(ptr, size, nmemb, handle);

    switch (read)
    {
        case -1:
            FLACNG_ERROR("Error while reading from stream!\n");
            return -1;

        case 0:
            AUDDBG("Stream reached EOF\n");
            return 0;

        default:
            return read;
    }
}
开发者ID:CBke,项目名称:audacious-plugins,代码行数:26,代码来源:metadata.c



注:本文中的AUDDBG函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AUDIO_INITINFO函数代码示例发布时间:2022-05-30
下一篇:
C++ AUBIO_FREE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap