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

C++ createClient函数代码示例

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

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



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

示例1: CreateSession

    extern void CreateSession(const std::string& token, SessionCallback callback) {
        std::string url = generateSignedUrl(GET_SESSION, { { "token", token } });

        auto client = createClient();
        client->Url(url)
            .Mode(LastFmClient::Thread::Background)
            .Run([token, callback](LastFmClient* client, int statusCode, CURLcode curlCode) {
                Session session;
                session.token = token;

                if (statusCode == 200) {
                    try {
                        auto json = nlohmann::json::parse(client->Stream().str());
                        auto subscriber = json["session"];
                        session.username = subscriber.value("name", "");
                        session.sessionId = subscriber.value("key", "");
                    }
                    catch (...) {
                        /* not much we can do... */
                    }
                }

                validate(session);
                callback(session);
        });
    }
开发者ID:clangen,项目名称:musikcube,代码行数:26,代码来源:LastFm.cpp


示例2: gettimeofday

// 录制线程
void *thread_recording(void*)
{
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
    env = BasicUsageEnvironment::createNew(*scheduler);
    gettimeofday(&startTime, NULL);
    streamURL = rtspPath;
    // Create (or arrange to create) our client object:
    if (createHandlerServerForREGISTERCommand) {
        handlerServerForREGISTERCommand
            = HandlerServerForREGISTERCommand::createNew(*env, continueAfterClientCreation0, handlerServerForREGISTERCommandPortNum, authDBForREGISTER,  verbosityLevel, progName);
        if (handlerServerForREGISTERCommand == NULL) {
            *env << "Failed to create a server for handling incoming \"REGISTER\" commands: " << env->getResultMsg() << "\n";
        } else {
            *env << "Awaiting an incoming \"REGISTER\" command on port " << handlerServerForREGISTERCommand->serverPortNum() << "\n";
        }
    } else {
        ourClient = createClient(*env, streamURL, verbosityLevel, progName);
        if (ourClient == NULL) {
            *env << "Failed to create " << clientProtocolName << " client: " << env->getResultMsg() << "\n";
            shutdown();
        }
        ALOG(TX_LOG_INFO, TAG,"client create success\n");
        continueAfterClientCreation1();
    }
    env->taskScheduler().doEventLoop();
}
开发者ID:minstrelsy,项目名称:live555-for-android,代码行数:27,代码来源:recorder.cpp


示例3: acceptCommonHandler

static void acceptCommonHandler(int fd, int flags) {
    client *c;
    if ((c = createClient(fd)) == NULL) {
        Log(WARNING,
            "Error registering fd event for the new client: %s (fd=%d)",
            strerror(errno),fd);
        close(fd); /* May be already closed, just ignore errors */
        return;
    }
    /* If maxclient directive is set and this is one client more... close the
     * connection. Note that we create the client instead to check before
     * for this condition, since now the socket is already set in non-blocking
     * mode and we can send an error for free using the Kernel I/O */
    if (listLength(server.clients) > server.maxclients) {
        char *err = "-ERR max number of clients reached\r\n";

        /* That's a best effort error message, don't check write errors */
        if (write(c->fd,err,strlen(err)) == -1) {
            /* Nothing to do, Just to avoid the warning... */
        }
        server.stat_rejected_conn++;
        freeClient(c);
        return;
    }
    server.stat_numconnections++;
    c->flags |= flags;
}
开发者ID:icoulter,项目名称:workspace_tubii,代码行数:27,代码来源:networking.c


示例4: debugf

err_t TcpServer::onAccept(tcp_pcb *clientTcp, err_t err)
{
	// Anti DDoS :-)
	if (system_get_free_heap_size() < 6500)
	{
		debugf("\r\n\r\nCONNECTION DROPPED\r\n\t(%d)\r\n\r\n", system_get_free_heap_size());
		return ERR_MEM;
	}

	#ifdef NETWORK_DEBUG
	debugf("onAccept state: %d K=%d", err, totalConnections);
	list_mem();
	#endif

	if (err != ERR_OK)
	{
		//closeTcpConnection(clientTcp, NULL);
		return err;
	}

	TcpConnection* client = createClient(clientTcp);
	if (client == NULL) return ERR_MEM;
	client->setTimeOut(timeOut);
	onClient((TcpClient*)client);

	return ERR_OK;
}
开发者ID:Hukuma23,项目名称:WS,代码行数:27,代码来源:TcpServer.cpp


示例5: QObject

SimpleMenu::SimpleMenu(QWidget* parent, WelcomeScreen* screen)
: QObject(parent)
, m_screen(screen)
, m_protocol(0)
, m_state(READY)
, m_player1(0)
, m_player2(0)
{
    if (m_screen) {
        // create buttons
        m_server_btn = m_screen->addButton(0, 0, QIcon(QLatin1String(iconServer)),
                                           tr("Host Game"));
        m_client_btn = m_screen->addButton(0, 1, QIcon(QLatin1String(iconClient)),
                                           tr("Connect to Game"));

        // create connections
        connect(m_server_btn, SIGNAL(clicked()),
            this, SLOT(createServer()));
        connect(m_client_btn, SIGNAL(clicked()),
            this, SLOT(createClient()));

        // WiFi direct
        wpa = new Wpa;
        wpa->setEnabled(true);

        QVariantMap args;
        args["DeviceName"] = QHostInfo::localHostName();
        const char dev_type[8] = {0x00, 0x09, 0x00, 0x50, 0xf2, 0x04, 0x00, 0x05};
        args["PrimaryDeviceType"] = QByteArray(dev_type, 8);
        wpa->setProperties(args);
    }
}
开发者ID:TI-OpenLink,项目名称:battleship,代码行数:32,代码来源:simplemenu.cpp


示例6: main

/**
 * Main program
 * @return 
 */
int main(int argc, char** argv) {

    
    // document root
    char* docroot = open_documentroot(argc, argv);


    int server = creer_serveur(WEBSERVER_PORT);
    printf("Server launched:\n");

    // Mimes
    loadMimes();
    
    // Load stats
    init_stats();
    
    
    // Signaux
    initialiser_signaux();

    
    /**
     * Get client request
     * @return 
     */
    createClient(server, docroot);

    return 0;

}
开发者ID:Monpoke,项目名称:iut-n4-webserver,代码行数:34,代码来源:main.c


示例7: ESP_LOGD

/**
 * @brief Set the value of a characteristic of a service on a remote device.
 * @param [in] bdAddress
 * @param [in] serviceUUID
 * @param [in] characteristicUUID
 */
/* STATIC */ void BLEDevice::setValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID, std::string value) {
	ESP_LOGD(LOG_TAG, ">> setValue: bdAddress: %s, serviceUUID: %s, characteristicUUID: %s", bdAddress.toString().c_str(), serviceUUID.toString().c_str(), characteristicUUID.toString().c_str());
	BLEClient *pClient = createClient();
	pClient->connect(bdAddress);
	pClient->setValue(serviceUUID, characteristicUUID, value);
	pClient->disconnect();
} // setValue
开发者ID:cuda-convnet,项目名称:WiFi_Kit_series,代码行数:13,代码来源:BLEDevice.cpp


示例8: main

int main(int argc, char** argv)
{
    if (usage(argc, argv) == false)
        return -1;
    
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
    env = BasicUsageEnvironment::createNew(*scheduler);
    
    progName = argv[0];
    verbosityLevel = 1;
    playContinuously = True;
    sendOptionsRequest = True;
    notifyOnPacketArrival = True;
    streamURL = argv[1];
    
    gettimeofday(&startTime, NULL);
    
    ourClient = createClient(*env, streamURL, verbosityLevel, progName);
    if (ourClient == NULL)
    {
        *env << "Failed to create " << clientProtocolName << " client: " << env->getResultMsg() << "\n";
        shutdown();
    }
    
    if (sendOptionsRequest)
        getOptions(continueAfterOPTIONS);
    
    else
        continueAfterOPTIONS(NULL, 0, NULL);
    
    env->taskScheduler().doEventLoop();
    return 0;
}
开发者ID:Itaelle,项目名称:AudioWire,代码行数:33,代码来源:playCommon.cpp


示例9: LOG

void Worker::onConnection(int fd, int ev, void *data)
{
	//check maxclients
	Config *pConfig = Config::getInstance();
	if(pMaster->pGlobals->clients >= pConfig->nMaxClients){
		LOG("Connection is full");
		close(fd);
		return ;
	}
	
	//ip and port
	struct sockaddr_in *pAddr = (struct sockaddr_in*)data;
	char ip[17]; 
	int port = ntohs(pAddr->sin_port);
	memset(ip, 0, sizeof(ip));
	inet_ntop(AF_INET, &pAddr->sin_addr, ip, 16);
	
	//create client
	createClient(fd, ip, port);
	
	//free accept lock
	if(pMaster->bUseAcceptMutex && 
		UnLockAcceptMutex(&pMaster->pGlobals->lock, nPid))
	{
		//LOG("unlock accept mutex");
		bHeldAcceptLock = false;
		pServer->stop();
	}
}
开发者ID:luozy,项目名称:fooking,代码行数:29,代码来源:Worker.cpp


示例10: openClient

    bool openClient (const double newSampleRate, const BitArray& newChannels)
    {
        sampleRate = newSampleRate;
        channels = newChannels;
        channels.setRange (actualNumChannels, channels.getHighestBit() + 1 - actualNumChannels, false);
        numChannels = channels.getHighestBit() + 1;

        if (numChannels == 0)
            return true;

        client = createClient();

        if (client != 0
             && (tryInitialisingWithFormat (true, 4) || tryInitialisingWithFormat (false, 4)
                  || tryInitialisingWithFormat (false, 3) || tryInitialisingWithFormat (false, 2)))
        {
            channelMaps.clear();
            for (int i = 0; i <= channels.getHighestBit(); ++i)
                if (channels[i])
                    channelMaps.add (i);

            REFERENCE_TIME latency;
            if (OK (client->GetStreamLatency (&latency)))
                latencySamples = wasapi_refTimeToSamples (latency, sampleRate);

            (void) OK (client->GetBufferSize (&actualBufferSize));

            return OK (client->SetEventHandle (clientEvent));
        }

        return false;
    }
开发者ID:alessandropetrolati,项目名称:juced,代码行数:32,代码来源:juce_win32_WASAPI.cpp


示例11: main

/*
 * Start of the ssl client
 * There is a main thread and a receive thread
 * Main:
 *
 * Recv:
 */
main() {
	int status;
	pthread_t recvThread;
	pthread_t fsmThread;
	sslStruct *sslC;

	// For now this is just a function where we set all variables
	// Ultimately this should be read from a resource file
	initCfg();
	// Connect to Unit under Test (UT)
	initConnectionToServer();
	// Ctrl-Z to give stats
	initSignals();

	status = pthread_create(&recvThread, NULL, &recvFunction, (void*)NULL);
	if (status != 0) {
		perror("Start Thread Error:"); return -1;
	}
	status = pthread_create(&fsmThread, NULL, &fsmFunction, (void*)NULL);
	if (status != 0) {
		perror("Start Thread Error:"); return -1;
	}
	fflush(stdout);

	// For now just create 1 Client to test Server
	sslC = createClient();
	if (sslC == NULL)
		return -1;
	sendHello(sslC);
	while(1);
}
开发者ID:aseemsethi,项目名称:ssl-tool,代码行数:38,代码来源:ssl.c


示例12: acceptHandler

void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    int cport, cfd;
    char cip[128];
    redisClient *c;
    REDIS_NOTUSED(el);
    REDIS_NOTUSED(mask);
    REDIS_NOTUSED(privdata);

    cfd = anetAccept(server.neterr, fd, cip, &cport);
    if (cfd == AE_ERR) {
        redisLog(REDIS_VERBOSE,"Accepting client connection: %s", server.neterr);
        return;
    }
    redisLog(REDIS_VERBOSE,"Accepted %s:%d", cip, cport);
    if ((c = createClient(cfd)) == NULL) {
        redisLog(REDIS_WARNING,"Error allocating resoures for the client");
        close(cfd); /* May be already closed, just ingore errors */
        return;
    }
    /* If maxclient directive is set and this is one client more... close the
     * connection. Note that we create the client instead to check before
     * for this condition, since now the socket is already set in nonblocking
     * mode and we can send an error for free using the Kernel I/O */
    if (server.maxclients && listLength(server.clients) > server.maxclients) {
        char *err = "-ERR max number of clients reached\r\n";

        /* That's a best effort error message, don't check write errors */
        if (write(c->fd,err,strlen(err)) == -1) {
            /* Nothing to do, Just to avoid the warning... */
        }
        freeClient(c);
        return;
    }
    server.stat_numconnections++;
}
开发者ID:bcg,项目名称:redis,代码行数:35,代码来源:networking.c


示例13: newFakeClient

/* ====================================================================
 * Bring up / Teardown
 * ==================================================================== */
void *load() {
    g.c = newFakeClient();
    g.c_noreturn = createClient(-1);
    g.err_parse = createObject(
        REDIS_STRING,
        sdsnew("-ERR JSON Parse Error.  You can debug with JSONDOCVALIDATE."));
    return NULL;
}
开发者ID:Wouter33,项目名称:krmt,代码行数:11,代码来源:json.c


示例14: DXDB_initServer

void DXDB_initServer() {                   //printf("DXDB_initServer\n");
    server.alc.RestClient         = createClient(-1);
    server.alc.RestClient->flags |= REDIS_LUA_CLIENT;
    aeCreateTimeEvent(server.el, 1, luaCronTimeProc, NULL, NULL);
    initX_DB_Range(); initAccessCommands(); init_six_bit_strings();
    init_DXDB_PersistentStorageItems(INIT_MAX_NUM_TABLES, INIT_MAX_NUM_INDICES);
    initServer_Extra();
}
开发者ID:JakSprats,项目名称:Alchemy-Database,代码行数:8,代码来源:xdb_hooks.c


示例15: localIp

UtlBoolean SipProtocolServerBase::send(SipMessage* message,
                            const char* hostAddress,
                            int hostPort)
{
    UtlBoolean sendOk = FALSE;


    UtlString localIp(message->getLocalIp());
    
    if (localIp.length() < 1)
    {
        localIp = mDefaultIp;
    }

    SipClient* client = createClient(hostAddress, hostPort, localIp);
    if(client)
    {
        int isBusy = client->isInUseForWrite();
        UtlString clientNames;

        client->getClientNames(clientNames);
        OsSysLog::add(FAC_SIP, PRI_DEBUG, "Sip%sServerBase::send %p isInUseForWrite %d, client info\n %s",
                mProtocolString.data(), client, isBusy, clientNames.data());

        sendOk = client->sendTo(*message, hostAddress, hostPort);
        if(!sendOk)
        {
            OsTask* pCallingTask = OsTask::getCurrentTask();
            OsTaskId_t callingTaskId = -1;
            OsTaskId_t clientTaskId = -1;

            if ( pCallingTask )
            {
               pCallingTask->id(callingTaskId);
            }
            client->id(clientTaskId);

            if (clientTaskId != callingTaskId)
            {
               // Do not need to clientLock.acquireWrite();
               // as deleteClient uses the locking list lock
               // which is all that is needed as the client is
               // already marked as busy when we called
               // createClient above.
               deleteClient(client);
               client = NULL;
            }
        }
    }

        if(client)
        {
            releaseClient(client);
        }

    return(sendOk);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:57,代码来源:SipProtocolServerBase.cpp


示例16: main

int main(int argc, char* argv[]) {
	int local_port;
	char* local_interface;
	char* remote_host;
	int remote_port;
	int isClient = 0;

	if (argc < 3 || argc > 4) {
		perror("Error: improper number of args entered\nProper format: ./cs352proxy <port> <local_interface> or ./cs352proxy <remote_host> <remote_port> <local_interface>\n");
		return 0;
	} else if (argc == 3) {
		local_port = atoi(argv[1]);
		if (local_port < 1024 || local_port > 65536) {
			printf("port out of range\n");
			return 1;
		}
		local_interface = argv[2];
		isClient = 0;
	} else {
		remote_host = argv[1];
		remote_port = atoi(argv[2]);
		if (remote_port < 1024 || remote_port > 65536) {
			printf("port out of range\n");
			return 1;
		}
		local_interface = argv[3];
		isClient = 1;
	}

	if ( (tap_fd = allocate_tunnel(local_interface, IFF_TAP | IFF_NO_PI)) < 0) {
		perror("Opening tap interface failed! \n");
		exit(1);
	}

	int socketfd = socket(AF_INET, SOCK_STREAM, 0);
	if (socketfd < 0) {
		perror("Socket failed");
		exit(1);
	}

	if (!isClient) {
		TCPSocketfd = createServer(socketfd, local_port);
	} else {
		TCPSocketfd = createClient(socketfd, remote_port, remote_host);
	}

	pthread_t TAPthread, TCPthread;

	pthread_create(&TAPthread, NULL, TAPHandle, NULL);
	pthread_create(&TCPthread, NULL, TCPHandle, NULL);

 	pthread_join(TAPthread, NULL);
	pthread_join(TCPthread, NULL);

	return 0;
}
开发者ID:sgrzenda,项目名称:cs352proxypart3,代码行数:56,代码来源:cs352proxy_old.c


示例17: SLOT

void MainWindow::setupActions()
{
    KStandardGameAction::gameNew(m_main, SLOT(newGame()), actionCollection());
    KStandardGameAction::restart(m_main, SLOT(restart()), actionCollection());
    KStandardGameAction::highscores(m_main, SLOT(highscores()), actionCollection());
    
    KStandardGameAction::quit(this, SLOT(close()), actionCollection());
    
    QAction* action;
    action = new QAction(i18n("&Single Player"), this);
    action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconLocal)));
    actionCollection()->addAction("game_local", action);
    connect(action, SIGNAL(triggered()), m_main, SLOT(localGame()));
    action = new QAction(i18n("&Host Game..."), this);
    action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconServer)));
    actionCollection()->addAction("game_create_server", action);
    connect(action, SIGNAL(triggered()), m_main, SLOT(createServer()));
    action = new QAction(i18n("&Connect to Game..."), this);
    action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconClient))),
    actionCollection()->addAction("game_create_client", action);
    connect(action, SIGNAL(triggered()), m_main, SLOT(createClient()));
    // settings
    action = new QAction(i18n("Change &Nickname..."), this);
    actionCollection()->addAction("options_nickname", action);
    connect(action, SIGNAL(triggered()), m_main, SLOT(changeNick()));
    action = new KToggleAction(i18n("&Play Sounds"), this);
    actionCollection()->addAction("options_sounds", action);
    connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleSounds(bool)));
    // This action will be disabled when a game is being run
    action = new KToggleAction(i18n("&Adjacent Ships"), this);
    action->setChecked(Settings::adjacentShips());
    actionCollection()->addAction("options_adjacent", action);
    connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleAdjacent(bool)));
    // This action will be disabled when a game is being run
    action = new KToggleAction(i18n("&Multiple Ships"), this);
    action->setChecked(Settings::severalShips());
    actionCollection()->addAction("options_multiple_ships", action);
    connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleMultiple(bool)));
    // config end of game message
    action = new KToggleAction(i18n("Show End-of-Game Message"), this);
    action->setChecked(true);
    actionCollection()->addAction("options_show_endgame_message", action);
    connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleEndOfGameMessage(bool)));
    // actions for grid
    action = new KToggleAction(i18n("Show &Left Grid"), this);
    action->setChecked(true);
    actionCollection()->addAction("options_showleftgrid", action);
    connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleLeftGrid(bool)));
    action = new KToggleAction(i18n("Show &Right Grid"), this);
    action->setChecked(true);
    actionCollection()->addAction("options_showrightgrid", action);
    connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleRightGrid(bool)));
    
    setupGUI();
}
开发者ID:alasin,项目名称:knavalbattle,代码行数:55,代码来源:mainwindow.cpp


示例18: QWidget

CWizDocumentView::CWizDocumentView(CWizExplorerApp& app, QWidget* parent)
    : QWidget(parent)
    , m_app(app)
    , m_userSettings(app.userSettings())
    , m_dbMgr(app.databaseManager())
    , m_title(new CWizTitleBar(app, this))
    , m_web(new CWizDocumentWebView(app, this))
    , m_client(NULL)
    , m_tags(NULL)
    , m_attachments(NULL)
    , m_editingDocument(true)
    , m_viewMode(app.userSettings().noteViewMode())
{
    m_client = createClient();

    QVBoxLayout* layout = new QVBoxLayout(this);
    setLayout(layout);
    layout->addWidget(m_client);
    layout->setContentsMargins(0, 0, 0, 0);

    m_title->setEditingDocument(m_editingDocument);

    m_timerDelay.setSingleShot(true);
    connect(&m_timerDelay, SIGNAL(timeout()), SLOT(on_titleEdit_textEdit_writeDelay()));

    connect(m_title->titleEdit(), SIGNAL(textChanged(const QString&)), \
            SLOT(on_titleEdit_textChanged(const QString&)));

    connect(m_title->editDocumentButton(), SIGNAL(clicked()), \
            SLOT(on_editDocumentButton_clicked()));

    connect(m_title->tagsButton(), SIGNAL(clicked()), \
            SLOT(on_tagsButton_clicked()));

    connect(m_title->attachmentButton(), SIGNAL(clicked()), \
            SLOT(on_attachmentButton_clicked()));

    connect(m_title->infoButton(), SIGNAL(clicked()), \
            SLOT(on_infoButton_clicked()));

    qRegisterMetaType<WIZDOCUMENTDATA>("WIZDOCUMENTDATA");
    qRegisterMetaType<WIZDOCUMENTATTACHMENTDATA>("WIZDOCUMENTATTACHMENTDATA");

    connect(&m_dbMgr, SIGNAL(documentModified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)), \
            SLOT(on_document_modified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)));

    connect(&m_dbMgr, SIGNAL(attachmentCreated(const WIZDOCUMENTATTACHMENTDATA&)), \
            SLOT(on_attachment_created(const WIZDOCUMENTATTACHMENTDATA&)));

    connect(&m_dbMgr, SIGNAL(attachmentDeleted(const WIZDOCUMENTATTACHMENTDATA&)), \
            SLOT(on_attachment_deleted(const WIZDOCUMENTATTACHMENTDATA&)));
}
开发者ID:badwtg1111,项目名称:WizQTClient,代码行数:52,代码来源:wizdocumentview.cpp


示例19: WASAPIDeviceBase

    WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& d, const bool exclusiveMode)
        : device (d),
          sampleRate (0),
          defaultSampleRate (0),
          numChannels (0),
          actualNumChannels (0),
          minBufferSize (0),
          defaultBufferSize (0),
          latencySamples (0),
          useExclusiveMode (exclusiveMode),
          sampleRateHasChanged (false)
    {
        clientEvent = CreateEvent (0, false, false, _T("JuceWASAPI"));

        ComSmartPtr <IAudioClient> tempClient (createClient());
        if (tempClient == nullptr)
            return;

        REFERENCE_TIME defaultPeriod, minPeriod;
        if (! check (tempClient->GetDevicePeriod (&defaultPeriod, &minPeriod)))
            return;

        WAVEFORMATEX* mixFormat = nullptr;
        if (! check (tempClient->GetMixFormat (&mixFormat)))
            return;

        WAVEFORMATEXTENSIBLE format;
        copyWavFormat (format, mixFormat);
        CoTaskMemFree (mixFormat);

        actualNumChannels = numChannels = format.Format.nChannels;
        defaultSampleRate = format.Format.nSamplesPerSec;
        minBufferSize = refTimeToSamples (minPeriod, defaultSampleRate);
        defaultBufferSize = refTimeToSamples (defaultPeriod, defaultSampleRate);

        rates.addUsingDefaultSort (defaultSampleRate);

        static const int ratesToTest[] = { 44100, 48000, 88200, 96000, 176400, 192000 };

        for (int i = 0; i < numElementsInArray (ratesToTest); ++i)
        {
            if (ratesToTest[i] == defaultSampleRate)
                continue;

            format.Format.nSamplesPerSec = (DWORD) ratesToTest[i];

            if (SUCCEEDED (tempClient->IsFormatSupported (useExclusiveMode ? AUDCLNT_SHAREMODE_EXCLUSIVE : AUDCLNT_SHAREMODE_SHARED,
                                                          (WAVEFORMATEX*) &format, 0)))
                if (! rates.contains (ratesToTest[i]))
                    rates.addUsingDefaultSort (ratesToTest[i]);
        }
    }
开发者ID:JeromeGill,项目名称:genie,代码行数:52,代码来源:juce_win32_WASAPI.cpp


示例20: createMissingClients

static void createMissingClients(client c) {
    int n = 0;

    while(config.liveclients < config.numclients) {
        createClient(NULL,0,c);

        /* Listen backlog is quite limited on most systems */
        if (++n > 64) {
            usleep(50000);
            n = 0;
        }
    }
}
开发者ID:JunyaShirahama,项目名称:tweeter,代码行数:13,代码来源:redis-benchmark.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ createCommand函数代码示例发布时间:2022-05-30
下一篇:
C++ createChannel函数代码示例发布时间: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