Contnious sound until event?

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
schepers_cp
Posts: 125
Joined: Tue Feb 04, 2014 9:48 pm
Location: netherlands
Contact:

Contnious sound until event?

Post by schepers_cp »

The title might be a little weird, but I'm looking for a way to play a saw waveform until I want it to stop with a command, this would be nice to have for the midi input channel. :)

Any idea if this is possible or f there is a simple way to use a pcm channel directly (like letting it read from an audio buffer?)
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Contnious sound until event?

Post by Artcfox »

You might be able to make a tiny midi that repeats with no delay, and then just use StartSong, StopSong, and ResumeSong.
User avatar
D3thAdd3r
Posts: 3292
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Contnious sound until event?

Post by D3thAdd3r »

I'm not sure exactly what your specific requirements are, but if it is tying in with some music related thing then I think Artcfox has suggested the right way.

Taking a guess at what you might be doing, you could manually use channel 5 wave setting the envelope to 0 and making it play a saw waveform from the kernel, where it will then continue to loop it until you change it(manually). Channel 5 is PCM, just that you can point the PCM at a kernel wave, and you can use most of the sound engine commands on it(but no PC_WAVE). PCM always loops, the only way to make it sound like it doesn't, is to put the loop point on a byte that is 0, so looping silence. It will otherwise loop whatever section you specify until you stop it with something else.

If you want to inject an arbitrary wave form or do something that is not static, then your only choice is to use the vsync mixer instead of the inline. This costs >~512 bytes of ram, at which point the sky is the limit on your level of manual control. Vsync mixer is basically just like 1 big ~15khz PCM channel you can do anything you want to, where the kernel mixes all the "virtual" channels into it. Inline mixer the channels are less "virtual" since they are actually hard limited to reasonable values by free cycles. With vsync mixer, there is no reason you couldn't have 10 music channels if you used a modified kernel.
Post Reply