For some reason my way of volume control is not affecting midi music but works perfect for .wav, .mp2, .mp3, .wma and .ogg files....
Also usually when a track is finished in my application it automatically go's to the next one, it has always worked with anything except midi files, nothing happens when track ends....
Here's what I use for changing volume:
// For Audio.
MCI_SETAUDIO = $0873;
MCI_DGV_SETAUDIO_ITEM = $00800000;
MCI_DGV_SETAUDIO_VALUE = $01000000;
MCI_DGV_SETAUDIO_VOLUME = $4002;
MCI_DGV_STATUS_VOLUME = $4019;
Procedure TFrmMain.SetVolume(Var TMP: TCMediaPlayer; Const Volume: SmallInt);
Begin // Volume: 0 - 1000.
p.dwCallback := 0;
p.dwItem := MCI_DGV_SETAUDIO_VOLUME;
p.dwValue := Volume;
p.dwOver := 0;
p.lpstrAlgorithm := Nil;
p.lpstrQuality := Nil;
MCI_DGV_SETAUDIO_VALUE Or MCI_DGV_SETAUDIO_ITEM, Cardinal(@p));
And here's how I test to see if the track has ended:
If (MP.Mode = mpPlaying) And (MP.Position >= MP.TrackLength) Then // If song is finished. Begin ... ... ... etc End;
Anyone have any idea why these issues only arise on playing midi files? I suppose it isn't all that important but I would like to fix these problems.