소스 검색

audio: don't die when failing to load a sample with SDL.

legacy
Sam Hocevar sam 11 년 전
부모
커밋
0c85df6717
1개의 변경된 파일6개의 추가작업 그리고 7개의 파일을 삭제
  1. +6
    -7
      src/sample.cpp

+ 6
- 7
src/sample.cpp 파일 보기

@@ -112,11 +112,7 @@ Sample::Sample(char const *path)
}
if (!data->m_chunk)
{
#if !LOL_RELEASE
Log::Error("could not load sample %s\n", path);
#endif
SDL_Quit();
exit(1);
}
data->m_channel = -1;
#endif
@@ -127,7 +123,8 @@ Sample::~Sample()
#if __CELLOS_LV2__
/* Nothing to do */
#elif defined USE_SDL_MIXER
Mix_FreeChunk(data->m_chunk);
if (data->m_chunk)
Mix_FreeChunk(data->m_chunk);
#endif
delete data;
}
@@ -174,7 +171,8 @@ void Sample::Play()
CELL_MS_SPEAKER_FR, CELL_MS_CHANNEL_0, 1.0f);
cellMSStreamPlay(data->m_channel);
#elif defined USE_SDL_MIXER
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, 0);
if (data->m_chunk)
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, 0);
#endif
}

@@ -184,7 +182,8 @@ void Sample::Loop()
/* FIXME: not implemented */
Play();
#elif defined USE_SDL_MIXER
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, -1);
if (data->m_chunk)
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, -1);
#endif
}



불러오는 중...
취소
저장