How to instantiate effect with a wet setting in tone.js? - tone.js

How do I instantiate an effect with a specific wet setting? I want to be able to create a new synth with updated effect parameters upon a range input change. However, I can't figure out how to make the wet/dry balance be anything but 100% wet. Is there a way to create an effect with a specific wet parameter? Something along the lines of
newDelay = new Tone.PingPongDelay(.5,.5).wet(.5)? Or would I have to assign the effect to a variable and access it like newDelay.wet = .5 after instantiating it?

To create an effect with a specific wet property, you can pass your options as an object like so:
const delay = new Tone.PingPongDelay({wet: 0.5, delayTime: "8n", feedback: 0.5});
Most Tone.js effects have different properties for that "options" object. You can find their documentation under the Constructor heading in the docs.
For instance, here's the reference for PingPongDelayOptions.

Related

Animation played once godot

I want to play a little Animated Sprite once, I mean only when the scene is visited the first time. I am trying to connect some signals in those ways:
on_scene_ready():
Animated_sprite.play("animation_name")
on_Animated_sprite_animation_finished():
Animated_sprite.hide()
And that's working correctly. But it repeats every time the scene is entered.
I tried a solution found on another forum that seemed to me similar to my issue: put a global variable (but doesn't work and I bet I make it bad)
var has_not_played = true
on_scene_ready():
if has_not_played:
Animated_sprite.play(animation_name)
on_Animated_sprite_animation_finished():
Animated_sprite.hide()
has_not_played = false
Any suggestions?
Thanks.
As long as you create a new instance of the scene (what you most likely do, as we can see) your has_not_played variable will always be instanced as true as well. Setting it to false will not help here then.
One simple solution would be to create a autoload script to hold all level informations you need your programm to save, after the scene was exited.
These are infos you most likely want to save as well, when your game is saved.
As an example you could do something like this.
Create a script LevelInfos.gd. Mine looked like this:
extends Node
var level_infos : Dictionary = {
"level_1" : {
"start_animation_played" : false
}
}
Then add this to Project -> project settings -> Autoload with the NodeName LevelInfos.
Now you can reuse your existing code like this:
on_scene_ready():
if not LevelInfos.level_infos["level_1"]["start_animation_played"]:
Animated_sprite.play(animation_name)
on_Animated_sprite_animation_finished():
Animated_sprite.hide()
LevelInfos.level_infos["level_1"]["has_already_loaded"] = true
This should make it so it only gets played the first time the scene is visited, after you start the game.
Code wise I guess it would be better to make dedicated variables instead of using a dictionary, but it works as a example and could be easily saved as an JSON, if needed.

Apply a sort to a dataset in a PowerApps component (PCF)

I’m trying to create a new dataset type Powerapps Component (PCF). For the moment I am using it to display a view of the records that are available in an entity in Microsoft Dynamics CRM.
I wish to make the view sort itself when I click on the grid column headers (in a similar way that the default CRM grid view does). I'm trying to figure out how to apply a sort to the dataset so that I can refresh it as indicated by the documentation for the dataset.refresh() function:
Refreshes the dataset based on filters, sorting, linking, new column.
New data will be pushed to control in another 'updateView' cycle.
The dataset object does have a “sorting” property, but changing its value and then refreshing the dataset doesn’t seem to have any effect. After the refresh, the sorting property reverts to the value it had before I changed it.
In short, the click handler for the grid header does something like the following bit of code. The refresh gets done and my updateView() function gets called as expected but the sorting was not applied.
dataset.sorting = [{name: 'createdon', sortDirection: 1}];
dataset.refresh();
Any help on getting the dataset sorting to work would be appreciated.
I've been experimenting with PowerApps Component Framework a little bit recently and I can confirm that the following code won't be working:
dataSet.sorting = [ { name: "columnName", sortDirection: 0 } ];
However, I managed to get this one working for me:
dataSet.sorting.pop(); // you may want to clean up the whole collection
dataSet.sorting.push({ name: "columnName", sortDirection: 0 });
I haven't really figured out the reason of this behavior. The sorting array may be implemented as some form of observable collection in the background.
I hope this will guide you to a functioning solution.
The documentation is pretty abysmal here, but here is my best guess from putting a few different pieces of information together.
TLDR: I think there is some kind of extra method that needs to be called on the .sorting property, but I can't find out what it is called. Maybe something like:
dataset.sorting.setSorting({name: 'createdon', sortDirection: 1});
I think you're going to have to try a bunch of likely method names and see what works.
Background and links:
The only reference I could find to dataset.sorting was from here:
In this preview for canvas apps, only a limited set of filtering and sortStatus methods are supported. Filter and sort can be applied to dataset on primary type columns except for the GUID. Filter and sorting can be applied in the same way as in model-driven apps.To retrieve the dataset with filtering and sorting information, call
the methods in context.parameters.[dataset_property_name].filtering
and context.parameters.[dataset_property_name].sorting, then invoke
the context.parameters.[dataset_property_name].refresh().
So it seems that the .filtering and .sorting properties are handled similarly, and that there are some methods attached to them, and only some are supported. That is about as vague as they could make it...
I did find an example of how .filtering is used:
_context.parameters.sampleDataset.filtering.setFilter({
conditions: conditionArray,
filterOperator: 1, // Or
});
There is a brief reference to .setFilter() in the docs, as well as FilterExpression
There is a SortStatus reference, but it doesn't have any corresponding methods explicitly called out. It is possible that this is not yet a supported feature in the public preview, or the documentation is lacking and the name and syntax of the method you need to call on .sorting is not yet documented.

Buildup and reference of objects in HP UFT

I'm wondering how I can access properties/methods via console/watch.
I have the following code:
Dim page
page = Browser("Welcome: Mercury Tours").Page
Now I want to obtain the title of this Page. Since I inspected the Page object with Object Spy and I saw it has a title property.
When I enter page.title in my watch however, it tells me that page does not contain the property.
1. What is the correct syntax?
2. Why is this not working? I presume that the watch is checking for VBScript object properties instead of TestObject properties?
(I have a programming background and I find it very confusing that I have VBObjects and TestObjects simply walking through the same file. It kind of feels like a black box :/)
Ok, well, your syntax is incorrect...
It appears that you're trying to put something into a variable called "page", but I'm not sure if I can figure out your intention.
If you are trying to put the page object into the var "page", you would need to use a set statement (to indicate to vbscript that it's going to hold an object, not just a single piece of data)...
Regardless of that, your syntax for specifying the Page is wrong.
In your example, you're specifying a browser test object called "Welcome: Mercury Tours" from the repository... but then you put .Page - and that's where your syntax error is.
It helps to understand the difference between Test Objects and Realtime Objects - because you need to specify a page Test Object. You can do that by specifying a page object from the Object Repository, or you can do it descriptively.
Test Objects are descriptions of real objects that QTP tries to find. If it successfully finds a real object that matches the description, then the Test Object kind of (virtually) "attaches to" the real object... then, you can use the test object to query the real attributes of the real object that it attached to.
Sincel you're clearly doing the tutorial, your object repository probably has a Page test object in the heiarchy under the browser object... (and if you had let Intellisense help, it would show you a list of pages to choose from while you type...). If so, you would specify the page object like this:
Browser("Welcome: Mercury Tours").Page("PageObjectNameHere")
If you would prefer to use descriptive programming, you could instead type something like:
Browser("Welcome: Mercury Tours").Page("Title:=Welcome: Mercury Tours")
Changing your syntax to either of those constructs would let you proceed with the next part of solving your question - how to get some data from the page...
So, once you have address the page test object correctly, then you can specify a method to get information from it... such as .GetROProperty()
You can choose from many properties for a page... If you examine a page using GUISPY, it pretty much gives you a list of the properties available to query... For example, if you want to check the URL of the page that's displayed, you could specify
Browser("Welcome: Mercury Tours").Page("Title:=Welcome: Mercury Tours").GetROProperty("url")
This, of course returns a value, so you want to do something with it... like assign it to a variable
result = Browser("Welcome: Mercury Tours").Page("Title:=Welcome: Mercury Tours").GetROProperty("url")
(If you do this, you can then add the variable "result" to the watch list... which answers your question.)
or examine it directly in your code
if Browser("Welcome: Mercury Tours").Page("Title:=Welcome: Mercury Tours").GetROProperty("url") = url_to_compare then DoSomething()
I hope this helps to clear up your understanding :)

Palm rotation in LeapJS

I wonder how could I get the correct palm rotation angle (along Y-axis) from Leap Motion (I'm using the latest LeapJS API)?
I have tried both rotationAngle(sinceFrame) method and the frame._rotation. However, the rotationAngle() returns a very small value close to 0, which seems to be the rotation angle calculated based on the current frame (how to define the sinceFrame in Leap.loop(function(frame)){}, as it seems only records data from current frame).
And the frame._rotation returns a 3*3 matrix (which I've no idea about what is it, as it's not included in the API documentation). Therefore, I wonder if there's any way to get the correct rotation angle of Y-axis from these methods?
The latest version of the leap.js library includes a roll() function as a member of the Hand object. (It also has pitch() and yaw(), if roll() isn't all you want.) The roll() function is defined as:
Hand.prototype.roll = function() {
return Math.atan2(this.palmNormal[0], -this.palmNormal[1]);
}
As an aside, since you don't need to use rotationAngle() to get the current palm angles, the rotationAngle() function gives you the rotation that has occurred between two frames. For sinceFrame, you can either store a reference to the starting frame or get a past frame from the history buffer maintained by the Controller object. Although the Leap.loop() function doesn't give you access to its Controller object directly, you should be able to create your own. Note that frame._rotation is an internal variable that is used in the calculation of the transformations between two frames. It isn't much use on its own.

jVectorMap define data series on the fly

What I am trying to do and is failing is this:
worldMap.series.regions[0]=new jvm.DataSeries({
scale:['#CCCCCC','#FF0000'],
normalizeFunction:'polynomial',
values:{'country_code':value...},
min:minValue,
max:maxValue
});
The error I get is that regions is not defined, so I'm doing that wrong.
What is the proper way of doing that and how can I dispose of data if I don't need it anymore (as in remove colouring of countries as if map was initialized with empty dataset).
Thank you.
If all you want to do is to change series data then you can use DataSeries methods like clear and setValues:
worldMap.series.regions[0].clear();

Resources