0

I have being upgrading an application to use the new Mobile Android GNSK but I have noticed that using the new MusicID-Stream is a little bit tricky. If the "identifyAlbumAsync" method get executed before the "audioProcessStart" method(since this need to be executed in a different thread), the application just crashes. In the Gracenote Demo application, the "audioProcessStart" method is continuously running so there is no need to synchronize its execution with the "identifyAlbumAsync" method call. Is it the way it is supposed to be used? It will be convenient if the application didn't crashed at least when the methods are not executed in order. Also in our application, we don't want to have the "audioProcessStart" method continuously like it is done in the demo application. We only want to run the "audioProcessStart" method when the user request identification and when the song playing gets identified , we want to stop the audio processing by calling "audioProcessStop". Is there an easy way to do this? Right now, we are getting the Thread where "identifyAlbumAsync" is running to sleep for 2 seconds in order to make sure that the Thread where the "audioProcessStart" method is supposed to run has time to get executed. Thank you in advance for your prompt response

user3257758
  • 17
  • 1
  • 5

2 Answers2

1

In the upcoming 1.2 release, IGnMusicIdStreamEvents includes a callback that signals audio-processing has started, and an ID can be synced with this, e.g.:

@Override
public void musicIdStreamProcessingStatusEvent( GnMusicIdStreamProcessingStatus status, IGnCancellable canceller ) {

    if (GnMusicIdStreamProcessingStatus.kStatusProcessingAudioStarted.compareTo(status) == 0) {
            try {
                    gnMusicIdStream.identifyAlbumAsync();

            } catch (GnException e) { }
        }

}   
hpham
  • 11
  • 3
0

Thanks for the feedback, you're right about this issue. Unfortunately right now sleeping is the best solution. But we are adding support for an explicit sync event in an upcoming release, please stay tuned.

cweichen
  • 493
  • 3
  • 5
  • Thanks for your prompt answer @cweichen. By the way, is your system taking some time ingesting new music? The reason I am asking is because I have music that i can find using the text search api but I can't get it to be identified using the musicId-stream api . I have come across similar situation many times and I was wondering if it is an expected scenario or it is a bug with the musicId algorithm or it is just a coincidence :) – user3257758 Sep 11 '14 at 21:25