• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NEWBIE] Old thread and Vu-Meters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NEWBIE] Old thread and Vu-Meters


  • Subject: Re: [NEWBIE] Old thread and Vu-Meters
  • From: Sanri Parov <email@hidden>
  • Date: Tue, 9 Aug 2005 19:24:47 +0200

On Tue, 9 Aug 2005 06:04:22 -0700, kelly jacklin wrote:

> I have no idea what the problems you are encountering would be, but
> just be careful of assumptions that a sample count is the same as a
> memory size (as was the case for the original poster), as it only is
> for very unusual (nowadays) audio streams (namely 8-bit integer
> uncompressed)...

Mmmh...I've probably understood...
You want to say that, if I use a sample rate of 48KHz/24bit it's
impossible that a sample is contained into a single byte.
Is it correct?

> On a side note, I will be very surprised indeed if an NSProgressBar
> provides sufficiently responsive performance to implement a VU
> meter...

I've already done a test.
By mean of forcing the display with the  "display"  method, the results
are just good for me.

> You might take a gander at the MeterView class in the
> CarbonGenericView for tips on drawing meters that are reasonably
> responsive, although the end result is not exactly the most pleasing
> visual content in the world.

I'm not familiar with anything Carbon. I started programming in Obj-C
and Cocoa directly (wonderful API, easy and understandable).
I will have a look somehow.

> Hope this helps, and if not, please provide more specifics (like
> actual code snippets) to help direct further responses.


Here I attach a snippet and a log. I'ts very similar to Michael Hanna
one, except I don't understand what I have to change.
I know I should use the absolute value for correctly use NSProgressBar
(g_progress outlet) but it works...

#define SOUND_PRINTOUT_SIZE (2*128)
#define SOUND_BUFFER_SIZE (8 * 1024 * 1024)
static unsigned char g_soundBuffer[SOUND_BUFFER_SIZE];
static int g_lastIndex;
static int g_bufferSize;


- (OSStatus) readCycleForDevice: (MTCoreAudioDevice *) theDevice
		      timeStamp: (const AudioTimeStamp *) now
		      inputData: (const AudioBufferList *) inputData
		      inputTime: (const AudioTimeStamp *) inputTime
		     outputData: (AudioBufferList *) outputData
		     outputTime: (const AudioTimeStamp *) outputTime
		     clientData: (void *) clientData
{

    float aSample[SOUND_PRINTOUT_SIZE];

    int i;
    const AudioBuffer *buffer;
    buffer = &inputData->mBuffers[0];
    memcpy (aSample, buffer->mData, SOUND_PRINTOUT_SIZE);
//--------------------

    for (i=0;i<SOUND_PRINTOUT_SIZE;i++)
    {
	NSLog(@"aSample %d %f\n",i,aSample[i]);
	[g_progress setDoubleValue:aSample[i]];
	[g_progress display];
    }
    memcpy (g_soundBuffer + g_lastIndex,buffer->mData,
buffer->mDataByteSize);
    g_lastIndex += buffer->mDataByteSize;
    return (noErr);
}

Here's the log

[Session started at 2005-08-09 19:15:45 +0200.]
2005-08-09 19:15:51.099 registra[2627] aSample 0 -0.007562
2005-08-09 19:15:51.100 registra[2627] aSample 1 -0.002824
2005-08-09 19:15:51.100 registra[2627] aSample 2 -0.002824
2005-08-09 19:15:51.100 registra[2627] aSample 3 -0.005558
2005-08-09 19:15:51.100 registra[2627] aSample 4 -0.005558
2005-08-09 19:15:51.101 registra[2627] aSample 5 -0.005922
2005-08-09 19:15:51.101 registra[2627] aSample 6 -0.005922
2005-08-09 19:15:51.101 registra[2627] aSample 7 -0.007471
2005-08-09 19:15:51.101 registra[2627] aSample 8 -0.007471
2005-08-09 19:15:51.101 registra[2627] aSample 9 -0.008017
2005-08-09 19:15:51.101 registra[2627] aSample 10 -0.008017
2005-08-09 19:15:51.101 registra[2627] aSample 11 -0.001549
2005-08-09 19:15:51.101 registra[2627] aSample 12 -0.001549
2005-08-09 19:15:51.101 registra[2627] aSample 13 0.002642
2005-08-09 19:15:51.101 registra[2627] aSample 14 0.002642
2005-08-09 19:15:51.102 registra[2627] aSample 15 0.003918
2005-08-09 19:15:51.102 registra[2627] aSample 16 0.003918
2005-08-09 19:15:51.102 registra[2627] aSample 17 0.007197
2005-08-09 19:15:51.103 registra[2627] aSample 18 0.007197
2005-08-09 19:15:51.103 registra[2627] aSample 19 0.005193
2005-08-09 19:15:51.103 registra[2627] aSample 20 0.005193
2005-08-09 19:15:51.103 registra[2627] aSample 21 0.001640
2005-08-09 19:15:51.103 registra[2627] aSample 22 0.001640
2005-08-09 19:15:51.103 registra[2627] aSample 23 0.003918
2005-08-09 19:15:51.103 registra[2627] aSample 24 0.003918
2005-08-09 19:15:51.103 registra[2627] aSample 25 0.002460
2005-08-09 19:15:51.104 registra[2627] aSample 26 0.002460
2005-08-09 19:15:51.104 registra[2627] aSample 27 0.001640
2005-08-09 19:15:51.104 registra[2627] aSample 28 0.001640
2005-08-09 19:15:51.104 registra[2627] aSample 29 0.000182
2005-08-09 19:15:51.104 registra[2627] aSample 30 0.000182
2005-08-09 19:15:51.104 registra[2627] aSample 31 -0.005375
2005-08-09 19:15:51.104 registra[2627] aSample 32 -0.005375
2005-08-09 19:15:51.104 registra[2627] aSample 33 -0.002733
2005-08-09 19:15:51.104 registra[2627] aSample 34 -0.002733
2005-08-09 19:15:51.105 registra[2627] aSample 35 -0.007015
2005-08-09 19:15:51.105 registra[2627] aSample 36 -0.007015
2005-08-09 19:15:51.105 registra[2627] aSample 37 -0.009202
2005-08-09 19:15:51.105 registra[2627] aSample 38 -0.009202
2005-08-09 19:15:51.105 registra[2627] aSample 39 -0.008017
2005-08-09 19:15:51.105 registra[2627] aSample 40 -0.008017
2005-08-09 19:15:51.106 registra[2627] aSample 41 -0.011479
2005-08-09 19:15:51.106 registra[2627] aSample 42 -0.011479
2005-08-09 19:15:51.106 registra[2627] aSample 43 -0.009202
2005-08-09 19:15:51.106 registra[2627] aSample 44 -0.009202
2005-08-09 19:15:51.106 registra[2627] aSample 45 -0.005740
2005-08-09 19:15:51.106 registra[2627] aSample 46 -0.005740
2005-08-09 19:15:51.106 registra[2627] aSample 47 -0.006286
2005-08-09 19:15:51.106 registra[2627] aSample 48 -0.006286
2005-08-09 19:15:51.106 registra[2627] aSample 49 -0.003189
2005-08-09 19:15:51.106 registra[2627] aSample 50 -0.003189
2005-08-09 19:15:51.106 registra[2627] aSample 51 -0.002824
2005-08-09 19:15:51.107 registra[2627] aSample 52 -0.002824
2005-08-09 19:15:51.107 registra[2627] aSample 53 -0.003189
2005-08-09 19:15:51.107 registra[2627] aSample 54 -0.003189
2005-08-09 19:15:51.107 registra[2627] aSample 55 -0.002824
2005-08-09 19:15:51.107 registra[2627] aSample 56 -0.002824
2005-08-09 19:15:51.107 registra[2627] aSample 57 -0.001913
2005-08-09 19:15:51.108 registra[2627] aSample 58 -0.001913
2005-08-09 19:15:51.108 registra[2627] aSample 59 0.002095
2005-08-09 19:15:51.108 registra[2627] aSample 60 0.002095
2005-08-09 19:15:51.108 registra[2627] aSample 61 0.007835
2005-08-09 19:15:51.108 registra[2627] aSample 62 0.007835
2005-08-09 19:15:51.108 registra[2627] aSample 63 0.003007
2005-08-09 19:15:51.108 registra[2627] aSample 64 0.000000
2005-08-09 19:15:51.108 registra[2627] aSample 65 0.000000
etc.. etc.. etc... etc... etc..
2005-08-09 19:15:51.116 registra[2627] aSample 130 0.000000
2005-08-09 19:15:51.116 registra[2627] aSample 131 0.000000
etc.. etc.. etc... etc... etc..
2005-08-09 19:15:51.117 registra[2627] aSample 141 0.000000
2005-08-09 19:15:51.117 registra[2627] aSample 142 0.000000
2005-08-09 19:15:51.117 registra[2627] aSample 143 0.000000
2005-08-09 19:15:51.117 registra[2627] aSample 144
-178359475259754122604863029248.000000
2005-08-09 19:15:51.117 registra[2627] aSample 145 0.000000

--
Sanri Parov
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [NEWBIE] Old thread and Vu-Meters
      • From: David Duncan <email@hidden>
References: 
 >[NEWBIE] Old thread and Vu-Meters (From: Sanri Parov <email@hidden>)
 >Re: [NEWBIE] Old thread and Vu-Meters (From: kelly jacklin <email@hidden>)

  • Prev by Date: Re: iTunes stuttering, and don't shoot me--it might involve Core Audio
  • Next by Date: Re: iTunes stuttering, and don't shoot me--it might involve Core Audio
  • Previous by thread: Re: [NEWBIE] Old thread and Vu-Meters
  • Next by thread: Re: [NEWBIE] Old thread and Vu-Meters
  • Index(es):
    • Date
    • Thread