瀏覽代碼

audio: do not free buffers that SDL may be using.

legacy
Sam Hocevar 8 年之前
父節點
當前提交
a45a0d45d1
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. +3
    -3
      src/audio/audio.cpp

+ 3
- 3
src/audio/audio.cpp 查看文件

@@ -33,6 +33,7 @@ struct audio_streamer
int m_channel;
std::function<void(void *, int)> m_callback;
#if defined LOL_USE_SDL_MIXER
array<uint8_t> m_empty; // SDL keeps a reference to this
Mix_Chunk *m_chunk;
#endif
};
@@ -95,9 +96,8 @@ int audio::start_streaming(std::function<void(void *, int)> const &f)
audio_streamer *s = new audio_streamer();
g_streamers.push(s);

array<uint8_t> empty;
empty.resize(1024);
s->m_chunk = Mix_QuickLoad_RAW(empty.data(), empty.bytes());
s->m_empty.resize(1024);
s->m_chunk = Mix_QuickLoad_RAW(s->m_empty.data(), s->m_empty.bytes());
s->m_channel = Mix_PlayChannel(-1, s->m_chunk, -1);
s->m_callback = f;
Mix_RegisterEffect(s->m_channel, trampoline, nullptr, s);


Loading…
取消
儲存