@@ -357,15 +357,33 @@ float CChannel::GetPan ( const int iChanID )
357357 }
358358}
359359
360+ void CChannel::ResetInfo ()
361+ {
362+ QMutexLocker locker ( &Mutex );
363+
364+ bIsIdentified = false ;
365+ ChannelInfo = CChannelCoreInfo ();
366+ }
367+
360368void CChannel::SetChanInfo ( const CChannelCoreInfo& NChanInf )
361369{
362- // apply value (if a new channel or different from previous one)
363- if ( !bIsIdentified || ChannelInfo != NChanInf )
370+ bool bChanged = false ;
371+
364372 {
365- bIsIdentified = true ; // Indicate we have received channel info
373+ QMutexLocker locker ( &Mutex );
366374
367- ChannelInfo = NChanInf;
375+ // apply value (if a new channel or different from previous one)
376+ if ( !bIsIdentified || ChannelInfo != NChanInf )
377+ {
378+ bIsIdentified = true ; // Indicate we have received channel info
368379
380+ ChannelInfo = NChanInf;
381+ bChanged = true ;
382+ }
383+ }
384+
385+ if ( bChanged )
386+ {
369387 // fire message that the channel info has changed
370388 emit ChanInfoHasChanged ();
371389 }
@@ -380,6 +398,15 @@ QString CChannel::GetName()
380398 return ChannelInfo.strName ;
381399}
382400
401+ CChannelCoreInfo CChannel::GetChanInfo ()
402+ {
403+ // make sure the struct is not written at the same time when it is
404+ // read here -> use mutex to secure access
405+ QMutexLocker locker ( &Mutex );
406+
407+ return ChannelInfo;
408+ }
409+
383410void CChannel::OnSendProtMessage ( CVector<uint8_t > vecMessage )
384411{
385412 // only send messages if protocol is enabled, otherwise delete complete
0 commit comments