Playback 24bit audio not possible

这一生的挚爱 提交于 2019-12-06 20:01:26

问题


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
}

回答1:


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



来源:https://stackoverflow.com/questions/6032795/playback-24bit-audio-not-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!