0

I'm a beginner with Bass (working right now on an MFC project) and I'm trying to figure this out.

I saw that I should start with the BASS_Init function, but I found two example, one with 4 parameters and one with 6.

When I trying to use the function, it only gives a 5-parameter version with no overloads, and when I try to use it, my app crashes. Is there a good example for using BASS on MFC that I could learn from? Or where do I find the docs for the API?

The line is:

BASS_Init(-1,44100,0,this->m_hWnd,NULL);

I've tried:

BASS_Init(-1,44100,0,GetSafeHwnd(),NULL);

but it still crashes

ollo
  • 24,797
  • 14
  • 106
  • 155
Erez
  • 1,933
  • 5
  • 29
  • 56
  • Did you try using the debugger to figure out where the crash is occurring? – casablanca Jul 16 '10 at 18:15
  • 1
    If you just include the lib with no use of it (comment the BASS_int) the compiler works? – Sunscreen Jul 20 '10 at 12:50
  • YES, when i include the lib the compiler works, the problem is with the function (or better with my implementatin of it) and i've tried to debug it, and it show me the when i'm returning from the function it crashes with an "changing of a pointer" error....but the only pointer i might change is the HWND and it is requird. the thing is that i have a working example that uses the 1.8 lib (they didn't requier a HWND handle in the 1.8), i have the exe, h file and dll file, but not the lib. And can't find the lib anywere over the net, i'm getting only the new lib 2.4, so i can't use the old on. – Erez Jul 24 '10 at 12:23

1 Answers1

1

The BASS_Init()-function takes 5 Parameters:

BOOL BASS_Init(
    int device, // The device to use... -1 = default device, 0 = no sound, 1 = first real output device
    DWORD freq, // Output sample rate
    DWORD flags, // A combination of flags
    HWND win, // The application's main window... 0 = the current foreground window (use this for console applications)
    GUID *clsid // Class identifier of the object to create, that will be used to initialize DirectSound... NULL = use default
);

Example:

int device = -1; // Default device
int freq = 44100; // Sample rate

BASS_Init(device, freq, 0, 0, NULL); // Init BASS

API Documentation: http://www.un4seen.com/doc/#bass/BASS_Init.html

ollo
  • 24,797
  • 14
  • 106
  • 155