VoiceOver (Classic)

VoiceOver (Classic)

923k Downloads

Books Narrated

tlplayer opened this issue ยท 12 comments

commented

Currently no books are narrated maybe they could be narrated by the narrator from the intro?

commented

I was thinking that too. Someone on the 11labs subreddit made an amazing voice clone of the narrator, so we'd need that + an sql query to get the book text. Not sure which function retrieves book text.

The code snippet you posted makes a ui element that updates the text to This is some text from a book. when clicked.

commented

I was wondering that too... Maybe it's the same as the QuestText() method.

commented

You could do some testing in game and see which one lets you hook into the currently displayed book text. I remember there is one in the orc Kultiran human's castle.

commented

Please dont copy and paste chatGPT code here unless youve tested it. These snippets arent useful.

commented

I just got excited most of those were junk. I'll test it with your event handler. How you have the quest id and guid to map to a voice might be an issue as the quest text doesn't really have a guid unless I'm missing something.

commented

here's some lua code to get the current text of the book. Not sure how to map it to your audio file structure.

VoiceOverEventHandler = {}
VoiceOverEventHandler.__index = VoiceOverEventHandler

function VoiceOverEventHandler:new(soundQueue)
    local eventHandler = {}
    setmetatable(eventHandler, VoiceOverEventHandler)

    eventHandler.soundQueue = soundQueue
    eventHandler.frame = CreateFrame("FRAME", "VoiceOver")

    return eventHandler
end

function VoiceOverEventHandler:RegisterEvents()
    self.frame:RegisterEvent("QUEST_DETAIL")
    self.frame:RegisterEvent("GOSSIP_SHOW")
    self.frame:RegisterEvent("QUEST_COMPLETE")
    self.frame:RegisterEvent("ITEM_TEXT_READY")

    local eventHandler = self
    self.frame:SetScript("OnEvent", function(self, event, ...)
        eventHandler[event](eventHandler)
    end)
end

function VoiceOverEventHandler:QUEST_DETAIL()
    local questId = GetQuestID()
    local questTitle = GetTitleText()
    local questText = GetQuestText()
    local guid
    if UnitExists("target") then
        guid = UnitGUID("target")
    end
    local soundData = {
        ["fileName"] = questId .. "-accept",
        ["questId"] = questId,
        ["title"] = questTitle,
        ["text"] = questText,
        ["unitGuid"] = guid
    }
    self.soundQueue:addSoundToQueue(soundData)
end

function VoiceOverEventHandler:QUEST_COMPLETE()
    local questId = GetQuestID()
    local questTitle = GetTitleText()
    local questText = GetQuestText()
    local guid
    if UnitExists("target") then
        guid = UnitGUID("target")
    end
    local soundData = {
        ["fileName"] = questId .. "-complete",
        ["questId"] = questId,
        ["title"] = questTitle,
        ["text"] = questText,
        ["unitGuid"] = guid
    }
    self.soundQueue:addSoundToQueue(soundData)

end

function VoiceOverEventHandler:GOSSIP_SHOW()
    local gossipText = GetGossipText()
    local guid, targetName
    if UnitExists("target") then
        guid = UnitGUID("target")
        targetName = UnitName("target")
    end
    local soundData = {
        ["title"] = targetName,
        ["text"] = gossipText,
        ["unitGuid"] = guid
    }
    VoiceOverUtils:addGossipFileName(soundData)
    self.soundQueue:addSoundToQueue(soundData)
end

function VoiceOverEventHandler:ITEM_TEXT_READY()
    local itemName = ItemTextGetItem()
    local itemText = ItemTextGetText()

    local soundData = {
        ["filename"] = itemName.."-page-"..ItemTextGetPage(),
        ["text"] = itemText
    }
    self.soundQueue:addSoundToQueue(soundData)
end
commented

this is a good start, the files dont exist yet. wed need a way to figure out when to play them and how to query them.

commented

do you have a schema for the db/ how can I directly query the db?

commented

Could you further describe what you mean by having your character narrate the books? Does that mean it selects the voice depending on the race and gender of your character? I was imagining having the narrator from the new character intro read them in his voice.

You got it! It is 1000% simpler to do the narrator from the new character intro, and I honestly love that idea. I think it would be additionally cool if the addon user had an option for their character to read it. So the addon would check if the user has a checkbox ticked on for character voice for book narration, and then picks the race/gender of the player character to read the book. :D

Well writing this out, I thought of another level of complication... What if we knew the author of the books? Maybe they have a voice? Perhaps you can associate specific characters to specific books? Have that as another option. ;)

commented

Might I suggest that you add an option to make books narrated by your character? :) After you have it figured out for the narrator, of course. ;)

commented

Might I suggest that you add an option to make books narrated by your character? :) After you have it figured out for the narrator, of course. ;)

Could you further describe what you mean by having your character narrate the books? Does that mean it selects the voice depending on the race and gender of your character? I was imagining having the narrator from the new character intro read them in his voice.

do you have a schema for the db/ how can I directly query the db?

The readme explains how to setup the database. The text is somewhere in there. You can use a database explorer to see the schema. I use Datagrip personally