Reputation: 9037
I'm trying to coordinate playing sound with displaying some other data on a graph recorded at the same time. If the user drags the graph forward or backwards how can I skip forward or backward in the WAV file so the sound is still coordinated? I can't see a time offset in APIs like SoundPlayer.
Upvotes: 2
Views: 1448
Reputation: 521
if i understood your question correctly, then use WMPLib.WindowsMediaPlayer
, add reference to "Windows Media Player" from COM and then you set the position by using:
WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
player.URL = file; //file to be played
player.controls.play();
player.controls.currentPosition = x; //set the position you want here when user drag
or you can use naudio, free opensource API, download it from codeplex:
Upvotes: 1
Reputation: 3431
Seems like you can't skip backward or forward using SoundPlayer.
Windows Form: Play sound, but not from beginning
C# - Get time from soundplayer
Upvotes: 1