Code Monkey home page Code Monkey logo

Comments (12)

BillHu avatar BillHu commented on July 18, 2024

need this feature...

from theamazingaudioengine.

lijon avatar lijon commented on July 18, 2024

Hmm, can't attach patches on github? I'll paste it here below.
So basically, you just AUGraphStop(audioController.audioGraph) and then run AEAudioControllerRenderMainOutput() to render chunks of audio.

From aeae6ebae5043e1c74da624860c36fd9ba29b0ef Mon Sep 17 00:00:00 2001
From: Jonatan Liljedahl <[email protected]>
Date: Mon, 27 May 2013 14:28:07 +0200
Subject: [PATCH] Add AEAudioControllerRenderMainOutput()

---
 TheAmazingAudioEngine/AEAudioController.h |    6 ++++++
 TheAmazingAudioEngine/AEAudioController.m |   12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/TheAmazingAudioEngine/AEAudioController.h b/TheAmazingAudioEngine/AEAudioController.h
index b2b0197..287b605 100644
--- a/TheAmazingAudioEngine/AEAudioController.h
+++ b/TheAmazingAudioEngine/AEAudioController.h
@@ -667,6 +667,12 @@ typedef void (*AEAudioControllerMainThreadMessageHandler)(AEAudioController *aud
  */
 AudioUnit AEAudioControllerMainMixerUnit(AEAudioController *audioController);

+/*!
+ * Render main output into AudioBufferList.
+ * Use only while the AUGraph is not running.
+ */
+BOOL AEAudioControllerRenderMainOutput(AEAudioController *audioController, AudioTimeStamp inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData);
+
 ///@}
 #pragma mark - Filters
 /** @name Filters */
diff --git a/TheAmazingAudioEngine/AEAudioController.m b/TheAmazingAudioEngine/AEAudioController.m
index 85471a8..0c9297c 100644
--- a/TheAmazingAudioEngine/AEAudioController.m
+++ b/TheAmazingAudioEngine/AEAudioController.m
@@ -1201,6 +1201,18 @@ AudioUnit AEAudioControllerMainMixerUnit(AEAudioController *audioController) {
     return audioController->_topGroup->mixerAudioUnit;
 }

+BOOL AEAudioControllerRenderMainOutput(AEAudioController *audioController, AudioTimeStamp inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData) {
+    channel_producer_arg_t arg = {
+        .channel = audioController->_topChannel,
+        .inTimeStamp = inTimeStamp,
+        .ioActionFlags = 0,
+        .nextFilterIndex = 0
+    };
+    OSStatus result = channelAudioProducer((void*)&arg, ioData, &inNumberFrames);
+    handleCallbacksForChannel(arg.channel, &inTimeStamp, inNumberFrames, ioData);
+    return result;
+}
+
 #pragma mark - Filters

 - (void)addFilter:(id<AEAudioFilter>)filter {
-- 
1.7.10.2 (Apple Git-33)

from theamazingaudioengine.

michaeltyson avatar michaeltyson commented on July 18, 2024

Cheers Jonatan! That's a good start, but I would prefer to be able to avoid needing to access the audio unit directly like that. Maybe a couple of functions to start and stop the offline rendering process? I think we talked about the list of functions that would make a good interface over on the forum thread.

You can send code changes by creating a fork of your own, and then doing a pull request, by the way.

Sent from my iPhone

On 21/06/2013, at 5:30 AM, Jonatan Liljedahl [email protected] wrote:

Hmm, can't attach patches on github? I'll paste it here below.
So basically, you just AUGraphStop(audioController.audioGraph) and then run AEAudioControllerRenderMainOutput() to render chunks of audio.

From aeae6ebae5043e1c74da624860c36fd9ba29b0ef Mon Sep 17 00:00:00 2001
From: Jonatan Liljedahl [email protected]
Date: Mon, 27 May 2013 14:28:07 +0200
Subject: [PATCH] Add AEAudioControllerRenderMainOutput()


TheAmazingAudioEngine/AEAudioController.h | 6 ++++++
TheAmazingAudioEngine/AEAudioController.m | 12 ++++++++++++
2 files changed, 18 insertions(+)

diff --git a/TheAmazingAudioEngine/AEAudioController.h b/TheAmazingAudioEngine/AEAudioController.h
index b2b0197..287b605 100644
--- a/TheAmazingAudioEngine/AEAudioController.h
+++ b/TheAmazingAudioEngine/AEAudioController.h
@@ -667,6 +667,12 @@ typedef void (*AEAudioControllerMainThreadMessageHandler)(AEAudioController *aud
*/
AudioUnit AEAudioControllerMainMixerUnit(AEAudioController *audioController);

+/*!

  • * Render main output into AudioBufferList.
  • * Use only while the AUGraph is not running.
  • /
    +BOOL AEAudioControllerRenderMainOutput(AEAudioController *audioController, AudioTimeStamp inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData);
    +
    ///@}
    #pragma mark - Filters
    /
    * @name Filters */
    diff --git a/TheAmazingAudioEngine/AEAudioController.m b/TheAmazingAudioEngine/AEAudioController.m
    index 85471a8..0c9297c 100644
    --- a/TheAmazingAudioEngine/AEAudioController.m
    +++ b/TheAmazingAudioEngine/AEAudioController.m
    @@ -1201,6 +1201,18 @@ AudioUnit AEAudioControllerMainMixerUnit(AEAudioController *audioController) {
    return audioController->_topGroup->mixerAudioUnit;
    }

+BOOL AEAudioControllerRenderMainOutput(AEAudioController *audioController, AudioTimeStamp inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData) {

  • channel_producer_arg_t arg = {
  •    .channel = audioController->_topChannel,
    
  •    .inTimeStamp = inTimeStamp,
    
  •    .ioActionFlags = 0,
    
  •    .nextFilterIndex = 0
    
  • };
  • OSStatus result = channelAudioProducer((void*)&arg, ioData, &inNumberFrames);
  • handleCallbacksForChannel(arg.channel, &inTimeStamp, inNumberFrames, ioData);
  • return result;
    +}

#pragma mark - Filters

- (void)addFilter:(id)filter {

1.7.10.2 (Apple Git-33)

Reply to this email directly or view it on GitHub.

from theamazingaudioengine.

lijon avatar lijon commented on July 18, 2024

Yeah, I will do a fork and work some more on this when I find the time :)

But I don't expose any audio unit directly in this patch. However, another
change is shown in the diff context, which exposes the main mixer unit.
This is not needed for this though. The only thing needed is to stop and
resume the AUGraph, and the audioGraph is already exposed in the API. But
perhaps it would be better to encapsulate that into
AEAudioControllerBeginRendering() and AEAudioControllerStopRendering() just
in case we need to add some other state changes too.

On Fri, Jun 21, 2013 at 3:57 PM, Michael Tyson [email protected]:

Cheers Jonatan! That's a good start, but I would prefer to be able to
avoid needing to access the audio unit directly like that. Maybe a couple
of functions to start and stop the offline rendering process? I think we
talked about the list of functions that would make a good interface over on
the forum thread.

You can send code changes by creating a fork of your own, and then doing a
pull request, by the way.

Sent from my iPhone

On 21/06/2013, at 5:30 AM, Jonatan Liljedahl [email protected]
wrote:

Hmm, can't attach patches on github? I'll paste it here below.
So basically, you just AUGraphStop(audioController.audioGraph) and then
run AEAudioControllerRenderMainOutput() to render chunks of audio.

From aeae6ebae5043e1c74da624860c36fd9ba29b0ef Mon Sep 17 00:00:00 2001
From: Jonatan Liljedahl [email protected]
Date: Mon, 27 May 2013 14:28:07 +0200
Subject: [PATCH] Add AEAudioControllerRenderMainOutput()


TheAmazingAudioEngine/AEAudioController.h | 6 ++++++
TheAmazingAudioEngine/AEAudioController.m | 12 ++++++++++++
2 files changed, 18 insertions(+)

diff --git a/TheAmazingAudioEngine/AEAudioController.h
b/TheAmazingAudioEngine/AEAudioController.h
index b2b0197..287b605 100644
--- a/TheAmazingAudioEngine/AEAudioController.h
+++ b/TheAmazingAudioEngine/AEAudioController.h
@@ -667,6 +667,12 @@ typedef void
(*AEAudioControllerMainThreadMessageHandler)(AEAudioController *aud
*/
AudioUnit AEAudioControllerMainMixerUnit(AEAudioController
*audioController);

+/*!

  • * Render main output into AudioBufferList.
  • * Use only while the AUGraph is not running.
  • /
    +BOOL AEAudioControllerRenderMainOutput(AEAudioController
    *audioController, AudioTimeStamp inTimeStamp, UInt32 inNumberFrames,
    AudioBufferList *ioData);
    +
    ///@}
    #pragma mark - Filters
    /
    * @name Filters */
    diff --git a/TheAmazingAudioEngine/AEAudioController.m
    b/TheAmazingAudioEngine/AEAudioController.m
    index 85471a8..0c9297c 100644
    --- a/TheAmazingAudioEngine/AEAudioController.m
    +++ b/TheAmazingAudioEngine/AEAudioController.m
    @@ -1201,6 +1201,18 @@ AudioUnit
    AEAudioControllerMainMixerUnit(AEAudioController *audioController) {
    return audioController->_topGroup->mixerAudioUnit;
    }

+BOOL AEAudioControllerRenderMainOutput(AEAudioController
*audioController, AudioTimeStamp inTimeStamp, UInt32 inNumberFrames,
AudioBufferList *ioData) {

  • channel_producer_arg_t arg = {
  • .channel = audioController->_topChannel,
  • .inTimeStamp = inTimeStamp,
  • .ioActionFlags = 0,
  • .nextFilterIndex = 0
  • };
  • OSStatus result = channelAudioProducer((void*)&arg, ioData,
    &inNumberFrames);
  • handleCallbacksForChannel(arg.channel, &inTimeStamp, inNumberFrames,
    ioData);
  • return result;
    +}
    +
    #pragma mark - Filters

- (void)addFilter:(id)filter {

1.7.10.2 (Apple Git-33)

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-19817220
.

/Jonatan
http://kymatica.com

from theamazingaudioengine.

blim8183 avatar blim8183 commented on July 18, 2024

+1

from theamazingaudioengine.

lukebradford avatar lukebradford commented on July 18, 2024

Has any further progress been made on this?

Thanks,

Luke

from theamazingaudioengine.

huangy10 avatar huangy10 commented on July 18, 2024

Really need this~

Thanks~

from theamazingaudioengine.

LaChrome avatar LaChrome commented on July 18, 2024

Not sure if this enhancement is planned or not? It would be a great feature.

http://stackoverflow.com/questions/15297990/core-audio-offline-rendering-genericoutput/15361251#15361251

from theamazingaudioengine.

michaeltyson avatar michaeltyson commented on July 18, 2024

I'm working on this for TAAE2 - nearly done, just not quite yet.

from theamazingaudioengine.

Augustyniak avatar Augustyniak commented on July 18, 2024

@michaeltyson Is there any update on this? I can help with the implementation if you give me some tips regarding the implementation's idea.

Btw. Really great work with TAAE2. 👏

from theamazingaudioengine.

michaeltyson avatar michaeltyson commented on July 18, 2024

It's done: http://theamazingaudioengine.com/doc2/interface_a_e_audio_file_output.html#details

Thank you! =)

from theamazingaudioengine.

mgill404 avatar mgill404 commented on July 18, 2024

!!!

from theamazingaudioengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.