📄 xaudioplayer.pas
字号:
if Assigned(FOnNotifyOutputDeviceInfo) then
FOnNotifyOutputDeviceInfo(self,
xa_msg.device_info.module_id,
xa_msg.device_info.index,
xa_msg.device_info.flags,
xa_msg.device_info.name,
xa_msg.device_info.description);
end;
XA_MSG_NOTIFY_OUTPUT_FILTER_INFO:
begin
if Assigned(FOnNotifyOutputFilterInfo) then
FOnNotifyOutputFilterInfo(self,
xa_msg.filter_info.id,
xa_msg.filter_info.name);
end;
XA_MSG_NOTIFY_STREAM_MIME_TYPE:
begin
if Assigned(FOnNotifyStreamMimeType) then
FOnNotifyStreamMimeType(self, xa_msg.mime_type);
end;
XA_MSG_NOTIFY_STREAM_DURATION:
begin
if Assigned(FOnNotifyStreamDuration) then
FOnNotifyStreamDuration(self, xa_msg.duration);
end;
XA_MSG_NOTIFY_STREAM_PARAMETERS:
begin
if Assigned(FOnNotifyStreamParameters) then
FOnNotifyStreamParameters(self,
xa_msg.stream_parameters.frequency,
xa_msg.stream_parameters.bitrate,
xa_msg.stream_parameters.nb_channels);
end;
XA_MSG_NOTIFY_STREAM_PROPERTIES:
begin
if Assigned(FOnNotifyStreamProperties) then
FOnNotifyStreamProperties(self,
xa_msg.properties.nb_properties,
xa_msg.properties.properties);
end;
XA_MSG_NOTIFY_CODEC_MODULE:
begin
if Assigned(FOnNotifyCodecModule) then
FOnNotifyCodecModule(self, xa_msg.module_id);
end;
XA_MSG_NOTIFY_CODEC_MODULE_INFO:
begin
if Assigned(FOnNotifyCodecModuleInfo) then
FOnNotifyCodecModuleInfo(self,
xa_msg.module_info.id,
xa_msg.module_info.nb_devices,
xa_msg.module_info.name,
xa_msg.module_info.description);
end;
XA_MSG_NOTIFY_CODEC_DEVICE_INFO:
begin
if Assigned(FOnNotifyCodecDeviceInfo) then
FOnNotifyCodecDeviceInfo(self,
xa_msg.device_info.module_id,
xa_msg.device_info.index,
xa_msg.device_info.flags,
xa_msg.device_info.name,
xa_msg.device_info.description);
end;
XA_MSG_NOTIFY_CODEC_QUALITY:
begin
if Assigned(FOnNotifyCodecQuality) then
FOnNotifyCodecQuality(self, xa_msg.quality);
end;
XA_MSG_NOTIFY_CODEC_EQUALIZER:
begin
if Assigned(FOnNotifyCodecEqualizer) then
FOnNotifyCodecEqualizer(self, xa_msg.equalizer^);
end;
XA_MSG_NOTIFY_NOTIFICATION_MASK:
begin
if Assigned(FOnNotifyNotificationMask) then
FOnNotifyNotificationMask(self, xa_msg.notification_mask);
end;
XA_MSG_NOTIFY_DEBUG_LEVEL:
begin
if Assigned(FOnNotifyDebugLevel) then
FOnNotifyDebugLevel(self, xa_msg.debug_level);
end;
XA_MSG_NOTIFY_PROGRESS:
begin
if Assigned(FOnNotifyProgress) then
FOnNotifyProgress(self,
xa_msg.progress.source,
xa_msg.progress.code,
xa_msg.progress.value,
xa_msg.progress.msg);
end;
XA_MSG_NOTIFY_DEBUG:
begin
if Assigned(FOnNotifyDebug) then
FOnNotifyDebug(self,
xa_msg.debug.source,
xa_msg.debug.level,
xa_msg.debug.msg);
end;
XA_MSG_NOTIFY_ERROR:
begin
if Assigned(FOnNotifyError) then
FOnNotifyError(self,
xa_msg.error.source,
xa_msg.error.code,
xa_msg.error.msg);
end;
end;
end;
{************************************************************}
function TXaudioPlayer.GetVersion(VersionId: Byte): Cardinal;
begin
if (Player <> nil) then
GetVersion := XaudioGetVersion(VersionId)
else
GetVersion := 0;
end;
{************************************************************}
procedure TXaudioPlayer.SetPriority(Priority: Cardinal);
begin
if (Player <> nil) then
PlayerSetPriority(Player, Priority)
else
PlayerPriority := Priority;
end;
{************************************************************}
function TXaudioPlayer.GetPriority: Cardinal;
begin
if (Player <> nil) then
GetPriority := PlayerGetPriority(Player)
else
GetPriority := PlayerPriority;
end;
{************************************************************}
function TXaudioPlayer.ErrorString(Code: Integer): string;
begin
if CheckPlayerInstance then
ErrorString := XaudioErrorString(Code)
else
ErrorString := '';
end;
{************************************************************}
procedure TXaudioPlayer.Ping(Tag: Cardinal);
begin
if CheckPlayerInstance then
ControlMessageSend_I(Player, XA_MSG_COMMAND_PING, Tag);
end;
{************************************************************}
procedure TXaudioPlayer.Play;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_PLAY);
end;
{************************************************************}
procedure TXaudioPlayer.Pause;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_PAUSE);
end;
{************************************************************}
procedure TXaudioPlayer.Stop;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_STOP);
end;
{************************************************************}
procedure TXaudioPlayer.Synchronize;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_SYNC);
end;
{************************************************************}
procedure TXaudioPlayer.InputSeek(Offset: Cardinal; Range: Cardinal);
begin
if CheckPlayerInstance then
ControlMessageSend_II(Player, XA_MSG_COMMAND_SEEK, Offset, Range);
end;
{************************************************************}
procedure TXaudioPlayer.InputOpen(const Name: String);
begin
if CheckPlayerInstance then
ControlMessageSend_S(Player, XA_MSG_COMMAND_INPUT_OPEN, PChar(Name));
end;
{************************************************************}
procedure TXaudioPlayer.InputClose;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_INPUT_CLOSE);
end;
{************************************************************}
procedure TXaudioPlayer.InputSendMessage(MsgType: Word; const Data: Pointer; Size: Cardinal);
begin
if CheckPlayerInstance then
ControlMessageSend_IPI(Player, XA_MSG_COMMAND_INPUT_SEND_MESSAGE, MsgType, Data, Size);
end;
{************************************************************}
procedure TXaudioPlayer.InputAddFilter(const Name: String; Where: Integer);
begin
if CheckPlayerInstance then
ControlMessageSend_SI(Player, XA_MSG_COMMAND_INPUT_ADD_FILTER, PChar(Name), Where);
end;
{************************************************************}
procedure TXaudioPlayer.InputRemoveFilter(const Name: String; ID: Integer);
begin
if CheckPlayerInstance then
ControlMessageSend_SI(Player, XA_MSG_COMMAND_INPUT_REMOVE_FILTER, PChar(Name), ID);
end;
{************************************************************}
procedure TXaudioPlayer.InputFilterList;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_INPUT_FILTERS_LIST);
end;
{************************************************************}
procedure TXaudioPlayer.InputModuleRegister(const Name: String);
begin
if CheckPlayerInstance then
ControlMessageSend_S(Player, XA_MSG_COMMAND_INPUT_MODULE_REGISTER, PChar(Name));
end;
{************************************************************}
procedure TXaudioPlayer.InputModuleQuery(ID: Cardinal);
begin
if CheckPlayerInstance then
ControlMessageSend_I(Player, XA_MSG_COMMAND_INPUT_MODULE_QUERY, ID);
end;
{************************************************************}
procedure TXaudioPlayer.InputModulesList;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_INPUT_MODULES_LIST);
end;
{************************************************************}
procedure TXaudioPlayer.OutputOpen(const Name: String);
begin
if CheckPlayerInstance then
ControlMessageSend_S(Player, XA_MSG_COMMAND_OUTPUT_OPEN, PChar(Name));
end;
{************************************************************}
procedure TXaudioPlayer.OutputClose;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_OUTPUT_CLOSE);
end;
{************************************************************}
procedure TXaudioPlayer.OutputMute;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_OUTPUT_MUTE);
end;
{************************************************************}
procedure TXaudioPlayer.OutputUnmute;
begin
if CheckPlayerInstance then
ControlMessageSend_N(Player, XA_MSG_COMMAND_OUTPUT_UNMUTE);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -