2
A
回答
7
下面的脚本,使一个按钮,通过它可以根据其当前状态播放或暂停流:
[Setup]
AppName=Bass Audio Project
AppVersion=1.0
DefaultDirName={pf}\Bass Audio Project
[Files]
Source: "Bass.dll"; Flags: dontcopy
Source: "AudioFile.mp3"; Flags: dontcopy
[CustomMessages]
SoundCtrlButtonCaptionSoundOn=Music on
SoundCtrlButtonCaptionSoundOff=Music off
[Code]
const
BASS_SAMPLE_LOOP = 4;
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 3;
BASS_UNICODE = $80000000;
BASS_CONFIG_GVOL_STREAM = 5;
const
#ifndef UNICODE
EncodingFlag = 0;
#else
EncodingFlag = BASS_UNICODE;
#endif
type
HSTREAM = DWORD;
function BASS_Init(device: LongInt; freq, flags: DWORD;
win: HWND; clsid: Cardinal): BOOL;
external '[email protected]:bass.dll stdcall';
function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD;
offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
external '[email protected]:bass.dll stdcall';
function BASS_Start: BOOL;
external '[email protected]:bass.dll stdcall';
function BASS_Pause: BOOL;
external '[email protected]:bass.dll stdcall';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL;
external '[email protected]:bass.dll stdcall';
function BASS_SetConfig(option: DWORD; value: DWORD): BOOL;
external '[email protected]:bass.dll stdcall';
function BASS_ChannelIsActive(handle: DWORD): DWORD;
external '[email protected]:bass.dll stdcall';
function BASS_Free: BOOL;
external '[email protected]:bass.dll stdcall';
var
SoundStream: HSTREAM;
SoundCtrlButton: TNewButton;
procedure SoundCtrlButtonClick(Sender: TObject);
begin
case BASS_ChannelIsActive(SoundStream) of
BASS_ACTIVE_PLAYING:
begin
if BASS_Pause then
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOn}');
end;
BASS_ACTIVE_PAUSED:
begin
if BASS_Start then
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
end;
end;
end;
procedure InitializeWizard;
begin
ExtractTemporaryFile('AudioFile.mp3');
if BASS_Init(-1, 44100, 0, 0, 0) then
begin
SoundStream := BASS_StreamCreateFile(False,
ExpandConstant('{tmp}\AudioFile.mp3'), 0, 0, 0, 0,
EncodingFlag or BASS_SAMPLE_LOOP);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
BASS_ChannelPlay(SoundStream, False);
SoundCtrlButton := TNewButton.Create(WizardForm);
SoundCtrlButton.Parent := WizardForm;
SoundCtrlButton.Left := 8;
SoundCtrlButton.Top := WizardForm.ClientHeight -
SoundCtrlButton.Height - 8;
SoundCtrlButton.Width := 155;
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
SoundCtrlButton.OnClick := @SoundCtrlButtonClick;
end;
end;
procedure DeinitializeSetup;
begin
BASS_Free;
end;
相关问题
- 1. jQuery音频按钮
- 2. Javascript AnalyserNode低频(低音)
- 3. 音频路由按钮 - AirPlay
- 4. 停止音频按钮
- 5. 分享音频按钮
- 6. 静音和取消静音按钮切换HTML5音频,
- 7. 音频低延迟与Python
- 8. 低频音符识别
- 9. 降低音频压缩率
- 10. PhoneGap iOS低延迟音频
- 11. 按下按钮时播放音频
- 12. 覆盖音量调高和音量调低按钮?
- 13. 音乐音调类检测音频库
- 14. C#音频库
- 15. HTML5音频库
- 16. Ruby音频库
- 17. MySql音频库
- 18. Javascript音频库
- 19. C++音频插件的音频库?
- 20. 静音和静音按钮
- 21. iPhone - 音量/静音按钮
- 22. 在iOS中从音频中提取高音和低音
- 23. 使用FFMPEG降低视频的音频
- 24. 播放/暂停按钮HTML5音频
- 25. JavaScript停止按钮单击的音频
- 26. html5音频多重播放按钮
- 27. Javascript按钮多个音频源
- 28. 音频控制器停止按钮
- 29. 音频完成后隐藏按钮
- 30. Iphone音频路由选择按钮
我会很感激任何反馈...你知道,这是唯一的动机我在这里写这种具体的解决方案。我花了一定的时间来写它,现在我只有一个赞成,没有任何反馈。这并不能让我满意,因为我已经完成了所有的工作,下一次我会考虑三次,然后才会把时间花在这样的事情上;-) – TLama
亲爱的TLama,你好吗?对不起,我迟迟不回应你的提示,我出去旅行了一小会儿。上面的脚本完美地工作,但是,我想在我的安装程序中使用PNG按钮。目前,我使用这个脚本[链接] http://s17.postimage.org/mh7eadvn3/Sem_t_tulo.jpg。但是如果我的窗口音量是30%,当我朗姆我的安装程序,它自动进入100%。基于我向您展示的脚本,我该如何解决这个问题?在此先谢谢,再次抱歉,我迟迟没有回复。 – Andrezork