Skip to content

Commit ea333df

Browse files
committed
BSE: remove Bus::sync property, no longer required due to panning support
Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
1 parent 752ee2a commit ea333df

File tree

2 files changed

+9
-88
lines changed

2 files changed

+9
-88
lines changed

bse/bsebus.cc

Lines changed: 9 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ bse_bus_init (BseBus *self)
4040
self->set_flag (BSE_SOURCE_FLAG_PRIVATE_INPUTS);
4141
self->left_volume = 1.0;
4242
self->right_volume = 1.0;
43-
self->synced = TRUE;
44-
self->saved_sync = self->synced;
4543
bse_sub_synth_set_null_shortcut (BSE_SUB_SYNTH (self), TRUE);
4644
}
4745

@@ -198,21 +196,6 @@ song_connect_master (BseSong *song,
198196
}
199197
}
200198

201-
static gdouble
202-
center_volume (gdouble volume1,
203-
gdouble volume2)
204-
{
205-
if (volume1 > 0 && volume2 > 0)
206-
{
207-
/* center volumes in decibel */
208-
volume1 = bse_db_from_factor (volume1, -200);
209-
volume2 = bse_db_from_factor (volume2, -200);
210-
return bse_db_to_factor ((volume1 + volume2) * 0.5);
211-
}
212-
else
213-
return (volume1 + volume2) * 0.5;
214-
}
215-
216199
static void
217200
bus_volume_changed (BseBus *self)
218201
{
@@ -226,12 +209,8 @@ bus_volume_changed (BseBus *self)
226209
}
227210
else
228211
{
229-
double lvolume = self->left_volume;
230-
double rvolume = self->right_volume;
231-
if (self->synced)
232-
lvolume = rvolume = center_volume (lvolume, rvolume);
233-
v1 = lvolume;
234-
v2 = rvolume;
212+
v1 = self->left_volume;
213+
v2 = self->right_volume;
235214
}
236215
g_object_set (self->bmodule, "volume1", v1, "volume2", v2, NULL);
237216
}
@@ -721,17 +700,6 @@ bus_restore_add_input (gpointer data,
721700
}
722701
}
723702

724-
static void
725-
bus_restore_start (BseObject *object,
726-
BseStorage *storage)
727-
{
728-
BseBus *self = BSE_BUS (object);
729-
self->saved_sync = self->synced;
730-
/* support seperate left & right volumes */
731-
self->synced = FALSE;
732-
BSE_OBJECT_CLASS (bus_parent_class)->restore_start (object, storage);
733-
}
734-
735703
static GTokenType
736704
bus_restore_private (BseObject *object,
737705
BseStorage *storage,
@@ -755,19 +723,6 @@ bus_restore_private (BseObject *object,
755723
return BSE_OBJECT_CLASS (bus_parent_class)->restore_private (object, storage, scanner);
756724
}
757725

758-
static void
759-
bus_restore_finish (BseObject *object,
760-
guint vmajor,
761-
guint vminor,
762-
guint vmicro)
763-
{
764-
BseBus *self = BSE_BUS (object);
765-
/* restore real sync setting */
766-
auto impl = self->as<Bse::BusImpl*>();
767-
impl->sync (self->saved_sync);
768-
BSE_OBJECT_CLASS (bus_parent_class)->restore_finish (object, vmajor, vminor, vmicro);
769-
}
770-
771726
static void
772727
bus_store_private (BseObject *object,
773728
BseStorage *storage)
@@ -807,9 +762,7 @@ bse_bus_class_init (BseBusClass *klass)
807762

808763
object_class->editable_property = bse_bus_editable_property;
809764
object_class->store_private = bus_store_private;
810-
object_class->restore_start = bus_restore_start;
811765
object_class->restore_private = bus_restore_private;
812-
object_class->restore_finish = bus_restore_finish;
813766

814767
item_class->set_parent = bse_bus_set_parent;
815768
item_class->get_candidates = bse_bus_get_candidates;
@@ -942,44 +895,24 @@ BusImpl::solo (bool is_solo)
942895
bool
943896
BusImpl::sync() const
944897
{
945-
BseBus *self = const_cast<BusImpl*> (this)->as<BseBus*>();
946-
947-
return self->synced;
898+
// sync property is no longer used, this is just compat code
899+
return false;
948900
}
949901

950902
void
951903
BusImpl::sync (bool val)
952904
{
953-
BseBus *self = as<BseBus*>();
954-
955-
if (val != self->synced)
956-
{
957-
auto prop = "sync";
958-
push_property_undo (prop);
959-
960-
self->synced = val;
961-
if (self->synced)
962-
{
963-
self->left_volume = center_volume (self->right_volume, self->left_volume);
964-
self->right_volume = self->left_volume;
965-
}
966-
bus_volume_changed (self);
967-
968-
notify ("left_volume");
969-
notify ("right_volume");
970-
notify ("volume_db");
971-
notify ("pan");
972-
notify (prop);
973-
}
974-
self->saved_sync = self->synced;
905+
// sync property is no longer used, this is just compat code
906+
if (val)
907+
notify ("sync");
975908
}
976909

977910
double
978911
BusImpl::left_volume() const
979912
{
980913
BseBus *self = const_cast<BusImpl*> (this)->as<BseBus*>();
981914

982-
return self->synced ? center_volume (self->left_volume, self->right_volume) : self->left_volume;
915+
return self->left_volume;
983916
}
984917

985918
void
@@ -993,11 +926,6 @@ BusImpl::left_volume (double val)
993926
push_property_undo (prop);
994927

995928
self->left_volume = CLAMP (val, 0, 1000);
996-
if (self->synced)
997-
{
998-
self->right_volume = self->left_volume;
999-
notify ("right_volume");
1000-
}
1001929
bus_volume_changed (self);
1002930

1003931
notify ("volume_db");
@@ -1011,7 +939,7 @@ BusImpl::right_volume() const
1011939
{
1012940
BseBus *self = const_cast<BusImpl*> (this)->as<BseBus*>();
1013941

1014-
return self->synced ? center_volume (self->left_volume, self->right_volume) : self->right_volume;
942+
return self->right_volume;
1015943
}
1016944

1017945
void
@@ -1025,11 +953,6 @@ BusImpl::right_volume (double val)
1025953
push_property_undo (prop);
1026954

1027955
self->right_volume = CLAMP (val, 0, 1000);
1028-
if (self->synced)
1029-
{
1030-
self->left_volume = self->right_volume;
1031-
notify ("left_volume");
1032-
}
1033956
bus_volume_changed (self);
1034957

1035958
notify ("volume_db");

bse/bsebus.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ struct BseBus : BseSubSynth {
1919
double left_volume;
2020
double right_volume;
2121
guint muted : 1;
22-
guint synced : 1;
23-
guint saved_sync : 1;
2422
guint solo_muted : 1;
2523
BseSource *summation;
2624
BseSource *vin;

0 commit comments

Comments
 (0)