Author Topic: BASS_StreamCreate, STREAMPROC_DUMMY missing on Mac?  (Read 724 times)

soundgals

  • Posts: 75
I tried to use the BASS_StreamCreate function on Mac app written in Swift and got an error (cannot find 'STREAMPROC_DUMMY' in scope)when I included STREAMPROC_DUMMY in the call. I think the same would be true for STREAMPROC_DEVICE and STREAMPROC_PUSH. I'm probably missing something obvious; but shouldn't these be available to me in my BASS installation in xCode?


Ian @ un4seen

  • Administrator
  • Posts: 26178
Re: BASS_StreamCreate, STREAMPROC_DUMMY missing on Mac?
« Reply #1 on: 15 May '24 - 13:27 »
It seems like the STREAMPROC_PUSH/DUMMY/DEVICE constants don't get bridged to Swift, perhaps because they're pointers. I'm not sure if there's a better way to handle it, but one solution is to add a wrapper function in the bridging header with an intptr_t "proc" parameter and change the constants accordingly, like this:

Code: [Select]
#include "bass.h"

// Special STREAMPROCs
#define STREAMPROC_DUMMY (intptr_t)0 // "dummy" stream
#define STREAMPROC_PUSH (intptr_t)-1 // push stream
#define STREAMPROC_DEVICE (intptr_t)-2 // device mix stream
#define STREAMPROC_DEVICE_3D (intptr_t)-3 // device 3D mix stream

static inline HSTREAM BASS_StreamCreateSpecial(DWORD freq, DWORD chans, DWORD flags, intptr_t proc)
{
return BASS_StreamCreate(freq, chans, flags, (STREAMPROC*)proc, 0);
}

And then use BASS_StreamCreateSpecial instead of BASS_StreamCreate.

soundgals

  • Posts: 75
Re: BASS_StreamCreate, STREAMPROC_DUMMY missing on Mac?
« Reply #2 on: 15 May '24 - 13:49 »
Thanks Ian. That got rid of the error.