本文整理汇总了C#中ISound类的典型用法代码示例。如果您正苦于以下问题:C# ISound类的具体用法?C# ISound怎么用?C# ISound使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISound类属于命名空间,在下文中一共展示了ISound类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: btnPlay_Click_1
private void btnPlay_Click_1(object sender, EventArgs e)
{
openFileDialog1.InitialDirectory = Application.StartupPath + "\\musicas\\";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
btnPause.Enabled = true;
btnPlay.Enabled = false;
btnStop.Enabled = true;
ISoundEngine engine = new ISoundEngine();
StreamReader rd = new StreamReader(openFileDialog1.FileName, true);
List<String> arquivo = new List<string>();
while (!rd.EndOfStream)
{
arquivo.Add(rd.ReadLine());
}
String nomeMusica = arquivo[0];
String caminhoMusica = Path.Combine(Application.StartupPath + "\\media", arquivo[1]);
frases = new List<Frase>();
arquivo.RemoveRange(0, 2);
foreach (String frase in arquivo)
{
String[] componentes = frase.Split('#');
frases.Add(new Frase(componentes[0], uint.Parse(componentes[1]), uint.Parse(componentes[2])));
}
rd.Close();
lblNomeMusica.Text = nomeMusica;
musica = engine.Play2D(caminhoMusica);
timer1.Start();
frasesParaExibir = getFrasesParaExibicao(frases, musica.PlayPosition);
renderizarFrases(frasesParaExibir);
musica.Volume = 1;
}
}
开发者ID:Punloeu,项目名称:karaoke,代码行数:34,代码来源:frmPrincipal.cs
示例2: Initialize
public static void Initialize()
{
sounds = new Cache<string, ISoundSource>(LoadSound);
music = null;
currentMusic = null;
video = null;
}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:7,代码来源:Sound.cs
示例3: Play
public void Play(ISound Sound)
{
#if DEBUG_VERBOSE
if (Debugger.IsAttached)
Debug.WriteLine("Play(Sound) called from NullAudioService");
#endif
}
开发者ID:iLambda,项目名称:Freemwork,代码行数:7,代码来源:NullAudioService.cs
示例4:
Result IFModSystem.PlaySound(ChannelIndex channelIndex, ISound sound, bool paused, ref IChannel channel)
{
CheckMemberOnlyCall();
var result = NativeFModSystem.PlaySound(Self, channelIndex, sound, paused, ref channel);
return result;
}
开发者ID:HaKDMoDz,项目名称:InVision,代码行数:8,代码来源:InVisionNativeFMod.CppInstances.cs
示例5: Play
public void Play(ISound sound)
{
lock (_lock)
{
sounds.Add(sound);
}
}
开发者ID:YJh2046,项目名称:BlockFun,代码行数:8,代码来源:DSPPlayer.cs
示例6: PlayFinished
void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData)
{
_soundPlaying = null;
if (PlayFinished != null)
{
PlayFinished(_audioClip);
_audioClip = null;
}
}
开发者ID:smarinel,项目名称:ags-web,代码行数:9,代码来源:IrrklangPlayer.cs
示例7: Play
public void Play(ISound Sound)
{
var sound = (XNASound)Sound;
if (AllowedToPlay)
{
var inst = sound.Sound.CreateInstance();
inst.Volume = sound.Volume;
inst.Pitch = sound.Pitch;
inst.Pan = sound.Pan;
inst.Play();
}
}
开发者ID:iLambda,项目名称:Freemwork,代码行数:12,代码来源:XNAAudioService.cs
示例8: SoundCrossfader
/// <summary>
/// Creates a crossfader that will crossfade two sounds over the specified duration.
/// </summary>
/// <param name="toFadeOut">The sound you want to fade out.</param>
/// <param name="toFadeIn">The sound you want to fade in.</param>
/// <param name="duration">How long you want the crossfade to take, in seconds.</param>
/// <param name="toFadeInVolume">What volume you want the "fade in" sound to have when it is completed</param>
public SoundCrossfader(ISound toFadeOut, ISound toFadeIn, float duration, float toFadeInVolume = 1f)
{
// NOTE: Sounds will not exist when we're using the null sound driver!
// Make sure that the sound is not null before touching it.
this.duration = duration;
this.soundToFadeIn = toFadeIn;
this.soundToFadeOut = toFadeOut;
this.initialFadeOutVolume = toFadeOut == null ? 0.0f : toFadeOut.Volume;
this.targetFadeInVolume = toFadeIn == null ? 1.0f : toFadeInVolume;
LKernel.GetG<Root>().FrameEnded += FrameEnded;
}
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:20,代码来源:SoundCrossfader.cs
示例9: ConvertReason
/// <summary>
/// 再生が停止した時に呼ばれます。
/// </summary>
void ISoundStopEventReceiver.OnSoundStopped(ISound sound,
StopEventCause cause,
object userData)
{
var handler = Interlocked.Exchange(ref Stopped, null);
if (handler != null)
{
var reason = ConvertReason(cause);
handler(null, new SoundStopEventArgs(reason));
}
}
开发者ID:leontius,项目名称:Ragnarok,代码行数:16,代码来源:SoundObjectBackend_IrrKlang.cs
示例10: DeployerContext
public DeployerContext(ISimultaneousKeys keys, IProjectSelector projectSelect,
ICharDisplay lcd,
IIndicators indicatorRefresh, ISound sound, IWebUtility netio, INetwork network,
IWebRequestFactory webFactory, IGarbage garbage,
IConfigurationService configurationService)
{
_keys = keys;
_projectSelect = projectSelect;
_lcd = lcd;
_indicatorRefresh = indicatorRefresh;
_sound = sound;
_netio = netio;
_network = network;
_webFactory = webFactory;
_garbage = garbage;
_configurationService = configurationService;
}
开发者ID:DevOpsGear,项目名称:DeployerOfCodes,代码行数:17,代码来源:DeployerContext.cs
示例11: SoundPlayer
private ISound sound; // Current playing song
#endregion Fields
#region Constructors
/// <summary>
/// Initializes music player and randomizer. After that plays first song
/// from file and sets event receiver.
/// </summary>
/// <param name="mWindow">The RenderWindow instance for making overlays</param>
public SoundPlayer( Mogre.RenderWindow mWindow)
{
engine = new ISoundEngine();
songs = Directory.GetFiles(songPath);
r = new Random();
this.mWindow = mWindow;
sound = engine.Play2D(songs[0]);
sound.setSoundStopEventReceiver(this);
ShowCurrentPlaying(songs[current]);
effects = new Dictionary<string, string>();
var tempEff = Directory.GetFiles(effectPath);
foreach (var effName in tempEff) {
var splited = effName.Split('\\');
effects.Add(splited[splited.Length - 1], effName);
}
}
开发者ID:vavrekmichal,项目名称:Strategy,代码行数:28,代码来源:SoundPlayer.cs
示例12: Play
public bool Play(AudioClip clip)
{
if (!File.Exists(clip.CacheFileName))
{
return false;
}
// we have to read it into memory and then play from memory,
// because the built-in Irrklang play from file function keeps
// the file open and locked
byte[] audioData = File.ReadAllBytes(clip.CacheFileName);
ISoundSource source = _soundEngine.AddSoundSourceFromMemory(audioData, clip.CacheFileName);
_soundPlaying = _soundEngine.Play2D(source, false, false, false);
if (_soundPlaying == null)
{
return false;
}
_audioClip = clip;
_soundPlaying.setSoundStopEventReceiver(this);
return true;
}
开发者ID:Aquilon96,项目名称:ags,代码行数:20,代码来源:IrrklangPlayer.cs
示例13: Sound2D
public Sound2D(string soundName, bool looped, bool paused)
{
this.loop = looped;
this.paused = paused;
SoundEffect soundEffect = ResourceManager.Inst.GetSoundEffect(soundName);
this.sound = SoundEngine.Device.Play2D(soundEffect.Sound, loop, paused, false);
}
开发者ID:MattVitelli,项目名称:Nosferatu,代码行数:7,代码来源:Sound2D.cs
示例14: Demo
public Demo()
{
this.graphics = new GraphicsDeviceManager(this);
this.sound = new SoundBASS();
Content.RootDirectory = "Content";
}
开发者ID:scenex,项目名称:Demo,代码行数:7,代码来源:Demo.cs
示例15: EntityWalker
public EntityWalker(string unique_name)
: base(unique_name)
{
IsGhost = false;
StepSounds = new List<string>();
active_step_sound = null;
step_sound_index = 0;
}
开发者ID:bomzhkolyadun,项目名称:InvisibilityGame,代码行数:8,代码来源:EntityWalker.cs
示例16: Dispose
public void Dispose()
{
if(m_Sound != null)
{
m_Sound.Dispose();
m_Sound = null;
m_Filename = null;
}
}
开发者ID:grofit,项目名称:Ambient,代码行数:9,代码来源:IrrKlangSoundPlayer.cs
示例17: PlayLooped
public void PlayLooped()
{
if (_sound == null) _sound = AudioProvider.SoundEngine.Play2D(_source, true, false, false);
else
{
_sound.Looped = true;
_sound.Paused = false;
}
}
开发者ID:Zhenya21,项目名称:Checkers,代码行数:9,代码来源:Audio.cs
示例18: LoadFile
public void LoadFile(string filePath)
{
if(internalSound != null)
{
internalSound.Stop();
internalSound.Dispose();
}
internalSound = soundFactory.GetSoundForFile(filePath);
}
开发者ID:grofit,项目名称:Ambient-v2,代码行数:9,代码来源:IrrklangMusicPlayer.cs
示例19: IntroScreen
public IntroScreen(Game Game)
: base(Game, GeneralManager.ScreenX, GeneralManager.ScreenY)
{
BSS = new BlackScreenSwitch();
BSS.SwitchState = SceneSwitchEffect.State.SwitchOn;
BSS.MaxTime = 1f;
m = SoundEngine.PlaySound(Vector2.Zero,"Content/Sounds/Logos jingle.mp3");
Renderer.AddPostProcess(BSS, "Switch");
}
开发者ID:BartoszF,项目名称:ArtifactsRider,代码行数:10,代码来源:IntroScreen.cs
示例20: SoundManager
SoundManager()
{
Sound = new SoundXACT()
{
SettingsFile = @"Content\Sound\ccm.xgs",
EffectWaveBankFile = @"Content\Sound\SE Bank.xwb",
StreamWaveBankFile = @"Content\Sound\BGM Bank.xwb",
SoundBankFile = @"Content\Sound\Sound Bank.xsb",
};
}
开发者ID:himapo,项目名称:ccm,代码行数:10,代码来源:SoundManager.cs
注:本文中的ISound类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论