added new method to JSoundSystem to pause music. Previously, "pause" meant kill the music and "resume" effectively restarted the music. iOS will now pause and resume appropriately
modified pc and android impls to ensure new calls are made. These still have the same effective outcome (kill and start) until the equivalent is coded on these platforms to pause and resume the music. fixed bug with iOS sound effects not playing. Forgot to assign the key to the associated music sample
This commit is contained in:
+17
-2
@@ -118,6 +118,18 @@ JMusic *JSoundSystem::LoadMusic(const char *fileName)
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::ResumeMusic(JMusic *music)
|
||||
{
|
||||
[[SoundManager sharedSoundManager] resumeMusic];
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::PauseMusic(JMusic *music)
|
||||
{
|
||||
[[SoundManager sharedSoundManager] pauseMusic];
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::PlayMusic(JMusic *music, bool looping)
|
||||
{
|
||||
NSString *key = [NSString stringWithCString: music->key.c_str() encoding: NSUTF8StringEncoding];
|
||||
@@ -156,10 +168,13 @@ JSample *JSoundSystem::LoadSample(const char *fileName)
|
||||
{
|
||||
NSArray *components = [[NSString stringWithCString:fileName encoding:NSUTF8StringEncoding] componentsSeparatedByString:@"."];
|
||||
string fullpath = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||
sample->filename = fullpath;
|
||||
sample->ext = [[components lastObject] cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
NSString *key = [components objectAtIndex:0];
|
||||
NSString *musicFile = [NSString stringWithCString: fullpath.c_str() encoding:NSUTF8StringEncoding];
|
||||
sample->filename = fullpath;
|
||||
sample->ext = [[components lastObject] cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
if ([key isEqualToString: @""])
|
||||
return sample;
|
||||
sample->key = [key cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
[[SoundManager sharedSoundManager] loadSoundWithKey: key musicFile: musicFile];
|
||||
}
|
||||
return sample;
|
||||
|
||||
Reference in New Issue
Block a user