Author Topic: Visual C++ 2008 & BASSMOD  (Read 5074 times)

0 Members and 1 Guest are viewing this topic.

Offline ChipWarrior

  • ZX 81
  • *
  • Posts: 3
  • Karma: 1
    • View Profile
Visual C++ 2008 & BASSMOD
« on: February 04, 2010 »
Hi There!

I searched my ass of for a Tutorial on bassmod on Visual C++ but i cant get it 2 work :(

So ich found this Forum and see some Interest stuff around here and just reg me bc0z i wanna learn more about Demoscene...

So i thougt i start with the Basics: C++ with Classes and Co ist no big deal but i am Wondering wit that bassmod DLL... i cant get it to work, i just wanna Play an .XM File inmy Application like a Keygen.

I tried PlaySounds() but this doesent Work either and when will call InitAndPlay() for Bassmod it just says unknown Variable... :-/

So anyone wanna help me to get some qewl Chiptunes in my Application?

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Visual C++ 2008 & BASSMOD
« Reply #1 on: February 04, 2010 »
Hi ChipWarrior, welcome to the forum!

Quick question - have you done much Visual Studio programming or C or C++ programming before?

Under the project properties, linker, additional dependencies setting you need to add 'bassmod.lib' - simplest thing to do is to copy this .lib file from the bassmod20\c file into your project folder.

You also need to #include "bassmod.h" from that folder into your project, though I guess you've probably done that.

If you can't get that to work, I'm sure one of our members will be  along in a sec with a quick sample code.

Have you got a demo in the works, or is this something for yourself?

Cheers,

Jim
Challenge Trophies Won:

Offline ChipWarrior

  • ZX 81
  • *
  • Posts: 3
  • Karma: 1
    • View Profile
Re: Visual C++ 2008 & BASSMOD
« Reply #2 on: February 04, 2010 »
Hey THX for the warm Welcome!

Yes i Code sinde 1,5 Years in C++ most in Console Application but since a half Year in GUI Applications...
I read about the bassmod.lib and how to import a DLL and i "think" i got it straight but i am not very sure, bc0z its the First time i do so... At least the Code Compiles with no Error...

Its not really a Demo now just a Tool with some Keygen-Flavor but i wanna Develop for the Demoscene in the Feature, i am since 3 Years huge Fan of the Scene, and will particpate in the Future, but as i say i am a total n00b in GUI Coding but MS VC++ takes a lot Work from me...

So another Question:

For Demos it is better to Code managed C++ or Win32 WINAPI?

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Visual C++ 2008 & BASSMOD
« Reply #3 on: February 04, 2010 »
:hi:

Have you got it to play music dude?
If you want a hand I'll have a look into it for you.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Visual C++ 2008 & BASSMOD
« Reply #4 on: February 04, 2010 »
Quote
For Demos it is better to Code managed C++ or Win32 WINAPI?
I'd avoid managed stuff for demos, but it can be done.  I've got a prototype c# 3d software render which runs not too bad (well, it runs slow, but it's interesting :)).

Jim
Challenge Trophies Won:

Offline ChipWarrior

  • ZX 81
  • *
  • Posts: 3
  • Karma: 1
    • View Profile
Re: Visual C++ 2008 & BASSMOD
« Reply #5 on: February 12, 2010 »
:hi:

Have you got it to play music dude?
If you want a hand I'll have a look into it for you.

thx man i will come back for that another time  ;D really great forum here thanks for all you help meights without you i wouldent have make it!
so i finally got it r1ght, the problem was that i got in trouble with this peace of code:

Code: [Select]
            BASSMOD_Init(-1, 44100, 0); //device, bitrate, flag
            BASSMOD_MusicLoad(false, "CORE.MOD", 0, 0, BASS_MUSIC_LOOP);
            BASSMOD_MusicPlay();

i thougt i have to declare the funktions in the header like the codesnippets in de manual but i finaly understand this hole .dll thing xD
so then my compiler bug me out with:
Quote
fatal error LNK1313: ijw/native-Modul gefunden. Es kann kein Link mit pure-Modulen hergestellt werden.
//says: cannot link to pure-modules
and then i could make it run when i change my compiler settings from /clr:pure to /clr and my programm is finaly playing musik :clap:

so here is the code for an empty form in visual c++ for a clr projekt that plays a .mod file named core.mod

Code: [Select]
#include "stdafx.h"
#include "Form1.h"
#include "bassmod.h"


#pragma comment( lib, "bassmod.lib" )


using namespace projekt;


[STAThreadAttribute]
int main(array<System::String ^> ^args)
{   

        if( BASSMOD_Init ( -1, 44100, 0 ) == false)
       {
        MessageBox::Show( "Coud not Init BASS" );
        }

        if(BASSMOD_MusicLoad ( FALSE, "core.mod", 0, 0, BASS_MUSIC_LOOP ) == false)
        {
        MessageBox::Show ( "Could not laod the Music File" );
        }

        if( BASSMOD_MusicPlay( ) == false)
        {
        MessageBox::Show ( "Can not Play the Music File" );
        }

       Application::EnableVisualStyles();
       Application::SetCompatibleTextRenderingDefault(false);

       Application::Run(gcnew Form1());
     
    return 0;
}
« Last Edit: February 12, 2010 by ChipWarrior »