Trying to get sound running without of framework help

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
IvanBacic
Posts: 5
Joined: November 30th, 2016, 9:08 am

Trying to get sound running without of framework help

Post by IvanBacic » March 25th, 2017, 7:19 pm

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...

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Trying to get sound running without of framework help

Post by chili » March 26th, 2017, 7:40 am

Need to see your full code before we can even begin to guide you bro.
Chili

IvanBacic
Posts: 5
Joined: November 30th, 2016, 9:08 am

Re: Trying to get sound running without of framework help

Post by IvanBacic » March 26th, 2017, 12:13 pm


User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Trying to get sound running without of framework help

Post by chili » March 26th, 2017, 1:42 pm

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.
Chili

IvanBacic
Posts: 5
Joined: November 30th, 2016, 9:08 am

Re: Trying to get sound running without of framework help

Post by IvanBacic » March 26th, 2017, 2:09 pm

Thanks man, take your time, any tip helps :)

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Trying to get sound running without of framework help

Post by albinopapa » March 26th, 2017, 7:18 pm

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.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

IvanBacic
Posts: 5
Joined: November 30th, 2016, 9:08 am

Re: Trying to get sound running without of framework help

Post by IvanBacic » March 27th, 2017, 2:06 pm

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.

IvanBacic
Posts: 5
Joined: November 30th, 2016, 9:08 am

Re: Trying to get sound running without of framework help

Post by IvanBacic » March 27th, 2017, 2:36 pm

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.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Trying to get sound running without of framework help

Post by albinopapa » March 27th, 2017, 7:07 pm

Yeah, Pause is just stopping the audio and resuming from where the stream was stopped.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Trying to get sound running without of framework help

Post by LuisR14 » March 29th, 2017, 7:20 am

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 ;))
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Post Reply