Author Topic: Getting the raw audio samples data  (Read 12967 times)


kamen

  • Jr. Member
  • **
  • Posts: 105
I liked the split output/source sample rate and channel count, but even with the new bass dll, I have some problems:

Code
public struct SoundStreamInfo
{
    public int OutputApi;   // always 0, previously worked well
    public int OutputChannelCount;  // always 0
    public int OutputSampleRate;  // always 0
    public int SourceChannelCount; // works very well
    public int SourceSampleRate; // works very well
    public int SourceDsdRate;  // works very well
    public int SourceBitsPerSample; // works very well

// the rest is unchanged -> works
    public long Length;
    public double Volume;
    public double PreAmp;
    public double ReplayGain;
}

The callback on startup is also missing (if something has changed there).

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I liked the split output/source sample rate and channel count, but even with the new bass dll, I have some problems:

Just confirming I'm getting the same results as kamen.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I haven't checked all the settings but OutputApi, OutputChannelCount, Volume, PreAmp and ReplayGain are working for me.

kamen

  • Jr. Member
  • **
  • Posts: 105
tested with the C# interface and should work now for both
https://getmusicbee.com/patches/MusicBee36_Patched.zip
GetStreamInformation does not get called at all for c++ and c#.

I'm perplexed as BoringName says it works on his setup.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974
GetStreamInformation does not get called at all for c++ and c#.
its also working for me. Is your plugin enabled? I changed it so an explicit check is done before calling the function

edit:
actually it wont get called if you dont also have GetPCMRawData exported. I will fix that tonight
Last Edit: October 01, 2024, 10:07:30 PM by Steven

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974
you dont have to update the streaminfo structure definition but i have added one more field at the end:
public bool LogarithmicVolume;
if you are adjusting sample data for volume for the wasapi exclusive volume slider, and LogarithmicVolume = true then you should divide the Volume value by Math.Pow(10, ((PlayerSettings.Volume - 1) * 40) / 20)

i will not add the field and just adjust the Volume value instead
Last Edit: October 02, 2024, 10:46:13 AM by Steven

kamen

  • Jr. Member
  • **
  • Posts: 105
actually it wont get called if you dont also have GetPCMRawData exported. I will fix that tonight
Your guess and the following fix did the trick. I'm very much happy with how it works!

I want to state two lesser issues, without pushing for a fix. It may be useful for the stabilization of the api.
1) If two plugins (one c++ (background) and one c# (with visible panel)) are implementing GetPCMRawData, then GetPCMRawData for the c++ one does not get called. I have a c++ bridge plugin, so I found that by accident.
2) You close the player while playing a song with this option selected . After starting the player again it continues to play, but GetPCMRawData and GetStreamInformation does not get called, unless another song is selected.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974
both should be fixed now, updated musicbeebass.dll is included in this zip
https://getmusicbee.com/patches/MusicBee36_Patched.zip

the first required significant changes which I have tested

kamen

  • Jr. Member
  • **
  • Posts: 105
both should be fixed now, updated musicbeebass.dll is included in this zip
https://getmusicbee.com/patches/MusicBee36_Patched.zip

the first required significant changes which I have tested


It works very good! I think there is no regression, it just got better!

1) It is solid. No problems at all.
2) After finishing the startup song, it posts the GetStreamInformation for the next song. I'm good with that.

Thanks for including the bass dll into the zip.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I'm having an issue with the portable version. streamInfo.PreAmp is coming through as zero regardless of what the EQ PreAmp is set to. I'm using 3.6.9041 on both versions and they both have the new MusicBeeBass.dll with the same version of my plugin.

Installed works, portable is coming through as zero. I can't see anything I've done that could cause that, It's not just my machine, another user is having the same issue.

ReplayGain and OutputChannelCount seem ok. I haven't checked the other outputs.

This is the function I'm using and I just get the values directly from streamInfo.
Code
public void GetStreamInformation(IntPtr ptr)
        {
            streamInfo = (SoundStreamInfo)Marshal.PtrToStructure(ptr, typeof(SoundStreamInfo));
           
        }

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974
preamp is only applied if the equaliser is enabled

BoringName

  • Sr. Member
  • ****
  • Posts: 916
preamp is only applied if the equaliser is enabled

That would be it. And I can check if the equaliser is enabled in the api so all good. Thanks.

edit: I'd modified the preamp value but completely missed the "enable equaliser" at the top.
Last Edit: October 04, 2024, 05:11:22 AM by BoringName