Hintergrundsound



  • Hallo,
    weiß jemand wie ich einen hintergrundsound in meinem Spiel einbaue, ohne das er dann hängenbleibt? Hintergrundsoundformat = WAV

    Danke und tschüss



  • Was meinst du mit hängenbleiben ?



  • Damit mein ich das er erst mit dem Script weitermacht, wenn der Sound zuende ist, ich benutze PlaySound(); also PlaySound("planeloop.wav",NULL,SND_FILENAME);



  • Ich verschieb dich mal nach Winapi 🙂



  • Juhu, ich habs geschafft, mit fmod:

    .
    .
    .
    FSOUND_SAMPLE *pSound;                  // This will hold our sound pointer to the song
        int soundChannel = 0;                   // This is the sound channel our song is on
        if (FSOUND_GetVersion() < FMOD_VERSION)
        {
            // Display the error message that shows we need the correct version
            PostQuitMessage(0);
        }
    
        if (!FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS))
        {
            PostQuitMessage(0);
        }
        pSound=FSOUND_Sample_Load(FSOUND_FREE,"planeloop.wav",0,1);
    
        if (!pSound)
        {
            PostQuitMessage(0);
        }
        soundChannel = FSOUND_PlaySound(FSOUND_FREE,pSound);                
    //  FSOUND_PlaySound(FSOUND_FREE,pSound2);              
        //getch();
        while(1)                                            // Do our infinite loop
        {                                                   // Check if there was a message
            if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
            { 
                if(msg.message == WM_QUIT)                  // If the message wasn't to quit
                    break;
                TranslateMessage(&msg);                     // Find out what the message does
                DispatchMessage(&msg);                      // Execute the message
            }
            else                                            // if there wasn't a message
            { 
                Fly();
                g_Camera.Update();                          // Update the camera data
                RenderScene();                              // Render the scene every frame
            } 
        }
    
        DeInit();                                           // Clean up and free all allocated memory
        FSOUND_StopSound(soundChannel);
        FSOUND_Close();
    
    .
    .
    .
    


  • Wie wärs mit

    PlaySound("planeloop.wav",NULL,SND_FILENAME|<b>SND_ASYNC</b> );
    

    ???


Anmelden zum Antworten