当前位置: 首页>>代码示例>>C++>>正文


C++ SparseSet::size方法代码示例

本文整理汇总了C++中SparseSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ SparseSet::size方法的具体用法?C++ SparseSet::size怎么用?C++ SparseSet::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SparseSet的用法示例。


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

示例1: mouseDrag

    void mouseDrag (const MouseEvent& e) override
    {
        if (auto* m = owner.getModel())
        {
            if (isEnabled() && e.mouseWasDraggedSinceMouseDown() && ! isDragging)
            {
                SparseSet<int> rowsToDrag;

                if (owner.selectOnMouseDown || owner.isRowSelected (row))
                    rowsToDrag = owner.getSelectedRows();
                else
                    rowsToDrag.addRange (Range<int>::withStartAndLength (row, 1));

                if (rowsToDrag.size() > 0)
                {
                    auto dragDescription = m->getDragSourceDescription (rowsToDrag);

                    if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
                    {
                        isDragging = true;
                        owner.startDragAndDrop (e, rowsToDrag, dragDescription, true);
                    }
                }
            }
        }

        if (! isDraggingToScroll)
            if (auto* vp = owner.getViewport())
                isDraggingToScroll = vp->isCurrentlyScrollingOnDrag();
    }
开发者ID:RomanKubiak,项目名称:amnesia,代码行数:30,代码来源:juce_ListBox.cpp

示例2: getSelectedSceneName

std::string SceneComponent::getSelectedSceneName() {
    SparseSet< int > rows = listBox->getSelectedRows ();
    if( !rows.size() )
        return 0;
    int idx = rows[0];
    return sceneinfo[idx]->getSceneName();
}
开发者ID:offtools,项目名称:cubej,代码行数:7,代码来源:ui_scenecomponent.cpp

示例3: getDragSourceDescription

var RemoteDirectoryListBoxModel::getDragSourceDescription (const SparseSet<int> &currentlySelectedRows)
{
	if (currentlySelectedRows.size() > 0) {
        String path (curlSession->getRemotePath().upToLastOccurrenceOf ("/", true, false) + itemList[currentlySelectedRows[0]]);

		return path;
	}
	
	return String::empty;
}
开发者ID:alexgustafson,项目名称:DiauproProject,代码行数:10,代码来源:RemoteDirectoryListBox.cpp

示例4: getDragSourceDescription

    var getDragSourceDescription (const SparseSet<int>& selectedRows)
    {
        // for our drag desctription, we'll just make a list of the selected
        // row numbers - this will be picked up by the drag target and displayed in
        // its box.
        String desc;

        for (int i = 0; i < selectedRows.size(); ++i)
            desc << (selectedRows [i] + 1) << " ";

        return desc.trim();
    }
开发者ID:Krewn,项目名称:LIOS,代码行数:12,代码来源:DragAndDropDemo.cpp

示例5: mouseDrag

    void mouseDrag (const MouseEvent& e)
    {
        if (isEnabled() && owner.getModel() != nullptr && ! (e.mouseWasClicked() || isDragging))
        {
            const SparseSet<int> selectedRows (owner.getSelectedRows());

            if (selectedRows.size() > 0)
            {
                const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows));

                if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
                {
                    isDragging = true;
                    owner.startDragAndDrop (e, dragDescription);
                }
            }
        }
    }
开发者ID:sonic59,项目名称:JuceEditor,代码行数:18,代码来源:juce_ListBox.cpp

示例6: selectedRowsChanged

    //==============================================================================
    void selectedRowsChanged (int) override
    {
        SparseSet<int> newSelectedItems = getSelectedRows();
        if (newSelectedItems != lastSelectedItems)
        {
            for (int i = 0; i < lastSelectedItems.size(); ++i)
            {
                if (! newSelectedItems.contains (lastSelectedItems[i]))
                    parent.closeDevice (isInput, lastSelectedItems[i]);
            }

            for (int i = 0; i < newSelectedItems.size(); ++i)
            {
                if (! lastSelectedItems.contains (newSelectedItems[i]))
                    parent.openDevice (isInput, newSelectedItems[i]);
            }

            lastSelectedItems = newSelectedItems;
        }
    }
开发者ID:Neknail,项目名称:JUCE,代码行数:21,代码来源:MainComponent.cpp

示例7: mouseDrag

    void mouseDrag (const MouseEvent& e) override
    {
        if (isEnabled() && owner.getModel() != nullptr && ! (e.mouseWasClicked() || isDragging))
        {
            SparseSet<int> rowsToDrag;

            if (owner.selectOnMouseDown || owner.isRowSelected (row))
                rowsToDrag = owner.getSelectedRows();
            else
                rowsToDrag.addRange (Range<int>::withStartAndLength (row, 1));

            if (rowsToDrag.size() > 0)
            {
                const var dragDescription (owner.getModel()->getDragSourceDescription (rowsToDrag));

                if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
                {
                    isDragging = true;
                    owner.startDragAndDrop (e, rowsToDrag, dragDescription, true);
                }
            }
        }
    }
开发者ID:AlessandroGiacomini,项目名称:pyplasm,代码行数:23,代码来源:juce_TableListBox.cpp

示例8: buttonClicked

void MainContentComponent::buttonClicked (Button* buttonThatWasClicked)
{
    //[UserbuttonClicked_Pre]
    //[/UserbuttonClicked_Pre]

    if (buttonThatWasClicked == convButton)
    {
        //[UserButtonCode_convButton] -- add your button handler code here..
		const ScopedLock fl(soundListLock);

		setPlayheadUiEnabled(false);

		bool convValid = true;

		float q;
		float s;
		double nfft;
		{
			const ScopedLock pl(paramLock);
			q = qParam;
			s = sParam;
			nfft = static_cast<double>(nfftParam);
		}

		int fftInputLen = static_cast<int>(std::pow(2.0, nfft));
		int fftOutputLen = fftInputLen / 2 + 1;
		int numChannels = 1;

		unordered_set<int> includedSounds;
		int maxChannels = 0;
		float pSum = 0.0f;
		float rSum = 0.0f;
		for (const auto& iter : idToSound) {
			int id = iter.first;
			Sound* sound = iter.second.get();
			int numChannels = sound->getBufferNumChannels();
			if (sound->isIncluded() && numChannels > 0) {
				maxChannels = numChannels > maxChannels ? numChannels : maxChannels;
				includedSounds.emplace(id);
				pSum += static_cast<float>(sound->getPValue());
				rSum += static_cast<float>(sound->getRValue());
			}
		}
		float n = static_cast<float>(includedSounds.size());
		float pScale = n * q / pSum;
		float rScale = n * s / rSum;

		if (maxChannels == 0) {
			return;
		}

		kiss_fftr_state* fftInverseState = kiss_fftr_alloc(fftInputLen, 1, nullptr, nullptr);
		kiss_fft_cpx* CONV = static_cast<kiss_fft_cpx*>(calloc(fftOutputLen * maxChannels, sizeof(kiss_fft_cpx)));
		conv.setSize(maxChannels, fftInputLen);

		float max = -1.0f;

		// convolve
		for (int convChannel = 0; convChannel < maxChannels; ++convChannel) {
			kiss_fft_cpx* CONVCHANNEL = CONV + (convChannel * fftOutputLen);

			bool isFirstSound = true;
			for (const auto& id : includedSounds) {
				Sound* sound = idToSound[id].get();
				jassert(sound != nullptr);
				float p = pScale * static_cast<float>(sound->getPValue());
				float r = rScale * static_cast<float>(sound->getRValue());
				int soundNumChannels = sound->getBufferNumChannels();
				int soundNumSamples = sound->getBufferNumSamples();
				int soundChannel = convChannel >= soundNumChannels ? soundNumChannels - 1 : convChannel;
				const kiss_fft_cpx* SOUNDCHANNEL = sound->getSpectra(fftInputLen, soundChannel);

				for (int i = 0; i < fftOutputLen; ++i) {
					float xr = SOUNDCHANNEL[i].r;
					float xi = SOUNDCHANNEL[i].i;
					float xMag = sqrtf((xr * xr) + (xi * xi));
					float xPhs = atan2f(xi, xr);
					float convMag = powf(xMag, p);
					float convPhs = r * xPhs;
					float convr = convMag * cosf(convPhs);
					float convi = convMag * sinf(convPhs);

					if (std::isnan(convr) || std::isnan(convi)) {
						convValid = false;
					}

					if (isFirstSound) {
						CONVCHANNEL[i].r = convr;
						CONVCHANNEL[i].i = convi;
					}
					else {
						float a = CONVCHANNEL[i].r;
						float b = CONVCHANNEL[i].i;
						float c = convr;
						float d = convi;
						CONVCHANNEL[i].r = a * c - b * d;
						CONVCHANNEL[i].i = a * d + b * c;
					}
				}

//.........这里部分代码省略.........
开发者ID:chrisdonahue,项目名称:ject,代码行数:101,代码来源:MainComponent.cpp

示例9: buttonClicked

void MappingsDialog::buttonClicked (Button* buttonThatWasClicked)
{
    //[UserbuttonClicked_Pre]
    //[/UserbuttonClicked_Pre]

    if (buttonThatWasClicked == addMidiButton)
    {
        //[UserButtonCode_addMidiButton] -- add your button handler code here..

		MidiMapping *mapping = new MidiMapping(midiManager,
											   pluginField->getFilterGraph(),
											   pluginNode->nodeId,
											   0,
											   0,
											   false,
											   0.0f,
											   1.0f);
		midiManager->registerMapping(0, mapping);
		mappings.add(mapping);
		pluginField->addMapping(mapping);
		mappingsList->updateContent();
		repaint();

        //[/UserButtonCode_addMidiButton]
    }
    else if (buttonThatWasClicked == addOscButton)
    {
        //[UserButtonCode_addOscButton] -- add your button handler code here..

		OscMapping *mapping = new OscMapping(oscManager,
											 pluginField->getFilterGraph(),
											 pluginNode->nodeId,
											 0,
											 "",
											 0);
		oscManager->registerMapping("", mapping);
		mappings.add(mapping);
		pluginField->addMapping(mapping);
		mappingsList->updateContent();
		repaint();

        //[/UserButtonCode_addOscButton]
    }
    else if (buttonThatWasClicked == deleteButton)
    {
        //[UserButtonCode_deleteButton] -- add your button handler code here..

		int i;
		Array<int> mappingsToDelete;
		const SparseSet<int> selectedRows = mappingsList->getSelectedRows();

		for(i=0;i<selectedRows.size();++i)
		{
			jassert(selectedRows[i] < mappings.size());

			mappingsToDelete.add(selectedRows[i]);
		}

		mappingsToDelete.sort(comparator);
		for(i=(mappingsToDelete.size()-1);i>=0;--i)
		{
			pluginField->removeMapping(mappings[mappingsToDelete[i]]);
			mappings.remove(mappingsToDelete[i]);
		}

		mappingsList->updateContent();

        //[/UserButtonCode_deleteButton]
    }
    else if (buttonThatWasClicked == overrideMidiButton)
    {
        //[UserButtonCode_overrideMidiButton] -- add your button handler code here..

		pluginField->enableMidiForNode(pluginNode,
									   overrideMidiButton->getToggleState());

        //[/UserButtonCode_overrideMidiButton]
    }

    //[UserbuttonClicked_Post]
    //[/UserbuttonClicked_Post]
}
开发者ID:eriser,项目名称:guitareffectvst,代码行数:82,代码来源:MappingsDialog.cpp


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