現在、Win 7 64 ビット システムで Libspotify を実装しています。再生以外は問題ないようです。callback からデータを取得しますが、保存されたオーディオに audity を使用しても、異常がいっぱいです。さらに調査するために、win32 サンプル (spshell) を取得し、音楽データをファイルに保存するように変更しました。同じ問題、間違いなくこれらの目盛りが入った音楽です。ここに欠けている単純なものがあると確信していますが、何が問題なのか途方に暮れています。私たちのプロジェクトは、これを解決できるまで停止しているため、どんな助けも素晴らしいでしょう.
保存されたオーディオは、ここで見ることができます http://uploader.crestron.com/download.php?file=8001d80992480280dba365752aeaca81
以下は、ファイルを保存するために行ったコードの変更です (テストのみ)。
static FILE *pFile;
int numBytesToWrite=0;
CRITICAL_SECTION m_cs;
int SP_CALLCONV music_delivery(sp_session *s, const sp_audioformat *fmt, const void *frames, int num_frames)
{
if ( num_frames == 0 )
return;
EnterCriticalSection(&m_cs);
numBytesToWrite = ( num_frames ) * fmt->channels * sizeof(short);
if (numBytesToWrite > 0 )
fwrite(frames, sizeof(short), numBytesToWrite, pFile);
LeaveCriticalSection(&m_cs);
return num_frames;
}
static void playtrack_test(void)
{
sp_error err;
InitializeCriticalSection(&m_cs);
pFile = fopen ("C:\\zzzspotify.pcm","wb");
test_start(&playtrack);
if((err = sp_session_player_load(g_session, stream_track)) != SP_ERROR_OK) {
test_report(&playtrack, "Unable to load track: %s", sp_error_message(err));
return;
}
info_report("Streaming '%s' by '%s' this will take a while", sp_track_name(stream_track),
sp_artist_name(sp_track_artist(stream_track, 0)));
sp_session_player_play(g_session, 1);
}
void SP_CALLCONV play_token_lost(sp_session *s)
{
fclose(pFile);
DeleteCriticalSection(&m_cs);
stream_track_end = 2;
notify_main_thread(g_session);
info_report("Playtoken lost");
}
static int check_streaming_done(void)
{
if(stream_track_end == 2)
test_report(&playtrack, "Playtoken lost");
else if(stream_track_end == 1)
test_ok(&playtrack);
else
return 0;
fclose(pFile);
stream_track_end = 0;
return 1;
}