# why my sounds could only play 64 times?

**URL:** https://qa.fmod.com/t/why-my-sounds-could-only-play-64-times/14179
**Category:** FMOD Engine
**Created:** [November 6, 2018, 3:17pm UTC](https://qa.fmod.com/t/why-my-sounds-could-only-play-64-times/14179 "2018-11-06T15:17:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hlz2516](https://avatars.discourse-cdn.com/v4/letter/h/22d042/32.png) [@hlz2516](https://qa.fmod.com/u/hlz2516)
#### Post date: [November 6, 2018, 3:17pm UTC](https://qa.fmod.com/t/why-my-sounds-could-only-play-64-times/14179/1 "2018-11-06T15:17:17Z")

</div>

I want to write a program that can play many sounds by pressing some keys.But I found that after I pressed keys 64 times,the program couldn’t play any sounds! I have loaded all the sounds and I also declared channel and I use this channel to play each of sounds.the following is code:

int main()  
{  
FMOD\_RESULT result;  
FMOD::System \*system = NULL;  
result = FMOD::System\_Create(&system);  
if (result != FMOD\_OK)  
{  
std::cout \<\< “FMOD error!” \<\< result \<\< FMOD\_ErrorString(result) \<\< std::endl;  
}  
result = system-\>init(512, FMOD\_INIT\_NORMAL, 0);  
if (result != FMOD\_OK)  
{  
std::cout \<\< “FMOD error!” \<\< result \<\< FMOD\_ErrorString(result) \<\< std::endl;  
}

```
FMOD::Sound *sound[24];
string soundsign[2][13] = { { "C1", C1,SC1,D1,SD1,E1,F1,SF1,G1,SG1,A1,SA1,B1},
								{ "C",C,SC,D,SD,E,F,SF,G,SG,A,SA,B } };
string a;
std::cin >> a;
int a_value = 0;
for (int i = 0; i < 2; i++)
{
	if (soundsign[i][0] == a)
	{
		for (int j = 1; j < 13; j++)
		{
			system->createSound(soundsign[i][j].c_str(), FMOD_DEFAULT, NULL, &sound[j - 1]);
		}
		a_value = 1;
	}
}

FMOD::Channel *channel[24];
int ch = 0, cnt = 0;
while (ch != 27)
{
	ch = _getch();
	switch (ch)
	{
	case 'z':if (a_value == 0) break; else { result = system->playSound(sound[0], NULL, 0, &channel[0]); break; }
	case 'x':if (a_value == 0) break; else { result=system->playSound(sound[1], NULL, 0, &channel[0]); break; }
	case 'c':if (a_value == 0) break; else { result = system->playSound(sound[2], NULL, 0, &channel[0]);break; }
	case 'v':if (a_value == 0) break; else { result = system->playSound(sound[3], NULL, 0, &channel[0]);break; }
	case 'b':if (a_value == 0) break; else { result = system->playSound(sound[4], NULL, 0, &channel[0]); break; }
	case 'n':if (a_value == 0) break; else { result = system->playSound(sound[5], NULL, 0, &channel[0]);break; }
	case 'm':if (a_value == 0) break; else { result = system->playSound(sound[6], NULL, 0, &channel[0]);break; }
	case ',':if (a_value == 0) break; else { result = system->playSound(sound[7], NULL, 0, &channel[0]);break; }
	case '.':if (a_value == 0) break; else { result = system->playSound(sound[8], NULL, 0, &channel[0]);break; }
	case '/':if (a_value == 0) break; else { result = system->playSound(sound[9], NULL, 0, &channel[0]);break; }
	case 32:if (a_value == 0) break; else { result = system->playSound(sound[10], NULL, 0, &channel[0]);break; }
	case 13:if (a_value == 0) break; else { result = system->playSound(sound[11], NULL, 0, &channel[0]);break; }
	default:
		break;
	} //在弹奏一段时间后会出现不出声的情况，result也没有返回不正常。
	cnt++;
	cout << cnt << endl;
	if (result != FMOD_OK)
	{
		std::cout << "error!" << std::endl;
		break;
	}
}
std::system("pause");
system->release();
return 0;

```

}

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [November 9, 2018, 1:53am UTC](https://qa.fmod.com/t/why-my-sounds-could-only-play-64-times/14179/2 "2018-11-09T01:53:41Z")

</div>

Please call System::update in your loop so that the channel management can run.
