No problem. Just relieved that its finally working! On Thu, Jul 21, 2011 at 12:16 PM, My <thakore.kar...@gmail.com> wrote:
> Ah anjali my mistake I forgot to mention effects ... my mistake. > > Kartik Thakore > > On 2011-07-21, at 10:02 PM, "Tobias Leich" <em...@froggs.de> wrote: > > > Take a look at this: > > > > <http://sdl.perl.org/SDL-Mixer-Effects.html#set_panning> > > http://sdl.perl.org/SDL-Mixer-Effects.html#set_panning > > > > > > > > You have to register a penning effect, on both channels. > > > > > > > > This should work. > > > > > > > > Cheers, > > > > FROGGS > > > > > > > > Von: Anjali Menon [mailto:anjalimeno...@gmail.com] > > Gesendet: Donnerstag, 21. Juli 2011 18:24 > > An: em...@froggs.de > > Cc: sdl-devel@perl.org > > Betreff: Re: SDL::Mixer::Channels > > > > > > > > Hi, > > > > Yes I want to play sound first on the left and then on the right channel. > My > > desktop is hooked to a USB sound card with Left and right Line-in and > Line > > out options and that is the sound card I am using to play the sounds. I > > modified the program to incorporate what you said but it still does not > > work. > > > > > > use SDL; > > use SDL::Mixer; > > use SDL::Mixer::Channels; > > use SDL::Mixer::Samples; > > > > > > > > SDL::init(SDL_INIT_AUDIO); > > SDL::Mixer::open_audio( 44100, AUDIO_U16SYS, 2, 4096 ); > > SDL::Mixer::Channels::allocate_channels( 2 ); > > SDL::Mixer::Channels::volume(0,0); > > SDL::Mixer::Channels::volume(1,90); > > my $chunk = SDL::Mixer::Samples::load_WAV('C:\1ksil1ch.wav'); > > > > SDL::Mixer::Channels::play_channel( 0, $chunk, 0 ); > > > > SDL::delay(10000); > > SDL::Mixer::Channels::halt_channel( 0 ); > > > > > > SDL::Mixer::Channels::play_channel( 1, $chunk, 0 ); > > SDL::delay(10000); > > > > SDL::Mixer::close_audio(); > > > > > > > > I set the volume for both channels, left and right. I play the sound to > the > > left channel then i tried to halt the left channel and then played to the > > right channel. What I saw was that the wav file played nothing to either > > channel in the first case (when I said play to channel 0) and it played > the > > sound to both channels in the second case (when I said play to channel > 1). > > All the sounds I am playing are mono. > > > > I guess I can understand the issue coz the data is going serially to the > > sound card and so I thought (before I saw the SDL documentation) that the > > only way to control the output on the channels would be to adjust the > > channel balance in the master volume. I am not sure what the scheme is > that > > you guys are using to control this. Anyway, do let me know if there is > > anything i can do or if there is something fundamentally wrong about the > way > > I understand this. thanks, > > > > Anjali > > > > On Thu, Jul 21, 2011 at 5:09 AM, <em...@froggs.de> wrote: > > > > Hi, > > > > Channels are not bound to left or right. A channel is just a slot that > lets > > you play sound samples. And if you allocate two channels, you have > channel 0 > > and 1 (not 1 and 2), thats why you dont hear your last sample. > > > > You want to play sounds first on left and then on right box for example? > > > > Cheers, FROGGS > > > > Zitat von Anjali Menon <anjalimeno...@gmail.com>: > > > > Hi, > > > > I got done with installing SDL and I wrote a simple program that opens > the > > audio device allocates both channels to the mixer, sets the volume of one > of > > the channels to be 0 , loads a wav file and then plays it twice one after > > another with a delay in between. I have pasted the code below. > > > > use SDL; > > use SDL::Mixer; > > use SDL::Mixer::Channels; > > use SDL::Mixer::Samples; > > > > > > > > SDL::init(SDL_INIT_AUDIO); > > SDL::Mixer::open_audio( 44100, AUDIO_S16, 2, 4096 ); > > SDL::Mixer::Channels::allocate_channels( 2 ); > > SDL::Mixer::Channels::volume(1,0); > > my $chunk = SDL::Mixer::Samples::load_WAV('C:\1ksil1ch.wav'); > > > > SDL::Mixer::Channels::play_channel( 1, $chunk, 0 ); > > > > SDL::delay(10000); > > SDL::Mixer::Channels::halt_channel( 1 ); > > > > > > SDL::Mixer::Channels::play_channel( 2, $chunk, 0 ); > > SDL::delay(10000); > > > > SDL::Mixer::close_audio(); > > > > > > The questions I have are: > > 1) When you say channel, do you mean one set of Left and Right Channels. > > This is because I saw then in this case, for the first condition of > > play_channel (when it was supposed to play to channel 1), it played the > wave > > file in both the right and left channel and in the second case (when it > was > > supposed to play to channel 2) there was no sound on either channels. Is > > there a way for me to access the left and right channel separately? > > > > 2)Also, I played another sound file which was just an instance of a > person > > saying the syllable "ta" and when i played that file using these > settings, > > the pitch of the sound changed. I noticed that when I increased the > sampling > > frequency from 44100 to 154100, was when the sound was the correct pitch. > > How is this happening? Is it something I am doing? > > > > I hope you can help, > > > > Thanks > > > > On Wed, Jul 20, 2011 at 2:08 PM, Anjali Menon > > <anjalimeno...@gmail.com>wrote: > > > > Thanks Kartik > > > > > > On Wed, Jul 20, 2011 at 12:03 PM, Kartik Thakore < > thakore.kar...@gmail.com > >> wrote: > > > > To work with perl, I suggest you learn CPAN. It is how all this will > > be installed for you. > > > > cpan SDL > > > > Should work. If you have trouble just bug us at sdl-devel@perl.org . > > Also when replying to these threads CC sdl-devel@perl.org > > > > On Wed, Jul 20, 2011 at 11:35 AM, Anjali Menon <anjalimeno...@gmail.com> > > wrote: > >> At differing times yes but with an overlap. That was what most others > > could > >> not do. There is nothing in the docs for SDL::Mixer that say that it > > cannot > >> be done so I guess I'll just have to try it. Also, is there any way of > >> installing this without getting git. Even if there is an older version > > I'm > >> ok with it if you could point me to it. I'm sorry for so many questions. > >> I've never worked with perl before and there is something I need to get > > done > >> really fast thus the hurry. Thank you, > >> > >> Anjali > >> > >> On Wed, Jul 20, 2011 at 6:16 AM, My <thakore.kar...@gmail.com> wrote: > >>> > >>> This should be possible. Just to be clear you want to play different > > wavs > >>> on different channels at differing times. Right? Have you read the > >>> SDL::Mixer::* docs? Is anything unclear? > >>> > >>> Kartik Thakore > >>> > >>> On 2011-07-20, at 3:45 AM, Anjali Menon <anjalimeno...@gmail.com> > > wrote: > >>> > >>>> Hi Kartik, > >>>> > >>>> I have been going through the SDL::Mixer installation files and I had > >>>> several questions about that. I am trying to write a program that > > will play > >>>> a certain wav file in one channel and somewhere in the middle of that > > file > >>>> it'll start playing another wav file in the other channel. Firstly, > > is is > >>>> possible with the SDL::Mixer::Channels extension to run two instances > > of a > >>>> player independent of eachother. I tried Win32::MediaPlayer and > > Win32::Sound > >>>> and both of them will stop a file that is currently playing if they > > are > >>>> given another play command. Can you tell me if SDL_Mixer can do this? > > Thanks > >>>> a lot for your help, > >>>> > >>>> Anjali > >> > >> > > > > > > > > > > > > > > > > > > >