Я создаю музыкальное приложение в Objective C. Мне нужно воспроизводить несколько звуков одновременно, и я могу добиться этого, используя аудиопроигрыватели Diracle.
Но метод управления громкостью этой библиотеки - (void) setVolume: (float) volume;, похоже, не работает.
Мой код для инициализации DiracAudioPlayer:
DiracAudioPlayer *player1,*player2;
NSURL *url1,*url2;
NSError *error = nil;
url1 = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"song1" ofType:@"mp3"]];
url2 = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"song2" ofType:@"mp3"]];
player1 = [[DiracAudioPlayer alloc] initWithContentsOfURL:mainURL channels:1 error:&error];
[player1 setDelegate:self];
player2 = [[DiracAudioPlayer alloc] initWithContentsOfURL:mainURL channels:1 error:&error];
[player2 setDelegate:self];
Способ установки томов проигрывателя:
-(void)setPlayerVolume
{
[player1 setVolume:0.5];
[player2 setVolume:0.2];
}
setVolume: не работает даже для одиночного игрока, и исключений нет.
Как это решить?