On Mon, Jun 4, 2012 at 5:30 PM, Michael Dickens <m...@alum.mit.edu> wrote: > Hi George - I believe there are 2 possible solutions, though I've never used > or tested either myself. If you just want to verify that what you want to do > works, I think (1) should be quite straight forward. > > 1) This method will certainly work, but it's not very robust : Make your > "custom_block2" take an argument which is of the "custom_block1" smart > pointer type, such that the amplitude can be set any time the former performs > the computation to do so. Instantiation of the "custom_block2" would take a > smart pointer to the "custom_block1", and then store that reference for > future use; because this is a C++ object, just use "." or "->" to access the > object's variable or method.
George, That would work, but it's very unsafe to do something like that. For testing or a simple program, sure, but don't rely on it as a method. If something goes out of scope at the wrong time or you close one object that is sharing state with another, you'll find yourself in trouble. > 2) I don't know if stream tags are in place well enough yet, nor if they > would work in the manner you require. The idea is that there's a tag plane > (sort of like a control plane) that "overlays" (or is in parallel with) the > graph (data-flow) plane, where tags can be inserted -- a timestamp, or a > value that might get used downstream. Since "custom_block1" isn't downstream > from "custom_block2", tags might not work. Maybe there's a branch for this > sort of non-downstream async control? > > Hope this helps; good luck! - MLD I'm not sure stream tags are right for this application because they are in two different flowgraphs. Stream tags start at one end of a flowgraph and move downstream. There is a message passing interface where a block has a message handler function. The trick you're going to have to deal with is how to tell one block about another. This has been a problem for a while that I hope we can sort out this year in a way that's robust (i.e., thread safe and won't suffer from scope issue if one block has a pointer to another). Tom > On Jun 4, 2012, at 3:52 PM, George Sklivanitis wrote: >> I am dealing with the problem of finding a way to dynamically give values to >> a parameter of a custom block that I 've made in gnuradio >> by the output of another custom block. >> The solution of function probe that I have found in previous conversations >> in the forum does not fit me as the value to be changed dynamically is >> entered ad-hoc by the user. >> I will try to simplify my problem to the rest of the community by giving the >> following example >> let us assume the following flowgraph implementation >> >> signal_source -> custom_block(arg amplitude) -> file_sink (1) >> >> file_source -> custom_block2 -> file_sink (2) >> >> Would it be possible to use as the amplitude argument in (1) the output of >> the custom_block2 in (2). > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio