Code Monkey home page Code Monkey logo

Comments (1)

aparks5 avatar aparks5 commented on June 26, 2024

UPDATE: I SOLVED IT (but it wasn't easy and I still don't know exactly why this works)

Since Links don't display for Values, I needed to create another value type node called a "Relay" whose sole is to allow me to call push() multiple times in a node.

I am able to create multiple outputs by calling process() on a Node in a circular way.

ADDITIONALLY
another edge needs to be created from the output to the node id. It is backwards from the inputs.
e.g.

	else if (ImGui::IsKeyReleased((ImGuiKey)SDL_SCANCODE_M)) {
			auto node = std::make_shared<MIDI>();
			auto extra = std::make_shared<Relay>();
			auto id = m_graph.insert_node(node);
			auto extraId = m_graph.insert_node(extra);
			m_graph.insert_edge(extraId, id);
			node->params[MIDI::NODE_ID] = id;
			node->params[MIDI::EXTRA_OUT_ID] = extraId;
			m_nodes.push_back(node);
			// outputs have to be inserted after the process node
			const ImVec2 click_pos = ImGui::GetMousePosOnOpeningCurrentPopup();
			ImNodes::SetNodeScreenSpacePos(id, click_pos);
		}

MIDI::process()
{
// fill voices etc.
...
	// N calls to process will return N voices
	// this module should push N values to the stack
	float val = m_voices[m_cycle];
	m_cycle++;
	if (m_cycle >= m_voices.size()) {
		m_cycle = 0;
	}
	return m_voices[m_cycle];

}

image

from imnodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.