View Single Post
Old 01-31-2018, 11:09 AM   #310
fundorin
Banned
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
Default

Quote:
Originally Posted by Xenakios View Post
Maybe Track_GetPeakInfo API function wasn't imported properly?
I've solved this issue by checking if the track, for which I'm requesting peak level, is actually exists in the project.
Code:
        else // Live VU meters
        {
            for (int i = 0; i < 8; i++)
            {
                int tid = (i + 1) + (bankTrackSel * 8);
                
                if (tid <= CountTracks(0))
                {
                    MediaTrack *tr = CSurf_TrackFromID(tid, false);
                    double curVU = volToChar(Track_GetPeakInfo(tr, 0));
                    if (ledE[i] != curVU)
                    {
                        midi_out->Send(0xBF, slR[i], ledRing(curVU, 0), -1);
                        ledE[i] = curVU;
                    }
                }
                else
                {
                    if (ledE[i] != 0)
                    {
                        midi_out->Send(0xBF, slR[i], 0, -1);
                        ledE[i] = 0;
                    }
                }
            }
        }
The if (tid <= CountTracks(0)) part.
fundorin is offline   Reply With Quote