iOS SoundTouch framework Przykład wykrywania BPM

Przeszukałem całą sieć i nie mogę znaleźć samouczka na temat korzystania zBiblioteka SoundTouch do wykrywania rytmu.

(Uwaga: wcześniej nie mam doświadczenia z C ++. Znam C, Objective-C i Javę. Mogłem więc trochę zepsuć, ale się kompiluje.)

Dodałemstruktura do mojego projektu i udało mi się skompilować:

NSString *path = [[NSBundle mainBundle] pathForResource:@"song" ofType:@"wav"];

NSData *data = [NSData dataWithContentsOfFile:path];

player =[[AVAudioPlayer alloc] initWithData:data error:NULL];

player.volume = 1.0;

player.delegate = self;

[player prepareToPlay];
[player play];

NSUInteger len = [player.data length]; // Get the length of the data

soundtouch::SAMPLETYPE sampleBuffer[len]; // Create buffer array

[player.data getBytes:sampleBuffer length:len]; // Copy the bytes into the buffer

soundtouch::BPMDetect *BPM = new soundtouch::BPMDetect(player.numberOfChannels, [[player.settings valueForKey:@"AVSampleRateKey"] longValue]); // This is working (tested)

BPM->inputSamples(sampleBuffer, len); // Send the samples to the BPM class

NSLog(@"Beats Per Minute = %f", BPM->getBpm()); // Print out the BPM - currently returns 0.00 for errors per documentation

TheinputSamples(*samples, numSamples) informacja o bajcie piosenki myli mnie.

Jak uzyskać te informacje z pliku utworu?

Próbowałem użyćmemcpy() ale to nie działa.

Czy ktoś ma jakieś myśli?

questionAnswers(3)

yourAnswerToTheQuestion