Microphone

From GiderosMobile
Revision as of 03:32, 26 August 2024 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.png
Available since: Gideros 2013.06

Description

Use this plugin to record to an audio clip using a connected microphone.

Example

require "microphone"

local microphone = Microphone.new(nil, 22050, 1, 16)

microphone:addEventListener(Event.DATA_AVAILABLE, function(event)
	print(event.peakAmplitude)
end)

microphone:setOutputFile("|D|record.wav")

local function onRecord()
	microphone:start()
end
--record:addEventListener(Event.CLICK, onRecord)

local function onRecordStop()
	microphone:stop()
end
--recordStop:addEventListener(Event.CLICK, onRecordStop)

Methods

Microphone.new creates a new Microphone object

Microphone:getStreamId gets the mic stream id
Microphone:isPaused returns the mic paused status
Microphone:isRecording returns the mic recording status
Microphone:setOutputFile sets the mic stream output file
Microphone:setPaused sets the mic paused state
Microphone:start starts mic recording
Microphone:stop stops mic recording

Events

Event.DATA_AVAILABLE

Constants