Page 1 of 1

Trying to get sound running without of framework help

Posted: March 25th, 2017, 7:19 pm
by IvanBacic
How would you get this code running for sound outside of framework, i tried something and it kinda works but the sound is real bad quality, i think its because (I put play() in while ) it processes to slow but in framework its in wWinMain and i got real lost there... Pleas some help or advice some link or something on how i can make it sound smooth ... I'm trying to understand APIs better :). And Chill you helped me a lot in learning to program thank a lot I LOVE YOU...

Re: Trying to get sound running without of framework help

Posted: March 26th, 2017, 7:40 am
by chili
Need to see your full code before we can even begin to guide you bro.

Re: Trying to get sound running without of framework help

Posted: March 26th, 2017, 12:13 pm
by IvanBacic

Re: Trying to get sound running without of framework help

Posted: March 26th, 2017, 1:42 pm
by chili
Ah nice, repo. I will take a look at this in a bit bro. Might take me a day or two, but I will see what's going wrong and hopefully give you some pointers. If somebody else wants to jump in and give advice that's cool too.

Re: Trying to get sound running without of framework help

Posted: March 26th, 2017, 2:09 pm
by IvanBacic
Thanks man, take your time, any tip helps :)

Re: Trying to get sound running without of framework help

Posted: March 26th, 2017, 7:18 pm
by albinopapa

Code: Select all


int main()
{
	Sound TheEnd = Sound(L"C:\\Users\\Ivan\\Desktop\\programiranje\\SimpleAudioLoader\\TheEnd.mp3");

		while (true) {
			TheEnd.Play();
		}
	return 0;
}
I believe your original thought is correct, you are unconditionally playing this sound each loop iteration. You would want to check if the sound file is finished playing before playing it again. I don't think chili's version has a way to tell built in, but I'm sure you could figure out how to write a function that returns a bool if file is still playing or if it is done playing.

Re: Trying to get sound running without of framework help

Posted: March 27th, 2017, 2:06 pm
by IvanBacic
OOOOOOOOoouuouou albinopapa thanks man for idea i figure it out. Now it plays smooth :) i'll uploud update version soon when i put sam options for play stop and that staff :) thanks.

Re: Trying to get sound running without of framework help

Posted: March 27th, 2017, 2:36 pm
by IvanBacic
hey :D . Is it possible to implement pause with this ??
i think i can make next or something like that but i cant find anything about pause in XAudio\XAudio2.h i think it uses stop and play form here .and maybe (I'am asking to much) to select time to start playing hehe :D. I'll try and let you know if i successfully find something.

Re: Trying to get sound running without of framework help

Posted: March 27th, 2017, 7:07 pm
by albinopapa
Yeah, Pause is just stopping the audio and resuming from where the stream was stopped.

Re: Trying to get sound running without of framework help

Posted: March 29th, 2017, 7:20 am
by LuisR14
all you have to do is call Play, XAudio will continue from where it stopped :) (only extra has to be done for a full stop ;))