Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





Music Problems

Iniciado por , 30 de Septiembre de 2005, 10:55:43 PM

« anterior - próximo »

  This is my code to free up the music I have loaded:


// DONE SOUND
int donesound(void)
{
if (ISoundFX->IsPlaying()) ISoundFX->MusicStop;
SDL_Delay(1000);

// Free musics
ISoundFX->MusicFree(MUSIC_TRACK_1);
ISoundFX->MusicFree(MUSIC_TRACK_2);
ISoundFX->MusicFree(MUSIC_TRACK_3);

// Close up Audio
ISoundFX->Quit();
return 0;
}


I have the delay, which doesn't help - to give it time to stop playing. But I'm guessing the track that is playing when it tries to shutdown doesn't get freed, because it's being used still. Is there something I missing? This is the only problem I'm having now.

 Thanks.

TheAzazel

 Mike,

Could you try the below code?


// DONE SOUND
void donesound(void)
{
// Stop music
ISoundFX->MusicStop();

// Free musics
ISoundFX->MusicFree(MUSIC_TRACK_1);
ISoundFX->MusicFree(MUSIC_TRACK_2);
ISoundFX->MusicFree(MUSIC_TRACK_3);
}


It should work!.

It is not necessary to wait to finish a music track, you can stop it whenever you want.
Also, do not call to ISoundFX->Quit() because when you call CRM32Pro_Quit() it close up all its interfaces, I will see the code, if there is any problem, I will fix it on next revision.

Let me know if it works for you.

Cheers

 Nah, I tried that.

 It still crashes. When it crashes the debugger says something like "no code to debug" so I'm guessing it is crm32pro..

Anywho, can't wait for the next version :)

by the way - It's only music, sounds effects have no problem.

TheAzazel

 
Cita de: "Mike"Nah, I tried that.

  It still crashes. When it crashes the debugger says something like "no code to debug" so I'm guessing it is crm32pro..

Anywho, can't wait for the next version :)

by the way - It's only music, sounds effects have no problem.
Dont worry, as soon as we find the problem... I will send you the "next revision" and I will update the packages at website.

I need further information about:

-your PC(cpu,operating system, video card and sound card).
-send me the log produced by your application.
-What compiler are you using? and dont forget its version.
-these music tracks...what kind of file are them? (ogg,xm,wav,s3m, etc..)

If you can, send me a piece of your full code to my email(or post it here). I need to reproduce your bug on my computer to fix it.
Thanks you very much for the feedback!

I'm longing for your reply....

 Windows XP Pro Service pack 2
intel PIII 863 mhz 256 mg mem
(sound) Intel 82801AA AC'97 Audio (onboard)
(video) NVIDIA GeForce2 MX 200 sulirio (agp)

the music tracks are .xm

I am sending you my entire source + data. Everything audio is in music.cpp (& music.h). It will be in your email shortly (and it will be zipped).

Thanks!

 Forgot the compiler..

Visual Studio .NET (Academic) 2003 (visual c++ .net)

dev. env. 7.1.3088
.net framework 1.1 ver 1.1.4322

Thats all the info I can get out of it.

TheAzazel

 Mike, I have found a few bugs on MikMod (related to XM modules).

Im working on it.

By the way, you can try to load your modules from a file (yourmodule.xm) instead of from DPF to see if it works and... try to work with others format (if it possible) while I find a workaround for this.

Cheers

 Oh man, bummer! Well at least you found the problem, I'll try something other than .xm


TheAzazel

 
Cita de: "Mike"Oh man, bummer! Well at least you found the problem, I'll try something other than .xm
Mike,

the problem was detected so I'm working on workaround.

If you are curious, the problem is inside SDL_mixer and MikMod, only one module can be loaded at the same time. But, as I have encasulated that functions on ISoundFX interface, I will extend the load manager to handle this issue on a fully transparent way for the programmers, therefore you(or any other programmers that uses CRM32Pro) will be able to load so many music tracks(OGG or modules) as you want without to deal with previous issue.

I think that for next friday you will have your problem solved :).

On the other hand, I tried your game and it seems cool! it has a nice gfx stuff. I imagine that it is not finish yet....... (I killed all *animals* and nothing stop me to follow walking haha) but it would be fine if you could use a kind of sword or something like that to kill them, maybe that is your next step, I dont know :). Whenever your game will be finish, I would like to play with it.

Also, I could see that you include SDL.dll but it is not necessary as SDL.dll is embedded on CRM32Pro.dll, so you only need to include the last one but do not forget to include on final release all the licenses files(SDL,SDL_mixer,etc...).

Cheers!

 oo! the licenses! I would have forgotten! thanks for reminding me.
Hm, so I could work around it by only loading one module, playing, unloading, then reapet for next.. if I have to, I'll do it. :)

ya - I have a different sprite set for the player, with an attack animation, and I just barely coded in a "begin round, play round, end round next round" program flow. You'll also have a farmer chasing you and attacking you to stop you from killin his chickens. I'm not sure if it'll be time based or what, but as the rounds go, more chickens will be there, more rabbits, and a faster/stronger farmer. (I'm poor at ai, so the farmer will not get any smarter at chasing you heh)

Prolly no real reward for finishing, I do not plan to develop this  thing very far, the code is too linear, and I'd like to work on a scrolling game, along with learning how to optimize ( this game doesn't run NEARLY as fast as it should on my p.c. )

anywho, hm.. it could be done in a few days.

TheAzazel

 Mike, as I told you, here you have the next version of the library. I´m testing it on all environment but for your game, it works fine!
This package is only the main dll but is fully compatible with previous one, you only have to replace the old library (CRM32Pro.dll).
It could be slower because is on debug mode... but it allow to you to follow with your development, this weekend I will update the web page with full packages, I let you know.

CRM32Pro v4.62 debug dll


About your game...I would like to play it when you finish your development..also I could do a betatesting (I have a few different platform).

Cheers!

 
 heh - hm I didn't get the debug dll in time. I was away with my band playing music for unappreciative kids.

anywho, my game wasn't meant to be a bugfree-feature-packed kickbutt game. it was just a test to see how easy cpp is to write games in, and actually, with your dll, it's really f---ing easy!

I have called it quits on that project, I will send you the finished product. Some sprites have transparency issues, but that is my fault, not crm32pro's - the farmer sprite had black in some areas that should be dark, so they show up transparent. Also, I didn't add an attack animation for the player, and I kept the old player sprite because the new one had transparency issues as well... Maybe the EditorDPF could preview ColorKey transparency to help verify correct & accurate sprite ColorKey? Or does it and I just missed that feature? Hm..

I'll send you the whole schabang, source and all for ya.

I am working on my next game, same idea, but it's a scroller - you're walking through farms, "pillaging" for food, bonuses, score, multipliers. It will be thoroughly coded this time, because a scrolling game is worth more effort :). I will also fix all of the sprites this time around. Also, I am going to work on a y-index sort algo for crm43pro_csprite which takes the sprites Y coord and a Y-Index value to determine when it should be drawn. Sadly, I have to code a dynamic list *uhhg* with a struct containting crm32pro_csprite & a Y-Index as it's data-type, or something like that - In order for Y-Index to be implemented.

Anyway I'm off the brainstorm, I'll get the game to you in time, and thanks for you help and the new version of crm32pro!








 

TheAzazel

 EditorDPF supports colorkey, alpha per surface and alpha per pixel and all of them are rendered on display window with this properties...you should see a background...
What version of EditorDPF are you using? Maybe it is not the latest :)

Otherwise, please, send me an example of your issue and I will study it.

I though a few months ago some way to sort an array of sprites, it would be interesting if you develop that.
Actually, I would like to add some code to avoid overblitting but it quite difficult to do that on a general way... dirty rectangles for example works fine for a kind of games but nor for others...

Anyway, I keep an eye on your developments!

happy coding!

 
 You are right :) I am wrong. I guess I was in too much of a hurry to check the preview box to make sure everything was okay.

 Sorry about that!

 Hm.. I will implement y-index and see how it goes, I really want to make the game as fast as possible (2D games should be lightning fast anyway!) This next project, if it dips below 60fps on my system, then I'll be working on performance, which I'm sure will take up most of my time coding. The great part is, my next project is a scroller, so there wont ever be more than say 15  sprites with 15 particle explosions of 30-40 sprites each. I plan to use pure Colorkey as well, and also drop the resolution for oldskool feel, opening up the option of using crm32pro's pixel-perfect collision detection. :) (which would be fantastic to finally use!)

 The problem with y-index sort is.. with the idea I have,

check y+y-index compare to previous and next sprite,
swap with prev or next if less or greater,
if  not swap update/draw -

 Some or alot of sprites wont be indexed properly or even drawn/updated, especially if they make large y-axis movements. But I have to implement it to find out if it is visually unsastisfying. But I do also have a huge book on sort algorithms, so if it fails I'm ready to modify it. Anyway I'm rambling see ya!

TheAzazel

 About performance and optimizacion.. I advice you the gold rule:

first, finish your application(in this case, your game) and when everything works successfully....try to optimize it.

I imagine you already know it :)

On the other hand, I will implement a OpenGL renderer (glSDL) so all your 2D graphics stuff will be hardware accelerated (even alpha per pixel) using the powerful videocard... so

Cheers






Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.