Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2019-05-21 Thread Tim Janik via beast
Closed #78.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/tim-janik/beast/pull/78#event-2356239447___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2019-05-05 Thread Stefan Westerfeld via beast
> So, to summarize our last meeting:
> 
> * The bus properties should be ported as straight forward as possible, 
> without adding new functionality / UI.
> * The APPLY_IDL_PROPERTY() macro should be used.
> 
> Once you've done this, please re-assign the new code to me.

I'm doing this in an new branch/PR as to keep the old version as reference: so 
the new code is now found in https://github.com/tim-janik/beast/pull/105

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/tim-janik/beast/pull/78#issuecomment-489439243___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-13 Thread Stefan Westerfeld via beast
Ok, so let me comment on anything that doesn't have to do with the new 
volume_db/pan properties first.

> Thanks Stefan, great to see steady progress here.
> 
> But note that travis-ci shows, that your changes broke the syndrum audio test 
> in all build variants, please take a look at that.

Right. This is a really nasty problem, which is caused by loading/reading code 
for float64 properties in aida. It turns out that even simple floating point 
numbers like "1.03" are written out correctly, but restore breaks in 
bsestorage.cc, because the scanner_parse_paren_rest does return this as "1. 3" 
and this is restored as a value of 1.0. I've fixed this by using the existing 
sfi_scanner_parse_real_num function to parse float64 values (see also commit 
comments). This seems to work, tests pass again. Not sure if this is what you 
think we should do to fix the problem, though.

> About volume clamping, taking a look at other DAWs suggests that this should 
> be done at the UI and doesn't need to be based on consts from the IDL at all.
> Also the property descriptios read "Volume adjustment in decibel of 
> left/right bus channel" and that's what we should make them. I.e. we should 
> pass actual dB values, e.g. 96 as property value through the IDL layer. (*1)

Ok. You'll notice that the magic factors are gone, and the clamping looks sane 
(CLAMP (v, -96, 12)). In particular I don't try to enforce restrictive CLAMP() 
boundaries for left_factor and right_factor, they are now an implementation 
detail and should not be used by the UI.

> About GParamSpec containing minus, that's because GLib enforces '-' instead 
> of '_' in the pspec names, so we're forced to work around that in other 
> places as well. Please take a look at name_to_identifier in bstparam.cc, 
> seems like it's time to move that to bstutils.hh to avoid gratituous 
> duplicatoin everywhere.

Fixed.

> About porting object / sequence properties, I'm actually not sure what's 
> missing there atm. If you want to make an attempt at porting such a property 
> and nag me about missing bits in the IDL layer or similar, that'd be ok as 
> well.

Ok. Maybe I'll try it later.

> ```
> +  for (auto& c : pname)
> ```
> pointers and references are written with *& attached to the variable, i.e. 
> write this as "auto "

Ok.

> ```
> + Const BUS_VOLUME_MIN = 1.58489319246111e-05; /* -96dB */
> ```
> if at all, this should be using '96' as Const value, and the const be defined 
> in terms of dB. but in other DAWs, the dB range displayed is a function of 
> the UI, e.g. the volume meter of a track display my use different limits than 
> for a related bus channel volume meter.

Fixed.

> ```
> +self->right_volume = self->left_volume = center_volume 
> (self->right_volume, self->left_volume);
> ```
> While you're at it, please make that a two liner.

Fixed. But code was deleted in a later commit.

> +  return (self == master);
> ```
> Please remove extraneous parenthesis like these, they could hide an 
> assignment.

Fixed.

> ```
> +  auto parent = BSE_ITEM (self)->parent;
> ```
> Please don't use 'auto' here, but BseItem*, like you did in other places. The 
> reason here is that the variable is the result of a hidden C-style cast 
> (BSE_ITEM()) and used as input for another C-style cast (BSE_SONG), so the 
> actual type used here is completely unclear to the reader and potentially 
> hiding a type bug.

Fixed.

> On a side note, it took a while, but I figured again the point of saved_sync. 
> It's clearly trying to preserve the 'sync' state around loading a BSE file 
> (termed 'restore' in the API), and sets that initially to FALSE to allow BSE 
> files to restore different left and right volumes, and syncs thouse only if 
> "sync" is also set or after the restore phase is completed. That heavily 
> depends on the order in which the properties are defined in the BSE file 
> which is somewhat fragile... (*2)

Right. Consider this fixed, as we no longer need sync, and I see absolutely no 
point in trying to be too perfect here. We read left_volume and right_volume in 
any order, and that is it. The UI should always use the volume_db/pan 
properties. If the user used sync before saving, left_volume and right_volume 
will be the same, and pan will be 0. If not, left_volume and right_volume will 
be different, and pan will not be 0.


So after commenting on your remarks, let be briefly describe what I did to get 
volume_db/pan properties. First, I looked at some variations on how to compute 
factors like our left_volume/right_volume from a total volume_db and panning. A 
good description of the possibilities is here:

http://www.cs.cmu.edu/~music/icm-online/readings/panlaws/index.html

I choose to implement constant power panning (-3dB), because:
- some popular DAWs use it as default (for instance Cubase)
- the mathematical definition is quite straightforward (we want constant power)
- from this follows that we have all functions we need to 

Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-13 Thread Stefan Westerfeld via beast
@swesterfeld pushed 1 commit.

5f86778  BSE: bsebus: add a few extra checks to volume/pan conversions


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/tim-janik/beast/pull/78/files/1fab3519857af77ccaa9b40e59eae94077a93edb..5f86778db247d22161fd7c6aa10ea5c4c2361736
___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-13 Thread Stefan Westerfeld via beast
@swesterfeld pushed 1 commit.

1fab351  BSE: Song: port remaining Bus::master-output set calls


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/tim-janik/beast/pull/78/files/ee9a2dfc61e9387221fb3a5a24036f116ce75c0e..1fab3519857af77ccaa9b40e59eae94077a93edb
___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-13 Thread Stefan Westerfeld via beast
@swesterfeld pushed 4 commits.

752ee2a  BSE: implement Bus::volume_db and Bus::pan properties
ea333df  BSE: remove Bus::sync property, no longer required due to panning 
support
39a9064  BEAST-GTK: bstbuseditor: edit volume_db/pan instead of left/right 
volume
94028c4  RES: add space for editing pan in each mixer bus


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/tim-janik/beast/pull/78/files/e850a0591eb7a301b42426653b15fe9c55e26a67..94028c4b1fc484947a7365c3aa4c5c8130b2a655
___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-13 Thread Tim Janik via beast
> > On 09.09.2018 15:21, Stefan Westerfeld via beast wrote:
> Instead of two volume sliders we only need one. The two meters could be put 
> next to each other. So this would mean left-to-right volume slider (only one 
> slider), scale numbers (-96..+12), left meter, right meter.

Do you intend to work on this as part of this pull request? For beast-gtk 
and/or ebeast?
I think that's beyond the scope of a property port, and I wonder if we're 
getting too side tracked here, especially when we're pumping resources into 
more beast-gtk UI development...

> Ideal for pan would be a round knob, but we could for now use a slider above 
> the other widgets left to right (where left is -100%, right is +100%).
> 
> > At least using (sqrt(2) ~= 3dB) is what I believe is the correct value 
> > here, I'd
> > have to double-check that before implementing it.
> > The monitoring code for our level meters uses dB SPL, which is 20log10(avg) 
> > and
> > corresponds to the power ratio of the signal, so the value to use here 
> > would be
> > more around 2. See also: https://en.wikipedia.org/wiki/Decibel#Acoustics_2
> 
> Lets discuss details not now, but when I've written the code.

When you convert to/from dB, simply use db SPL everywhere (described in the 
above WP page) then there's no need for further discussions.

> > Also sync is no longer needed
> > then, and should be removed.
> > The sync property is saved im BSE files, so we need compat loading code at
> > least. If sync is to be removed from the UI depends on how that's designed 
> > and
> > implemented to cope with panning. Thus my question above.
> 
> Right, it should be ignored during read (real compat code is just needed to 
> translate the stored left and right factors => volume/pan). Sync == true 
> files will have identical values for left and right volume, so sync is not 
> needed to load the file, and sync == false files will have their panning 
> information in left and right volume, so this needs to be translated.

We cannot make any assumptions about the values stored in BSE files, about the 
order or which values are present or not present, e.g. a user can add sync=1 to 
a bse file that has left=0.5 and right=1. That's why the code currently ensures 
left + right are synced after parsing if needed.

FWIW, that's one of the reasons things will get easier when we move to XML 
based BSE files, we don't have to react to property values coming in in random 
order, but can query left,right,sync from the XML nodes and attributes and 
configure the object accordingly.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/tim-janik/beast/pull/78#issuecomment-421014075___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-11 Thread Stefan Westerfeld via beast
@swesterfeld pushed 1 commit.

36e9df0  BSE: bsebus: avoid chained assignment


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/tim-janik/beast/pull/78/files/446a37cadba865069d4fa45f12313e5e082489bf..36e9df0a08702d8be4c88ea10e50928cafb8a772
___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-10 Thread Stefan Westerfeld via beast
@swesterfeld pushed 1 commit.

4084bb6  BSE: fix C++ property loading (float64)


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/tim-janik/beast/pull/78/files/bb74147fa4377c903048a072987c3a790baeabfb..4084bb6c5a48259d8c914260ff97b0d768570e9c
___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast


Re: [tim-janik/beast] Most Bus properties ported to C++ (#78)

2018-09-08 Thread Tim Janik via beast
Thanks Stefan, great to see steady progress here.

But note that travis-ci shows, that your changes broke the syndrum audio test 
in all build variants, please take a look at that.

About volume clamping, taking a look at other DAWs suggests that this should be 
done at the UI and doesn't need to be based on consts from the IDL at all.
Also the property descriptios read "Volume adjustment in decibel of left/right 
bus channel" and that's what we should make them. I.e. we should pass actual dB 
values, e.g. 96 as property value through the IDL layer. (*1)

About GParamSpec containing minus, that's because GLib enforces '-' instead of 
'_' in the pspec names, so we're forced to work around that in other places as 
well. Please take a look at name_to_identifier in bstparam.cc, seems like it's 
time to move that to bstutils.hh to avoid gratituous duplicatoin everywhere.

About porting object / sequence properties, I'm actually not sure what's 
missing there atm. If you want to make an attempt at porting such a property 
and nag me about missing bits in the IDL layer or similar, that'd be ok as well.

+  for (auto& c : pname)

pointers and references are written with *& attached to the variable, i.e. 
write this as "auto "

+ Const BUS_VOLUME_MIN = 1.58489319246111e-05; /* -96dB */

if at all, this should be using '96' as Const value, and the const be defined 
in terms of dB. but in other DAWs, the dB range displayed is a function of the 
UI, e.g. the volume meter of a track display my use different limits than for a 
related bus channel volume meter.

+self->right_volume = self->left_volume = center_volume 
(self->right_volume, self->left_volume);

While you're at it, please make that a two liner.
Modern code analysis tools tend to choke on using an assignment as rvalue, and 
its still very readable if it's just:

self->left_volume = center_volume (self->right_volume, 
self->left_volume);
self->right_volume = self->left_volume;


+  return (self == master);

Please remove extraneous parenthesis like these, they could hide an assignment.
 
+  auto parent = BSE_ITEM (self)->parent;

Please don't use 'auto' here, but BseItem*, like you did in other places. The 
reason here is that the variable is the result of a hidden C-style cast 
(BSE_ITEM()) and used as input for another C-style cast (BSE_SONG), so the 
actual type used here is completely unclear to the reader and potentially 
hiding a type bug.

On a side note, it took a while, but I figured again the point of saved_sync. 
It's clearly trying to preserve the 'sync' state around loading a BSE file 
(termed 'restore' in the API), and sets that initially to FALSE to allow BSE 
files to restore different left and right volumes, and syncs thouse only if 
"sync" is also set or after the restore phase is completed. That heavily 
depends on the order in which the properties are defined in the BSE file which 
is somewhat fragile... (*2)

I get the feeling that the old API is a bit too low level with using synced 
volume factors instead of actual dB values. (*1) and (*2) are both indications 
that we should probably move towards something like:

* Factors used internally: left_volume, right_volume - though a bit of compat 
code will be needed to still load these values from old BSE files; syncing is 
implemented here (as before)
* New API: left_volume_db, right_volume_db - values passed in actual dB, these 
values can still be different when read even if sync is enabled.
* So essentially, sync, left_volume_db, right_volume_db can all be read/set 
independently of each other and the internal bus logic adjusts left_volume, 
right_volume accordingly.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/tim-janik/beast/pull/78#issuecomment-419684838___
beast mailing list
beast@gnome.org
https://mail.gnome.org/mailman/listinfo/beast