导入Windows Media Player的类库就可以控制它播放多媒体文件,不过怎么选择左右声道啊

Miracle 2001-11-29 08:27:11
导入Windows Media Player的类库就可以控制它播放多媒体文件,不过怎么选择左右声道啊?好像有个Language属性,不过不知道怎么设置好,我试了很多数值都不行。是不是有其他属性?
...全文
69 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
spidertan 2002-06-19
  • 打赏
  • 举报
回复
http://www.csdn.net/expert/topic/805/805457.xml?temp=.5432703
xdspower 2002-06-19
  • 打赏
  • 举报
回复
要么你就要用TimedLevel structure
如下
The TimedLevel structure is composed of two two-dimensional arrays, a state value, and a time stamp value.

Frequency Array
The frequency array is a two-dimensional array. The first dimension of each array corresponds to the stereo audio channel (left or right), and the second corresponds to the frequency levels (in bytes) of the snapshot, where the audio spectrum is divided up into 1024 regions.

You can get the frequency array data supplied from the Windows Media Player in the following manner:

TimedLevel *pLevels;
int snapshot = pLevels->frequency[0][0];
The value of snapshot is for the left channel and contains the value of the lowest part of the frequency spectrum. For example, if snapshot has a large value, it indicates that the lowest 1024th part of the frequency spectrum is rich in frequency. A value of zero indicates no low frequency values in that part of the spectrum for the left channel. If you have a monophonic signal, only the first dimension has valid values.

If the signal is non-stereo, then the second array will contain a copy of the mono signal. That is, frequency[0][n] and frequency[1][n] will contain the same data, where n is the index into a particular cell.

Waveform Array
The waveform array is also a two-dimensional array. The first dimension of the array corresponds to the channel (left or right), and the second corresponds to the power levels (in bytes) of the snapshot, where the audio power is broken up into 1024 continguous time segments.

You can get the the waveform array data from Windows Media Player in the following manner:

TimedLevel *pLevels;
int snapshot = pLevels->waveform[0][0];

The value of snapshot is for the left channel and contains the first value of the quantized snapshot of the power values. When a snapshot is taken, it consists of 1024 tiny incremental measurements of the audio power. The lowest value of the array is generated by the first incremental measurement of audio power. Note that the values of the power are measured from -128 to +127 but the values in the array range from 0 to 255. If you have a monophonic wave, only the first dimension will have valid values.

If the signal is non-stereo, then the second array will contain a copy of the mono signal. That is, waveform[0][n] and waveform[1][n] will contain the same data, where n is the index into a particular cell.

State
The state variable reflects the audio playback state of Windows Media Player. The PlayerState enumeration values are

stop_state = 0, // audio is currently stopped
pause_state = 1, // audio is currently paused
play_state = 2 // audio is currently playing

You can use this variable to take different actions depending on the audio playback state. For example, you can play one kind of visualization when the audio is playing and another when it is stopped.

Time Stamp
The timeStamp variable reflects the current time when the snapshot is taken. This can be used to measure how frequently the snapshots are taken.

You can use this variable to time your animations. If the snapshots are too frequent, you can gracefully degrade your image to display in the manner you choose.

xdspower 2002-06-19
  • 打赏
  • 举报
回复
该是Balance的属性吧,你的WMP是多少版的,在6是
Player6.Balance
This property specifies or retrieves a value indicating the stereo balance.

Syntax

MediaPlayer.Balance

Possible Values

This property is a read/write Long ranging from –10,000 to 10,000. It has a default value of zero.

Remarks

The default value of zero indicates that the sound is balanced equally between the left and right speakers. A value of –10,000 indicates that all sound is going to the left speaker. A value of 10,000 indicates that all sound is going to the right speaker.

在7及以上是
Settings.balance
The balance property specifies or retrieves the current stereo balance.

Syntax

player.settings.balance

Possible Values

This property is a read/write Number (long) ranging from –100 to 100 with a default value of zero.

Remarks

The default value zero indicates that the sound is balanced equally between the left and right speakers. A value of –100 indicates that all sound is going to the left speaker, while a value of 100 indicates that all sound is going to the right speaker.

这是你要的吗?
shu 2002-06-18
  • 打赏
  • 举报
回复
a?
shu 2001-12-05
  • 打赏
  • 举报
回复
Miracle,我也很关心,想知道你是怎样到入类库的,请给我些详细资料,好仔细探讨。

8,303

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧