Author Topic: HSTREAM and BASS_SAMPLE_MUTEMAX  (Read 384 times)

daniel_mor

  • Posts: 7
HSTREAM and BASS_SAMPLE_MUTEMAX
« on: 27 Feb '19 - 20:03 »
Sorry for my English.
Is the BASS_SAMPLE_MUTEMAX flag only available for HSAMPLE?
It can not be installed when the sample has already been created, it applies only when you create?
I passed this flag to the BASS_StreamCreate function and nothing worked.

My code:
Code: [Select]
constexpr float min_distance = 10.f;
constexpr float max_distance = 100.f;
BASS_Init(-1, 48000, BASS_DEVICE_MONO | BASS_DEVICE_16BITS | BASS_DEVICE_3D, 0, NULL);
HSTREAM hstream = BASS_StreamCreateFile(FALSE, "test.wav", 0, 0, BASS_SAMPLE_3D | BASS_SAMPLE_LOOP | BASS_SAMPLE_SOFTWARE | BASS_SAMPLE_MUTEMAX | BASS_SAMPLE_OVER_DIST);
BASS_ChannelSet3DPosition(hstream, &BASS_3DVECTOR{ 0, 0, 0 }, NULL, NULL);
BASS_ChannelSet3DAttributes(hstream, BASS_3DMODE_NORMAL, min_distance, max_distance, -1, -1, 0);
BASS_ChannelPlay(hstream, FALSE);

Ian @ un4seen

  • Administrator
  • Posts: 21979
Re: HSTREAM and BASS_SAMPLE_MUTEMAX
« Reply #1 on: 28 Feb '19 - 14:10 »
Is the BASS_SAMPLE_MUTEMAX flag only available for HSAMPLE?

The BASS_SAMPLE_MUTEMAX flag should also work with streams. If it isn't working for you, please confirm what BASS version you are using (with BASS_GetVersion) and on what platform.

It can not be installed when the sample has already been created, it applies only when you create?

Yes, the BASS_SAMPLE_MUTEMAX flag can currently only be set at creation.

I passed this flag to the BASS_StreamCreate function and nothing worked.

My code:
Code: [Select]
constexpr float min_distance = 10.f;
constexpr float max_distance = 100.f;
BASS_Init(-1, 48000, BASS_DEVICE_MONO | BASS_DEVICE_16BITS | BASS_DEVICE_3D, 0, NULL);
HSTREAM hstream = BASS_StreamCreateFile(FALSE, "test.wav", 0, 0, BASS_SAMPLE_3D | BASS_SAMPLE_LOOP | BASS_SAMPLE_SOFTWARE | BASS_SAMPLE_MUTEMAX | BASS_SAMPLE_OVER_DIST);
BASS_ChannelSet3DPosition(hstream, &BASS_3DVECTOR{ 0, 0, 0 }, NULL, NULL);
BASS_ChannelSet3DAttributes(hstream, BASS_3DMODE_NORMAL, min_distance, max_distance, -1, -1, 0);
BASS_ChannelPlay(hstream, FALSE);

Are you moving the listener more than 100 units (max_distance) away from the stream's position via BASS_Set3DPosition? The listener starts at (0,0,0), the same position as your stream in that code. Make sure you use BASS_Apply3D afterwards too.

The BASS_SAMPLE_OVER_DIST flag isn't valid for streams, so that should be removed from the BASS_StreamCreateFile call. The BASS_DEVICE_MONO flag (for mono output) in the BASS_Init call also does not make much sense for 3D sound :)

daniel_mor

  • Posts: 7
Re: HSTREAM and BASS_SAMPLE_MUTEMAX
« Reply #2 on: 28 Feb '19 - 16:43 »
Thanks. It turned out that the whole thing in an outdated version of the library.