Author Topic: Adding VU Meter to mixer channels  (Read 664 times)

JJS

  • Posts: 125
Adding VU Meter to mixer channels
« on: 8 Oct '18 - 05:47 »
Hello,

I know this question has been asked and answered to death, but how exactly do I go about putting a VU meter on a mixer channel? I didn't find the answer I was looking for in the forum.

I have modeled a mixer (Using BassMix) with several instrument channels and a master channel. VST instruments may be plugged into the instrument channels, and VST effects may be plugged into the master and/or instrument channels (obviously using BassVst). The mixer has controls for volume and pan on each channel, and each instrument or effect can be bypassed (muted).

Everything is working fine, and now I would like to show activity on the mixer channels as they play. I am using Bass.NET, but I am fluent in C and C++.  Do I use a timer? Callback function?


Ian @ un4seen

  • Administrator
  • Posts: 21372
Re: Adding VU Meter to mixer channels
« Reply #1 on: 8 Oct '18 - 14:46 »
To get the level of a mixer source, you can use BASS_Mixer_ChannelGetLevel/Ex on it, eg. in a timer. Note you will need to include the BASS_MIXER_BUFFER flag in the source's BASS_Mixer_StreamAddChannel call, to enable buffering of the source's data (which BASS_Mixer_ChannelGetLevel/Ex gets the level from).

JJS

  • Posts: 125
Re: Adding VU Meter to mixer channels
« Reply #2 on: 14 Oct '18 - 23:54 »
"This function measures the level of the channel's sample data, not its level in the mixer output. It includes the effect of any DSP/FX set on the channel, but not the effect of the channel's BASS_ATTRIB_VOL or BASS_ATTRIB_PAN attributes or matrix mixing or any envelope set via BASS_Mixer_ChannelSetEnvelope(Int32, BASSMIXEnvelope,BASS_MIXER_NODE[], Int32)."

I'm sorry for not being specific.

What is the correct way to get the level at the mixer channel output, after volume and panning have been applied?

Ian @ un4seen

  • Administrator
  • Posts: 21372
Re: Adding VU Meter to mixer channels
« Reply #3 on: 15 Oct '18 - 13:07 »
Do you want to get the level of the mixer's output, after its BASS_ATTRIB_VOL/PAN settings have been applied? If so, there is a new BASS_ChannelGetLevelEx option coming in the next BASS release to simplify that. It's included in the latest build:

   www.un4seen.com/stuff/bass.zip

The new option is the BASS_LEVEL_VOLPAN flag, which tells BASS_ChannelGetLevelEx to apply the BASS_ATTRIB_VOL/PAN settings to its level readings. That option is also available for BASS_Mixer_ChannelGetLevelEx in the latest BASSmix build:

   www.un4seen.com/stuff/bassmix.zip

JJS

  • Posts: 125
Re: Adding VU Meter to mixer channels
« Reply #4 on: 15 Oct '18 - 18:01 »
Do you want to get the level of the mixer's output, after its BASS_ATTRIB_VOL/PAN settings have been applied? If so, there is a new BASS_ChannelGetLevelEx option coming in the next BASS release to simplify that. It's included in the latest build:

   www.un4seen.com/stuff/bass.zip

The new option is the BASS_LEVEL_VOLPAN flag, which tells BASS_ChannelGetLevelEx to apply the BASS_ATTRIB_VOL/PAN settings to its level readings. That option is also available for BASS_Mixer_ChannelGetLevelEx in the latest BASSmix build:

   www.un4seen.com/stuff/bassmix.zip
Hi,

I'm using Bass.NET.  I got: System.EntryPointNotFoundException: 'Unable to find an entry point named 'BASS_ChannelGetLevelEx' in DLL 'bassmix'.'

Code: [Select]
         
float[] channelLevel = BassMix.BASS_Mixer_ChannelGetLevel(this.Handle, 2, BASSLevel.BASS_LEVEL_STEREO | 16);
....

I'm assuming the new flag is 16 as bassmix.zip had no header file.  The bassmix.dll in my output directory is 2.4.9.7 and bass.dll is 2.4.13.28

radio42

  • Posts: 4637
Re: Adding VU Meter to mixer channels
« Reply #5 on: 15 Oct '18 - 21:08 »
What BASS.NET version are you using?
If not the latest v2.4.13.3, please try this latest version instead.

JJS

  • Posts: 125
Re: Adding VU Meter to mixer channels
« Reply #6 on: 15 Oct '18 - 22:36 »
What BASS.NET version are you using?
If not the latest v2.4.13.3, please try this latest version instead.

I'm using whatever loads with the latest NuGet package. Ok... I'll verify the versions...

JJS

  • Posts: 125
Re: Adding VU Meter to mixer channels
« Reply #7 on: 15 Oct '18 - 22:38 »
What BASS.NET version are you using?
If not the latest v2.4.13.3, please try this latest version instead.

I'm using whatever loads with the latest NuGet package. Ok... I'll verify the versions...

Yes, it is the latest v2.4.13.3

JJS

  • Posts: 125
Re: Adding VU Meter to mixer channels
« Reply #8 on: 16 Oct '18 - 00:09 »
All is working as expected, thanks.

Ian @ un4seen

  • Administrator
  • Posts: 21372
Re: Adding VU Meter to mixer channels
« Reply #9 on: 16 Oct '18 - 16:14 »
Good to hear that you got it working.

For anyone else that would like to use the new BASS_LEVEL_VOLPAN flag now, its value is actually 8 (see the included BASS.H file).