NSSound strange bug

336 Views Asked by At

This code plays the sound:

NSSound *sound = [[NSSound alloc] initWithContentsOfFile:@"/Users/alex/test.ogg"
                                            byReference:NO];
[sound play];

This code does not:

NSData *song = [testingResultsData objectAtIndex:0];
[song writeToFile:@"/Users/alex/test.ogg" atomically:YES];
NSSound *sound = [[NSSound alloc] initWithData:song];
[sound play];

It is the same content in both cases; the only difference is whether it is taken from a file on disk or directly from NSData.

0

There are 0 best solutions below