≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Trying to make a smooth transition/crossfade
Posted by:
(you are not logged in)
Enter the missing letter in: "Internat?onal"
(you are not logged in)
Text:
[quote][b]Darty[/b] wrote: Hello, I need some help with the following issue. Intro: I've created an application that uses soundeffects on certain buttons and events and while the converting-task is working, it's playing a music "loop". As the file format isn't a module, looping is done with custom crossfade. The beginning and end of the short music is the same. I've managed to get this working in Windows Media Player, but I wanted to change to another audio library that can handle the sounds (.ogg) better/faster. So far it works everywhere, except at the crossfade code. Code background: * I use a crossfadetimer that starts as soon as converting process starts. This timer simply counts an index till x, activates the volumefadetimer and resets x. This keeps looping till convertion is done. Volumefadetimer is the code that should rise/lower the volumes of both ISound objects (from same Engine). * I've tested many different values, in many situations it either plays the song once and goes silent, or it does a transition, but you hear a 'crack' at beginning of play and at the end. This also seems to get out of sync over time... Below is the code I used, which worked with WMP. The only difference I noticed was the Volume value being max 1 (where WMP had 100). I tried using the values needed for the same fade duration, tried different fade locations/durations, but it hasn't been smooth yet. It's the last thing I need to get working if I want to keep this audio library. Any suggestions? Actual code (with testvolume values): private void tCrossFade_Tick(object sender, EventArgs e) //1000ms { if (i == 0) { tVolFade.Start(); } // Start Track and set Current irrPlayer. if (i == 24) { i = -24; tVolFade.Start(); } // (Cross)Fade. i++; } private void tVolFade_Tick(object sender, EventArgs e) // TIMER to Switch between 2 players (100ms) { // BackGround Audio during Conversion. if (curirr == bgaudio1) { if (change == true) { bgaudio2 = irrEngine.Play2D(sBGAudio, false); change = false; } // Start new Player. if (bgaudio1.Volume != 0) { bgaudio1.Volume = bgaudio1.Volume - 0.1f; bgaudio2.Volume = bgaudio2.Volume + 0.1f; } // FadeOut/-In Players. else { tVolFade.Stop(); change = true; curirr = bgaudio2; } } else if (curirr == bgaudio2) { if (change == true) { bgaudio1 = irrEngine.Play2D(sBGAudio, false); change = false; } if (bgaudio2.Volume != 0) { bgaudio2.Volume = bgaudio2.Volume - 0.1f; bgaudio1.Volume = bgaudio1.Volume + 0.1f; } // FadeOut/-In Players. else { tVolFade.Stop(); change = true; curirr = bgaudio1; } } }[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact