<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Mp3-Player: wann ist das mp3 zu ende?]]></title><description><![CDATA[<p>hi leute</p>
<p>ich spiele mp3 wie folgt ab:</p>
<pre><code class="language-cpp">mciSendString(&quot;play MP3 from 0 notify&quot;,ReturnString,lstrlen(ReturnString), hAppWnd);

// in hAppWnd wird die Notify-Msg abgefangen
case MM_MCINOTIFY:

if (openMp3)
{
if (playMp3)
{
    Mp3Close();

    if (currNr_+1 &lt;= AllMp3s_.size()-1)      //  vector&lt;string&gt; AllMp3s_;
    {                                        //    - da drin sind die pfade der dateien gepeichert
        ++currNr_;                           //    - wird beim öffnen eines ordners gefüllt
        Mp3Play(AllMp3s_[currNr_].c_str());
    }
    else
    {
        currNr_ = 0;
        Mp3Play(AllMp3s_[currNr_].c_str());
    }
}
}
return 0;
// -----------
void Mp3Close()
{
    playMp3 = false;
    openMp3 = false;
    mciSendString(&quot;close MP3 wait&quot;, 0, 0, 0);
}
// -----------
void Mp3Play(const char * szFileName)
{
    if (openMp3) // falls schon etwas läuft
    {
        Mp3Close();
    }

    DWORD ErrorValue;
    char command[255] = &quot;&quot;;
    char ReturnString[255] = &quot;&quot;;

    // Öffnen
    wsprintf(command, &quot;open \&quot;%s\&quot; alias MP3 wait&quot;, szFileName); 
    if (ErrorValue = mciSendString(command,ReturnString,lstrlen(ReturnString), 0))
    {
        char lpszErrorText[255] = &quot;&quot;;
        mciGetErrorString(ErrorValue,lpszErrorText,lstrlen(lpszErrorText));
        MessageBox(hAppWnd, lpszErrorText, &quot;OPEN MP3&quot;, MB_OK | MB_ICONERROR);
        return;
    }    
    openMp3 = true; // öffnen hat geklappt

    // Das Zeitformat auf Millisekunden setzen:
    wsprintf(command,&quot;set MP3 time format milliseconds&quot;);
    if (mciSendString(command,ReturnString,lstrlen(ReturnString),NULL))
    {
        MessageBox(hAppWnd,&quot;Unable to set time format &quot;,&quot;mci-error&quot;,0);
        return;
    }

    // Abspielen
    if (ErrorValue = mciSendString(&quot;play MP3 from 0 notify&quot;,ReturnString,lstrlen(ReturnString), hAppWnd))
    {
        char lpszErrorText[255] = &quot;&quot;;
        mciGetErrorString(ErrorValue,lpszErrorText,lstrlen(lpszErrorText));
        MessageBox(hAppWnd, lpszErrorText, &quot;PLAY MP3&quot;, MB_OK | MB_ICONERROR);
        return;
    }
    playMp3 = true; // play hat geklappt
}
</code></pre>
<p>Das Problem ist relativ seltsam: zwei songs lang läuft alles normal. Dann plötzlich werden die songs geöffnet (der name wird in einem static angezeigt), und sofort der nächste song, dann der nächste.. beim ende des verzeichnisses schön brav wieder an den anfang, aber halt viel zu schnell (10ms / song oder so..)</p>
<p>vermutung: das abfangen der notify-message ist irgendwie problematisch (denn anscheinend wird diese sofort nach dem öffnen gesendet..)<br />
danke für eure hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/93273/mp3-player-wann-ist-das-mp3-zu-ende</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 02:30:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/93273.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 27 Nov 2004 23:34:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mp3-Player: wann ist das mp3 zu ende? on Sat, 27 Nov 2004 23:34:49 GMT]]></title><description><![CDATA[<p>hi leute</p>
<p>ich spiele mp3 wie folgt ab:</p>
<pre><code class="language-cpp">mciSendString(&quot;play MP3 from 0 notify&quot;,ReturnString,lstrlen(ReturnString), hAppWnd);

// in hAppWnd wird die Notify-Msg abgefangen
case MM_MCINOTIFY:

if (openMp3)
{
if (playMp3)
{
    Mp3Close();

    if (currNr_+1 &lt;= AllMp3s_.size()-1)      //  vector&lt;string&gt; AllMp3s_;
    {                                        //    - da drin sind die pfade der dateien gepeichert
        ++currNr_;                           //    - wird beim öffnen eines ordners gefüllt
        Mp3Play(AllMp3s_[currNr_].c_str());
    }
    else
    {
        currNr_ = 0;
        Mp3Play(AllMp3s_[currNr_].c_str());
    }
}
}
return 0;
// -----------
void Mp3Close()
{
    playMp3 = false;
    openMp3 = false;
    mciSendString(&quot;close MP3 wait&quot;, 0, 0, 0);
}
// -----------
void Mp3Play(const char * szFileName)
{
    if (openMp3) // falls schon etwas läuft
    {
        Mp3Close();
    }

    DWORD ErrorValue;
    char command[255] = &quot;&quot;;
    char ReturnString[255] = &quot;&quot;;

    // Öffnen
    wsprintf(command, &quot;open \&quot;%s\&quot; alias MP3 wait&quot;, szFileName); 
    if (ErrorValue = mciSendString(command,ReturnString,lstrlen(ReturnString), 0))
    {
        char lpszErrorText[255] = &quot;&quot;;
        mciGetErrorString(ErrorValue,lpszErrorText,lstrlen(lpszErrorText));
        MessageBox(hAppWnd, lpszErrorText, &quot;OPEN MP3&quot;, MB_OK | MB_ICONERROR);
        return;
    }    
    openMp3 = true; // öffnen hat geklappt

    // Das Zeitformat auf Millisekunden setzen:
    wsprintf(command,&quot;set MP3 time format milliseconds&quot;);
    if (mciSendString(command,ReturnString,lstrlen(ReturnString),NULL))
    {
        MessageBox(hAppWnd,&quot;Unable to set time format &quot;,&quot;mci-error&quot;,0);
        return;
    }

    // Abspielen
    if (ErrorValue = mciSendString(&quot;play MP3 from 0 notify&quot;,ReturnString,lstrlen(ReturnString), hAppWnd))
    {
        char lpszErrorText[255] = &quot;&quot;;
        mciGetErrorString(ErrorValue,lpszErrorText,lstrlen(lpszErrorText));
        MessageBox(hAppWnd, lpszErrorText, &quot;PLAY MP3&quot;, MB_OK | MB_ICONERROR);
        return;
    }
    playMp3 = true; // play hat geklappt
}
</code></pre>
<p>Das Problem ist relativ seltsam: zwei songs lang läuft alles normal. Dann plötzlich werden die songs geöffnet (der name wird in einem static angezeigt), und sofort der nächste song, dann der nächste.. beim ende des verzeichnisses schön brav wieder an den anfang, aber halt viel zu schnell (10ms / song oder so..)</p>
<p>vermutung: das abfangen der notify-message ist irgendwie problematisch (denn anscheinend wird diese sofort nach dem öffnen gesendet..)<br />
danke für eure hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/660865</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/660865</guid><dc:creator><![CDATA[nate7]]></dc:creator><pubDate>Sat, 27 Nov 2004 23:34:49 GMT</pubDate></item><item><title><![CDATA[Reply to Mp3-Player: wann ist das mp3 zu ende? on Sun, 28 Nov 2004 19:51:17 GMT]]></title><description><![CDATA[<p>hat sich erledigt..<br />
ich frage nun die aktuelle position ab. nur wenn diese grösser als 1s ist, passiert etwas.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/661334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/661334</guid><dc:creator><![CDATA[nate7]]></dc:creator><pubDate>Sun, 28 Nov 2004 19:51:17 GMT</pubDate></item></channel></rss>