本文整理汇总了C++中Music::Free方法的典型用法代码示例。如果您正苦于以下问题:C++ Music::Free方法的具体用法?C++ Music::Free怎么用?C++ Music::Free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Music
的用法示例。
在下文中一共展示了Music::Free方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ForkedProcess
void ForkedProcess (const char * file, float fade, int fd) {
printf ("initing device drivers\n");
if (!FSOUND_Init(44100, 64, FSOUND_INIT_GLOBALFOCUS))
{
printf("SOUND Error %d\n", FSOUND_GetError());
exit(1);
}
Music mus;
mus.Load(file);
if (mus.m) {
mus.Play(fade);
printf ("f0rked playing %s\n",file);
while (!INET_BytesToRead(fd)) {
if (AllDone) {
printf ("song done\n");
mus.Free();
return;
}
}
mus.Stop();
mus.Free();
}
return;
}
示例2: Play
/*
*
* void Play(float fadeout, float fadein, Music &oldmusic){
* if (!m) return;
* FSOUND_Stream_SetEndCallback(m,endcallback,0);
* FSOUND_Stream_SetSynchCallback(m, endcallback, 0);
* channel = FSOUND_Stream_PlayEx(FSOUND_FREE, m, NULL, 1);
* FSOUND_SetPaused(channel, 0);
* SetVolume(0);
* if (fadeout*100>1) {
* for (unsigned int i=0;i<fadeout*100;i++) {
* SetVolume(i/(float)fadeout);
* oldmusic.SetVolume(((float)fadeout-i)/fadeout);
* micro_sleep (10000);
* }
* }
* SetVolume(1);
* oldmusic.Stop();
* }
* void SetVolume(float vol) {
* if (m) {
* F_API FSOUND_SetVolume(this->channel,(int)(vol*GetMaxVolume()));
* }
* }
*/
void Play( float fadeout, float fadein, Music &oldmusic )
{
if (!m) return;
FSOUND_Stream_SetEndCallback( m, endcallback, 0 );
FSOUND_Stream_SetSynchCallback( m, endcallback, 0 );
channel = FSOUND_Stream_Play( FSOUND_FREE, m );
SetVolume( 0 );
if (fadeout*10 > 1)
for (unsigned int i = 0; i < fadeout*10; i++) {
float ratio = ( (float) i )/(fadeout*10.);
SetVolume( ratio );
oldmusic.SetVolume( 1-ratio );
micro_sleep( 10000 );
}
oldmusic.Stop();
oldmusic.Free();
SetVolume( 1 );
}