首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >BASS_StreamCreateFile在WPF中的应用

BASS_StreamCreateFile在WPF中的应用
EN

Stack Overflow用户
提问于 2012-12-14 10:45:55
回答 1查看 1.5K关注 0票数 0

BASS_StreamCreateFile(path,offset,length,BassFlags)总是返回'0‘。我不知道如何使用这个函数。在BassFlags的使用方面需要帮助。

PS :在WPF声音可视化库的帮助下使用这个。

EN

回答 1

Stack Overflow用户

发布于 2013-02-08 12:50:55

因为0只通知您有错误,所以您应该检查它是哪种错误:

代码语言:javascript
复制
int BASS_ErrorGetCode();

这将为最近的错误提供错误代码。

下面列出了可能的错误代码(=返回值):

代码语言:javascript
复制
BASS_ERROR_INIT // BASS_Init has not been successfully called.
BASS_ERROR_NOTAVAIL // Only decoding channels (BASS_STREAM_DECODE) are allowed when using the "no sound" device. The BASS_STREAM_AUTOFREE // flag is also unavailable to decoding channels.
BASS_ERROR_ILLPARAM // The length must be specified when streaming from memory.
BASS_ERROR_FILEOPEN // The file could not be opened.
BASS_ERROR_FILEFORM // The file's format is not recognised/supported.
BASS_ERROR_CODEC    // The file uses a codec that is not available/supported. This can apply to WAV and AIFF files, and also MP3 files when using the "MP3-free" BASS version.
BASS_ERROR_FORMAT   // The sample format is not supported by the device/drivers. If the stream is more than stereo or the BASS_SAMPLE_FLOAT flag is used, it could be that they are not supported.
BASS_ERROR_SPEAKER  // The specified SPEAKER flags are invalid. The device/drivers do not support them, they are attempting to assign a stereo stream to a mono speaker or 3D functionality is enabled.
BASS_ERROR_MEM  // There is insufficient memory.
BASS_ERROR_NO3D // Could not initialize 3D support.
BASS_ERROR_UNKNOWN  // Some other mystery problem! 

(来自bass.h__)

另外,请让正确初始化 BASS --在创建流之前必须调用BASS_Init()

代码语言:javascript
复制
BOOL BASS_Init(
    int device, // The device to use... -1 = default device, 0 = no sound, 1 = first real output device
    DWORD freq, // Output sample rate
    DWORD flags, // A combination of flags
    HWND win, // The application's main window... 0 = the current foreground window (use this for console applications)
    GUID *clsid // Class identifier of the object to create, that will be used to initialize DirectSound... NULL = use default
);

示例:

代码语言:javascript
复制
int device = -1; // Default device
int freq = 44100; // Sample rate

BASS_Init(device, freq, 0, 0, NULL); // Init BASS
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13877132

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档