0
0

Hi there,

I searched the forum for a while, but I couldn’t find a real answer, here’s my codes:

[code:12l8uqs0]
/*===============================================================================================
Technobase.FM Player – Spielt den Technobase.FM MP3 Stream ab und bietet eine Community Platform

TO-DO:

-Interface
-ACC Stream abspielen können
-Sämtliche Features
===============================================================================================*/

include "main.h"

///Mainwindow erstellen
int WINAPI WinMain( HINSTANCE, HINSTANCE, PSTR, int )
{

HWND hwnd = FindWindow("ConsoleWindowClass",NULL);
//ShowWindow(hwnd,SW_HIDE);

/*
SetApplicationMainFormOnTaskBar(Application, false);
Application->CreateForm(__classid(TForm2), &Form2);
DWORD dwExStyle=GetWindowLong(Application->Handle,GWL_EXSTYLE);
dwExStyle |= WS_EX_TOOLWINDOW;
SetWindowLong(Application->Handle,GWL_EXSTYLE,dwExStyle);
*/

///Irrlicht Device + Irrlicht System erstellen

device = createDevice(EDT_OPENGL, dimension2d<s32>(320, 240), 16, false, false, false, 0);

device->setWindowCaption(L"TechnoBase.FM Player - 2008 by Christian Sauthoff");

driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
//filesys = device->getFileSystem();

///Interface erstellen

Prozentanzeige = guienv->addStaticText(L"We aRe oNe!",rect<s32>(10, 10, 10+100, 10+20));


///FMOD Initialiesieren

FSOUND_Init(32000, 64, 0);
FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE);

FSOUND_SetPaused(FSOUND_SYSTEMCHANNEL, true);
FSOUND_FX_Enable(0, FSOUND_FX_PARAMEQ);
FSOUND_SetPaused(FSOUND_SYSTEMCHANNEL, false);

FSOUND_Stream_SetBufferSize(100);
FSOUND_Stream_Net_SetBufferProperties(64000, 60, 80);
TechnobaseFM_Stream = FSOUND_Stream_Open("http://dsl.tb-stream.net:80", FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0);





///Hauptschleife
while(device->run())
{
    driver->beginScene(true, true, SColor(255,255,255,255)); ///Irrlicht Szene Beginnen


    //UpdateKeys();
    UpdateStream();

    //ShowPercent();
    ShowSpectrum();


    smgr->drawAll();
    guienv->drawAll();
    driver->endScene(); ///Irrlicht Szene beenden

}

///Programm beenden
device->drop();

FSOUND_Stream_Close(TechnobaseFM_Stream);
FSOUND_Close();

}

///========================================================================================================================
///==================================================FUNKTIONEN============================================================
///========================================================================================================================

int GetStreamStatus()
{
FSOUND_Stream_Net_GetStatus(TechnobaseFM_Stream, &StreamStatus, &Prozent_Geladen, &StreamBitrate, &Stream_Flags);
return 5;
}

int GetStreamPercent()
{
FSOUND_Stream_Net_GetStatus(TechnobaseFM_Stream, &StreamStatus, &Prozent_Geladen, &StreamBitrate, &Stream_Flags);
return Prozent_Geladen;
}
void ShowPercent()
{
ProzentanzeigeStr=L"";
ProzentanzeigeStr.append(stringw(GetStreamPercent()));
Prozentanzeige->setText(ProzentanzeigeStr.c_str());
}
void ShowSpectrum()
{

SpectrumBalken=FSOUND_DSP_GetSpectrum();

    ProzentanzeigeStr=L"";
    ProzentanzeigeStr.append(stringw(SpectrumBalken[2]));
    Prozentanzeige->setText(ProzentanzeigeStr.c_str());

}

void UpdateKeys()
{

///Tastenabfragen
if (kbhit())
{
    LetzteTaste = getch();

    if (LetzteTaste == ' ')
    {
        if(PauseAktiv) {
            FSOUND_SetPaused(TechnobaseFM_Channel, false);
            PauseAktiv=false;
        }
        else if(!PauseAktiv) {
            FSOUND_SetPaused(TechnobaseFM_Channel, true);
            PauseAktiv=true;
        }
    }
}

}

void UpdateStream()
{

    if (TechnobaseFM_Channel < 0 && Prozent_Geladen>90)  ///Wenn Noch nicht abgespielt, und genug vorgebuffert abspielen
    {
        TechnobaseFM_Channel = FSOUND_Stream_PlayEx(FSOUND_FREE, TechnobaseFM_Stream, NULL, TRUE);
        FSOUND_SetVolume(TechnobaseFM_Channel, 10);
        FSOUND_SetPaused(TechnobaseFM_Channel, FALSE);
    }
    //Sleep(16);

}
[/code:12l8uqs0]

It’s a bit german text in it, but I hope you can understand it.

Why do I get only zeros?

Thanks

Fatal1ty

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.