Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: Is it possible of removing menues from a CDockablePane??? Pin
Randor 5-Nov-09 12:05
professional Randor 5-Nov-09 12:05 
JokeRe: Is it possible of removing menues from a CDockablePane??? Pin
«_Superman_»5-Nov-09 12:06
professional«_Superman_»5-Nov-09 12:06 
AnswerRe: Is it possible of removing menues from a CDockablePane??? Pin
«_Superman_»5-Nov-09 11:54
professional«_Superman_»5-Nov-09 11:54 
QuestionSound programming issue. Pin
GLGunblade5-Nov-09 9:27
GLGunblade5-Nov-09 9:27 
QuestionRe: Sound programming issue. Pin
David Crow5-Nov-09 9:40
David Crow5-Nov-09 9:40 
AnswerRe: Sound programming issue. Pin
GLGunblade5-Nov-09 12:02
GLGunblade5-Nov-09 12:02 
GeneralRe: Sound programming issue. Pin
David Crow6-Nov-09 3:19
David Crow6-Nov-09 3:19 
GeneralRe: Sound programming issue. [modified] Pin
GLGunblade6-Nov-09 7:24
GLGunblade6-Nov-09 7:24 
This doesn't work.

oggPlayer1.Play();
	while (oggPlayer1.StoppedPlaying())
	{
		oggPlayer1.Close();
		oggPlayer2.Play(true);
	}

if ((oggPlayer1.StoppedPlaying())==false)
	{
			oggPlayer1.Update();  // Ogg player update
	}

	if  ((oggPlayer2.StoppedPlaying())==false)
	{
			oggPlayer2.Update();  // Ogg player update
	}


How I've done it.
I used flags cause it was easier to get it working, at least it played the second sound then.

if (flag==0)
	{
	flag=1;
	oggPlayer1.Play();
	
	}
	while (oggPlayer1.StoppedPlaying())
	{
		flag=2;
	//	oggPlayer1.Close();
		oggPlayer2.Play(true);
	}


This works... to a point.
OggPlayer1.Close();
breaks the program and is commented out, and even when commented out the second sound doesn't even play properly.
[edit]
Just noticed that oggPlayer1.Close will contiunally get called so a flag is needed.
i.e. stoppedplaying is true and flag =1, then in that statement flag = 2 and close only gets called once without breaking the program.
I much prefer if statements since they don't give me headaches.

Why I use flags here.
StoppedPlaying will never equal to true with your code.

Since this is obviously within the update function it will continually loop past
oggPlayer1.Play()
While the sound does not reset and continues as normal, in the background the code is telling the while loop that yes it is true that sound 1 is still playing even when stopped.
I'm not sure how it keeps the sound playing without looping back on itself, I guess it's how the update function works.
Regardless without a flag it will never return false (sound has stopped playing).

Secondly this still doesn't solve the update problem, in the second example where I do use flags (And I'm pretty sure it's not flags causing my problem) and the second sound does play, though for a short period before the whole thing hangs up, the sound STILL audibly plays too early.

I apologise, I really do, you are trying to help and I really do appreciate it but even before trying your original code I never expected it to work.
Not because your code is bad or wrong, it isn't, but because it still does not change the fact that the boolean oggPlayerX.StoppedPlaying() still returns TRUE TOO early. I do not see how an if statement exchanged for a while loop would change this fact.

Unless i'm missing something huge on how a while loop and an if statement works.

modified on Friday, November 6, 2009 6:38 PM

QuestionRe: Sound programming issue. Pin
David Crow6-Nov-09 16:26
David Crow6-Nov-09 16:26 
AnswerRe: Sound programming issue. Pin
GLGunblade7-Nov-09 16:38
GLGunblade7-Nov-09 16:38 
QuestionInjecting code in all explorer processes Pin
Ivo Beltchev5-Nov-09 6:01
Ivo Beltchev5-Nov-09 6:01 
AnswerRe: Injecting code in all explorer processes Pin
«_Superman_»5-Nov-09 7:11
professional«_Superman_»5-Nov-09 7:11 
GeneralRe: Injecting code in all explorer processes Pin
Ivo Beltchev5-Nov-09 7:45
Ivo Beltchev5-Nov-09 7:45 
Questiongraphics design in c,c++ Pin
aviparida5-Nov-09 5:38
aviparida5-Nov-09 5:38 
AnswerRe: graphics design in c,c++ Pin
Richard MacCutchan5-Nov-09 5:43
mveRichard MacCutchan5-Nov-09 5:43 
QuestionMainframe Vista shadow Pin
baerten5-Nov-09 4:53
baerten5-Nov-09 4:53 
AnswerRe: Mainframe Vista shadow Pin
Richard MacCutchan5-Nov-09 5:56
mveRichard MacCutchan5-Nov-09 5:56 
GeneralRe: Mainframe Vista shadow Pin
baerten5-Nov-09 22:02
baerten5-Nov-09 22:02 
Question[VC++ 6.0] Dialog Control (Not MFC) Pin
PimpDawg5-Nov-09 3:39
PimpDawg5-Nov-09 3:39 
AnswerRe: [VC++ 6.0] Dialog Control (Not MFC) Pin
David Crow5-Nov-09 4:55
David Crow5-Nov-09 4:55 
AnswerRe: [VC++ 6.0] Dialog Control (Not MFC) Pin
«_Superman_»5-Nov-09 5:40
professional«_Superman_»5-Nov-09 5:40 
AnswerRe: [VC++ 6.0] Dialog Control (Not MFC) Pin
Saurabh.Garg5-Nov-09 14:56
Saurabh.Garg5-Nov-09 14:56 
QuestionGetting the dekstop window handle Pin
SujayG5-Nov-09 3:04
SujayG5-Nov-09 3:04 
AnswerRe: Getting the dekstop window handle Pin
Nuri Ismail5-Nov-09 3:13
Nuri Ismail5-Nov-09 3:13 
AnswerRe: Getting the dekstop window handle Pin
CPallini5-Nov-09 3:17
mveCPallini5-Nov-09 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.