소스 검색

tutorial: fix a signedness bug in the sound tutorial.

legacy
Sam Hocevar 6 년 전
부모
커밋
70847edb61
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. +3
    -3
      doc/tutorial/09_sound.cpp

+ 3
- 3
doc/tutorial/09_sound.cpp 파일 보기

@@ -41,16 +41,16 @@ public:

void synth(int mode, void *buf, int bytes)
{
uint16_t *stream = (uint16_t *)buf;
int16_t *stream = (int16_t *)buf;
for (int i = 0; i < bytes / 2; ++i)
{
switch (mode)
{
case 0: // sine wave
stream[i] = 400 * lol::sin(8 * i * F_TAU / bytes);
stream[i] = lol::sin(4 * i * F_TAU / bytes) > 0 ? 800 : -800;
break;
case 1: // white noise
stream[i] = lol::rand(-120, 120);
stream[i] = lol::rand(-200, 200);
break;
}
}


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