NO

Author Topic: Errors working with BASS Library  (Read 4779 times)

xteraco

  • Guest
Errors working with BASS Library
« on: June 28, 2009, 04:24:18 PM »
I'm trying to get a small example I coded in C++ working in Pelles C. Here is the code.

Code: [Select]
#include <bass.h>

int main(){
    HSAMPLE sfx[20];
    HSTREAM strm;
    BASS_Init(-1,44100,0,0,NULL);
    char hold;

    //sfx1 = BASS_StreamCreateFile(FALSE,"aud\\gun1.ogg",0,0,0);
sfx[0] = BASS_SampleLoad(FALSE,"aud\\gun1.ogg",0,0,1,0);
sfx[1] = BASS_SampleLoad(FALSE,"aud\\explode.ogg",0,0,1,0);
sfx[1] = BASS_SampleLoad(FALSE,"aud\\ric1.ogg",0,0,1,0);
sfx[2] = BASS_SampleLoad(FALSE,"aud\\ric2.ogg",0,0,1,0);
sfx[3] = BASS_SampleLoad(FALSE,"aud\\ric3.ogg",0,0,1,0);
sfx[4] = BASS_SampleLoad(FALSE,"aud\\healthPowerup.ogg",0,0,1,0);
sfx[5] = BASS_SampleLoad(FALSE,"aud\\weaponPowerup.ogg",0,0,1,0);

for(int i = 0  ; i < 5 ; i++){
    strm = BASS_SampleGetChannel(sfx[i],FALSE);
        BASS_ChannelPlay(strm,FALSE);
        scanf("%c",hold);
}
scanf("%c",hold);
}

I've tried this code with both Win32 Program (exe) and Win32 Console project types. Oddly both tell me that I need to include the /Ze option if I'm working on a windows program. I looked in Project Options -> Compiler -> Command line options (CCFLAGS) and see this string  -Tx86-coff -Ot -W1 -Gz -Ze so I'm assuming the /Ze option is being used. If not please tell me where to use the /Ze option.

Aside from that I get a lot of errors that look like this...

Code: [Select]
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3593): error #2001: Syntax error: found 'HMETAFILEPICT' - expecting '}'.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3596): error #2001: Syntax error: found 'LPOLESTR' - expecting '}'.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3599): error #2156: Unrecognized declaration.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3601): error #2156: Unrecognized declaration.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3601): warning #2099: Missing type specifier.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3607): error #2078: Invalid union field declarations.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3607): error #2001: Syntax error: found 'wireHBITMAP' - expecting '}'.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3608): error #2001: Syntax error: found 'wireHPALETTE' - expecting '}'.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3609): warning #2099: Missing type specifier.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3609): error #2001: Syntax error: found 'hGeneric' - expecting ';'.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3609): warning #2099: Missing type specifier.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3610): error #2156: Unrecognized declaration.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3610): warning #2099: Missing type specifier.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3611): error #2156: Unrecognized declaration.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3611): warning #2099: Missing type specifier.
E:\Program Files (x86)\PellesC\Include\Win\objidl.h(3618): error #2078: Invalid union field declarations.

There are hundreds of them so I only posted a few. What am I doing wrong here?

JohnF

  • Guest
Re: Errors working with BASS Library
« Reply #1 on: June 28, 2009, 06:31:31 PM »
Code: [Select]
#include <windows.h>
#include <stdio.h>
#include "bass.h"

int main(void)
{
    HSAMPLE sfx[20];
    HSTREAM strm;
    BASS_Init(-1,44100,0,0,NULL);
    char hold;

    //sfx1 = BASS_StreamCreateFile(FALSE,"aud\\gun1.ogg",0,0,0);
sfx[0] = BASS_SampleLoad(FALSE,"aud\\gun1.ogg",0,0,1,0);
sfx[1] = BASS_SampleLoad(FALSE,"aud\\explode.ogg",0,0,1,0);
sfx[1] = BASS_SampleLoad(FALSE,"aud\\ric1.ogg",0,0,1,0);
sfx[2] = BASS_SampleLoad(FALSE,"aud\\ric2.ogg",0,0,1,0);
sfx[3] = BASS_SampleLoad(FALSE,"aud\\ric3.ogg",0,0,1,0);
sfx[4] = BASS_SampleLoad(FALSE,"aud\\healthPowerup.ogg",0,0,1,0);
sfx[5] = BASS_SampleLoad(FALSE,"aud\\weaponPowerup.ogg",0,0,1,0);

for(int i = 0  ; i < 5 ; i++){
    strm = BASS_SampleGetChannel(sfx[i],FALSE);
        BASS_ChannelPlay(strm,FALSE);
        scanf("%c",hold);
}
scanf("%c",hold);
return 0;
}

"Project options/Compiler tab/"    - Enable Microsoft extensions

John

xteraco

  • Guest
Re: Errors working with BASS Library
« Reply #2 on: June 28, 2009, 09:47:42 PM »
Awesome! Thanks for helping me get this running.  8)