Hi,
Can’t seem to make detect tuner level if i want to save to a file
Tuner level doesn’t work when filename put in start recording
dataFileName = "tester"
filePath = system.pathForFile( dataFileName, system.DocumentsDirectory )
r = media.newRecording()--tuner level detection works and changes number and colour accordingly
--r = media.newRecording(filePath)--tuner level sits on 0 and does nothing but does playback file works
r:startRecording()
r:startTuner()
-- Create an object to hold display items
local g = display.newGroup()
soundDetector = display.newText( "............", 0, 0, nil, 22 )
soundDetector:setReferencePoint( display.TopLeftReferencePoint)
soundDetector:setTextColor( 255,255,255, 150 )
soundDetector.x = display.contentWidth/2
soundDetector.y = 0.8\*display.contentHeight
function soundDetector:enterFrame( event )
local v = r:getTunerVolume()
soundDetector.text = v
if v \>= 0.4 then
soundDetector:setTextColor( 0,255,0, 150 )
else
soundDetector:setTextColor( 255,0,0, 150 )
end
end
Runtime:addEventListener( "enterFrame", soundDetector );
g:insert(soundDetector)
function strec()
soundDetector.text = "stopped"
print("stop")
r:stopRecording()
print("play",dataFileName, filePath)
media.playSound( dataFileName, system.DocumentsDirectory )
print("end of play")
end
timer.performWithDelay(3000,strec)
any ideas,
cheers,
Rob [import]uid: 2131 topic_id: 14133 reply_id: 314133[/import]