Click here to Skip to main content
15,885,871 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to save the sound in array or variable so i can play the sound using the array index or variable .
Posted
Updated 8-Feb-12 20:34pm
v3
Comments
Eugen Podsypalnikov 9-Feb-12 4:09am    
Why not to hold a link to a sound file (instead) ? :)
chaiein 9-Feb-12 4:14am    
ya i can use file. but i want to know whether its possible to use array or variable if yes how and what type?
Eugen Podsypalnikov 9-Feb-12 4:20am    
static CStringArray arSoundFiles;

void CYourCode::AddSound(const CString& cszSoundFile)
{
arSoundFiles.Add(cszSoundFile); // :)
}

const CString& CYourCode::GetLastSound()
{
static CString cszNone;
if (arSoundFiles.GetCount()) {
return arSoundFiles.GetAt(arSoundFiles.GetCount() -1);
}
return cszNone;
}
chaiein 9-Feb-12 6:01am    
when do u call AddSound(...)
please can u explain?
Eugen Podsypalnikov 9-Feb-12 7:06am    
Hm... It was just an abstract example...

We could call it
as we want to add a sound file link to the collection...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900