media.newRecording() not overwritting previous sound

Hey guys, I have a problem that has been driving me crazy, it seems like I had it working before, but now for some reason when I try and record is doesn’t overwrite the previous audio file which I thought media.newRecording was supposed to do, but I’m new to all of this so who knows. Oh and I’m trying to get this to work on android, that’s why I’m using media.playSound() and the .3gp format.

Heres my code:

[lua]
– Recording App
– Developed by Carlos Yanez

– Hide Status Bar

display.setStatusBar(display.HiddenStatusBar)

– Graphics

– [Background]

local bg = display.newImage(‘bg.png’)

– [Buttons]

local stopBtn
local recBtn

– Variables

local play
local playAgain
local recording
local recPath
local recorded

– Functions

local Main = {}
local addListeners = {}
local startRec = {}
local stopRec = {}
local soundComplete = {}
local replay = {}

– Main Function

function Main()
stopBtn = display.newImage(‘stopBtn.png’, 170, 380)
recBtn = display.newImage(‘recBtn.png’, 70, 380)
play = display.newImage(‘play.png’, 116, 369)
play.isVisible = false
playAgain = display.newImage(‘playAgain.png’, 130, 450)
playAgain.isVisible = false

addListeners()
end

function addListeners()
recBtn:addEventListener(‘tap’, startRec)
playAgain:addEventListener(‘tap’, replay)
end

function startRec(e)
stopBtn:addEventListener(‘tap’, stopRec)
recPath = system.pathForFile(‘myRecording.3gp’, system.DocumentsDirectory)
recording = media.newRecording(recPath)
recording:startTuner()
recording:startRecording()
recBtn.isVisible = false

transition.to(stopBtn, {time = 200, x = display.contentWidth * 0.5})
end

function stopRec(e)
stopBtn:removeEventListener(‘tap’, stopRec)
recording:stopRecording()
recording:stopTuner()

stopBtn.isVisible = false
play.isVisible = true

– Play recorded file

–recorded = audio.loadStream(‘myRecording.3gp’, system.DocumentsDirectory)
media.playSound(‘myRecording.3gp’, system.DocumentsDirectory, soundComplete)
end

function soundComplete()
–audio.dispose(recorded)

recBtn.isVisible = true
stopBtn.isVisible = true
stopBtn.x = 217
play.isVisible = false
playAgain.isVisible = true
end

function replay()
recBtn.isVisible = false
stopBtn.isVisible = false
media.playSound(‘myRecording.3gp’, system.DocumentsDirectory, soundComplete)
end

Main()
[/lua]

Cheers, Dalton [import]uid: 220758 topic_id: 35860 reply_id: 335860[/import]

anyone have any ideas, I still can’t seem to figure this out… If I find the solution I will post it. [import]uid: 220758 topic_id: 35860 reply_id: 142636[/import]

Ok well I just tested it on my Samsung Galaxy S3 and it seems to be working fine, but its still not working properly in the simulator. Who knows. [import]uid: 220758 topic_id: 35860 reply_id: 142638[/import]

anyone have any ideas, I still can’t seem to figure this out… If I find the solution I will post it. [import]uid: 220758 topic_id: 35860 reply_id: 142636[/import]

Ok well I just tested it on my Samsung Galaxy S3 and it seems to be working fine, but its still not working properly in the simulator. Who knows. [import]uid: 220758 topic_id: 35860 reply_id: 142638[/import]