libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
libZPlayDelphi.TCallbackMessage Enumeration

Callback messages.

Pascal
TCallbackMessage = (
  MsgStopAsync = 1,
  MsgPlayAsync = 2,
  MsgEnterLoopAsync = 4,
  MsgExitLoopAsync = 8,
  MsgEnterVolumeSlideAsync = 16,
  MsgExitVolumeSlideAsync = 32,
  MsgStreamBufferDoneAsync = 64,
  MsgStreamNeedMoreDataAsync = 128,
  MsgNextSongAsync = 256,
  MsgStop = 65536,
  MsgPlay = 131072,
  MsgEnterLoop = 262144,
  MsgExitLoop = 524288,
  MsgEnterVolumeSlide = 1048576,
  MsgExitVolumeSlide = 2097152,
  MsgStreamBufferDone = 4194304,
  MsgStreamNeedMoreData = 8388608,
  MsgNextSong = 16777216,
  MsgWaveBuffer = 33554432,
  MsgAll = -1,
  MsgAllAsync = 65535,
  MsgAllSync = -65536
);
Parameters 
Description 
MsgStopAsync 
Send this message after song stops playing. Wave device is closed and decoding thread is ending.

param1: not used, always is 0
param2: not used, always is 0
return: not used
 
MsgPlayAsync 
Send this message when decoding thread starts and playing is about to start. Wave device is not open yet, but decoding thread is created.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgEnterLoopAsync 
Send this message when decoding thread enters loop processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgExitLoopAsync 
Send this message when decoding thread exits loop processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgEnterVolumeSlideAsync 
Send this message when decoding thread enters volume slide processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgExitVolumeSlideAsync 
Send this message when decoding thread exits volume slide processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgStreamBufferDoneAsync 
Send this message when one buffer is done and removed from dynamic stream.

param1: number of buffers remaining in dynamic stream
param2: number of bytes remaining in dynamic stream
return: not used 
MsgStreamNeedMoreDataAsync 
Send this message when dynamic stream needs more data.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgNextSongAsync 
Send this message when decoding thread starts playing next song from gapless queue.

param1: index of playing song
param2: number of songs remaining in gapless queue
return: not used 
MsgStop 
Send this message after song stops playing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgPlay 
Send this message when decoding thread starts and playing is about to start.

param1: not used, always is 0
param2: not used, always is 0
return: 0 continue playing, 1 break decoding thread and don't play anything 
MsgEnterLoop 
Send this message when decoding thread enters loop processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgExitLoop 
Send this message when decoding thread exits loop processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgEnterVolumeSlide 
Send this message when decoding thread enters volume slide processing.

param1: not used, always is 0
param2: not used, always is 0
return: 0 continue volume slide processing, 1 don't even start volume slide processing 
MsgExitVolumeSlide 
Send this message when decoding thread exits fade processing.

param1: not used, always is 0
param2: not used, always is 0
return: not used 
MsgStreamBufferDone 
Send this message when one buffer is done and removed from dynamic stream.

param1: number of buffers remaining in dynamic stream
param2: number of bytes remaining in dynamic stream
return: not used 
MsgStreamNeedMoreData 
Send this message when dynamic stream needs more data.

param1: not used, always is 0
param2: not used, always is 0
return: 0 wait for new data, 1 stop playing, 2 don't wait, try again 
MsgNextSong 
Send this message when decoding thread starts playing next song from gapless queue.

param1: index of playing song
param2: number of songs remaining in gapless queue
return: not used 
MsgWaveBuffer 
Send this message when decoding thread is ready to send data to soundcard.

param1: pointer to memory PCM data buffer
param2: number of bytes in PCM data buffer
return: 0 send data to soundcard, 1 skip sending data to soundcard, 2 stop playing

Note: PCM data buffer always contains 16 bit per sample, 2 channel PCM data.
Even if input data is 1 channel (mono), output data are always 16 bit per sample, 2 channel.
 

There are 2 types of messages. Sync (blocking) and async (non blocking) messages. 

Sync message is sent from decoding thread and thread is waiting until callback function returns, so thread is blocked until user process sync message. Return value from sync message can be used to control decoding thread. 

Note: DON'T CALL other interface functions from sync message because this will block decoding thread and calling thread. 

Async message is sent from another thread and this message is not blocking, decoding thread continues to play. Return value from async message is not used.

Copyright (c) 2010. Zoran Cindori - All rights reserved.

Web: http://libzplay.sourceforge.net/

Email: zcindori@inet.hr