无法播放 24 位音频

发布于 2024-11-08 03:53:09 字数 2764 浏览 5 评论 0原文

我正在尝试使用我的 AutoHotkey 应用程序播放 24 位音频文件。它只是使用 SoundPlay。 Windows 7没有问题,但Windows XP用户无法播放24位文件。

文档 说:

所有 Windows 操作系统都应该能够 播放 .wav 文件。然而,其他文件 (.mp3、.avi 等)可能不是 如果编解码器正确或可以播放 操作系统上未安装功能。

文章中提到的可能的修复如何在 Windows Media Player 中播放 24 位 WAV 文件 正在解决 Windows Media Player 的问题,但尚未解决对于 autohotkey:

分步指南

  1. 下载旧版高清音频过滤器
  2. regsvr32 .exe AudioTypeConvert.ax
  3. 在 Windows Media Player(有效)和 AHK(无声音)中播放 24 位文件。
  4. regsvr32.exe /u AudioTypeConvert.ax 卸载

预期行为:在 Windows Media Player 和 AutoHotkey 应用程序中音频文件播放没有错误。 实际行为:音频文件仅在 Windows Media Player 中正常播放,在 Windows XP 下的 AutoHotkey 应用程序中无法播放。

进一步调查

正如 AutoHotKey 论坛中提到的,SoundPlay 正在使用 mciSendString 在幕后,可以通过直接调用它来获得有关错误性质的更多信息。

使用 mciSendString 替代 DLL 调用我收到 错误消息320 对应于 MCIERR_WAVE_OUTPUTSINUSE< /a>

所有可以播放当前格式文件的波形设备都在使用中。等到其中一台设备空闲;然后再试一次。

如何在 Windows XP 中的 AutoHotkey 应用程序中播放 24 位音频文件?

基于 SoundPlay 的测试应用下载

#NoEnv 
SetWorkingDir %A_ScriptDir%
FileSelectFile, f
SoundPlay, %f%
Msgbox, You should hear audio - except for 24bit wave files under Windows XP.

基于 MCI 的测试应用程序下载

#NoEnv 
SetWorkingDir %A_ScriptDir%
FileSelectFile, f
TryPlaySound(f)
Msgbox, You should hear audio - except for 24bit wave files under Windows XP.

; If SoundPlay does not work TryPlaySound
TryPlaySound( mFile ) 
{ 
    ; SKAN  www.autohotkey.com/forum/viewtopic.php?p=361791#361791
    VarSetCapacity( DN,16 ), DLLFunc := "winmm.dll\mciSendString" ( A_IsUnicode ? "W" : "A" )
    DN := DllCall(DLLFunc, Str, "play " """" mFile """" "", Uint, 0, Uint, 0, Uint, 0)
    Return DN
}

I'm trying to play a 24bit audio file with my AutoHotkey app. It just uses SoundPlay. Windows 7 has no problem, however Windows XP users cannot play the 24bit files.

The documentation says:

All Windows OSes should be able to
play .wav files. However, other files
(.mp3, .avi, etc.) might not be
playable if the right codecs or
features aren't installed on the OS.

Possible fixes mentioned in the article How to play 24bit WAV files in Windows Media Player are fixing the problem for Windows Media Player, however but not for autohotkey:

Step-by-step guide

  1. Download Legacy HD Audio Filter
  2. regsvr32.exe AudioTypeConvert.ax
  3. Play 24bit file in windows media player (works) and AHK (no sound).
  4. regsvr32.exe /u AudioTypeConvert.ax to uninstall

Expected behaviour: audio file playsback without errors in both Windows Media Player and AutoHotkey Apps.
Actual behavious: audio file playsback without errors only in Windows Media Player and does not playback in AutoHotkey Apps under Windows XP.

Further Investigation

As mentioned in the AutoHotKey forums SoundPlay is using mciSendString under the hood and more information on the nature of the error can be gained by calling it directly.

Using the mciSendString alternative DLL call I get error message 320 which corresponds to MCIERR_WAVE_OUTPUTSINUSE

All waveform devices that can play files in the current format are in use. Wait until one of these devices is free; then, try again.

How do I play 24bit audio files in Windows XP in my AutoHotkey app?

SoundPlay based Test app (download)

#NoEnv 
SetWorkingDir %A_ScriptDir%
FileSelectFile, f
SoundPlay, %f%
Msgbox, You should hear audio - except for 24bit wave files under Windows XP.

MCI based test app (download)

#NoEnv 
SetWorkingDir %A_ScriptDir%
FileSelectFile, f
TryPlaySound(f)
Msgbox, You should hear audio - except for 24bit wave files under Windows XP.

; If SoundPlay does not work TryPlaySound
TryPlaySound( mFile ) 
{ 
    ; SKAN  www.autohotkey.com/forum/viewtopic.php?p=361791#361791
    VarSetCapacity( DN,16 ), DLLFunc := "winmm.dll\mciSendString" ( A_IsUnicode ? "W" : "A" )
    DN := DllCall(DLLFunc, Str, "play " """" mFile """" "", Uint, 0, Uint, 0, Uint, 0)
    Return DN
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落花浅忆 2024-11-15 03:53:09

如果可行的话,我会将 24 位文件转换为 16 位文件。

I would convert the 24-bit file to a 16-bit file, if that's at all feasible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文