Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

funkman

How do I call

This topic is 5645 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Yo, I want to call this method: void BoidMusic::StartMusic() { if (m_pDMusic) { m_pDMusic->Activate(TRUE); } if (m_pPrimarySegments[0]) { m_pPerformance->PlaySegment( m_pPrimarySegments[0], 0, 0, NULL); m_dwIndex = 0; } } which is in a class file. I want to call it from a different class file tho. Both classes include music.h I am trying to call it with: BoidMusic->StartMusic(); But get the error message: C:\coursework files\flyloop.cpp(518) : error C2143: syntax error : missing '';'' before ''->'' Please help, Cheers

Share this post


Link to post
Share on other sites
Advertisement
iirc the function prototype would need to change to: static void StartMusic(); and the call would be: BoidMusic.StartMusic(); Might have been doing too much C# lately tho''

-- Exitus Acta Probat --

Share this post


Link to post
Share on other sites
You need to learn the fundamentals of C++ programming.

But to answer your question, you create the BoidMusic like any other variable:



BoidMusic bm;

bm.StartMusic();

Share this post


Link to post
Share on other sites
Nope doesnt work

c:\coursework files\flyloop.cpp(518) : error C2143: syntax error : missing '';'' before ''.''
c:\coursework files\flyloop.cpp(518) : error C2143: syntax error : missing '';'' before ''.''
music.cpp
c:\coursework files\music.cpp(348) : error C2724: ''StartMusic'' : ''static'' should not be used on member functions defined at file scope
Error executing cl.exe.

Share this post


Link to post
Share on other sites
I have files
flyloop.cpp
music.cpp
music.h

I need to call
void BoidMusic::StartMusic()
{
if (m_pDMusic)
{
m_pDMusic->Activate(TRUE);
}
if (m_pPrimarySegments[0])
{
m_pPerformance->PlaySegment(
m_pPrimarySegments[0], 0, 0, NULL);
m_dwIndex = 0;
}
}

from music.cpp but in my flyloop.cpp so the music will play.
BoidMusic is identified in music.h

I''m getting realy frustrated here please help

Share this post


Link to post
Share on other sites
Is BoidMusic class defined in Music.h? (if so... Please include music.h to this topic)

[edited by - JoeyBlow2 on January 30, 2003 1:01:36 PM]

Share this post


Link to post
Share on other sites
class BoidMusic
{
public:
BoidMusic();
~BoidMusic();
HRESULT LoadMusic( HWND hWnd );
BOOL LoadChordMap();
BOOL LoadStyle();
BOOL LoadSegment();
HRESULT LoadDLS();
BOOL LoadTemplate(DWORD dwIndex, WCHAR * pszName);
BOOL GetMotif(DWORD dwIndex, WCHAR * pszName);
void ComposeSegment(DWORD dwIndex);
void EndMusic();
void StartMusic();
void Transition();
void Collapse();
void Expand();
void Migrate();
void HandleNotifies();
void SetDistance(double fDistance);
BOOL GetSearchPath(WCHAR path[MAX_PATH]);
void Activate(BOOL bActive);
IDirectMusicStyle* m_pStyle;
IDirectMusicChordMap* m_pChordMap;
IDirectMusicSegment* m_pTemplateSegments[6];
IDirectMusicSegment* m_pPrimarySegments[6];
IDirectMusicSegment* m_pTransitionSegment;
IDirectMusicSegment* m_pMotifSegments[6];
IDirectMusicSegment* m_pSegment;
IDirectMusicComposer* m_pComposer;
IDirectMusicLoader* m_pLoader;
IDirectMusicPerformance* m_pPerformance;
IDirectMusicGraph* m_pGraph;
IDirectMusicPort* m_pPort;
IDirectMusicBand* m_pBand;
IDirectMusic* m_pDMusic;
DWORD m_dwIndex;
HANDLE m_hNotify;
DWORD m_dwLevel;
CTool m_Tool;
BOOL m_dwBeatsSinceLastMotif;
BOOL m_fCollapsed;
};

Share this post


Link to post
Share on other sites
Looks good.

In flyloop.cpp are you including music.h like "#include "music.h"" instead of using "#include <music.h>"

Change it to use the quotes. Then make sure your music.h is in the same directory as flyloop.cpp.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!