- Script Code -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_BRONZE")
require("reaper_AZSTOKE_SILVER")
require("reaper_AZSTOKE_GOLD")
p4URL = "********"
p4UserName = "********"
p4Password = "********"
p4Workspace = "********"
function GetP4Files(depotPath, excelPath, sheetName)
filePathList = {}
if reaper.AZ_P4_Connect(p4URL, p4UserName, p4Password)then
filePathList = reaper.AZ_P4_SyncFiles(p4Workspace, depotPath, -1, "wav")
reaper.AZ_P4_Disconnect()
end
excelDoc = reaper.AZ_Excel_OpenFile(excelPath)
worksheet = reaper.AZ_Excel_AddWorksheet(excelDoc, sheetName)
row = 1
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 1, "Name")
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 2, "Local Path")
for i, filePath in pairs(filePathList) do
row = row + 1
fileName = reaper.AZ_GetPathInfo(filePath)["FileNameWithoutExtension"]
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 1, fileName)
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 2, filePath)
end
reaper.AZ_Excel_SaveDocument(excelDoc)
reaper.AZ_Excel_CloseFile(excelDoc)
end
function SearchVoicesInWwise(excelPath, sheetName)
voiceSoundPath = "\\Actor-Mixer Hierarchy\\VOICE"
voiceEventPath = "\\Events\\VOICE"
if reaper.AZ_Wwise_Connect("127.0.0.1", 8080) then
soundTable = {}
eventTable = {}
soundItemList = reaper.AZ_Wwise_SearchSoundItemFromName(voiceSoundPath, "")
for k, sound in pairs(soundItemList) do
soundTable[sound["Name"]] = true
end
eventList = reaper.AZ_Wwise_GetChildrenList(voiceEventPath, true)
for k, event in pairs(eventList) do
eventTable[event["Name"]] = true
end
reaper.AZ_Wwise_Disconnect()
end
excelDoc = reaper.AZ_Excel_OpenFile(excelPath)
worksheet = reaper.AZ_Excel_OpenWorksheet(excelDoc, sheetName)
rows = reaper.AZ_Excel_SearchRowsInWorksheet(worksheet, ".+", "A", "2:5000,A", true)
unimportedSoundList = {}
unimportedEventList = {}
for i, row in pairs(rows["Cells"]) do
if soundTable[row["A"]] ~= true then
table.insert(unimportedSoundList, row["A"])
end
if eventTable[row["A"]] ~= true then
table.insert(unimportedEventList, row["A"])
end
end
reaper.AZ_Excel_CloseFile(excelDoc)
Msg("以下のサウンドが実装されていません")
ShowObject(unimportedSoundList)
Msg("")
Msg("以下のイベントが実装されていません")
ShowObject(unimportedEventList)
return unimportedSoundList
end
LoudnessTable = {
{ Name = "AZ_vo", Loudness = -24 }
}
function ImportunimportedFiles(excelPath, sheetName, unimportedSoundList)
track = reaper.AZ_InsertTrackId(0, reaper.CountTracks(0), "unimported")
excelDoc = reaper.AZ_Excel_OpenFile(excelPath)
worksheet = reaper.AZ_Excel_OpenWorksheet(excelDoc, sheetName)
filePathList = {}
for i, sound in pairs(unimportedSoundList) do
rows = reaper.AZ_Excel_SearchRowsInWorksheet(worksheet, sound, "A", ",A:B")
for j, row in pairs(rows["Cells"]) do
table.insert(filePathList, row["B"])
end
end
reaper.AZ_Excel_CloseFile(excelDoc)
mediaItems = reaper.AZ_InsertMediaItems(track, filePathList, 0, 1, 0)
reaper.AZ_SetMediaItemListHANDAUTOMER(mediaItems, 2)
middlewareInfo = reaper.AZ_MIDDLESCANNER_Wwise_GetVolumeForMediaItemList(mediaItems, "SFX", "")
reaper.AZ_LOUDMATCHIFY_SetVolumeForMediaItemList(mediaItems, LoudnessTable, 0, middlewareInfo)
end
function main()
retval, inputList = reaper.AZ_GetUserInputList("", 2, "DeptPath,ExcelPath", "")
if retval == false then return end
deptPath = inputList[1]
excelPath = inputList[2]
sheetName = "voices_" ..os.date("%Y%m%d_%H%M%S", ts)
GetP4Files(deptPath, excelPath, sheetName)
unimportedSoundList = SearchVoicesInWwise(excelPath, sheetName)
ImportunimportedFiles(excelPath, sheetName, unimportedSoundList)
reaper.AZ_ShowMessageBox_Info("success!", "", reaper.AZ_WindowType_OK())
end
main()
- Warm Up -
Prepare an Excel file
Prepare audio files
- Script Detail -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_BRONZE")
require("reaper_AZSTOKE_SILVER")
require("reaper_AZSTOKE_GOLD")
・Import RIGDOCKS
-------- ここから REAPDOCK AZSTOKE_Excel_GetP4Filesを参照 --------
p4URL = "********"
p4UserName = "********"
p4Password = "********"
p4Workspace = "********"
function GetP4Files(depotPath, excelPath, sheetName)
filePathList = {}
if reaper.AZ_P4_Connect(p4URL, p4UserName, p4Password)then
filePathList = reaper.AZ_P4_SyncFiles(p4Workspace, depotPath, -1, "wav")
reaper.AZ_P4_Disconnect()
end
excelDoc = reaper.AZ_Excel_OpenFile(excelPath)
worksheet = reaper.AZ_Excel_AddWorksheet(excelDoc, sheetName)
row = 1
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 1, "Name")
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 2, "Local Path")
for i, filePath in pairs(filePathList) do
row = row + 1
fileName = reaper.AZ_GetPathInfo(filePath)["FileNameWithoutExtension"]
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 1, fileName)
reaper.AZ_Excel_SetCellValue_ByNumber(worksheet, row, 2, filePath)
end
reaper.AZ_Excel_SaveDocument(excelDoc)
reaper.AZ_Excel_CloseFile(excelDoc)
end
-------- ここまで REAPDOCK AZSTOKE_Excel_GetP4Filesを参照 --------
-------- ここから REAPDOCK AZSTOKE_Excel_SearchVoicesInWwiseを参照 --------
function SearchVoicesInWwise(excelPath, sheetName)
voiceSoundPath = "\\Actor-Mixer Hierarchy\\VOICE"
voiceEventPath = "\\Events\\VOICE"
if reaper.AZ_Wwise_Connect("127.0.0.1", 8080) then
soundTable = {}
eventTable = {}
soundItemList = reaper.AZ_Wwise_SearchSoundItemFromName(voiceSoundPath, "")
for k, sound in pairs(soundItemList) do
soundTable[sound["Name"]] = true
end
eventList = reaper.AZ_Wwise_GetChildrenList(voiceEventPath, true)
for k, event in pairs(eventList) do
eventTable[event["Name"]] = true
end
reaper.AZ_Wwise_Disconnect()
end
excelDoc = reaper.AZ_Excel_OpenFile(excelPath)
worksheet = reaper.AZ_Excel_OpenWorksheet(excelDoc, sheetName)
rows = reaper.AZ_Excel_SearchRowsInWorksheet(worksheet, ".+", "A", "2:5000,A", true)
unimportedSoundList = {}
unimportedEventList = {}
for i, row in pairs(rows["Cells"]) do
if soundTable[row["A"]] ~= true then
table.insert(unimportedSoundList, row["A"])
end
if eventTable[row["A"]] ~= true then
table.insert(unimportedEventList, row["A"])
end
end
reaper.AZ_Excel_CloseFile(excelDoc)
Msg("以下のサウンドが実装されていません")
ShowObject(unimportedSoundList)
Msg("")
Msg("以下のイベントが実装されていません")
ShowObject(unimportedEventList)
return unimportedSoundList
end
-------- ここまで REAPDOCK AZSTOKE_Excel_SearchVoicesInWwiseを参照 --------
LoudnessTable = {
{ Name = "AZ_vo", Loudness = -24 }
}
・Define the loudness settings table
function ImportunimportedFiles(excelPath, sheetName, unimportedSoundList)
・Define the function to import unimplemented sound files
track = reaper.AZ_InsertTrackId(0, reaper.CountTracks(0), "unimported")
・Insert a new track
excelDoc = reaper.AZ_Excel_OpenFile(excelPath)
worksheet = reaper.AZ_Excel_OpenWorksheet(excelDoc, sheetName)
・Open the Excel file and open the worksheet
filePathList = {}
・Initialize the file path list
for i, sound in pairs(unimportedSoundList) do
rows = reaper.AZ_Excel_SearchRowsInWorksheet(worksheet, sound, "A", ",A:B")
・Search rows by unimplemented sound name
for j, row in pairs(rows["Cells"]) do
table.insert(filePathList, row["B"])
end
・Add the local path of the matching row to the file path list
end
reaper.AZ_Excel_CloseFile(excelDoc)
・Close the Excel file
mediaItems = reaper.AZ_InsertMediaItems(track, filePathList, 0, 1, 0)
・Import unimplemented files into Reaper
reaper.AZ_SetMediaItemListHANDAUTOMER(mediaItems, 2)
・Run HANDAUTOMER
middlewareInfo = reaper.AZ_MIDDLESCANNER_Wwise_GetVolumeForMediaItemList(mediaItems, "SFX", "")
・Get Wwise's volume settings info with MIDDLESCANNER
reaper.AZ_LOUDMATCHIFY_SetVolumeForMediaItemList(mediaItems, LoudnessTable, 0, middlewareInfo)
・Adjust volume with LOUDMATCHIFY
end
function main()
retval, inputList = reaper.AZ_GetUserInputList("", 2, "DeptPath,ExcelPath", "")
if retval == false then return end
deptPath = inputList[1]
excelPath = inputList[2]
sheetName = "voices_" ..os.date("%Y%m%d_%H%M%S", ts)
GetP4Files(deptPath, excelPath, sheetName)
unimportedSoundList = SearchVoicesInWwise(excelPath, sheetName)
ImportunimportedFiles(excelPath, sheetName, unimportedSoundList)
・Run the function to import unimplemented sound files
reaper.AZ_ShowMessageBox_Info("success!", "", reaper.AZ_WindowType_OK())
end
main()
- API LINK -
- API LINK -
Excel
AZSTOKE_Excel_ImportunimportedFiles
Record Perforce-managed audio files in Excel and verify whether they are implemented in Wwise (3)











