Author Topic: AddMarker {Color=Orange} does not work  (Read 147 times)

musicnapper

  • Posts: 3
AddMarker {Color=Orange} does not work
« on: 7 Feb '17 - 09:35 »
Hi all

I have several markers to show up in individual colors. The addition with {Color=Red} etc. does not work.
e.g. Start{Color=Yellow}, Check{Color=White} etc. does not work.
I always get the default marker color set in the previous lines (marked in bold)
When I mark out the marker color, every marker is in a dark blue.
The text is correctly shown in the wave next to the marker.

Any hints to this? (I use a recent bass version)

Code: [Select]
Wave = new WaveForm(fileName, new WAVEFORMPROC(WaveFormCallback), waveFormControl);
                Wave.FrameResolution = 0.01f; // 10ms are nice
                Wave.CallbackFrequency = 2000;
                Wave.ColorBackground = Color.Black;
                Wave.ColorBeat = Color.Yellow;
                Wave.DrawMarker = WaveForm.MARKERDRAWTYPE.Line | WaveForm.MARKERDRAWTYPE.Name | WaveForm.MARKERDRAWTYPE.NamePositionAlternate;
                Wave.MarkerLength = 0.75f;
                Wave.RenderStart(true, BASSFlag.BASS_SAMPLE_FLOAT); // Background = true
                [b]//Wave.ColorMarker = Color.Yellow;[/b]
                if (markers != null)
                {
                    foreach (MarkerInfo info in markers)
                    {
                        string test = string.Format("{0}{1})", info.Description, ObtainMarkerColor(info.Type));
                        long pos = Bass.BASS_ChannelSeconds2Bytes(stream, info.Position);
                        Wave.AddMarker(test, pos);
                    }
                }
                Wave.ColorLeftEnvelope = Color.Green;
                Wave.ColorRight = Color.Green;
                Wave.ColorLeft = Color.DarkSeaGreen;
                Wave.DrawGradient = true;
                Wave.DrawEnvelope = true;
                Wave.DrawBeat = WaveForm.BEATDRAWTYPE.Top;

Thanks a lot

radio42

  • Posts: 4573
Re: AddMarker {Color=Orange} does not work
« Reply #1 on: 7 Feb '17 - 10:28 »
There seems to be a couple of issues in your code:

1. A marker should be added after the wave form as been rendered - as else the position might not be rendered yet.
You however render the WaveForm async in the background but immediately add a marker.
So consider using the WAVEFORMPROC callback delegate as explained in the docs.

2. The String.Format seems incorrect:
string.Format("{0}{1})", info.Description, ObtainMarkerColor(info.Type));
-> take a look at the "{0}{1})" format - the closing bracket seems incorrect.

3. I also don't know, what the method ObtainMarkerColor(info.Type) returns.
If it only returns the color, not, that the correct syntax is:
E.g. "Description{Color=Yellow}"