[{"location":"#Public-interface","page":"Public interface","title":"Public interface","text":"","category":"section"},{"location":"","page":"Public interface","title":"Public interface","text":"Pages = [\"index.md\"]","category":"page"},{"location":"","page":"Public interface","title":"Public interface","text":"Modules = [PortAudio]\nPrivate = false","category":"page"},{"location":"#PortAudio.PortAudioStream","page":"Public interface","title":"PortAudio.PortAudioStream","text":"PortAudioStream(input_channels=2,output_channels=2;options...)\nPortAudioStream(duplex_device,input_channels=2,output_channels=2;options...)\nPortAudioStream(input_device,output_device,input_channels=2,output_channels=2;options...)\n\nAudiodevicescaneitherbePortAudioDeviceinstancesasreturnedbydevices,orstringswiththedevicenameasreportedbytheoperatingsystem.Setinput_channelsto0foranoutputonlystream;setoutput_channelsto0foraninputonlysteam.Ifyoupassthefunctionmaximuminsteadofanumberofchannels,usethemaximumchannelsallowedbythecorrespondingdevice.Ifasingleduplex_deviceisgiven,itwillbeusedforbothinputandoutput.Ifnodevicesaregiven,thesystemdefaultdeviceswillbeused.\n\nThePortAudioStreamtypesupportsallthestreamandbufferfeaturesdefinedSampledSignals.jlbydefault.Forexample,ifyouloadSampledSignalswithusingSampledSignalsyoucanread5secondstoabufferwithbuf=read(stream,5s),regardlessofthesamplerateofthedevice.write(stream,stream)willsetupaloopbackthatwillreadfromtheinputandplayitbackontheoutput.\n\nOptions:\n\nadjust_channels=false:Ifsettotrue,ifeitherinput_channelsoroutput_channelsexceedsthecorrespondingdevicemaximum,adjustdowntothemaximum.\ncall_back=C_NULL:ThePortAudiocall-backfunction.Currently,passinganythingexceptC_NULLisunsupported.\neltype=Float32:Sampletypeoftheaudiostream\nflags=PortAudio.paNoFlag:PortAudioflags\nframes_per_buffer=128:thenumberofframesperbuffer\ninput_info=C_NULL:hostAPIspecificstreaminfofortheinputdevice.Currently,passinganythingexceptC_NULLisunsupported.\nlatency=nothing:Requestedlatency.Streamcouldunderrunwhentoolow,considerusingthedefaults.Ifleftasnothing,usethedefaultsbelow:\nForinput/outputonlystreams,usethecorrespondingdevice's default high latency.\nFor duplex streams, use the max of the default high latency of the input and output devices.\noutput_info = C_NULL: host API specific stream info for the output device. Currently, passing anything except C_NULL is unsupported.\nreader = PortAudio.SampledSignalsReader(): the scribe that will read input. Defaults to a PortAudio.SampledSignalsReader. Users can pass custom scribes; see PortAudio.Scribe.\nsamplerate = nothing: Sample rate. If left as nothing, use the defaults below:\nFor input/output only streams, use the corresponding device'sdefaultsamplerate.\nForduplexstreams,usethedefaultsamplerateifthedefaultsampleratesfortheinputandoutputdevicesmatch,otherwisethrowanerror.\nwarn_xruns=true:Displayawarningifthereisastreamoverrunorunderrun,whichoftenhappenswhenJuliaiscompiling,orwithaparticularlylargeGCrun.Onlyaffectsduplexstreams.\nwriter=PortAudio.SampledSignalsWriter():thescribethatwillwriteoutput.DefaultstoaPortAudio.SampledSignalsReader.Userscanpasscustomscribes;seePortAudio.Scribe.\n\nExamples:\n\nSetupanaudiopass-throughfrommicrophonetospeaker\n\njulia>usingPortAudio,SampledSignals\n\njulia>stream=PortAudioStream(2,2;warn_xruns=false);\n\njulia>try\n#cancelwithCtrl-C\nwrite(stream,stream,2s)\nfinally\nclose(stream)\nend\n\nUsedosyntaxtoauto-closethestream\n\njulia>usingPortAudio,SampledSignals\n\njulia>PortAudioStream(2,2;warn_xruns=false)dostream\nwrite(stream,stream,2s)\nend\n\nOpendevicesbyname\n\nusingPortAudio