- 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 -
Excelファイルを用意する
音声ファイルを用意する
- Script Detail -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_BRONZE")
require("reaper_AZSTOKE_SILVER")
require("reaper_AZSTOKE_GOLD")
・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 }
}
・ラウドネス設定テーブルを定義
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)
・Excelファイルを開き、ワークシートを開く
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)
・Excelファイルを閉じる
mediaItems = reaper.AZ_InsertMediaItems(track, filePathList, 0, 1, 0)
・未実装ファイルをReaperにインポート
reaper.AZ_SetMediaItemListHANDAUTOMER(mediaItems, 2)
・HANDAUTOMERを実行
middlewareInfo = reaper.AZ_MIDDLESCANNER_Wwise_GetVolumeForMediaItemList(mediaItems, "SFX", "")
・MIDDLESCANNERでWwiseの音量設定情報を取得
reaper.AZ_LOUDMATCHIFY_SetVolumeForMediaItemList(mediaItems, LoudnessTable, 0, middlewareInfo)
・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)
・未実装サウンドファイルをインポートする関数を実行
reaper.AZ_ShowMessageBox_Info("success!", "", reaper.AZ_WindowType_OK())
end
main()
- API LINK -
Excel
AZSTOKE_Excel_ImportunimportedFiles
Perforceで管理された音声ファイルをExcelに記録し、Wwise上に実装されているか確認③







