1
1
/*
2
- * Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
3
- * (C) 2021 Vladimir Sadovnikov <[email protected] >
2
+ * Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3
+ * (C) 2024 Vladimir Sadovnikov <[email protected] >
4
4
*
5
5
* This file is part of lsp-plugins-trigger
6
6
* Created on: 31 июл. 2021 г.
@@ -614,7 +614,7 @@ namespace lsp
614
614
lsp_trace (" load failed: status=%d (%s)" , status, get_status (status));
615
615
return status;
616
616
}
617
- size_t channels = lsp_min (nChannels, source->channels ());
617
+ const size_t channels = lsp_min (nChannels, source->channels ());
618
618
if (!source->set_channels (channels))
619
619
{
620
620
lsp_trace (" failed to resize source sample to %d channels" , int (channels));
@@ -738,6 +738,11 @@ namespace lsp
738
738
{
739
739
lsp_trace (" id=%d, gain=%f, delay=%d" , int (af->nID ), gain, int (delay));
740
740
741
+ // Obtain the sample that will be used for playback
742
+ dspu::Sample *s = vChannels[0 ].get (af->nID );
743
+ if (s == NULL )
744
+ return ;
745
+
741
746
// Scale the final output gain
742
747
gain *= af->fMakeup ;
743
748
@@ -751,18 +756,22 @@ namespace lsp
751
756
for (size_t i=0 ; i<nChannels; ++i)
752
757
{
753
758
size_t j=i^1 ; // j = (i + 1) % 2
759
+ const size_t channel = i % s->channels ();
760
+
754
761
lsp_trace (" channels[%d].play(%d, %d, %f, %d)" , int (i), int (af->nID ), int (i), gain * af->fGains [i], int (delay));
755
- vChannels[i].play (af->nID , i , gain * af->fGains [i], delay);
762
+ vChannels[i].play (af->nID , channel , gain * af->fGains [i], delay);
756
763
lsp_trace (" channels[%d].play(%d, %d, %f, %d)" , int (j), int (i), int (af->nID ), gain * (1 .0f - af->fGains [i]), int (delay));
757
- vChannels[j].play (af->nID , i , gain * (1 .0f - af->fGains [i]), delay);
764
+ vChannels[j].play (af->nID , channel , gain * (1 .0f - af->fGains [i]), delay);
758
765
}
759
766
}
760
767
else
761
768
{
762
769
for (size_t i=0 ; i<nChannels; ++i)
763
770
{
771
+ const size_t channel = i % s->channels ();
772
+
764
773
lsp_trace (" channels[%d].play(%d, %d, %f, %d)" , int (i), int (af->nID ), int (i), gain * af->fGains [i], int (delay));
765
- vChannels[i].play (af->nID , i , gain * af->fGains [i], delay);
774
+ vChannels[i].play (af->nID , channel , gain * af->fGains [i], delay);
766
775
}
767
776
}
768
777
}
@@ -1017,7 +1026,7 @@ namespace lsp
1017
1026
if (af->sListen .pending ())
1018
1027
{
1019
1028
// Play sample
1020
- play_sample (af, 0 . 5f , 0 ); // Listen at mid-velocity
1029
+ play_sample (af, 1 . 0f , 0 );
1021
1030
1022
1031
// Update states
1023
1032
af->sListen .commit ();
@@ -1078,7 +1087,7 @@ namespace lsp
1078
1087
1079
1088
// Store file thumbnails to mesh
1080
1089
plug::mesh_t *mesh = reinterpret_cast <plug::mesh_t *>(af->pMesh ->buffer ());
1081
- if ((mesh == NULL ) || (!mesh->isEmpty ()) || (!af->bSync ) || (!af->pLoader ->idle ()))
1090
+ if ((mesh == NULL ) || (!mesh->isEmpty ()) || (!af->bSync ) || (!af->pLoader ->idle ()) || (!af-> pRenderer -> idle ()) )
1082
1091
continue ;
1083
1092
1084
1093
if ((channels > 0 ) && (af->vThumbs [0 ] != NULL ))
0 commit comments