SDL_mixer icon indicating copy to clipboard operation
SDL_mixer copied to clipboard

Add ability to set Sound playback from an offset

Open SDLBugzilla opened this issue 4 years ago • 0 comments

This bug report was migrated from our old Bugzilla tracker.

Reported in version: unspecified Reported for operating system, platform: Other, x86

Comments on the original bug report:

On 2009-02-14 15:50:35 +0000, Sebastian Gray wrote:

Hi,

I've been porting an audio composition and mixing tool called OpenSebJ (http://www.sf.net/projects/opensebj) to use the SDL audio libraries (Through the SDL.Net and the taoframework wrappers) and have been successful in removing all the previous propitiatory dependencies which were supplied through Managed DirectX.

However there is one function that I was hoping you would be willing to consider implementing in the SDL library which would greatly assist me. Could you add the ability to play a sample from a specified offset; I don't think it would matter if the offset is stored in samples or in milliseconds, it would be easy enough to work out either one based of the format of the sample. Or being able to specify a position while playback is occurring. i.e. like the Pause function on a specified location, then set any position and then resume - I'm not really sure how this works within the buffers and how much pre allocation of streams occurs but if it is possiable it would be a great addition. As having this function would allow for a lot more flexibility when mixing samples.

Thanks for the great work with this Library; it certainly makes cross-platform development many times more attainable.

Cheers, Sebastian

On 2009-02-18 23:33:49 +0000, Ryan C. Gordon wrote:

Just to be clear: are you using SDL_sound or SDL_mixer (or just SDL by itself)?

--ryan.

On 2009-02-27 13:42:54 +0000, Sebastian Gray wrote:

I use Mixer and Sound. I don't / didn't know you could use them independently of each other and achieve the same result however I am also not sure if any of this is to do with the SDL.Net wrapper I am using.

I'll put in a sample of the code that I am using so you can see what I use, hope this makes it clearer:

// I open the mixer and define channels Mixer.Open(44100, AudioFormat.Default, (int)SoundChannel.Stereo, 1024); Mixer.ChannelsAllocated = channels * subChannels;

// Then load samples in to an array of Sounds aSound[position] = new Sound(fileName);

// Then find a free channel for the sample and play the sample ch[position][p].Play(aSound[position], false);

// I use the instance of the sound directly to control behaviour once playing has started. aSound[position].Stop();

Hope that clarify's what you were looking for, in effect I was hoping for a method on the Sound class like aSound.SetPosition(Position); just as I use the stop or volume methods to control playback.

Thanks, let me know if you need anything more.

On 2009-10-10 22:57:03 +0000, Ryan C. Gordon wrote:

Changing product: pretty sure this was meant to be the SDL_mixer add-on library, not the SDL_sound add-on.

--ryan.

On 2009-10-11 00:48:16 +0000, Sam Lantinga wrote:

This seems pretty useful, although you can simulate this yourself by creating a new Mix_Chunk structure that points at the data of another chunk at an offset.

SDLBugzilla avatar Feb 11 '21 04:02 SDLBugzilla