Differences From Artifact [7cef1841c0]:
- File src/sound.mm — part of check-in [d2f07d884a] at 2025-03-12 00:16:05 on branch trunk — Be more tolerant of invalid arguments (user: js, size: 5995) [annotate] [blame] [check-ins using]
To Artifact [285830fef5]:
- File
src/sound.mm
— part of check-in
[489124a92f]
at
2025-03-16 10:11:39
on branch trunk
— Use one autorelease pool per frame
This way, nowhere else autorelease pools need to be managed. (user: js, size: 5912) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
83 84 85 86 87 88 89 | void music(OFString *name) { if (nosound) return; stopsound(); if (soundvol && musicvol) { | < | | | | | | | | < | | | | | < | | | | | < | | | | | | | < | | < | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | void music(OFString *name) { if (nosound) return; stopsound(); if (soundvol && musicvol) { name = [name stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; OFString *path = [OFString stringWithFormat:@"packages/%@", name]; OFIRI *IRI = [Cube.sharedInstance.gameDataIRI IRIByAppendingPathComponent:path]; #ifdef USE_MIXER if ((mod = Mix_LoadMUS( IRI.fileSystemRepresentation.UTF8String)) != NULL) { Mix_PlayMusic(mod, -1); Mix_VolumeMusic((musicvol * MAXVOL) / 255); } #else if ((mod = FMUSIC_LoadSong( IRI.fileSystemRepresentation.UTF8String)) != NULL) { FMUSIC_PlaySong(mod); FMUSIC_SetMasterVolume(mod, musicvol); } else if (stream = FSOUND_Stream_Open( IRI.fileSystemRepresentation.UTF8String, FSOUND_LOOP_NORMAL, 0, 0)) { int chan = FSOUND_Stream_Play(FSOUND_FREE, stream); if (chan >= 0) { FSOUND_SetVolume( chan, (musicvol * MAXVOL) / 255); FSOUND_SetPaused(chan, false); } } else { conoutf(@"could not play music: %@", IRI.string); } #endif } } COMMAND(music, ARG_1STR) #ifdef USE_MIXER vector<Mix_Chunk *> samples; #else |
︙ | ︙ |