0
0

hi!
I have some mp3 files in a list.If i call my function to play a sound it takes 3 seconds to beginn playing my sound. Thats a big problem. What its false on my functions?What should i do to can play the sounds faster and not wait 3 seconds if i call another song?

here my code:
[code]

void Form1::init()
{

  FSOUND_SetBufferSize(100);  /* This is nescessary to get FX to work on output buffer */
 FSOUND_Init(44100, 16, FSOUND_INIT_ENABLESYSTEMCHANNELFX);

}

[/code]

[code]
FSOUND_SAMPLE *samp1= 0;
void Form1::playMPEFiles()
{
stopPlaying();
listView->setFocus();

if (listView->currentItem() == 0){
QMessageBox::information(this, 
("Info"),("List is Empty"));
}

else{
/* PCM,44,100 Hz, 16 Bit, Stereo */
samp1 = FSOUND_Sample_Load(FSOUND_FREE, mymusicpath + “/” +listView->currentItem()->text( 1) + “/” + ( listView->currentItem() )->text( 0 ) + “”, FSOUND_HW2D, 0, 0);
FSOUND_PlaySound(FSOUND_FREE, samp1);
//Panorama und volume initialisieren
changePanorama();
setVolume();

QString test =   QString::number(FSOUND_Sample_GetLength(samp1));
  QTimer *timer = new QTimer( this);
    connect( timer, SIGNAL(timeout()), this, SLOT(getPosition()) );
    timer->start( 2000, FALSE ); // 2 seconds single-shot time   

}
}
[/code]

  • You must to post comments
0
0

hi, after reading a litle i think i am in the right way. Wih this code i can play my songs very fast. So please let me know if its perfekt..

[code]
FSOUND_Init(44100, 16, 0);
FSOUND_STREAM *stream;

stream = FSOUND_Stream_Open(mymusicpath + "/" +listView->currentItem()->text( 1)  + "/" + ( listView->currentItem() )->text( 0 ) + "", FSOUND_NORMAL, 0, 0);        
FSOUND_Stream_Play(FSOUND_FREE, stream);  

[/code]

Its right that FOUND_INIT is every time needed?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.