I'm new to this forum and quite new to programming as well. This far, I've written two very simple games using Allegro 5 but I still don't feel particurarly sure that I always know what's going on.
I've never had this problem before, maybe it's caused by using a wrong name somewhere, maybe it's an effect of me having not enough C++ knowledge. Whatever.
If you could help me, I'd be very greatful!
So, what is my problem? I'm following this tutorial: http://fixbyproximity.com/oop-game-development/
Here's my problem:
My SAMPLE_INSTANCE does not want to play at all. I tried al_set_sample_instance_playing(songInstance, true) as well as al_play_sample_instance(songInstance). At first, I put it in my changeState function, but I've also tried to put it in various places in main just to see, where the problem is.
I've told the program to write out if the sample_instance is playing and it always told me: 0, (not playing). The changeState function itself most certainly works, because I've told the game to write out the current state and it changed how I wanted it to.
So, what the hell is wrong with my instance? I don't know.
Here are parts of my code that include anything connected with the instance.
This is global:
This is in main:
And this is the changeState function, called right now only once, just before while(!done) loop.
3 if (
7 else if (
9 for (
11 if ((*
PLAYER && (*
16 else if (
21 if (
25 else if (
29 else if (
Ok guys, so I have a very surprising solution to my problem. I honestly have no idea why it worked, but here's what I did:
checked if another .wav sound would play
"oh, it works with this one. Strange"
checked if I misspelled the file name or something but not. It was also .wav
I opened it in Audacity and exported it again as a .wav (not having changed anything)
I replaced my old .wav file with the new one from Audacity
It started working.
I'm dumbfounded. But also glad it worked.
Thank you for all the advise you've given me.