Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: [1] 2

Author Topic: mClip->setAudioDriver( mAudio ); --- throws error  (Read 4378 times)

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« on: March 16, 2006, 07:04:48 PM »

im trying to put the cegui demo code into my game....i thought it would go over fairly easy but then when i try to run it i can a error....

i debuged my program and found that the pprogram exits at the line

mClip->setAudioDriver( mAudio );

in the MovieLogic play method

any ideas why....i assume it has something to do with the audio....ive recompiled the openal mod...and i have the dll so it should be finding the audio mod...


i dont know though...any ideas
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #1 on: March 16, 2006, 08:33:41 PM »

okay ive tried some more testing and now i dont know what the problem is....it may be something with the creating texture part....i dont know....it works in the demo...and i use the same code but just in my game...
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #2 on: March 16, 2006, 10:14:55 PM »

I'm sorry, the information you posted is very vague. Have you tried running through the debugger - is that what you mean by debugging? What do you mean by exits? Throws an exception? Adding a video driver only registers a pointer.. no reason for that to crash. The only crash I can think of happening if you are using null pointers for something. Or, perhaps a bad theora video... are you using the example cheer.ogg to test your app? Did you remember to add Theora Video plugin to your plugin.cfg file? Plus, look through your Ogre log for any odd errors.
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #3 on: March 17, 2006, 03:38:43 AM »

yeah i ran through a debugger and it breaks at that line mClip->setAudioDriver( mAudio );
it would throw an exception and then exit....the video is fine its one ive used before and i tried it in the demo and it worked fine....and i added the plugin to the plugin config file

alright i can now see in the ogre log that it initializes the movielogic class, creates the movie clip, but then it says that the end of file is reached....looking at the code this means that the oggstream has ended i think....what does this mean
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #4 on: March 17, 2006, 08:50:59 AM »

The end of the stream could be reached immediately depending on how small the movie is? As for "it would throw an exception and then exit", what exception?
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #5 on: March 17, 2006, 10:10:46 AM »

it used to throw and error saying the application has requested to terminate in an unusual way....now it just freezes and i have to force quit...
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #6 on: March 17, 2006, 11:09:45 AM »

You will have to step inside the theora plugin code to determine what line is causing problems. I have not seen any problems like this (usually that error is because of an uncaught exception, devide by zero, or access violations).

Edit - you can try running your app through a memory debugger - looking for uninitialized variables or access violations. (Valgrind on linux for instance).
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #7 on: March 21, 2006, 07:43:01 AM »

Code: [Select]
//Now attach Texture to
if( mMovieControl->getTexture() )
{
CEGUI::String temp = "MyImagesNumber";
CEGUI::String tempName = mMovieControl->getTextureName();

Imageset *img = ImagesetManager::getSingleton().createImageset(
temp, mMovieControl->getTexture() );

unsigned int width = mMovieControl->getWidth();
unsigned int height= mMovieControl->getHeight();

img->defineImage( tempName, Point(0.0f,0.0f), Size( width, height ), Point(0.0f,0.0f));
simg = (StaticImage*)WindowManager::getSingleton().getWindow("PlayWindow/Image1");

simg->setImage(tempName,temp);

mEditorGuiSheet->addChildWindow(simg);
}


i think this is where the problem is with my code...if i dont run through this line that my game will load up and just show  ablack CEGUI window where the video should be...

so it seems like it is having problems get the texture to the screen...

if checked through the code when it creates the texture, and it doesnt seem to be doing anything wrong....
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #8 on: March 21, 2006, 10:18:16 AM »

Hmm, I still don't see anything wrong. You could try forgoing Video to CEGUI texture for the time being in your app. Instead, place a simple Ogre object (mesh/entity) into the scene - perhaps a cude would be easy.. Then, after you create the movie, just do a setMaterialName( NameOfMovieMaterial ) on that object. You should get a video playin on it.
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #9 on: March 21, 2006, 10:46:29 AM »

its still not able to set the material of just an object....so i guess this means that its a problem with creating the texture

Code: [Select]
#include "CEGUI/CEGUI.h"
#include "OgrePrerequisites.h"
#include "OgreCEGUIRenderer.h"

#include "MovieLogic.h"

#include "OgreStringConverter.h"
#include "OgreLogManager.h"
#include "OgreException.h"
#include "OgreTexture.h"
#include "OgreTextureManager.h"
#include "OgreMaterialManager.h"
#include "OgreTechnique.h"
#include "OgreExternalTextureSourceManager.h"

namespace Ogre
{
MovieLogic::MovieLogic( CEGUI::OgreCEGUIRenderer *renderer )
{
mGUIRenderer = renderer;

mSoundSystem = 0;
mVideoControl = 0;
done = false;

maxTime = 0.0f;
mClip = 0;
mText = 0;
mAudio = 0;
mPaused = true;
}

MovieLogic::~MovieLogic()
{
if( mClip )
{
mClip->changePlayMode( TextureEffectPause );
mVideoControl->destroyAdvancedTexture( "Example/TheoraVideoPlayer/Play" );
}

if( mSoundSystem )
{
mSoundSystem->destroyAudio( mAudio );
VideoSoundManager::stopVideoSoundManager( mSoundSystem );
}

//Unloaded any loaded sound modules
VideoSoundManager::unloadSoundModules();
}

void MovieLogic::initialise()
{
mVideoControl = static_cast<TheoraVideoController*>
(ExternalTextureSourceManager::getSingleton().
getExternalTextureSource("ogg_video"));

if( !mVideoControl )
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
"Error grabbing Plugin_TheoraVideoSystem. Added in plugins.cfg file?",
"MovieLogic::initialise");

std::vector<std::string> list = VideoSoundManager::loadSoundModules();

//Set first in list as default one
mSoundSystem = VideoSoundManager::startUpVideoSoundManager(list[0]);
}

void MovieLogic::changeSoundSystem( const std::string& sndMgr )
{
VideoSoundManager::stopVideoSoundManager( mSoundSystem );
mSoundSystem = VideoSoundManager::startUpVideoSoundManager(sndMgr);
CEGUI::WindowManager::getSingletonPtr()->getWindow("APS")->setText(sndMgr);
}

unsigned int MovieLogic::getWidth()
{
return mClip->getVideoDriver()->getWidth();
}

unsigned int MovieLogic::getHeight()
{
return mClip->getVideoDriver()->getHeight();
}

void MovieLogic::stopMovie()
{
if( mClip )
{
mClip->changePlayMode( TextureEffectPause );
mVideoControl->destroyAdvancedTexture( "Example/TheoraVideoPlayer/Play" );
if( mSoundSystem )
mSoundSystem->destroyAudio( mAudio );
}

maxTime = 0.0f;
mClip = 0;
mText = 0;
mAudio = 0;
mPaused = true;
}

void MovieLogic::pauseMovie( bool bPause )
{
if( mClip )
{
if( mPaused == bPause )
return;

if( mPaused == false )
mClip->changePlayMode( TextureEffectPause );
else
mClip->changePlayMode( TextureEffectPlay_ASAP );

mPaused = bPause;
}
}

void MovieLogic::playMovie( const String& movieName )
{
stopMovie();

mVideoControl->setInputName( movieName );
mVideoControl->setPlayMode( TextureEffectPause );
mVideoControl->setTextureTecPassStateLevel( 0, 0, 0 );
mVideoControl->setSeekEnabled( false );
mVideoControl->setAutoAudioUpdate( true );

MaterialPtr material = MaterialManager::getSingleton().getByName("Example/TheoraVideoPlayer/Play");

if( material.isNull() )
material = MaterialManager::getSingleton().create("Example/TheoraVideoPlayer/Play", "General");

material->getTechnique(0)->getPass(0)->createTextureUnitState();

mVideoControl->createDefinedTexture( "Example/TheoraVideoPlayer/Play", "General" );
mClip = mVideoControl->getMaterialNameClip( "Example/TheoraVideoPlayer/Play" );
if( !mClip )
OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Clip not found", "MovieLogic::playMovie" );

mClip->registerMessageHandler( this );

if( mSoundSystem )
{
mAudio = mSoundSystem->createAudio();
mClip->setAudioDriver( mAudio );
}

mClip->changePlayMode( TextureEffectPlay_ASAP );
mPaused = false;

mCurrentMoviePlaying = mClip->getMovieName();
mText = mGUIRenderer->createTexture( mClip->getVideoDriver()->getTexture() );

done = false;
}

int MovieLogic::messageEvent( PLUGIN_theora_message m )
{
switch( m )
{
case TH_TheoraStreamDone:
done = true;
LogManager::getSingleton().logMessage("Video Packets empty");
break;
case TH_VorbisStreamDone:
LogManager::getSingleton().logMessage("Audio Packets empty");
break;
case TH_OggStreamDone:
LogManager::getSingleton().logMessage("End of file reached");
break;
case TH_EndOfMovie:
LogManager::getSingleton().logMessage("Movie Playback done");
break;
}
return 0;
}
}




this is the movie logic code.....

Code: [Select]
using namespace CEGUI;

mMovieControl = new MovieLogic(mGUIRenderer);
mMovieControl->initialise();

FrameWindow* fwnd3 = (FrameWindow*)WindowManager::getSingleton().getWindow("PlayWindow");
assert( fwnd3 );
StaticImage* simg = 0;

mMovieControl->playMovie( "LAXMovieTVOD3TVOD.ogg" );

simg = (StaticImage*)WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "PlayWindow/Image1");

fwnd3->addChildWindow(simg);
simg->setMaximumSize(Size(2.0f, 2.0f));
simg->setPosition(Point(0.0f, 0.05f));
simg->setSize(Size(1.0f, 0.86f));
simg->setFrameEnabled(false);
simg->setBackgroundEnabled(false);

//Now attach Texture to
if( mMovieControl->getTexture() )
{
CEGUI::String temp = "MyImagesNumber";
CEGUI::String tempName = mMovieControl->getTextureName();

Imageset *img = ImagesetManager::getSingleton().createImageset(
temp, mMovieControl->getTexture() );

unsigned int width = mMovieControl->getWidth();
unsigned int height= mMovieControl->getHeight();

img->defineImage( tempName, Point(0.0f,0.0f), Size( width, height ), Point(0.0f,0.0f));
simg = (StaticImage*)WindowManager::getSingleton().getWindow("PlayWindow/Image1");
simg->setImage( temp, tempName);
}


this is wheri create the movielogic and try to play a video...can you see anything that looks wrong....i copied and pasted the code form the demo project into my project...the demoproject works but not the game....

thanks for all the help by the way....i really appreciate it...
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #10 on: March 21, 2006, 10:59:41 AM »

Ok, before I look at your code in depth. Just verify that you have a sane workng directory structure. All you plugin's are located in the same directory as your exe.. you are using the default (ST_GENRIC) scene manager, and have removed all other scene managers from plugins.cfg (just for testing, it really shouldn't affect things).

Place the CEGUIDemo Application exe (the one you say works) into your app's exe directory and ensure it still works from that diectory. (to make sure some paths, configs are not setup wrong).
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #11 on: March 21, 2006, 11:47:57 AM »

i am able to put in the demo into my game bin folder, and it runs fin...after changing the layout to taharez scheme because the window scheme was throwing an error...


so i really dont knwo waht the probelm is now....it uses the same codeexcept that i get the gui renderer and system from my game manager class.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #12 on: March 21, 2006, 12:09:21 PM »

Well, I can't see anything wrong. And since you say that the demo works fine in your apps directory... It must not be a resource.cfg, plugins.cfg, etc type of problem.. And you say it does the same thing when you apply it to an object and not CEGUI, so it has to be entirely in your code.. a typo. or maybe an unintialised variable.. are you using Fmod or openAL? maybe one or the other would make a difference...
Logged

StoneDevil

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #13 on: March 23, 2006, 03:44:37 PM »

i think the main problem is that my project is split into dlls....

i have a dll for gamemanager which i was trying to put a video state into that....but for some reasons its not working...

ill have to look into restructuring it
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
mClip->setAudioDriver( mAudio ); --- throws error
« Reply #14 on: March 23, 2006, 05:58:36 PM »

Hmm, as long as all your dll's are using the same runtime, you shouldn't be seeing any problems.. unless, something wierd is happening with how the plugin is loaded, and where it is located. Someone (by trying to split the dll's to a seperate directory then the exe) had two theora plugin dlls going, and was running into something like this.
Logged
Pages: [1] 2